Expand description
64-bit OpenLCB Event IDs and event states.
OpenLCB’s Event Transport Standard implements a producer/consumer
model. An event is identified by a globally unique 64-bit
EventId; there is no payload. A producer announces “this event
happened” with a PCER (Producer/Consumer Event
Report) and every consumer of that Event ID reacts to it. The bus does
not route: every node sees every PCER and acts on the IDs it cares about.
Event IDs are normally allocated from the Node ID of the device that
creates them: the first six bytes are a Node ID and the last two are free
for that node to number its events (see the Event Identifiers Standard).
For example a block detector with Node ID 05.01.01.01.22.00 might use
05.01.01.01.22.00.00.10 for “block 1 occupied” and …00.11 for
“block 1 clear”. A few well-known IDs (emergency stop, “is train”) use the
reserved 01.xx range; they are provided as constants on EventId.
Besides PCERs, nodes advertise which events they produce and consume
(Producer/Consumer Identified messages) together with an EventState
saying whether that event is currently valid (true), invalid (false)
or unknown. Configuration tools and throttles use the identification
exchange to discover state without waiting for the next PCER. See the
events guide for a worked example.
use rolcb::EventId;
let e: EventId = "05.01.01.01.22.00.00.10".parse()?;
assert_eq!(e, EventId(0x0501_0101_2200_0010));
assert_eq!(e.to_string(), "05.01.01.01.22.00.00.10");
assert_eq!(EventId::from_bytes(&e.to_bytes())?, e);Structs§
- EventId
- A 64-bit event identifier, e.g.
05.01.01.01.22.00.00.10.
Enums§
- Event
State - The state reported in Producer/Consumer Identified messages.