|
Model Railroad System 2.2.2
|
Base class to connect to a CAN bus using GridConnect formatted message over. More...
Public Member Functions | |
| CANGridConnect (name,...) | |
| Constructor: create a connection to a Grid Connect CAN bus. More... | |
| getAliasOfNID (nid) | |
| Fetch the alias of a NID. More... | |
| getNIDofAlias (alias) | |
| Get the NID of the alias. More... | |
| getAllNIDs () | |
| Get all known NIDs. More... | |
| getAllAliases () | |
| Get all known aliases. More... | |
| updateAliasMap (nid, alias) | |
| Update the alias map with the specificed Node ID and Alias. More... | |
| populateAliasMap () | |
| Send an AME. More... | |
| setMessageHandler (handler) | |
| Set the message handler. More... | |
| setSentMessageHandler (handler) | |
| Set the sent message handler. More... | |
| sendMessage (...) | |
| Send a message on the OpenLCB bus. More... | |
| sendOpenLCBMessage (message) | |
| Send a message on the OpenLCB bus. More... | |
| reserveAlias (canalias) | |
| Reserve an alias. More... | |
Private Member Functions | |
| _sendDatagram (message) | |
| Send a datagram message. More... | |
| _reserveMyAlias () | |
| Reserve my alias. More... | |
| _timedout () | |
| Timeout method. More... | |
| _flags0 (srcid, r, doff) | |
| Method to deal with possible multipart messages, with partitular handling of multi-part Simple Node Info messages. More... | |
| _messageReader (message) | |
| Handling incoming messages. More... | |
| _sendmessage (canmessage) | |
| Send a low-level CAN bus message using the Grid Connect format. More... | |
Static Private Member Functions | |
| static | listeq (a, b) |
| Compare two lists. More... | |
| static | getBits (top, bottom, bytelist) |
| Get the selected bitfield. More... | |
| static | countNUL (list) |
| Count NUL bytes in a byte buffer. More... | |
| static | listeq (a, b) |
| Compare two lists. More... | |
Private Attributes | |
| parent | |
| Parent instance. More... | |
| gcmessage | |
| GridConnectMessage component. More... | |
| gcreply | |
| GridConnectReply component. More... | |
| mtidetail | |
| MTIDetail component. More... | |
| mtiheader | |
| MTIHeader component. More... | |
| canheader | |
| CANHeader component. More... | |
| messagehandler | |
| Message handler. More... | |
| sentMessageHandler | |
| Sent Message handler. More... | |
| datagrambuffers | |
| Datagram buffers. More... | |
| messagebuffers | |
| General message buffers (for multi frame messages) More... | |
| simplenodeflags | |
| Simple node info flags. More... | |
| mycanalias | |
| My CanAlias component. More... | |
| aliasMap | |
| Alias to NID map. More... | |
| nidMap | |
| NID to alias map. More... | |
| _timeout | |
| Timeout flag. More... | |
| _timeoutFlag | |
| Timeout or error message received flag. More... | |
Static Private Attributes | |
| static | NIDPATTERN |
| The regexp for breaking up the Node ID into bytes. More... | |
Base class to connect to a CAN bus using GridConnect formatted message over.
Options:
hh:hh:hh:hh:hh:hh which is a 48 bit number expressed as 6 pairs of hexadecimal digits separacted by colons (:). | lcc::CANGridConnect::CANGridConnect | ( | name | , |
| ... | |||
| ) |
Constructor: create a connection to a Grid Connect CAN bus.
Connect to the CAN bus via a Grid Connect CAN bus.
| name | The name of the instance. |
| ... | The options:
|
|
private |
Method to deal with possible multipart messages, with partitular handling of multi-part Simple Node Info messages.
| srcid | The source alias of the message. |
References i.
|
private |
Handling incoming messages.
Handle control (CAN) messages here. OpenLCB messages are assembled possibly from multiple CAN messages and then dispatched to the upper level message handler.
|
private |
Reserve my alias.
|
private |
Send a datagram message.
A possibly multi-part datagram message is sent.
| message | The OpenLCB message to send. |
|
private |
Send a low-level CAN bus message using the Grid Connect format.
| canmessage | The (binary) CANMessage to send. |
|
private |
Timeout method.
Called on timeout.
|
staticprivate |
Count NUL bytes in a byte buffer.
| list | The list of bytes to search. |
| lcc::CANGridConnect::getAliasOfNID | ( | nid | ) |
Fetch the alias of a NID.
| nid | A full NID of the form hh:hh:hh:hh:hh:hh |
| lcc::CANGridConnect::getAllAliases | ( | ) |
Get all known aliases.
| lcc::CANGridConnect::getAllNIDs | ( | ) |
Get all known NIDs.
|
staticprivate |
Get the selected bitfield.
Extract the bits from a list of 6 8-bit (byte) numbers representing a 48 bit number.
| top | Topmost (highest) bit number. |
| bottom | Bottommost (lowest) bit number. |
| bytelist | List of 6 bytes. |
| lcc::CANGridConnect::getNIDofAlias | ( | alias | ) |
Get the NID of the alias.
| alias | The alias to look up. |
|
staticprivate |
Compare two lists.
Compares two lists for equality.
| a | First list to compare. |
| b | Second list to compare. |
|
staticprivate |
Compare two lists.
Compares two lists for equality.
| a | First list to compare. |
| b | Second list to compare. |
| lcc::CANGridConnect::populateAliasMap | ( | ) |
Send an AME.
| lcc::CANGridConnect::reserveAlias | ( | canalias | ) |
Reserve an alias.
Sends out CID messages and eventually RID and AMD messages, if there are no errors.
| canalias | A CanAlias object. |
| lcc::CANGridConnect::sendMessage | ( | ... | ) |
Send a message on the OpenLCB bus.
| ... | Message options. See OpenLCBMessage for possible options. |
| lcc::CANGridConnect::sendOpenLCBMessage | ( | message | ) |
Send a message on the OpenLCB bus.
| message | An OpenLCBMessage. |
| lcc::CANGridConnect::setMessageHandler | ( | handler | ) |
Set the message handler.
Generally called from the upper level class to gain access to incoming messages asyncronously.
| handler | The new handler procedure. |
| lcc::CANGridConnect::setSentMessageHandler | ( | handler | ) |
Set the sent message handler.
Generally called from the upper level class to gain access to outgoing messages asyncronously.
| handler | The new handler procedure. |
| lcc::CANGridConnect::updateAliasMap | ( | nid | , |
| alias | |||
| ) |
Update the alias map with the specificed Node ID and Alias.
| nid | An OpenLCB Node ID. |
| alias | A 12-bit CAN Alias. |
|
private |
Timeout flag.
|
private |
Timeout or error message received flag.
|
private |
Alias to NID map.
|
private |
CANHeader component.
This component is used to extract and pack fields from and to a CAN header at a CAN Header level.
|
private |
Datagram buffers.
|
private |
GridConnectMessage component.
This component is used to encode CAN Messages in Grid Connect Message format for transmission.
|
private |
GridConnectReply component.
This component is used to decode received Grid Connect Messages into binary CAN Messages.
|
private |
General message buffers (for multi frame messages)
|
private |
Message handler.
|
private |
MTIDetail component.
This component is used to extract and pack fields from and to a CAN header at a MTI detail level
|
private |
MTIHeader component.
This component is used to extract and pack fields from and to a CAN header at a MTI header level.
|
private |
My CanAlias component.
|
private |
NID to alias map.
|
staticprivate |
The regexp for breaking up the Node ID into bytes.
|
private |
Parent instance.
|
private |
Sent Message handler.
|
private |
Simple node info flags.