Package jmri.jmrix.powerline
Class X10Sequence
java.lang.Object
jmri.jmrix.powerline.X10Sequence
Represent a sequence of one or more X10 commands (addresses and functions).
These are X10 specific, but not device/interface specific.
A sequence should consist of addressing (1 or more), and then one or more commands. It can address multiple devices, but not more than one house-code.
House codes and devices within this class are sequential numbers (1-16 for
house code, 1-16 for device code). These must be translated to line coding by
other code that converts the sequence to adapter-specific messages. The
encode(int) and decode(int) functions are provided to make that
easier by converting to and from the standard line-code sequences, but you
should check the coding of your new specific adapter before using them.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresent a single "set address" X10 commandstatic interfaceRepresent a single X10 command, which is either a "set address" or "do function" operationstatic classRepresent a single "Extended Data" X10 commandstatic classRepresent a single "do function" X10 command -
Field Summary
FieldsModifier and TypeFieldDescription(package private) X10Sequence.Command[](package private) static final int[](package private) static final int[]static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int(package private) static String[]Array of human readable names for X10 commands, indexed by the command numbers that are constants in this class.(package private) static String[](package private) int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAddress(int house, int device) Append a new "set address" operation to the sequencevoidaddExtData(int house, int device, int cmd, int data) Append a new "do function" operation to the sequencevoidaddFunction(int house, int function, int dimcount) Append a new "do function" operation to the sequencestatic intdecode(int i) Get house (A-P as 1-16) or device (1-16) from line-coded value.static intencode(int i) For the house (A-P) and device (1-16) codes, get the line-coded value.static StringformatAddressByte(int b) Pretty-print an address codestatic StringformatCommandByte(int b) Pretty-print a function codestatic StringfunctionName(int i) Return a human-readable name for a function codeRetrieve the next command in the sequencestatic StringhouseCodeToText(int hC) Translate House Code to textstatic StringhouseValueToText(int hV) Translate House Value (1 to 16) to textvoidreset()Next getCommand will be the first in the sequence
-
Field Details
-
FUNCTION_ALL_UNITS_OFF
- See Also:
-
FUNCTION_ALL_LIGHTS_ON
- See Also:
-
FUNCTION_ON
- See Also:
-
FUNCTION_OFF
- See Also:
-
FUNCTION_DIM
- See Also:
-
FUNCTION_BRIGHT
- See Also:
-
FUNCTION_ALL_LIGHTS_OFF
- See Also:
-
FUNCTION_EXTENDED_CODE
- See Also:
-
FUNCTION_HAIL_REQUEST
- See Also:
-
FUNCTION_HAIL_ACKNOWLEDGE
- See Also:
-
FUNCTION_PRESET_DIM_1
- See Also:
-
FUNCTION_PRESET_DIM_2
- See Also:
-
FUNCTION_EXTENDED_DATA_TRANSFER
- See Also:
-
FUNCTION_STATUS_ON
- See Also:
-
FUNCTION_STATUS_OFF
- See Also:
-
FUNCTION_STATUS_REQUEST
- See Also:
-
EXTCMD_DIM
- See Also:
-
index
int index -
cmds
-
functionNames
Array of human readable names for X10 commands, indexed by the command numbers that are constants in this class. -
encoder
-
decoder
-
houseValueDecoder
-
-
Constructor Details
-
X10Sequence
public X10Sequence()
-
-
Method Details
-
addFunction
Append a new "do function" operation to the sequence- Parameters:
house- house codefunction- functiondimcount- dimming step count
-
addAddress
Append a new "set address" operation to the sequence- Parameters:
house- house code A-Pdevice- device 1-16
-
addExtData
Append a new "do function" operation to the sequence- Parameters:
house- A-Pdevice- 1-16cmd- command codedata- additional data
-
reset
Next getCommand will be the first in the sequence -
getCommand
Retrieve the next command in the sequence- Returns:
- next available command
-
functionName
Return a human-readable name for a function code- Parameters:
i- value of function code- Returns:
- string translation
-
encode
For the house (A-P) and device (1-16) codes, get the line-coded value. Argument is from 1 to 16 only.- Parameters:
i- house or device code value- Returns:
- line code value
-
decode
Get house (A-P as 1-16) or device (1-16) from line-coded value.- Parameters:
i- line code value- Returns:
- house or device code value
-
formatAddressByte
Pretty-print an address code- Parameters:
b- address code value- Returns:
- human string form
-
formatCommandByte
Pretty-print a function code- Parameters:
b- command code value- Returns:
- human string form
-
houseValueToText
Translate House Value (1 to 16) to text- Parameters:
hV- device code value- Returns:
- human string form
-
houseCodeToText
Translate House Code to text- Parameters:
hC- house code- Returns:
- A-P
-