|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object x10.Command
Command represents an x10 command. This class encapsulates
the house code, unit code, function, and optionally the level
value for the command.
An instance of this class may be constructed and posted to a
Controller to have the command executed.
Also, a UnitEvent contains the command that generated the event.
Controller
,
UnitEvent
,
Serialized FormField Summary | |
static byte |
ALL_LIGHTS_OFF
ALL_LIGHTS_OFF byte - the x10 function "All Lights Off". |
static byte |
ALL_LIGHTS_ON
ALL_LIGHTS_ON byte - the x10 function "All Lights On". |
static byte |
ALL_UNITS_OFF
ALL_UNITS_OFF byte - the x10 function "All Units Off". |
static byte |
BRIGHT
BRIGHT byte - the x10 function "Bright". |
static byte |
DIM
DIM byte - the x10 function "Dim". |
static byte |
OFF
OFF byte - the x10 function "Off". |
static byte |
ON
ON byte - the x10 function "On". |
Constructor Summary | |
Command(byte address,
byte function)
Command constructs a Command object with the specified address and function. |
|
Command(byte address,
byte function,
byte level)
Command constructs a Command object with the specified address, function, and level. |
|
Command(java.lang.String address,
byte function)
Command constructs a Command object with the specified address and function. |
|
Command(java.lang.String address,
byte function,
int level)
Command constructs a Command object with the specified address, function, and level. |
Method Summary | |
short |
getAddress()
getAddress returns the x10 address in ready-to-send "CM11A" protocol format. |
static java.lang.String |
getAddress(byte address)
getAddress returns a String-based x10 address as a [HouseCode][UnitCode] two-character String, based on the specified address in x10 "CM11A" protocol format. |
short |
getFunction()
getFunction returns the x10 function in ready-to-send "CM11A" protocol format. |
static byte |
getFunction(byte function)
getFunction returns the function as a constant (specified above), based on the specified function in x10 "CM11A" protocol format. |
byte |
getFunctionByte()
getFunctionByte returns the function of this Command. |
char |
getHouseCode()
getHouseCode returns the housecode as a character. |
int |
getLevel()
getLevel returns the level associated with this Command. |
int |
getUnitCode()
getUnitCode returns the unitcode as an integer. |
static boolean |
isValid(java.lang.String address)
isValid checks the specified address to see if it is valid. |
void |
setAddress(java.lang.String address)
setAddress sets the housecode and unitcode of this command based on the specified address. |
void |
setFunction(byte func)
setFunction sets the function of this command. |
void |
setFunction(byte func,
int level)
setFunction sets the function and level of this command. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte ALL_UNITS_OFF
public static final byte ALL_LIGHTS_ON
public static final byte ON
public static final byte OFF
public static final byte DIM
public static final byte BRIGHT
public static final byte ALL_LIGHTS_OFF
Constructor Detail |
public Command(byte address, byte function)
address
- an x10 module's housecode and unitcode in
"CM11A" protocol format.function
- an x10 function in "CM11A" protocol
format.public Command(byte address, byte function, byte level)
address
- an x10 module's housecode and unitcode in
"CM11A" protocol format.function
- an x10 function in "CM11A" protocol
format.level
- an x10 module level in "CM11A" protocol
format.public Command(java.lang.String address, byte function) throws java.lang.IllegalArgumentException
address
- the housecode and unitcode as a two-character Stringfunction
- a valid function constant (listed above).
java.lang.IllegalArgumentException
- thrown if either parameter is
invalid. An address is illegal if the housecode is greater than 'P'
or if the unitcode is greater than 16. The function is illegal if
it is not one of the functions listed as a constant (listed above).public Command(java.lang.String address, byte function, int level) throws java.lang.IllegalArgumentException
address
- the housecode and unitcode as a two-character Stringfunction
- a valid function constant (listed above).level
- the percentage by which the level should change.
java.lang.IllegalArgumentException
- thrown if either parameter is
invalid. An address is illegal if the housecode is greater than 'P'
or if the unitcode is greater than 16. The function is illegal if
it is not one of the functions listed as a constant (listed above).Method Detail |
public static boolean isValid(java.lang.String address)
address
- a housecode and unitcode as a two-character String
public void setAddress(java.lang.String address) throws java.lang.IllegalArgumentException
address
- a housecode and unitcode as a two-character String
java.lang.IllegalArgumentException
- thrown if the address is invalid.isValid(java.lang.String)
public void setFunction(byte func) throws java.lang.IllegalArgumentException
func
- a valid function constant (listed above).
java.lang.IllegalArgumentException
- thrown if the specified function
is not one of the constant functions listed above.public void setFunction(byte func, int level) throws java.lang.IllegalArgumentException
func
- a valid function constant (listed above).level
- the percentage by which the level should change.
java.lang.IllegalArgumentException
- if the specified function is not
one of the constant functions listed above.public short getAddress()
public short getFunction()
public char getHouseCode()
public int getUnitCode()
public byte getFunctionByte()
public int getLevel()
public static java.lang.String getAddress(byte address)
address
- the x10 address as a "CM11A" protocol value.
public static byte getFunction(byte function)
function
- the x10 function as a "CM11A" protocol value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |