apis_saltans_hw/lib.rs
1//! Zigbee hardware abstraction API.
2//!
3//! This crate defines the boundary between coordinator-level logic and concrete Zigbee network
4//! co-processor (NCP) drivers.
5//!
6//! No default features are enabled. Enable exactly the API surface needed by the depending crate:
7//!
8//! - `coordinator` exposes `Ncp`, `Driver`, `NcpHandle`, `WeakNcpHandle`, common errors, hardware
9//! events, access to the NCP's local simple descriptors, scan results, transmit datagram types,
10//! and the deferred `HwResponse` returned by transmission requests for coordinator and
11//! application code that sends commands to a running NCP actor.
12//! - `driver` exposes `Driver`, shared driver/coordinator data types, the required local-endpoint
13//! API, command handles, `HwResponse`, common errors, and the `aps`, `core`, `nwk`, and `zdp`
14//! protocol re-export modules for hardware backend implementations.
15//!
16//! `Driver` is part of the shared API and is therefore available with either feature. Event
17//! translation and startup wiring are backend concerns; this crate does not prescribe backend
18//! configuration or provide an event-translator abstraction.
19//!
20//! The protocol re-export modules are available only with `driver`. They let driver crates refer to
21//! APIS Saltans protocol types through this crate, for example `apis_saltans_hw::core::IeeeAddress`
22//! or `apis_saltans_hw::zdp::SimpleDescriptor`, without adding direct dependencies on each
23//! protocol crate.
24//!
25//! `Ncp::transmit` is a two-stage operation. Awaiting the method hands the datagram to the driver
26//! actor and returns an `HwResponse`; awaiting that response observes completion of the hardware
27//! transmission.
28//!
29//! Every `Driver` implementation must provide the NCP's local application endpoints through
30//! `Driver::get_endpoints`. Each endpoint is represented by a complete
31//! `zb_zdp::SimpleDescriptor`; coordinator code retrieves the same descriptors through
32//! `Ncp::get_endpoints`.
33#![cfg_attr(docsrs, feature(doc_cfg))]
34
35#[cfg(any(feature = "coordinator", feature = "driver"))]
36#[cfg_attr(docsrs, doc(cfg(any(feature = "coordinator", feature = "driver"))))]
37pub use zb_aps::TxOptions;
38
39#[cfg(any(feature = "coordinator", feature = "driver"))]
40#[cfg_attr(docsrs, doc(cfg(any(feature = "coordinator", feature = "driver"))))]
41pub use self::common::{
42 Clusters, Datagram, Driver, Error, Event, FoundNetwork, HwResponse, Metadata, NcpHandle,
43 Network, RouteError, ScannedChannel, WeakNcpHandle,
44};
45#[cfg(feature = "coordinator")]
46#[cfg_attr(docsrs, doc(cfg(feature = "coordinator")))]
47pub use self::coordinator::*;
48#[cfg(feature = "driver")]
49#[cfg_attr(docsrs, doc(cfg(feature = "driver")))]
50pub use self::reexports::{aps, core, nwk, zdp};
51
52mod common;
53mod coordinator;
54mod reexports;