Skip to content

The library crates

zigbee-bridge is built as a stack of library crates. The bridge binary is the thinnest layer on top; everything else can be used without it, to build a different bridge, a gateway, a test tool or a protocol analyzer.

Crate Layer Use it to
zigbee-host coordinator application run a Zigbee network from Rust
zigbee-zcl Zigbee Cluster Library encode and decode ZCL frames and values
zigbee-zdo Zigbee Device Objects encode and decode ZDO requests and responses
zigbee-ezsp and zigbee-ash Silicon Labs serial protocols talk to an EmberZNet NCP directly
zigbee-znp Texas Instruments serial protocol talk to a Z-Stack NCP directly
zigbee-deconz dresden elektronik serial protocol talk to a ConBee or RaspBee directly
zigbee-primitives shared types addresses, keys, a safe wire reader
zigbee-sim test support test Zigbee software without hardware
zigbee-bridge MQTT bridge run or embed the bridge itself

The API documentation covers every public item. This guide explains what each crate is for and how the pieces fit.

Every crate is on crates.io, with its API also on docs.rs:

Terminal window
cargo add zigbee-host

Every crate shares the workspace version and is released together. While the project is at 0.x, minor versions may break the API; the changelog says what changed.

  • No unsafe. The workspace lints forbid unsafe code in every crate.
  • No panics on input. Everything that parses bytes from a radio or a serial port goes through the bounds-checked reader in zigbee-primitives, and is fuzzed. A malformed frame is an error value, never a panic.
  • Bounded allocation. Parsers allocate in proportion to their input, never to a length field the input claims.
  • Sans-IO where it matters. Protocol state machines (the ASH link, frame decoders) take bytes and time as input and return actions, so they can be tested without I/O and driven by any runtime. The async clients are thin tokio drivers around them.
  • Encoding in both directions. Frame types encode and decode both the host’s and the NCP’s or device’s side, so the simulator shares the definitions the host uses.