A CAN Message, containing a 29-bit header and upto 8 bytes of data.
More...
A CAN Message, containing a 29-bit header and upto 8 bytes of data.
Options:
- -header The 29-bit header. Readonly, used only during creation. Default 0.
- -length The length of the data. Readonly, used only during creation. Default 0.
- -data The initial data. Readonly, used only during creation. Default is the empty list.
- -extended. Boolean flag to indicate an extended protocol frame. Default is false.
- -rtr. Boolean flag to indicate if a reply is expected. Default is false.
- Additional methods defined using the macros AbstractMessage and AbstractMRMessage include:
- getElement {n} – Get the nth data element.
- getNumDataElements {} – Get the number of data elements.
- setElement {n v} – Set the nth data element.
- setOpCode {i} – Set the opcode (byte 0).
- getOpCode {} – Get the opcode (byte 0).
- getOpCodeHex {} – Get the opcode (byte 0) in hex.
- setNeededMode {pMode} – Set the needed mode.
- getNeededMode {} – Get the needed mode.
- replyExpected {} – Returns reply expected flag.
- isBinary {} – Returns binary flag.
- setBinary {b} – Set the binary flag.
- setTimeout {t} – Set the timeout.
- getTimeout {} – Get the timeout.
- setRetries {i} – Set the number of retries.
- getRetries {} – Get the number of retries.
- addIntAsThree {val offset} – Insert an integer as three decimal digits (with leading 0s).
- addIntAsTwoHex {val offset} – Insert an integer as two hexadecimal digits (with leading 0s).
- addIntAsThreeHex {val offset} – Insert an integer as three hexadecimal digits (with leading 0s).
- addIntAsFourHex {val offset} – Insert an integer as four hexadecimal digits (with leading 0s).
- setNumDataElements {n} – Set the number of data bytes.
- toString {} – Return the data object as a string.
- And these (private) instance variables:
- _dataChars {}
- _nDataChars 0
- mNeededMode 0
- _isBinary false
- mTimeout 0
- mRetries 0
- And these (private) static variables:
- SHORT_TIMEOUT 2000
- LONG_TIMEOUT 60000
◆ CanMessage()
lcc::CanMessage::CanMessage |
( |
name |
, |
|
|
|
... |
|
) |
| |
Constructor: create a CANMessage object Creates a fresh CANMessage object, with possible initialization.
- Parameters
-
name | The name of the new instance. |
... | The options:
- -header The 29-bit header. Readonly, used only during creation.
- -length The length of the data. Readonly, used only during creation.
- -data The initial data. Readonly, used only during creation.
- -extended. Boolean flag to indicate an extended protocol frame.
- -rtr. Boolean flag to indicate if a reply is expected.
|
◆ copy()
static lcc::CanMessage::copy |
( |
m |
| ) |
|
|
static |
Copy constructor.
Copies a CANMessage instance.
- Parameters
-
m | The CANMessage to make a copy of. |
◆ equals()
lcc::CanMessage::equals |
( |
a |
| ) |
|
Equality check.
CANMessages are equal if all of the bits are the same.
- Parameters
-
a | A CANMessage to compare to. |
- Returns
- A boolean value indication equality.
◆ getData()
lcc::CanMessage::getData |
( |
| ) |
|
Return the data vector.
- Returns
- The data vector.
◆ getHeader()
lcc::CanMessage::getHeader |
( |
| ) |
|
Return the header.
- Returns
- The header.
◆ hashCode()
lcc::CanMessage::hashCode |
( |
| ) |
|
Return a hash code.
- Returns
- The header as the object's hash code.
◆ replyExpected()
lcc::CanMessage::replyExpected |
( |
| ) |
|
Reply expected.
- Returns
- A boolean flag indicating if a reply is expected.
◆ setData()
lcc::CanMessage::setData |
( |
d |
| ) |
|
Set the data values.
Copy data into the data vector.
- Parameters
-
d | Replacement data values. |
◆ setHeader()
lcc::CanMessage::setHeader |
( |
h |
| ) |
|
Set the header.
- Parameters
-
◆ setNumDataElements()
lcc::CanMessage::setNumDataElements |
( |
n |
| ) |
|
Set the number of data elements.
Sets the number of data elements.
- Parameters
-
n | The number of data elements. |
◆ toString()
lcc::CanMessage::toString |
( |
| ) |
|
Method to create a string version of the message.
- Returns
- A string representation of the message.
◆ validate()
static lcc::CanMessage::validate |
( |
o |
| ) |
|
|
static |
Validator typemethod.
- Parameters
-
◆ _header