Class GridConnectReply
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRReply
jmri.jmrix.can.adapters.gridconnect.GridConnectReply
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
MergReply
Class for replies in a GridConnect based message/reply protocol.
The GridConnect protocol encodes messages as an ASCII string of up to 24 characters of the form: :ShhhhNd0d1d2d3d4d5d6d7;
hhhh is the two byte (11 useful bits) header The S indicates a standard CAN frame :XhhhhhhhhNd0d1d2d3d4d5d6d7; The X indicates an extended CAN frame N or R indicates a normal or remote frame, in position 6 or 10 d0 - d7 are the (up to) 8 data bytes
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) static final intFields inherited from class jmri.jmrix.AbstractMRReply
DEFAULTMAXSIZEFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of GridConnectReply.Creates a new GridConnectReply from String. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCheck if this GCReply contains an Extended or Standard flag.Create a CanReply from a GridConnectReply.intgetByte(int b) Get a hex data byte from the message.intgetElement(int n) Get a particular element in a Message.intGet the CAN header by using chars from 2 to up to 9.intGet the number of data bytes.intGet the number of data elements in a Message.booleanGet if the GridConnectReply is Extended.booleanisRtr()Get if the GridConnectReply is RtR.intmaxSize()voidsetData(int[] d) Set the GridConnectReply data by Array.voidsetElement(int n, int v) Set a single Data Element at a particular index.voidsetNumDataElements(int n) Set Number of Data Elements.protected intskipPrefix(int index) Methods inherited from class jmri.jmrix.AbstractMRReply
flush, getOpCode, isBinary, isRetransmittableErrorMsg, isUnsolicited, match, pollValue, setBinary, setOpCode, setUnsolicited, skipWhiteSpace, toString, valueMethods inherited from class jmri.jmrix.AbstractMessage
equals, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.jmrix.Message
toMonitorString
-
Field Details
-
MAXLEN
- See Also:
-
_RTRoffset
int _RTRoffset
-
-
Constructor Details
-
GridConnectReply
public GridConnectReply()Creates a new instance of GridConnectReply. -
GridConnectReply
Creates a new GridConnectReply from String.- Parameters:
s- String to use as basis for the GCReply.
-
-
Method Details
-
createReply
Create a CanReply from a GridConnectReply.- Returns:
- new CanReply Outgoing message.
-
basicFormatCheck
Check if this GCReply contains an Extended or Standard flag.- Returns:
- true if contains a flag, else false.
-
skipPrefix
- Specified by:
skipPrefixin classAbstractMRReply
-
getNumDataElements
Get the number of data elements in a Message.- Specified by:
getNumDataElementsin interfaceMessage- Overrides:
getNumDataElementsin classAbstractMessage- Returns:
- number elements.
-
setNumDataElements
Set Number of Data Elements. Max. length set by the MAXLEN constant.- Parameters:
n- Number Elements.
-
getElement
Get a particular element in a Message.- Specified by:
getElementin interfaceMessage- Overrides:
getElementin classAbstractMessage- Parameters:
n- Element Index.- Returns:
- single element of message.
-
setElement
Set a single Data Element at a particular index.- Specified by:
setElementin interfaceMessage- Overrides:
setElementin classAbstractMRReply- Parameters:
n- index of element.v- value of element.
-
isExtended
Get if the GridConnectReply is Extended.- Returns:
- true if extended, else false.
-
isRtr
Get if the GridConnectReply is RtR.- Returns:
- true if RtR, else false.
-
maxSize
- Overrides:
maxSizein classAbstractMRReply
-
setData
Set the GridConnectReply data by Array.- Parameters:
d- data array.
-
getHeader
Get the CAN header by using chars from 2 to up to 9.Right justify standard headers that had 4 digits.
- Returns:
- the CAN header as an int
-
getNumBytes
Get the number of data bytes.- Returns:
- number of bytes in reply.
-
getByte
Get a hex data byte from the message.Data bytes are encoded as two ASCII hex digits starting at byte 7 of the message.
- Parameters:
b- The byte offset (0 - 7)- Returns:
- The value
-