apis_saltans_coordinator/lib.rs
1//! Zigbee transceiver API.
2//!
3//! This library provides a fully abstracted interface to expose an interface to communicate with
4//! a Zigbee transceiver regardless of the underlying hardware.
5//!
6//! The application supplies a `tokio::sync::mpsc::Sender<Event>` at startup to receive coordinator
7//! [`Event`] values. Discovery, binding, address resolution, and persistence are application-owned
8//! workflows built from traits such as [`Node`], [`Endpoints`], [`Binding`],
9//! [`AddressTranslation`], [`Zcl`], and [`Zdp`].
10//!
11//! The hardware NCP is responsible for providing its complete local endpoint descriptors through
12//! [`zb_hw::Ncp::get_endpoints`]. The coordinator queries those descriptors when serving ZDP match
13//! requests and exposes them through [`LocalNode::get_endpoints`]; they are no longer passed to
14//! [`Coordinator::start`].
15//!
16//! [`Driver`] is re-exported from `zb_hw`, allowing hardware integrations to implement the driver
17//! contract through this crate's public API.
18//!
19//! ZCL and ZDP sends use deferred response futures. The first await queues an operation and returns
20//! either [`TransmissionResponse`] or a protocol-specific [`ZclResponse`] or [`ZdpResponse`]. Await
21//! that returned future to observe hardware completion and, for communication requests, receive the
22//! converted protocol response. All of these futures report failures through the coordinator's
23//! [`Error`] type.
24
25use const_env::env_item;
26pub use zb_hw::Driver;
27
28pub use self::api::{
29 AddressTranslation, Attributes, Binding, Clusters, ColorControl, Endpoints, FoundNetwork,
30 Groups, Joining, Level, LocalNode, Node, OnOff, ReadAttributeResult, Routing, ScannedChannel,
31 Scanning, SimpleDescriptor, WriteAttributeResult, Zcl, ZclResponse, Zdp, ZdpResponse,
32};
33pub use self::coordinator::Coordinator;
34pub use self::error::{Error, Optional, StatusExt};
35pub use self::event::{Device, Event, Network, NetworkError};
36pub use self::response::{CommunicationResponse, TransmissionResponse};
37
38mod api;
39mod coordinator;
40mod error;
41mod event;
42mod index;
43mod mux;
44mod response;
45mod zcl;
46mod zdp;
47
48/// The delay between retries, in seconds.
49#[env_item("ZIGBEE_COORDINATOR_MPSC_CHANNEL_SIZE")]
50const MPSC_CHANNEL_SIZE: usize = 128;