/* ============================================================= GetPowerStatus.java Author: Martin Olsson, molsson@csee.usf.edu and Jakob Klamra jklamra@csee.usf.edu This file is part of the power management service. This is a UPnP service that will allow a device to enter power sleep mode by communicating with a proxy. The service has two modes: POWER and SLEEP. The service and proxy communicates by using GENA events. To run the program use: java -classpath [path to Atinav library] Power To power up the device type on, to power down type off, to exit the program type exit. This file contains the action that can be invoked on the service. The action allows a control point to get the status of the power management. The action will return true if the device is powered up or false if the device is powered down. A known bug in the program is that several exceptions is received when the device that runs the program enters power sleep mode. These exceptions are due to the fact that notifications cannot be sent. The program is unable to recover from this error state and must be restarted to be able to send notifications again. The program was developed using the Atinav Java SDK for UPnP Devices. A free trial of the SDK can be downloaded from: http://www.avelink.com/upnp/index.htm You need to install the SDK to be able to run the program. This program was downloaded from http://www.csee.usf.edu/~jklamra/upnp/ and is part of a master thesis about power management in Universal Plug and Play. Please refer to the homepage for known bugs and comments. We do not guarantee the functionality of this program. Use this program at your own risk. ============================================================= */ import java.util.Properties; import com.atinav.upnp.device.*; public class GetPowerStatus extends UPnPAction{ public GetPowerStatus(){ } public String getName(){ return "GetPowerStatus"; } public void invoke() throws SOAPException{ UPnPOutputArgument outArgs[] = getAllOutputArguments(); outArgs[0].setValue(this.getOwnerService().getStateVariableByName("power").getStringValue()); } }