Package jmri.jmrix.grapevine
Class SerialMessage
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRMessage
jmri.jmrix.grapevine.SerialMessage
- All Implemented Interfaces:
Message
Contains the data payload of a serial packet. Note that it's _only_ the
payload.
See the Grapevine Binary Message Format Summary
-
Field Summary
FieldsFields inherited from class jmri.jmrix.AbstractMRMessage
LONG_TIMEOUT, SHORT_TIMEOUTFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new SerialMessage instance.SerialMessage(byte[] a) Deprecated, for removal: This API element is subject to removal in a future version.5.13.5, unused, requires further development.SerialMessage(int len) Create a new SerialMessage instance of a given byte size.Create a new Message instance from a string.Copy a SerialMessage to a new instance. -
Method Summary
Modifier and TypeMethodDescription(package private) static StringcolorAsString(int color) format()Format the reply as human-readable text.intgetAddr()static SerialMessagegetPoll(int addr) For Grapevine, which doesn't have a data poll, the poll operation is only used to see that the nodes are present.intbooleanIs a reply expected to this message?voidsetBank(int b) voidvoidsetParity(int start) voidsetReplyLen(int len) Set the number of characters expected back from the command station.(package private) static StringstaticFormat(int b1, int b2, int b3, int b4) Provide a human-readable form of a message.Methods inherited from class jmri.jmrix.AbstractMRMessage
addIntAsFourHex, addIntAsThree, addIntAsThreeHex, addIntAsTwoHex, getNeededMode, getOpCode, getOpCodeHex, getRetries, getTimeout, isBinary, setBinary, setNeededMode, setOpCode, setRetries, setTimeout, toStringMethods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode, setElementMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.jmrix.Message
toMonitorString
-
Field Details
-
replyLen
int replyLen -
colors
-
-
Constructor Details
-
SerialMessage
public SerialMessage()Create a new SerialMessage instance. -
SerialMessage
Create a new SerialMessage instance of a given byte size.- Parameters:
len- number of elements in the message
-
SerialMessage
Copy a SerialMessage to a new instance.- Parameters:
m- the message to copy
-
SerialMessage
Create a new Message instance from a string. Interprets the String as the exact sequence to send, byte-for-byte.- Parameters:
m- String to use as message content
-
SerialMessage
Deprecated, for removal: This API element is subject to removal in a future version.5.13.5, unused, requires further development.Interpret the byte array as a sequence of characters to send.- Parameters:
a- Array of bytes to send
-
-
Method Details
-
replyExpected
Description copied from class:AbstractMRMessageIs a reply expected to this message?By default, a reply is expected to every message; either a reply or a timeout is needed before the next message can be sent.
If this returns false, the transmit queue will immediately go on to transmit the next message (if any).
- Overrides:
replyExpectedin classAbstractMRMessage- Returns:
- true by default in Abstract MR message.
-
getAddr
-
getPoll
For Grapevine, which doesn't have a data poll, the poll operation is only used to see that the nodes are present. This is done by sending a "get software version" command.- Parameters:
addr- address to poll.- Returns:
- serial message to poll data.
-
setBank
-
setParity
-
setParity
-
setReplyLen
Set the number of characters expected back from the command station. Normally four, this is used to set other lengths for special cases, like a reply to a poll (software version) message.- Parameters:
len- reply length.
-
getReplyLen
-
format
Format the reply as human-readable text.- Returns:
- human-readable text of reply.
-
staticFormat
Provide a human-readable form of a message.Used by both SerialMessage and SerialReply, because so much of it is common. That forces the passing of arguments as numbers. Short messages are marked by having missing bytes put to -1 in the arguments. See the Grapevine Binary Message Format Summary
- Parameters:
b1- 1st message byteb2- 2nd message byteb3- 3rd message byteb4- 4th message byte- Returns:
- Human-readable form
-
colorAsString
-