Skip to main content

Module mti

Module mti 

Source
Expand description

Message Type Indicators (16-bit, as defined in the Message Network Standard).

Every OpenLCB message starts with a 16-bit MTI that says what kind of message it is. The Message Network Standard packs a few properties into fixed bit positions, so a node can handle an unknown MTI sensibly:

 bits 15-13 : reserved (0)
 bit  12    : stream or datagram (set only for Datagram/Stream MTIs)
 bits 11-10 : static priority
 bits  9-5  : type within priority
 bit   4    : "simple" flag: simple nodes must also process this message
 bit   3    : 1 = addressed (payload begins with a destination)
 bit   2    : 1 = an Event ID is present
 bits  1-0  : modifier (e.g. Valid/Invalid/Unknown for Identified
              messages, or "sent by a simple node" for Init Complete)

On CAN only the low 12 bits fit into the frame header (“CAN-MTI”); see Mti::can_mti. Datagrams (0x1C48) and streams have bit 12 set, do not fit, and instead travel in dedicated datagram/stream frame types, see MessageFrameType.

The full MTI table is in the protocol reference.

use rolcb::Mti;

assert!(Mti::TRACTION_CONTROL_COMMAND.is_addressed());
assert!(!Mti::PCER.is_addressed());
assert!(Mti::PCER.has_event());
assert_eq!(Mti::PCER.name(), "PCER");
assert_eq!(Mti::VERIFY_NODE_ID_GLOBAL.can_mti(), 0x490);

Modules§

error_code
Error codes used in Optional Interaction Rejected / Datagram Rejected.

Structs§

Mti
A 16-bit OpenLCB Message Type Indicator.