edu.wisc.trace.upnptarget
Class SatelliteDevice

java.lang.Object
  extended by org.cybergarage.upnp.Device
      extended by edu.wisc.trace.upnptarget.SatelliteDevice
All Implemented Interfaces:
org.cybergarage.http.HTTPRequestListener, org.cybergarage.upnp.control.ActionListener, org.cybergarage.upnp.control.QueryListener, org.cybergarage.upnp.device.SearchListener

public class SatelliteDevice
extends org.cybergarage.upnp.Device
implements org.cybergarage.upnp.control.ActionListener, org.cybergarage.upnp.control.QueryListener

This class provides functionality of SatelliteBox device. It uses cybergarage UPNP library. It extends Device class and implements ActionListener and QueryListener interfaces.

Created on: 11/15/2007
Known bugs: None
Thread safe: Yes

Version:
$Revision: 1.12 $
Author:
Parikshit Thakur & Team, Trace R&D Center

Field Summary
 
Fields inherited from class org.cybergarage.upnp.Device
DEFAULT_DESCRIPTION_URI, DEFAULT_DISCOVERY_WAIT_TIME, DEFAULT_LEASE_TIME, DEFAULT_STARTUP_WAIT_TIME, ELEM_NAME, HTTP_DEFAULT_PORT, UPNP_ROOTDEVICE
 
Constructor Summary
SatelliteDevice(File deviceDescription)
          Class constructor.
 
Method Summary
 boolean actionControlReceived(org.cybergarage.upnp.Action action)
          This method is being called when any actions is performed on SatelliteBoxDevice.
 int getCurrentChannel()
          Returns current channel
 boolean getMuteStatus()
          Returns MuteStateVariable
 String getPowerState()
          Returns power mode state ( "ON" or "STANDBY" )
 int getPreviousChannel()
          Returns Previous channel
 int getVolume()
          Returns volume
 void mute(boolean muteFlag)
          Sets MuteStateVariable to the value passed.
 void on()
          Sets PowerMode state variable to on.
 boolean queryControlReceived(org.cybergarage.upnp.StateVariable stateVar)
          This method is being called when query is called on any state variable of SatelliteBoxDevice.
 void setCurrentChannel(int channel)
          Set value of ActiveChannelStateVariable to channel
 void SetPowerMode(String state)
          Call corresponding method for changing power mode.
 void setPreviousChannel(int prevChannel)
          Set value of PreviousChannelStateVariable to prevChannel
 void setSatelliteBoxListener(IDeviceListener listener)
          Assigns ISatelliteBoxListener objects.
 void setVolume(int vol)
          Set value of VolumeStateVariable to vol
 void standby()
          Sets PowerMode state variable to standby.
 void startDevice()
          Calls start method
 void stopDevice()
          Calls stop method
 void stopSatelliteBoxDevice()
           
 
Methods inherited from class org.cybergarage.upnp.Device
announce, announce, byebye, byebye, deviceSearchReceived, deviceSearchResponse, getAction, getDescriptionFile, getDescriptionFilePath, getDevice, getDeviceByDescriptionURI, getDeviceList, getDeviceNode, getDeviceType, getElapsedTime, getFriendlyName, getHTTPPort, getIcon, getIconList, getInterfaceAddress, getLeaseTime, getLocation, getLocationURL, getManufacture, getManufactureURL, getModelDescription, getModelName, getModelNumber, getModelURL, getParentDevice, getPresentationURL, getRootDevice, getRootNode, getSerialNumber, getService, getServiceByControlURL, getServiceByEventSubURL, getServiceBySCPDURL, getServiceList, getSSDPAnnounceCount, getSSDPPacket, getStateVariable, getStateVariable, getSubscriberService, getTimeStamp, getUDN, getUPC, getURLBase, hasUDN, httpRequestRecieved, isDevice, isDeviceNode, isDeviceType, isExpired, isNMPRMode, isRootDevice, isWirelessMode, loadDescription, loadDescription, lock, notifyWait, postSearchResponse, setActionListener, setActionListener, setDeviceNode, setDeviceType, setFriendlyName, setHTTPPort, setLeaseTime, setLocation, setManufacture, setManufactureURL, setModelDescription, setModelName, setModelNumber, setModelURL, setNMPRMode, setPresentationURL, setQueryListener, setQueryListener, setRootNode, setSerialNumber, setSSDPPacket, setUDN, setUPC, setWirelessMode, start, stop, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SatelliteDevice

