Skip to main content

Module protocol

Module protocol 

Source
Expand description

Protocol Support Inquiry flag bits (first three bytes of the reply, with byte 0 in bits 23-16).

The Message Network Standard’s Protocol Identification Protocol (PIP) lets a node ask another which optional protocols it implements. The reply is a bit field; this crate represents the first three bytes as a u32 (byte 0 → bits 23-16, byte 1 → bits 15-8, byte 2 → bits 7-0) and sends three trailing zero bytes. Combine the constants with | and pass them to Node::set_protocols; test a reply’s flags with &.

use rolcb::message::protocol;

let flags = protocol::EVENT_EXCHANGE | protocol::SNIP | protocol::TRACTION_CONTROL;
assert_eq!(flags, 0x04_1400);
assert!(flags & protocol::SNIP != 0);

Constants§

ACDI
Byte 1 bit 6: Abbreviated Default CDI (ACDI) memory spaces.
CDI
Byte 1 bit 3: Configuration Description Information (CDI).
DATAGRAM
Byte 0 bit 6: Datagram Transport.
DISPLAY
Byte 1 bit 5: Display protocol.
EVENT_EXCHANGE
Byte 0 bit 2: Event Exchange (producer/consumer, Event Transport Standard).
FDI
Byte 1 bit 1: Function Description Information (FDI) for trains.
FUNCTION_CONFIGURATION
Byte 2 bit 6: Function Configuration memory space for trains.
IDENTIFICATION
Byte 0 bit 1: Identification protocol.
MEMORY_CONFIGURATION
Byte 0 bit 4: Memory Configuration (over datagrams).
REMOTE_BUTTON
Byte 1 bit 7: Remote Button protocol.
RESERVATION
Byte 0 bit 3: Reservation protocol.
SIMPLE
Byte 0 bit 7: the node implements only the Simple Protocol subset.
SIMPLE_TRAIN_NODE_INFO
Byte 2 bit 7: Simple Train Node Information.
SNIP
Byte 1 bit 4: Simple Node Information (Simple Node Information Standard).
STREAM
Byte 0 bit 5: Stream Transport.
TEACHING
Byte 0 bit 0: Teaching/Learning configuration (Learn Event).
TRACTION_CONTROL
Byte 1 bit 2: Traction Control (Traction Control Standard). Train nodes set this.