|
Open Model Railroad Network (OpenMRN)
|
The generic interface for NMRAnet network interfaces. More...
#include <Defs.hxx>
Public Types | |
| enum | MTI { MTI_EXACT = 0xFFFF , MTI_NONE = 0x0000 , MTI_INITIALIZATION_COMPLETE = 0x0100 , MTI_VERIFY_NODE_ID_ADDRESSED = 0x0488 , MTI_VERIFY_NODE_ID_GLOBAL = 0x0490 , MTI_VERIFIED_NODE_ID_NUMBER = 0x0170 , MTI_OPTIONAL_INTERACTION_REJECTED = 0x0068 , MTI_TERMINATE_DUE_TO_ERROR = 0x00A8 , MTI_PROTOCOL_SUPPORT_INQUIRY = 0x0828 , MTI_PROTOCOL_SUPPORT_REPLY = 0x0668 , MTI_CONSUMER_IDENTIFY = 0x08F4 , MTI_CONSUMER_IDENTIFIED_RANGE = 0x04A4 , MTI_CONSUMER_IDENTIFIED_UNKNOWN = 0x04C7 , MTI_CONSUMER_IDENTIFIED_VALID = 0x04C4 , MTI_CONSUMER_IDENTIFIED_INVALID = 0x04C5 , MTI_CONSUMER_IDENTIFIED_RESERVED = 0x04C6 , MTI_PRODUCER_IDENTIFY = 0x0914 , MTI_PRODUCER_IDENTIFIED_RANGE = 0x0524 , MTI_PRODUCER_IDENTIFIED_UNKNOWN = 0x0547 , MTI_PRODUCER_IDENTIFIED_VALID = 0x0544 , MTI_PRODUCER_IDENTIFIED_INVALID = 0x0545 , MTI_PRODUCER_IDENTIFIED_RESERVED = 0x0546 , MTI_EVENTS_IDENTIFY_ADDRESSED = 0x0968 , MTI_EVENTS_IDENTIFY_GLOBAL = 0x0970 , MTI_LEARN_EVENT = 0x0594 , MTI_EVENT_REPORT = 0x05B4 , MTI_TRACTION_CONTROL_COMMAND = 0x05EB , MTI_TRACTION_CONTROL_REPLY = 0x01E9 , MTI_TRACTION_PROXY_COMMAND = 0x05EA , MTI_TRACTION_PROXY_REPLY = 0x01E8 , MTI_XPRESSNET = 0x09C0 , MTI_IDENT_INFO_REQUEST = 0x0DE8 , MTI_IDENT_INFO_REPLY = 0x0A08 , MTI_DATAGRAM = 0x1C48 , MTI_DATAGRAM_OK = 0x0A28 , MTI_DATAGRAM_REJECTED = 0x0A48 , MTI_STREAM_INITIATE_REQUEST = 0x0CC8 , MTI_STREAM_INITIATE_REPLY = 0x0868 , MTI_STREAM_DATA = 0x1F88 , MTI_STREAM_PROCEED = 0x0888 , MTI_STREAM_COMPLETE = 0x08A8 , MTI_MODIFIER_MASK = 0x0003 , MTI_EVENT_MASK = 0x0004 , MTI_ADDRESS_MASK = 0x0008 , MTI_SIMPLE_MASK = 0x0010 , MTI_TYPE_MASK = 0x03e0 , MTI_PRIORITY_MASK = 0x0c00 , MTI_DATAGRAM_MASK = 0x1000 , MTI_SPECIAL_MASK = 0x2000 , MTI_RESERVED_MASK = 0xc000 , MTI_MODIFIER_SHIFT = 0 , MTI_EVENT_SHIFT = 2 , MTI_ADDRESS_SHIFT = 3 , MTI_SIMPLE_SHIFT = 4 , MTI_TYPE_SHIFT = 5 , MTI_PRIORITY_SHIFT = 10 , MTI_DATAGRAM_SHIFT = 12 , MTI_SPECIAL_SHIFT = 13 , MTI_RESERVED_SHIFT = 14 } |
| Known Message type indicators. More... | |
| enum | ErrorCodes { ERROR_CODE_OK = 0 , ERROR_PERMANENT = 0x1000 , ERROR_TEMPORARY = 0x2000 , ERROR_SRC_NOT_PERMITTED = 0x1020 , ERROR_OPENMRN_NOT_FOUND = 0x1030 , ERROR_UNIMPLEMENTED = 0x1040 , ERROR_INVALID_ARGS = 0x1080 , ERROR_OPENLCB_TIMEOUT = 0x2030 , ERROR_OUT_OF_ORDER = 0x2040 , ERROR_INVALID_ARGS_MESSAGE_TOO_SHORT = ERROR_INVALID_ARGS | 1 , ERROR_UNIMPLEMENTED_MTI = ERROR_UNIMPLEMENTED | 3 , ERROR_UNIMPLEMENTED_CMD = ERROR_UNIMPLEMENTED | 2 , ERROR_UNIMPLEMENTED_SUBCMD = ERROR_UNIMPLEMENTED | 1 , ERROR_OPENMRN_ALREADY_EXISTS = ERROR_OPENMRN_NOT_FOUND | 2 , ERROR_FIRMWARE_INCOMPATIBLE = ERROR_INVALID_ARGS | 8 , ERROR_FIRMWARE_CORRUPTED = ERROR_INVALID_ARGS | 9 , ERROR_FIRMWARE_CSUM = 0x2088 , ERROR_DST_NOT_FOUND = 0x40000 , OPENMRN_TIMEOUT = 0x80000 , ERROR_DST_REBOOT = 0x100000 , ERROR_REJECTED = 0x200000 } |
| enum | Protocols { SIMPLE_PROTOCOL_SUBSET = 0x800000000000 , DATAGRAM = 0x400000000000 , STREAM = 0x200000000000 , MEMORY_CONFIGURATION = 0x100000000000 , RESERVATION = 0x080000000000 , EVENT_EXCHANGE = 0x040000000000 , IDENTIFICATION = 0x020000000000 , LEARN_CONFIGURATION = 0x010000000000 , REMOTE_BUTTON = 0x008000000000 , ABBREVIATED_DEFAULT_CDI = 0x004000000000 , DISPLAY_PROTOCOL = 0x002000000000 , SIMPLE_NODE_INFORMATION = 0x001000000000 , CDI = 0x000800000000 , TRACTION_CONTROL = 0x000400000000 , TRACTION_FDI = 0x000200000000 , TRACTION_PROXY = 0x000100000000 , TRACTION_SIMPLE_TRAIN_INFO = 0x000080000000 , FUNCTION_CONFIGURATION = 0x000040000000 , FIRMWARE_UPGRADE = 0x000020000000 , FIRMWARE_UPGRADE_ACTIVE = 0x000010000000 , RESERVED_MASK = 0x00000FFFFFFF } |
| Bitmask for all potentially supported NMRAnet protocols. More... | |
| enum | LinkStatus { LINK_UP , LINK_DOWN } |
| Status of the pysical layer link. More... | |
Static Public Member Functions | |
| static bool | get_mti_address (MTI mti) |
| Get the MTI address present value field. | |
| static bool | get_mti_event (MTI mti) |
| Get the MTI event present value field. | |
| static bool | get_mti_datagram (MTI mti) |
| Get the MTI datagram or stream value field. | |
| static unsigned int | mti_priority (MTI mti) |
| Get the MTI priority (value 0 through 3). | |
Static Public Attributes | |
| static constexpr uint64_t | EMERGENCY_OFF_EVENT = 0x010000000000FFFFULL |
| "Emergency off (de-energize)" Producing this event causes an Emergency Off (de-energize). | |
| static constexpr uint64_t | CLEAR_EMERGENCY_OFF_EVENT = 0x010000000000FFFEULL |
| "Clear emergency off (energize)" Producing this event clears an Emergency Off (energize). | |
| static constexpr uint64_t | EMERGENCY_STOP_EVENT = 0x010000000000FFFDULL |
| "Emergency stop of all operations" The Emergency Stop Event is a request for a node to command all of its outputs to a safe state. | |
| static constexpr uint64_t | CLEAR_EMERGENCY_STOP_EVENT = 0x010000000000FFFCULL |
| "Clear Emergency stop of all operations" Producing this event clears an Emergency Stop. | |
| static constexpr uint64_t | POWER_STANDARD_BROWNOUT_EVENT = 0x010000000000FFF0ULL |
| "Power supply brownout detected below minimum required by standard" This event can be generated when a node detects that the CAN bus power has dropped below the minimum declared in the standard. | |
| static constexpr uint64_t | NODE_POWER_BROWNOUT_EVENT = 0x010000000000FFF1ULL |
| "Power supply brownout detected below minimum required by node" This event can be generated when a node detects that it has insufficient power for normal operations. | |
| static constexpr uint64_t | NODE_IDENT_BUTTON_EVENT = 0x010000000000FE00ULL |
| "Ident button combination pressed" This event can be generated by a node when it is instructed to generate an identification event. | |
| static const size_t | MAX_ADDRESSED_SIZE = 14 |
| Maximum size of a static addressed message payload. | |
Private Member Functions | |
| Defs () | |
| This struct should not be instantiated. | |
The generic interface for NMRAnet network interfaces.
Definition at line 96 of file openlcb/Defs.hxx.
Definition at line 166 of file openlcb/Defs.hxx.
Status of the pysical layer link.
| Enumerator | |
|---|---|
| LINK_UP | link is up and ready for transmit |
| LINK_DOWN | link is down and unable to transmit |
Definition at line 278 of file openlcb/Defs.hxx.
| enum openlcb::Defs::MTI |
Known Message type indicators.
| Enumerator | |
|---|---|
| MTI_EXACT | match mask for a single MTI |
| MTI_NONE | invalid MTI |
| MTI_INITIALIZATION_COMPLETE | initialization complete |
| MTI_VERIFY_NODE_ID_ADDRESSED | verify a Node ID |
| MTI_VERIFY_NODE_ID_GLOBAL | verify a Node ID globally |
| MTI_VERIFIED_NODE_ID_NUMBER | respond to a verify Node ID request |
| MTI_OPTIONAL_INTERACTION_REJECTED | rejected request |
| MTI_TERMINATE_DUE_TO_ERROR | terminate due to some error |
| MTI_PROTOCOL_SUPPORT_INQUIRY | inquire on supported protocols |
| MTI_PROTOCOL_SUPPORT_REPLY | reply with supported protocols |
| MTI_CONSUMER_IDENTIFY | query about consumers |
| MTI_CONSUMER_IDENTIFIED_RANGE | consumer broadcast about a range of consumers |
| MTI_CONSUMER_IDENTIFIED_UNKNOWN | consumer broadcast, validity unknown |
| MTI_CONSUMER_IDENTIFIED_VALID | consumer broadcast, valid state |
| MTI_CONSUMER_IDENTIFIED_INVALID | consumer broadcast, invalid state |
| MTI_CONSUMER_IDENTIFIED_RESERVED | reserved for future use |
| MTI_PRODUCER_IDENTIFY | query about producers |
| MTI_PRODUCER_IDENTIFIED_RANGE | producer broadcast about a range of producers |
| MTI_PRODUCER_IDENTIFIED_UNKNOWN | producer broadcast, validity unknown |
| MTI_PRODUCER_IDENTIFIED_VALID | producer broadcast, valid state |
| MTI_PRODUCER_IDENTIFIED_INVALID | producer broadcast, invalid state |
| MTI_PRODUCER_IDENTIFIED_RESERVED | reserved for future use |
| MTI_EVENTS_IDENTIFY_ADDRESSED | request identify all of a node's events |
| MTI_EVENTS_IDENTIFY_GLOBAL | request identify all of every node's events |
| MTI_IDENT_INFO_REQUEST | request node identity |
| MTI_IDENT_INFO_REPLY | node identity reply |
| MTI_DATAGRAM | datagram |
| MTI_DATAGRAM_OK | datagram received okay |
| MTI_DATAGRAM_REJECTED | datagram rejected by receiver |
| MTI_STREAM_INITIATE_REQUEST | Stream initiate request. |
| MTI_STREAM_INITIATE_REPLY | Stream initiate reply. |
| MTI_STREAM_DATA | stream data |
| MTI_STREAM_PROCEED | stream flow control |
| MTI_STREAM_COMPLETE | stream terminate connection |
| MTI_MODIFIER_MASK | modifier within Priority/Type mask |
| MTI_EVENT_MASK | event number present mask |
| MTI_ADDRESS_MASK | Address present mask. |
| MTI_SIMPLE_MASK | simple protocol mask |
| MTI_TYPE_MASK | type within priority mask |
| MTI_PRIORITY_MASK | priority mask |
| MTI_DATAGRAM_MASK | stream or datagram mask |
| MTI_SPECIAL_MASK | special mask |
| MTI_RESERVED_MASK | reserved mask |
| MTI_MODIFIER_SHIFT | modifier within Priority/Type shift |
| MTI_EVENT_SHIFT | event number present shift |
| MTI_ADDRESS_SHIFT | Address present shift. |
| MTI_SIMPLE_SHIFT | simple protocol shift |
| MTI_TYPE_SHIFT | type within priority shift |
| MTI_PRIORITY_SHIFT | priority shift |
| MTI_DATAGRAM_SHIFT | stream or datagram shift |
| MTI_SPECIAL_SHIFT | special shift |
| MTI_RESERVED_SHIFT | reserved shift |
Definition at line 100 of file openlcb/Defs.hxx.
Bitmask for all potentially supported NMRAnet protocols.
Definition at line 208 of file openlcb/Defs.hxx.
Get the MTI address present value field.
| mti | MTI to extract field value from |
Definition at line 288 of file openlcb/Defs.hxx.
Get the MTI datagram or stream value field.
| mti | MTI to extract field value from |
Definition at line 306 of file openlcb/Defs.hxx.
Get the MTI event present value field.
| mti | MTI to extract field value from |
Definition at line 297 of file openlcb/Defs.hxx.
|
inlinestatic |
Get the MTI priority (value 0 through 3).
| mti | MTI to extract field value from |
Definition at line 315 of file openlcb/Defs.hxx.
|
staticconstexpr |
"Clear emergency off (energize)" Producing this event clears an Emergency Off (energize).
For example, a DCC command station or booster mauy react to this by restoring track power.
Definition at line 244 of file openlcb/Defs.hxx.
|
staticconstexpr |
"Clear Emergency stop of all operations" Producing this event clears an Emergency Stop.
For example, a DCC command station may react to this by restoring locomotive speed settings.
Definition at line 260 of file openlcb/Defs.hxx.
|
staticconstexpr |
"Emergency off (de-energize)" Producing this event causes an Emergency Off (de-energize).
For example, a DCC command station or booster may react to this by turning off the command station or booster power output.
Definition at line 238 of file openlcb/Defs.hxx.
|
staticconstexpr |
"Emergency stop of all operations" The Emergency Stop Event is a request for a node to command all of its outputs to a safe state.
A node receiving this event is not required to de-energize any of its outputs. The meaning of “safe state” is not prescribed for any given node, it is up to the node manufacturer and/or user to prescribe what, if anything, should happen in the node if it receives this event. For example, a DCC command station may react to this by sending a DCC emergency stop command packet to the track outputs.
Definition at line 255 of file openlcb/Defs.hxx.
|
static |
Maximum size of a static addressed message payload.
Definition at line 321 of file openlcb/Defs.hxx.
|
staticconstexpr |
"Ident button combination pressed" This event can be generated by a node when it is instructed to generate an identification event.
Definition at line 275 of file openlcb/Defs.hxx.
|
staticconstexpr |
"Power supply brownout detected below minimum required by node" This event can be generated when a node detects that it has insufficient power for normal operations.
Definition at line 270 of file openlcb/Defs.hxx.
|
staticconstexpr |
"Power supply brownout detected below minimum required by standard" This event can be generated when a node detects that the CAN bus power has dropped below the minimum declared in the standard.
Definition at line 265 of file openlcb/Defs.hxx.