Package jmri.jmrix.oaktree
Class SerialMessage
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRMessage
-
- jmri.jmrix.oaktree.SerialMessage
-
- All Implemented Interfaces:
Message
public class SerialMessage extends AbstractMRMessage
Contains the data payload of a serial packet.Note that only the payload, not the header or trailer, nor the padding DLE characters are included. These are added during transmission.
-
-
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 SerialMessage(byte[] a, int l)
Interpret the byte array as a sequence of characters to send.SerialMessage(int l)
SerialMessage(java.lang.String m, int l)
Interpret the String as the exact sequence to send, byte-for-byte.SerialMessage(SerialMessage m, int l)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAddr()
static SerialMessage
getPoll(int addr)
int
getResponseLength()
boolean
isPoll()
boolean
isXmt()
void
setElement(int element, int value)
Override parent method to ensure that message always has valid error check byte.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
-
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
-
responseLength
int responseLength
-
-
Constructor Detail
-
SerialMessage
public SerialMessage(int l)
-
SerialMessage
public SerialMessage(SerialMessage m, int l)
-
SerialMessage
public SerialMessage(java.lang.String m, int l)
Interpret the String as the exact sequence to send, byte-for-byte.- Parameters:
m
- message string.l
- response length.
-
SerialMessage
public SerialMessage(byte[] a, int l)
Interpret the byte array as a sequence of characters to send.- Parameters:
a
- Array of bytes to sendl
- response length.
-
-
Method Detail
-
setResponseLength
public void setResponseLength(int l)
-
getResponseLength
public int getResponseLength()
-
setElement
public void setElement(int element, int value)
Override parent method to ensure that message always has valid error check byte.- Specified by:
setElement
in interfaceMessage
- Overrides:
setElement
in classAbstractMessage
- Parameters:
element
- index of element.value
- value of element.
-
isPoll
public boolean isPoll()
-
isXmt
public boolean isXmt()
-
getAddr
public int getAddr()
-
getPoll
public static SerialMessage getPoll(int addr)
-
-