sophware.home.lang
Class HomeDevice

java.lang.Object
  extended by sophware.home.lang.StateObject
      extended by sophware.home.lang.BinaryObject
          extended by sophware.home.lang.HomeDevice
All Implemented Interfaces:
java.io.Serializable, Named
Direct Known Subclasses:
AdjustableHomeDevice, DeviceGroup, LampDevice, ReadOnlyDevice

public class HomeDevice
extends BinaryObject
implements Named, java.io.Serializable

HomeDevice is the base class for all addressable devices on the home network.

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
HomeDevice(DeviceAddress address)
          Creates a HomeDevice with the given address
HomeDevice(DeviceAddress address, java.lang.String name)
          Creates a HomeDevice with the given address and name.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns string representation of this device (i.e.
 DeviceAddress getAddress()
          Gets DeviceAddress for this HomeDevice.
 java.lang.String getName()
          Gets name of this device
 java.util.Properties getProperties()
          Gets the properties for this device.
 void sendHail()
          sends a HAIL request to this device
 void sendOff()
          sends an OFF request to this device
 void sendOn()
          sends an ON request to this device
 void sendStatusRequest()
          sends an STATUS REQUEST to this device
 void setName(java.lang.String name)
          Sets name of this device
 void setProperties(java.util.Properties prop)
          Sets the properties for this device.
 java.lang.String toString()
          Returns string representation of this device (i.e.
 void update(Home home, HomeEvent event)
          Applies a HomeEvent to this device.
 
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

HomeDevice

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

Parameters:
address - the DeviceAddress for this device

HomeDevice

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

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

getAddress

public DeviceAddress getAddress()
Gets DeviceAddress for this HomeDevice.

Returns:
the DeviceAddress

getName

public java.lang.String getName()
Gets name of this device

Specified by:
getName in interface Named
Returns:
the name

setName

public void setName(java.lang.String name)
Sets name of this device

Parameters:
name - the new name of this device

getProperties

public java.util.Properties getProperties()
Gets the properties for this device.


setProperties

public void setProperties(java.util.Properties prop)
Sets the properties for this device.

Parameters:
prop - the properties

sendOn

public void sendOn()
            throws HomeException
sends an ON request to this device

Throws:
HomeException

sendOff

public void sendOff()
             throws HomeException
sends an OFF request to this device

Throws:
HomeException

sendStatusRequest

public void sendStatusRequest()
                       throws HomeException
sends an STATUS REQUEST to this device

Throws:
HomeException

sendHail

public void sendHail()
              throws HomeException
sends a HAIL request to this device

Throws:
HomeException

update

public void update(Home home,
                   HomeEvent event)
Applies a HomeEvent to this device. By default this method calls the HomeEvent.update() method with itself as a parameter.

Parameters:
home - the home
event - the event
See Also:
HomeEvent

equals

public boolean equals(java.lang.Object obj)
Returns string representation of this device (i.e. name)

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns string representation of this device (i.e. name)

Overrides:
toString in class java.lang.Object