sophware.home.lang
Class AdjustableHomeDevice

java.lang.Object
  extended by sophware.home.lang.StateObject
      extended by sophware.home.lang.BinaryObject
          extended by sophware.home.lang.HomeDevice
              extended by sophware.home.lang.AdjustableHomeDevice
All Implemented Interfaces:
java.io.Serializable, AdjustableLevel, Named

public class AdjustableHomeDevice
extends HomeDevice
implements AdjustableLevel, java.io.Serializable

AdjustableHomeDevice extends the HomeDevice and represents devices that can have their "ON" value adjusted from 0 to 100%

Version:
1.0, 03/19/07
Author:
Russell Soph
See Also:
Serialized Form

Field Summary
 
Fields inherited from class sophware.home.lang.BinaryObject
OFF, ON
 
Constructor Summary
AdjustableHomeDevice(DeviceAddress address)
          Creates a AdjustableHomeDevice with the given DeviceAddress
AdjustableHomeDevice(DeviceAddress address, java.lang.String name)
          Creates a AdjustableHomeDevice with the given DeviceAddress and name
 
Method Summary
 void adjustLevel(int adjustment)
          Makes a relative adjustment to the level
 int getLevel()
          Gets the current level
 void sendOn(int level)
          Sends request to set device to given level
 void setLevel(int level)
          Sets the current level
 
Methods inherited from class sophware.home.lang.HomeDevice
equals, getAddress, getName, getProperties, sendHail, sendOff, sendOn, sendStatusRequest, setName, setProperties, toString, update
 
Methods inherited from class sophware.home.lang.BinaryObject
isOn, setOn, stateEquals
 
Methods inherited from class sophware.home.lang.StateObject
addStateChangeListener, fireStateChange, removeStateChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AdjustableHomeDevice

public AdjustableHomeDevice(DeviceAddress address)
Creates a AdjustableHomeDevice with the given DeviceAddress

Parameters:
address - the DeviceAddress of the lamp

AdjustableHomeDevice

public AdjustableHomeDevice(DeviceAddress address,
                            java.lang.String name)
Creates a AdjustableHomeDevice with the given DeviceAddress and name

Parameters:
address - the DeviceAddress of the lamp
name - of this device
Method Detail

sendOn

public void sendOn(int level)
            throws HomeException
Sends request to set device to given level

Parameters:
level - the desired level
Throws:
HomeException

getLevel

public int getLevel()
Gets the current level

Specified by:
getLevel in interface AdjustableLevel
Returns:
the level 0-100%

setLevel

public void setLevel(int level)
Sets the current level

This method is usually not called directly, instead it is typically called by the methods processing HomeEvents

Specified by:
setLevel in interface AdjustableLevel
Parameters:
level - the level 0-100%

adjustLevel

public void adjustLevel(int adjustment)
Makes a relative adjustment to the level

If the resulting value is outside the range of the min or max values, it will be silently adjusted to the min or max value

Specified by:
adjustLevel in interface AdjustableLevel
Parameters:
adjustment - a signed adjustment (-100% to 100%)