sophware.home.insteon
Class InsteonAddress

java.lang.Object
  extended by sophware.home.lang.DeviceAddress
      extended by sophware.home.insteon.InsteonAddress
All Implemented Interfaces:
java.io.Serializable

public class InsteonAddress
extends DeviceAddress
implements java.io.Serializable

InsteonAddress uniquely identifies an Insteon HomeDevice or group

Version:
1.0, 02/17/06
Author:
Russell Soph
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
InsteonAddress(byte[] addr)
          Creates a InsteonAddress with the given address
InsteonAddress(byte[] addr, int start)
          Creates a InsteonAddress with the given address
InsteonAddress(short group)
          Creates a InsteonAddress for the given group
InsteonAddress(short high, short middle, short low)
          Creates a InsteonAddress with the given address
InsteonAddress(java.lang.String addr)
          Creates a InsteonAddress with the given address
 
Method Summary
 int getAddress()
          Returns a copy of the raw Insteon address
 HomeCommand getBrightCommand()
          Get bright command for this address
 byte[] getBytes(byte[] buf)
          Get the 3 address bytes
 byte[] getBytes(byte[] buf, int start)
          Get the 3 address bytes
 HomeCommand getDimCommand()
          Get dim command for this address
 short getGroup()
          Get group number
 HomeCommand getHailCommand()
          Get hail command for this address
 HomeCommand getOffCommand()
          Get off command for this address
 HomeCommand getOnCommand()
          Get on command for this address
 HomeCommand getOnCommand(int level)
          Get on command for this address
 HomeCommand getStatusRequestCommand()
          Get status command for this address
 boolean isGroupAddress()
          identifies whether or not this address is a group address
 java.lang.String toString()
          Returns string dot representation of this address
 
Methods inherited from class sophware.home.lang.DeviceAddress
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

InsteonAddress

public InsteonAddress(byte[] addr)
               throws HomeException
Creates a InsteonAddress with the given address

Parameters:
addr - first three bytes assumed to be address
Throws:
HomeException - if address is invalid

InsteonAddress

public InsteonAddress(byte[] addr,
                      int start)
               throws HomeException
Creates a InsteonAddress with the given address

Parameters:
addr - first three bytes after start assumed to be address
start - position of first byte in address
Throws:
HomeException - if address is invalid

InsteonAddress

public InsteonAddress(short group)
               throws HomeException
Creates a InsteonAddress for the given group

Parameters:
group - the group number
Throws:
HomeException - if address is invalid

InsteonAddress

public InsteonAddress(short high,
                      short middle,
                      short low)
               throws HomeException
Creates a InsteonAddress with the given address

Parameters:
high - high order unsigned address byte
middle - middle order unsigned address byte
low - low order unsigned address byte
Throws:
HomeException - if address is invalid

InsteonAddress

public InsteonAddress(java.lang.String addr)
               throws HomeException
Creates a InsteonAddress with the given address

Parameters:
addr - address in hex dot format
Throws:
HomeException - if address is invalid
Method Detail

isGroupAddress

public boolean isGroupAddress()
identifies whether or not this address is a group address

Returns:
true if this is a group address

getGroup

public short getGroup()
Get group number

Returns:
group number

toString

public java.lang.String toString()
Returns string dot representation of this address

Overrides:
toString in class java.lang.Object
Returns:
string representation.

getBytes

public byte[] getBytes(byte[] buf)
Get the 3 address bytes

Parameters:
buf - byte buffer for address (must at least 3 in length)
Returns:
address bytes

getBytes

public byte[] getBytes(byte[] buf,
                       int start)
Get the 3 address bytes

Parameters:
buf - byte buffer for address (must at least 3 in length)
start - the staring position within the buffer
Returns:
address bytes

getAddress

public int getAddress()
Returns a copy of the raw Insteon address

Specified by:
getAddress in class DeviceAddress
Returns:
address integer representing address

getOnCommand

public HomeCommand getOnCommand()
Get on command for this address

Specified by:
getOnCommand in class DeviceAddress
Returns:
the command

getOnCommand

public HomeCommand getOnCommand(int level)
Get on command for this address

Specified by:
getOnCommand in class DeviceAddress
Parameters:
level - the desired level
Returns:
the command

getOffCommand

public HomeCommand getOffCommand()
Get off command for this address

Specified by:
getOffCommand in class DeviceAddress
Returns:
the command

getDimCommand

public HomeCommand getDimCommand()
Get dim command for this address

Specified by:
getDimCommand in class DeviceAddress
Returns:
the command

getBrightCommand

public HomeCommand getBrightCommand()
Get bright command for this address

Specified by:
getBrightCommand in class DeviceAddress
Returns:
the command

getHailCommand

public HomeCommand getHailCommand()
Get hail command for this address

Specified by:
getHailCommand in class DeviceAddress
Returns:
the command

getStatusRequestCommand

public HomeCommand getStatusRequestCommand()
Get status command for this address

Specified by:
getStatusRequestCommand in class DeviceAddress
Returns:
the command