public SatelliteDevice(File deviceDescription)
                throws org.cybergarage.upnp.device.InvalidDescriptionException
Class constructor. Subscribes to various actions, Subscribes to a service, Creates State variables, and Sets initial value to all variables.

Parameters:
deviceDescription - XML file containing Satellite Box device description.
Throws:
org.cybergarage.upnp.device.InvalidDescriptionException
Method Detail

stopSatelliteBoxDevice

public void stopSatelliteBoxDevice()

setSatelliteBoxListener

public void setSatelliteBoxListener(IDeviceListener listener)
Assigns ISatelliteBoxListener objects.

Parameters:
listener - Object of ISatelliteBoxListener

on

public void on()
Sets PowerMode state variable to on.


standby

public void standby()
Sets PowerMode state variable to standby.


SetPowerMode

public void SetPowerMode(String state)
Call corresponding method for changing power mode. Allowed states are "ON", "OFF", "STANDBY".

Parameters:
state - String containing power state.

getPowerState

public String getPowerState()
Returns power mode state ( "ON" or "STANDBY" )

Returns:
power mode String

setCurrentChannel

public void setCurrentChannel(int channel)
Set value of ActiveChannelStateVariable to channel

Parameters:
channel - integer value

getCurrentChannel

public int getCurrentChannel()
Returns current channel

Returns:
value of ActiveChannelStateVariable as integer

setPreviousChannel

public void setPreviousChannel(int prevChannel)
Set value of PreviousChannelStateVariable to prevChannel

Parameters:
prevChannel - integer value

getPreviousChannel

public int getPreviousChannel()
Returns Previous channel

Returns:
value of PreviousChannelStateVariable as integer

setVolume

public void setVolume(int vol)
Set value of VolumeStateVariable to vol

Parameters:
vol - integer value( 0 to 100 )

getVolume

public int getVolume()
Returns volume

Returns:
value of VolumeStateVariable as integer

mute

public void mute(boolean muteFlag)
Sets MuteStateVariable to the value passed. If argument is true, mutedVolume is set to current volume and current volume is set to 0. If argument is false, volume is set to mutedVolume.

Parameters:
muteFlag - boolean value indicating switching ON or OFF mute

getMuteStatus

public boolean getMuteStatus()
Returns MuteStateVariable

Returns:
boolean value indicating switching ON or OFF mute(true and false respectively.)

actionControlReceived

public boolean actionControlReceived(org.cybergarage.upnp.Action action)
This method is being called when any actions is performed on SatelliteBoxDevice.

Specified by:
actionControlReceived in interface org.cybergarage.upnp.control.ActionListener
Parameters:
action - an Action object
Returns:
true if action performed is one of the action defined in description.xml

queryControlReceived

public boolean queryControlReceived(org.cybergarage.upnp.StateVariable stateVar)
This method is being called when query is called on any state variable of SatelliteBoxDevice.

Specified by:
queryControlReceived in interface org.cybergarage.upnp.control.QueryListener
Parameters:
stateVar - variable in which query result is stored
Returns:
true if state variable is one of the variable defined in description.xml

startDevice

public void startDevice()
Calls start method


stopDevice

public void stopDevice()
Calls stop method



Copyright © 2006 Trace R&D Center, University of Wisconsin-Madison. All Rights Reserved.