Expand description
Zigbee protocol stack in no-std.
This is the crate an application depends on: it re-exports the layers of
the stack — nwk, aps, security, the cluster library as zcl,
the MAC abstraction as mac and the shared types as types — and adds
the runtime that drives them.
The layers below implement the specification and nothing else: the NWK layer owns the keepalive primitives and the rejoin procedure (3.6.10, 3.6.1.4.2), the ZDO owns the Network Manager’s rejoin-when-communication- is-lost duty (2.5.2.4), and BDB owns the commissioning procedures. What none of them define is when to run those procedures: 3.6.10.3 leaves the keepalive period to the manufacturer, and the order in which a device resumes, rejoins, or re-commissions at startup is an application decision.
This crate holds exactly that policy on top of the re-exported layers. An
application describes itself once
with a StackConfig, builds a Stack on top of its MAC, and spawns
the loops against it:
let stack = STACK.init(Stack::new(mac, config, handler, storage));
spawner.spawn(stack_task(stack)); // stack.run(Delay): commission, then stay on
stack.wait_until_joined().await; // ready to talk to the networkStack::run is the only task the stack needs: it commissions the device,
then drives the receive loop, link maintenance and persistence together.
Every other task borrows the same Stack to talk to the network. Drive
the parts separately with Stack::commission, Stack::rx_loop and
Stack::link_maintenance if they need tasks of their own.
Re-exports§
pub use config::DeviceConfig;pub use config::NetworkConfig;pub use config::StackConfig;pub use config::TimingConfig;pub use stack::Commissioned;pub use stack::Stack;pub use stack::StackStopped;pub use zigbee_base_device_behavior as bdb;pub use zigbee_cluster_library as zcl;pub use zigbee_mac as mac;pub use zigbee_types as types;
Modules§
- apl
- Application layer descriptors (APL). Application Framework
- aps
- Application support sub-layer (APS): the AIB, bindings and the APSDE-SAP. Application Support Sub-Layer
- config
- Everything an application configures, in one place.
- nwk
- Network layer (NWK): the NIB, the NLME and the network frames. Network Layer
- security
- Security services: keys, the trust center and the frame protection. Security Service
- stack
- The runtime object an application spawns its tasks against.
- storage
- Persistence of the information bases. Persistent storage for the information bases.
- zdp
- Zigbee Device Profile (ZDP) frames. Zigbee Device Profile (2.4). Device Profile
Structs§
- Base
Device Behavior - The commissioning procedures the stack runs, reachable via
Stack::bdbfor the ones it does not run itself. Base Device Behavior (BDB) commissioning manager. - Flash
Storage - Flash-backed persistence (feature
storage): restore the information bases withinit_with_flash, then hand the driver toStack::new. Persistence of the information bases over a NOR flash region. - NoStorage
- RAM-only persistence: pass it to
Stack::newwhen state need not survive a reset. RAM-only operation: state is lost on reset.
Enums§
- Current
Power Mode - Current power mode field (2.3.2.4.1).
- Current
Power Source Level - Current power source level field (2.3.2.4.4).
- Logical
Type - Logical type field (2.3.2.3.1): device type of the Zigbee node.
- Power
Source - A power source of the node, as its bit in the available power sources (2.3.2.4.2) and current power source (2.3.2.4.3) fields, which share a bit assignment.
Functions§
- init_
with_ flash - Initializes the NIB and AIB backed by the given flash region.