Skip to main content

Crate osdp

Crate osdp 

Source
Expand description

Pure-Rust, no_std-friendly implementation of the SIA OSDP v2.2 protocol.

§Crate features

  • std (default): enables alloc, plus desktop convenience.
  • alloc (default via std): enables alloc::vec::Vec-based codec paths.
  • secure-channel (default): enables Annex D (AES-128, MAC, encryption).
  • embedded-io / embedded-io-async: transport adapters.
  • defmt: structured logging on embedded targets.

§Layering

  • packet — wire framing (SOM, header, SCB, MAC, trailer)
  • command / reply — typed messages
  • multipart — RFC §5.10 multi-part assembly / disassembly
  • secure — Annex D secure channel
  • transport — byte-stream abstraction
  • driver — ACU and PD state machines
  • caps — Annex B function codes

§Specification cross-references

All spec citations refer to SIA OSDP v2.2 (©2020 Security Industry Association). Where an item maps directly onto a spec section it is noted in the docs as # Spec: §X.Y.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use packet::Address;
pub use packet::ControlByte;
pub use packet::ParsedPacket;
pub use packet::Sqn;
pub use packet::Trailer;
pub use packet::Packet;

Modules§

caps
PD capability function codes.
clock
Time abstraction. Drivers take a Clock so that timing logic is testable from no_std targets without pulling in a runtime.
command
Typed OSDP commands (ACU → PD).
driver
Higher-level drivers built atop the codec and transport.
error
Crate-wide error type. core::error::Error-compatible.
multipart
Multi-part message engine.
packet
Packet codec — framing, header, security control block, MAC, trailer.
reply
Typed OSDP replies (PD → ACU). See sibling crate::command.
secure
Secure Channel — Annex D.
transport
Transport abstraction. The driver works against any half-duplex byte stream that exposes Transport::write_all and Transport::read.

Constants§

BROADCAST_ADDR
Broadcast address.
MAX_BUS_PACKET
Maximum packet length that any device must tolerate on the wire (even if addressed elsewhere).
MAX_PD_ADDR
Largest legal PD unicast address.
MIN_RX_SIZE
Minimum receive-buffer size every PD must support.
OFFLINE_THRESHOLD_MS
Off-line declaration threshold.
REPLY_DELAY_MS
Default ACU reply-delay budget.
REPLY_FLAG
Reply flag set in Address when sent from PD to ACU.
SOM
Start of message marker — begins every OSDP packet header.