Package jmri.jmrix.powerline
Class SerialMessage
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRMessage
-
- jmri.jmrix.powerline.SerialMessage
-
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
SpecificMessage
,SpecificMessage
,SpecificMessage
,SpecificMessage
,SpecificMessage
public abstract class SerialMessage extends AbstractMRMessage
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) boolean
interlocked
(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 Modifier Constructor Description protected
SerialMessage()
Suppress the default ctor, as the length must always be specifiedSerialMessage(byte[] a, int l)
This ctor interprets the byte array as a sequence of characters to send.SerialMessage(int l)
SerialMessage(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()
boolean
getInterlocked()
static SerialMessage
getPoll(int addr)
int
getResponseLength()
boolean
isPoll()
boolean
isXmt()
void
setInterlocked(boolean v)
void
setResponseLength(int l)
-
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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.Message
toMonitorString
-
-
-
-
Field Detail
-
interlocked
boolean interlocked
-
responseLength
int responseLength
-
-
Constructor Detail
-
SerialMessage
protected SerialMessage()
Suppress the default ctor, as the length must always be specified
-
SerialMessage
public SerialMessage(int l)
-
SerialMessage
public SerialMessage(java.lang.String m, int l)
This ctor interprets the String as the exact sequence to send, byte-for-byte.- Parameters:
m
- sequence to sendl
- expected reply length
-
SerialMessage
public SerialMessage(byte[] a, int l)
This ctor interprets the byte array as a sequence of characters to send.- Parameters:
a
- Array of bytes to sendl
- expected reply length
-
-
Method Detail
-
setInterlocked
public void setInterlocked(boolean v)
-
getInterlocked
public boolean getInterlocked()
-
setResponseLength
public void setResponseLength(int l)
-
getResponseLength
public int getResponseLength()
-
isPoll
public boolean isPoll()
-
isXmt
public boolean isXmt()
-
getAddr
public int getAddr()
-
getPoll
public static SerialMessage getPoll(int addr)
-
-