Class MergMessage
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRMessage
-
- jmri.jmrix.can.adapters.gridconnect.GridConnectMessage
-
- jmri.jmrix.can.adapters.gridconnect.canrs.MergMessage
-
- All Implemented Interfaces:
Message
public class MergMessage extends GridConnectMessage
Class for messages for a MERG CAN-RS hardware adapter.The MERG variant of 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 Strict Gridconnect protocol allows a variable number of header characters, e.g., a header value of 0x123 could be encoded as S123 rather than S0123 or X00000123. We choose a fixed number, either 4 or 8 bytes when sending GridConnectMessages to keep MERG CAN-RS/USB adapters happy. The 11 bit standard header is left justified in these 4 bytes. The 29 bit standard header is sent as
<11 bit SID><0><1><0>< 18 bit EID>
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
-
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 MergMessage()
MergMessage(CanMessage m)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setByte(int val, int n)
Set a byte as two ASCII hex digitsvoid
setHeader(int header)
Set the header in MERG formatvoid
setRtr(boolean rtr)
Set CAN Frame as RtR.-
Methods inherited from class jmri.jmrix.can.adapters.gridconnect.GridConnectMessage
getElement, getNumDataElements, isExtended, setData, setElement, setExtended, setHexDigit, setNumDataElements
-
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, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.Message
toMonitorString
-
-
-
-
Constructor Detail
-
MergMessage
public MergMessage()
-
MergMessage
public MergMessage(CanMessage m)
-
-
Method Detail
-
setHeader
public void setHeader(int header)
Set the header in MERG format- Overrides:
setHeader
in classGridConnectMessage
- Parameters:
header
- A valid CAN header value
-
setRtr
public void setRtr(boolean rtr)
Description copied from class:GridConnectMessage
Set CAN Frame as RtR.- Overrides:
setRtr
in classGridConnectMessage
- Parameters:
rtr
- true to set rtr, else false.
-
setByte
public void setByte(int val, int n)
Set a byte as two ASCII hex digitsData bytes are encoded as two ASCII hex digits starting at byte 7 of the message.
- Overrides:
setByte
in classGridConnectMessage
- Parameters:
val
- the value to set, must be in range 0 - 255n
- the index of the byte to be set
-
-