sophware.home.lang
Class DimableLampDevice

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.LampDevice
                  extended by sophware.home.lang.DimableLampDevice
All Implemented Interfaces:
java.io.Serializable, AdjustableLevel, Named

public class DimableLampDevice
extends LampDevice
implements AdjustableLevel, java.io.Serializable

DimableLampDevice extends the LampDevice and represents dimable lights/lamps.

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
DimableLampDevice(DeviceAddress address)
          Creates a DimableLampDevice with the given DeviceAddress
DimableLampDevice(DeviceAddress address, java.lang.String name)
          Creates a DimableLampDevice with the given DeviceAddress and name
 
Method Summary
 void adjustLevel(int dim)
          Makes a relative adjustment to the dim value
 int getLevel()
          Gets the current dim value
 void sendBright()
          Sends dim request to the lamp
 void sendDim()
          Sends dim request to the lamp
 void sendOn(int level)
          sets device to desired level
 void setLevel(int dim)
          Sets the dim value to an absolute level between 0 and 100%.
 
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

DimableLampDevice

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

Parameters:
address - the DeviceAddress of the lamp

DimableLampDevice

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

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

sendOn

public void sendOn(int level)
            throws HomeException
sets device to desired level

Parameters:
level - desired level
Throws:
HomeException

sendDim

public void sendDim()
             throws HomeException
Sends dim request to the lamp

Throws:
HomeException

sendBright

public void sendBright()
                throws HomeException
Sends dim request to the lamp

Throws:
HomeException

getLevel

public int getLevel()
Gets the current dim value

Specified by:
getLevel in interface AdjustableLevel
Returns:
the dim level

setLevel

public void setLevel(int dim)
Sets the dim value to an absolute level between 0 and 100%.

Any value outside that range will be automatically adjusted to the closest valid value. A value of zero will set the device's state to off. Any other value will result in the state of on.

Specified by:
setLevel in interface AdjustableLevel
Parameters:
dim - the level

adjustLevel

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

Adjusts the dim value by a signed percentage. If the adjustement drops the dim value to or below 0%, the device's state will be set to off and the value to zero. Any value greater than zero will result in the device's state being on. Adjustments resulting in a value greater than 100% will result in the value set to 100.

Specified by:
adjustLevel in interface AdjustableLevel
Parameters:
dim - a signed offset (-100% to 100%) applied to the current level