Package jmri.jmrix.can.adapters.lawicell
Class Message
- java.lang.Object
-
- jmri.jmrix.AbstractMessage
-
- jmri.jmrix.AbstractMRMessage
-
- jmri.jmrix.can.adapters.lawicell.Message
-
- All Implemented Interfaces:
Message
public class Message extends AbstractMRMessage
Class for messages for a LAWICELL CAN hardware adapter.The Lawicell adapter protocol encodes messages as an ASCII string of up to 24 characters of the form: tiiildd...[CR] Tiiiiiiiildd...[CR] The t or T indicates a standard or extended CAN frame iiiiiiii is the header as hex digits l is the number of bytes of data dd are the (up to) 8 data bytes
RTR Extended frames start with an R, RTR standard frames with r.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
MAXLEN
-
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 Message()
Message(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()
boolean
isRtrSet()
void
setByte(int val, int n)
Set a byte as two ASCII hex digitsvoid
setData(int[] d)
void
setElement(int n, int v)
Set a single Data Element at a particular index.void
setExtended(boolean extended)
int
setHeader(int header, int index)
Set the CAN header as ASCII hex digits.(package private) void
setHexDigit(int val, int n)
void
setNumDataElements(int n)
void
setRtr(boolean isrtr)
-
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
-
-
-
-
Field Detail
-
MAXLEN
static final int MAXLEN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Message
public Message()
-
Message
public Message(CanMessage m)
-
-
Method Detail
-
getNumDataElements
public int getNumDataElements()
Description copied from class:AbstractMessage
Get the number of data elements in a Message.- Specified by:
getNumDataElements
in interfaceMessage
- Overrides:
getNumDataElements
in classAbstractMessage
- Returns:
- number elements.
-
setNumDataElements
public void setNumDataElements(int n)
-
getElement
public int getElement(int n)
Description copied from class:AbstractMessage
Get a particular element in a Message.- Specified by:
getElement
in interfaceMessage
- Overrides:
getElement
in classAbstractMessage
- Parameters:
n
- Element Index.- Returns:
- single element of message.
-
setElement
public void setElement(int n, int v)
Description copied from class:AbstractMessage
Set a single Data Element at a particular index.- Specified by:
setElement
in interfaceMessage
- Overrides:
setElement
in classAbstractMessage
- Parameters:
n
- index of element.v
- value of element.
-
setData
public void setData(int[] d)
-
setExtended
public void setExtended(boolean extended)
-
isExtended
public boolean isExtended()
-
setRtr
public void setRtr(boolean isrtr)
-
isRtrSet
public boolean isRtrSet()
-
setHeader
public int setHeader(int header, int index)
Set the CAN header as ASCII hex digits. Handles extended/standard internally.- Parameters:
header
- A valid CAN header valueindex
- start index.- Returns:
- index to next bytes, after this
-
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.
- Parameters:
val
- the value to setn
- the index of the byte to be set
-
setHexDigit
void setHexDigit(int val, int n)
-
-