pub struct Mti(pub u16);Expand description
A 16-bit OpenLCB Message Type Indicator.
The associated constants name every MTI the crate decodes into a
dedicated Message variant. Other values can still be
built with Mti(0x…) and are carried by
Message::Other.
Tuple Fields§
§0: u16Implementations§
Source§impl Mti
impl Mti
Sourcepub const INITIALIZATION_COMPLETE: Mti
pub const INITIALIZATION_COMPLETE: Mti
Initialization Complete (global). Sent once by a node after it has finished logging in; carries the 6-byte Node ID.
Sourcepub const INITIALIZATION_COMPLETE_SIMPLE: Mti
pub const INITIALIZATION_COMPLETE_SIMPLE: Mti
Initialization Complete from a node that implements only the Simple Protocol subset.
Sourcepub const VERIFY_NODE_ID_ADDRESSED: Mti
pub const VERIFY_NODE_ID_ADDRESSED: Mti
Verify Node ID, addressed to one node. Optional Node ID payload.
Sourcepub const VERIFY_NODE_ID_GLOBAL: Mti
pub const VERIFY_NODE_ID_GLOBAL: Mti
Verify Node ID, global: “everyone (or the node with this ID) please announce yourself”. Optional Node ID payload.
Sourcepub const VERIFIED_NODE_ID: Mti
pub const VERIFIED_NODE_ID: Mti
Verified Node ID (global): the answer to Verify Node ID, carrying the responder’s Node ID.
Sourcepub const VERIFIED_NODE_ID_SIMPLE: Mti
pub const VERIFIED_NODE_ID_SIMPLE: Mti
Verified Node ID from a Simple Protocol node.
Sourcepub const OPTIONAL_INTERACTION_REJECTED: Mti
pub const OPTIONAL_INTERACTION_REJECTED: Mti
Optional Interaction Rejected (addressed): the receiver does not
support or cannot handle the request. Payload is an error code (see
error_code) and the MTI being rejected.
Sourcepub const TERMINATE_DUE_TO_ERROR: Mti
pub const TERMINATE_DUE_TO_ERROR: Mti
Terminate Due To Error (addressed): an interaction was aborted. Payload is an error code and the related MTI.
Sourcepub const PROTOCOL_SUPPORT_INQUIRY: Mti
pub const PROTOCOL_SUPPORT_INQUIRY: Mti
Protocol Support Inquiry (addressed): “which protocols do you speak?”
Sourcepub const PROTOCOL_SUPPORT_REPLY: Mti
pub const PROTOCOL_SUPPORT_REPLY: Mti
Protocol Support Reply (addressed): a bit field of supported
protocols, see crate::message::protocol.
Sourcepub const IDENTIFY_CONSUMER: Mti
pub const IDENTIFY_CONSUMER: Mti
Identify Consumer (global, with event): “who consumes this event?”
Sourcepub const CONSUMER_RANGE_IDENTIFIED: Mti
pub const CONSUMER_RANGE_IDENTIFIED: Mti
Consumer Range Identified: the sender consumes a whole range of events, encoded as a mask in the low-order bits of the Event ID.
Sourcepub const CONSUMER_IDENTIFIED_VALID: Mti
pub const CONSUMER_IDENTIFIED_VALID: Mti
Consumer Identified, state Valid.
Sourcepub const CONSUMER_IDENTIFIED_INVALID: Mti
pub const CONSUMER_IDENTIFIED_INVALID: Mti
Consumer Identified, state Invalid.
Sourcepub const CONSUMER_IDENTIFIED_UNKNOWN: Mti
pub const CONSUMER_IDENTIFIED_UNKNOWN: Mti
Consumer Identified, state Unknown.
Sourcepub const IDENTIFY_PRODUCER: Mti
pub const IDENTIFY_PRODUCER: Mti
Identify Producer (global, with event): “who produces this event?”
Also used by the Train Search Standard (see
traction::search).
Sourcepub const PRODUCER_RANGE_IDENTIFIED: Mti
pub const PRODUCER_RANGE_IDENTIFIED: Mti
Producer Range Identified: the sender produces a range of events.
Sourcepub const PRODUCER_IDENTIFIED_VALID: Mti
pub const PRODUCER_IDENTIFIED_VALID: Mti
Producer Identified, state Valid.
Sourcepub const PRODUCER_IDENTIFIED_INVALID: Mti
pub const PRODUCER_IDENTIFIED_INVALID: Mti
Producer Identified, state Invalid.
Sourcepub const PRODUCER_IDENTIFIED_UNKNOWN: Mti
pub const PRODUCER_IDENTIFIED_UNKNOWN: Mti
Producer Identified, state Unknown.
Sourcepub const IDENTIFY_EVENTS_ADDRESSED: Mti
pub const IDENTIFY_EVENTS_ADDRESSED: Mti
Identify Events (addressed): “tell me everything you produce and consume”.
Sourcepub const IDENTIFY_EVENTS_GLOBAL: Mti
pub const IDENTIFY_EVENTS_GLOBAL: Mti
Identify Events (global): every node lists all its events.
Sourcepub const LEARN_EVENT: Mti
pub const LEARN_EVENT: Mti
Learn Event: teaching message used by blue/gold button configuration.
Sourcepub const TRACTION_CONTROL_COMMAND: Mti
pub const TRACTION_CONTROL_COMMAND: Mti
Traction Control Command (addressed, throttle → train), defined by the
Traction Control Standard. See crate::traction::Command.
Sourcepub const TRACTION_CONTROL_REPLY: Mti
pub const TRACTION_CONTROL_REPLY: Mti
Traction Control Reply (addressed, train → throttle). See
crate::traction::Reply.
Sourcepub const SNIP_REQUEST: Mti
pub const SNIP_REQUEST: Mti
Simple Node Information Request (addressed), from the Simple Node Information Standard.
Sourcepub const SNIP_REPLY: Mti
pub const SNIP_REPLY: Mti
Simple Node Information Reply (addressed, multi-frame). Payload format
in NodeInfo::snip_payload.
Sourcepub const DATAGRAM: Mti
pub const DATAGRAM: Mti
Datagram (addressed, up to 72 bytes), from the Datagram Transport Standard. On CAN it uses datagram frame types instead of a CAN-MTI.
Sourcepub const DATAGRAM_RECEIVED_OK: Mti
pub const DATAGRAM_RECEIVED_OK: Mti
Datagram Received OK (addressed). Optional one-byte flags field.
Sourcepub const DATAGRAM_REJECTED: Mti
pub const DATAGRAM_REJECTED: Mti
Datagram Rejected (addressed), with an error_code.
Sourcepub const fn is_addressed(self) -> bool
pub const fn is_addressed(self) -> bool
True if the message carries a destination (addressed message).
This is bit 3 (0x0008) of the MTI. On CAN, addressed messages put
the 12-bit destination alias in the first two data bytes; see
Message::to_frames.
Sourcepub const fn can_mti(self) -> u16
pub const fn can_mti(self) -> u16
The 12-bit value carried in the CAN header for this MTI.
This is simply the low 12 bits. It is only meaningful for MTIs sent
in global/addressed frames (frame type 1); Mti::DATAGRAM uses
datagram frame types instead. MTIs with bit 12 set do not fit; see
Message::try_to_frames.
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
A short human readable name, for logging ("Unknown" for MTIs
without a constant). Display prints the name and the hex value.
Sourcepub const fn from_can_mti(v: u16) -> Mti
pub const fn from_can_mti(v: u16) -> Mti
Map a 12-bit CAN-MTI back to the full MTI. All MTIs that are sent in CAN “global/addressed” frames fit in 12 bits, so this is the identity.