Class GridConnectDoubledMessage
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRMessage
-
- jmri.jmrix.can.adapters.gridconnect.GridConnectMessage
-
- jmri.jmrix.can.adapters.gridconnect.can2usbino.GridConnectDoubledMessage
-
- All Implemented Interfaces:
Message
public class GridConnectDoubledMessage extends GridConnectMessage
Class for GridConnectDoubled messages for a CAN hardware adapter.The GridConnect protocol encodes messages as an ASCII string of up to 24 characters of the form: :ShhhhNd0d1d2d3d4d5d6d7; The S indicates a standard CAN frame :XhhhhhhhhNd0d1d2d3d4d5d6d7; The X indicates an extended CAN frame hhhh is the two byte header N or R indicates a normal or remote frame, in position 6 or 10 d0 - d7 are the (up to) 8 data bytes
On transmit, this is doubled and starts with an "!" character.
-
-
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 GridConnectDoubledMessage()
GridConnectDoubledMessage(CanMessage m)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getElement(int n)
Get a particular element in a Message.int
getNumDataElements()
Get the number of data elements in a Message.boolean
isExtended()
Get if the GC Message is Extended.void
setByte(int val, int n)
Set a byte as two ASCII hex digitsvoid
setData(int[] d)
Set data from array.void
setElement(int n, int v)
Set a single Data Element at a particular index.void
setExtended(boolean extended)
Set the GC Message as Extended.void
setHeader(int header)
Set the headerprotected void
setHexDigit(int val, int n)
Set a hex digit at offset n in _dataChars.void
setNumDataElements(int n)
Set Number of Data Elements.void
setRtr(boolean rtr)
Set CAN Frame as RtR.-
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
-
GridConnectDoubledMessage
public GridConnectDoubledMessage()
-
GridConnectDoubledMessage
public GridConnectDoubledMessage(CanMessage m)
-
-
Method Detail
-
getNumDataElements
public int getNumDataElements()
Description copied from class:GridConnectMessage
Get the number of data elements in a Message.- Specified by:
getNumDataElements
in interfaceMessage
- Overrides:
getNumDataElements
in classGridConnectMessage
- Returns:
- number elements.
-
setNumDataElements
public void setNumDataElements(int n)
Description copied from class:GridConnectMessage
Set Number of Data Elements.- Overrides:
setNumDataElements
in classGridConnectMessage
- Parameters:
n
- number Elements. Max 28.
-
getElement
public int getElement(int n)
Description copied from class:GridConnectMessage
Get a particular element in a Message.- Specified by:
getElement
in interfaceMessage
- Overrides:
getElement
in classGridConnectMessage
- Parameters:
n
- Element Index.- Returns:
- single element of message.
-
setElement
public void setElement(int n, int v)
Description copied from class:GridConnectMessage
Set a single Data Element at a particular index.- Specified by:
setElement
in interfaceMessage
- Overrides:
setElement
in classGridConnectMessage
- Parameters:
n
- index of element.v
- value of element.
-
setData
public void setData(int[] d)
Description copied from class:GridConnectMessage
Set data from array.- Overrides:
setData
in classGridConnectMessage
- Parameters:
d
- array, max length 24.
-
setExtended
public void setExtended(boolean extended)
Description copied from class:GridConnectMessage
Set the GC Message as Extended.- Overrides:
setExtended
in classGridConnectMessage
- Parameters:
extended
- true for extended, else false
-
isExtended
public boolean isExtended()
Description copied from class:GridConnectMessage
Get if the GC Message is Extended.- Overrides:
isExtended
in classGridConnectMessage
- Returns:
- true for extended, else false
-
setHeader
public void setHeader(int header)
Set the header- 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 setn
- the index of the byte to be set
-
setHexDigit
protected void setHexDigit(int val, int n)
Description copied from class:GridConnectMessage
Set a hex digit at offset n in _dataChars.- Overrides:
setHexDigit
in classGridConnectMessage
- Parameters:
val
- min 0, max value 15.n
- _dataChars Array Index.
-
-