Package jmri.jmrix.powerline
Class X10Sequence
- java.lang.Object
-
- jmri.jmrix.powerline.X10Sequence
-
public class X10Sequence extends java.lang.Object
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)anddecode(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 Classes Modifier and Type Class Description static classX10Sequence.AddressRepresent a single "set address" X10 commandstatic interfaceX10Sequence.CommandRepresent a single X10 command, which is either a "set address" or "do function" operationstatic classX10Sequence.ExtDataRepresent a single "Extended Data" X10 commandstatic classX10Sequence.FunctionRepresent a single "do function" X10 command
-
Field Summary
Fields Modifier and Type Field Description (package private) X10Sequence.Command[]cmds(package private) static int[]decoder(package private) static int[]encoderstatic intEXTCMD_DIMstatic intFUNCTION_ALL_LIGHTS_OFFstatic intFUNCTION_ALL_LIGHTS_ONstatic intFUNCTION_ALL_UNITS_OFFstatic intFUNCTION_BRIGHTstatic intFUNCTION_DIMstatic intFUNCTION_EXTENDED_CODEstatic intFUNCTION_EXTENDED_DATA_TRANSFERstatic intFUNCTION_HAIL_ACKNOWLEDGEstatic intFUNCTION_HAIL_REQUESTstatic intFUNCTION_OFFstatic intFUNCTION_ONstatic intFUNCTION_PRESET_DIM_1static intFUNCTION_PRESET_DIM_2static intFUNCTION_STATUS_OFFstatic intFUNCTION_STATUS_ONstatic intFUNCTION_STATUS_REQUEST(package private) static java.lang.String[]functionNamesArray of human readable names for X10 commands, indexed by the command numbers that are constants in this class.(package private) static java.lang.String[]houseValueDecoder(package private) intindex
-
Constructor Summary
Constructors Constructor Description X10Sequence()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAddress(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 java.lang.StringformatAddressByte(int b)Pretty-print an address codestatic java.lang.StringformatCommandByte(int b)Pretty-print a function codestatic java.lang.StringfunctionName(int i)Return a human-readable name for a function codeX10Sequence.CommandgetCommand()Retrieve the next command in the sequencestatic java.lang.StringhouseCodeToText(int hC)Translate House Code to textstatic java.lang.StringhouseValueToText(int hV)Translate House Value (1 to 16) to textvoidreset()Next getCommand will be the first in the sequence
-
-
-
Field Detail
-
FUNCTION_ALL_UNITS_OFF
public static final int FUNCTION_ALL_UNITS_OFF
- See Also:
- Constant Field Values
-
FUNCTION_ALL_LIGHTS_ON
public static final int FUNCTION_ALL_LIGHTS_ON
- See Also:
- Constant Field Values
-
FUNCTION_ON
public static final int FUNCTION_ON
- See Also:
- Constant Field Values
-
FUNCTION_OFF
public static final int FUNCTION_OFF
- See Also:
- Constant Field Values
-
FUNCTION_DIM
public static final int FUNCTION_DIM
- See Also:
- Constant Field Values
-
FUNCTION_BRIGHT
public static final int FUNCTION_BRIGHT
- See Also:
- Constant Field Values
-
FUNCTION_ALL_LIGHTS_OFF
public static final int FUNCTION_ALL_LIGHTS_OFF
- See Also:
- Constant Field Values
-
FUNCTION_EXTENDED_CODE
public static final int FUNCTION_EXTENDED_CODE
- See Also:
- Constant Field Values
-
FUNCTION_HAIL_REQUEST
public static final int FUNCTION_HAIL_REQUEST
- See Also:
- Constant Field Values
-
FUNCTION_HAIL_ACKNOWLEDGE
public static final int FUNCTION_HAIL_ACKNOWLEDGE
- See Also:
- Constant Field Values
-
FUNCTION_PRESET_DIM_1
public static final int FUNCTION_PRESET_DIM_1
- See Also:
- Constant Field Values
-
FUNCTION_PRESET_DIM_2
public static final int FUNCTION_PRESET_DIM_2
- See Also:
- Constant Field Values
-
FUNCTION_EXTENDED_DATA_TRANSFER
public static final int FUNCTION_EXTENDED_DATA_TRANSFER
- See Also:
- Constant Field Values
-
FUNCTION_STATUS_ON
public static final int FUNCTION_STATUS_ON
- See Also:
- Constant Field Values
-
FUNCTION_STATUS_OFF
public static final int FUNCTION_STATUS_OFF
- See Also:
- Constant Field Values
-
FUNCTION_STATUS_REQUEST
public static final int FUNCTION_STATUS_REQUEST
- See Also:
- Constant Field Values
-
EXTCMD_DIM
public static final int EXTCMD_DIM
- See Also:
- Constant Field Values
-
index
int index
-
cmds
X10Sequence.Command[] cmds
-
functionNames
static java.lang.String[] functionNames
Array of human readable names for X10 commands, indexed by the command numbers that are constants in this class.
-
encoder
static final int[] encoder
-
decoder
static final int[] decoder
-
houseValueDecoder
static java.lang.String[] houseValueDecoder
-
-
Constructor Detail
-
X10Sequence
public X10Sequence()
-
-
Method Detail
-
addFunction
public void addFunction(int house, int function, int dimcount)
Append a new "do function" operation to the sequence- Parameters:
house- house codefunction- functiondimcount- dimming step count
-
addAddress
public void addAddress(int house, int device)
Append a new "set address" operation to the sequence- Parameters:
house- house code A-Pdevice- device 1-16
-
addExtData
public void addExtData(int house, int device, int cmd, int data)
Append a new "do function" operation to the sequence- Parameters:
house- A-Pdevice- 1-16cmd- command codedata- additional data
-
reset
public void reset()
Next getCommand will be the first in the sequence
-
getCommand
public X10Sequence.Command getCommand()
Retrieve the next command in the sequence- Returns:
- next available command
-
functionName
public static java.lang.String functionName(int i)
Return a human-readable name for a function code- Parameters:
i- value of function code- Returns:
- string translation
-
encode
public static int encode(int i)
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
public static int decode(int i)
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
public static java.lang.String formatAddressByte(int b)
Pretty-print an address code- Parameters:
b- address code value- Returns:
- human string form
-
formatCommandByte
public static java.lang.String formatCommandByte(int b)
Pretty-print a function code- Parameters:
b- command code value- Returns:
- human string form
-
houseValueToText
public static java.lang.String houseValueToText(int hV)
Translate House Value (1 to 16) to text- Parameters:
hV- device code value- Returns:
- human string form
-
houseCodeToText
public static java.lang.String houseCodeToText(int hC)
Translate House Code to text- Parameters:
hC- house code- Returns:
- A-P
-
-