Package jmri.jmrix.powerline.cp290
Class SpecificMessage
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRMessage
-
- jmri.jmrix.powerline.SerialMessage
-
- jmri.jmrix.powerline.cp290.SpecificMessage
-
- All Implemented Interfaces:
Message
public class SpecificMessage extends SerialMessage
Contains the data payload of a serial packet.The transmission protocol can come in one of several forms:
- If the interlocked parameter is false (default), the packet is just sent. If the response length is not zero, a reply of that length is expected.
- If the interlocked parameter is true, the transmission will require a CRC interlock, which will be automatically added. (Design note: this is done to make sure that the messages remain atomic)
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
responseLength
-
Fields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUT, SHORT_TIMEOUT
-
Fields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars
-
-
Constructor Summary
Constructors Constructor Description SpecificMessage(byte[] a, int l)
This ctor interprets the byte array as a sequence of characters to send.SpecificMessage(int l)
SpecificMessage(java.lang.String m, int l)
This ctor interprets the String as the exact sequence to send, byte-for-byte.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAddr()
static SpecificMessage
getAddress(int housecode, int devicecode)
static SpecificMessage
getAddressDim(int housecode, int devicecode, int dimcode)
static SpecificMessage
getFunction(int housecode, int function)
static SpecificMessage
getFunctionDim(int housecode, int function, int dimcode)
static SerialMessage
getPoll(int addr)
int
getResponseLength()
boolean
isPoll()
boolean
isXmt()
void
setResponseLength(int l)
(package private) int
startIndex()
Find 1st byte that's not 0xFF, or -1 if nonejava.lang.String
toMonitorString()
Translate packet to text-
Methods inherited from class jmri.jmrix.powerline.SerialMessage
getInterlocked, setInterlocked
-
Methods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCode, getOpCodeHex, getRetries, getTimeout, isBinary, replyExpected, setBinary, setNeededMode, setOpCode, setRetries, setTimeout, toString
-
Methods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode, setElement
-
-
-
-
Field Detail
-
responseLength
int responseLength
-
-
Constructor Detail
-
SpecificMessage
public SpecificMessage(int l)
-
SpecificMessage
public SpecificMessage(java.lang.String m, int l)
This ctor interprets the String as the exact sequence to send, byte-for-byte.- Parameters:
m
- messagel
- response length in bytes
-
SpecificMessage
public SpecificMessage(byte[] a, int l)
This ctor interprets the byte array as a sequence of characters to send.- Parameters:
a
- Array of bytes to sendl
- length of expected reply
-
-
Method Detail
-
startIndex
int startIndex()
Find 1st byte that's not 0xFF, or -1 if none- Returns:
- -1 or index of first valid byte
-
toMonitorString
public java.lang.String toMonitorString()
Translate packet to text- Returns:
- a human-readable representation of the message.
-
setResponseLength
public void setResponseLength(int l)
- Overrides:
setResponseLength
in classSerialMessage
-
getResponseLength
public int getResponseLength()
- Overrides:
getResponseLength
in classSerialMessage
-
isPoll
public boolean isPoll()
- Overrides:
isPoll
in classSerialMessage
-
isXmt
public boolean isXmt()
- Overrides:
isXmt
in classSerialMessage
-
getAddr
public int getAddr()
- Overrides:
getAddr
in classSerialMessage
-
getPoll
public static SerialMessage getPoll(int addr)
-
getAddress
public static SpecificMessage getAddress(int housecode, int devicecode)
-
getAddressDim
public static SpecificMessage getAddressDim(int housecode, int devicecode, int dimcode)
-
getFunctionDim
public static SpecificMessage getFunctionDim(int housecode, int function, int dimcode)
-
getFunction
public static SpecificMessage getFunction(int housecode, int function)
-
-