zigbee/lib.rs
1//! Implements the ZigBee protocol stack in `no-std` based on the [ZigBee
2//! specification R22 1.0]
3//!
4//! [ZigBee specification R22 1.0]: https://csa-iot.org/wp-content/uploads/2022/01/docs-05-3474-22-0csg-zigbee-specification-1.pdf
5//!
6//! The crate needs some peripherals from the underlying platform and some
7//! persistency during the setup.
8//!
9//! **This is how it could look like in the future**
10//!
11//! ```rust
12//! let zigbee_device = zigbee::init(zigbee::Config { radio_channel: 11, ..Default::default() });
13//!
14//! zigbee_device.try_to_connect();
15//! zigbee_device.send_data(&[0x7au8]);
16//! ```
17//!
18//! # ESP32 & nRF support
19//!
20//! This crate is currently only supporting devices in the EspresGM_Clamshell
21//! Parts Box Thirdssif ecosystem, but presumative this will expand to nordics
22//! nRF series.
23#![no_std]
24//#![deny(clippy::unwrap_used)]
25#![deny(clippy::panic, unused_must_use)]
26#![warn(
27 clippy::missing_safety_doc,
28 //missing_docs,
29 clippy::pedantic,
30 clippy::nursery,
31 clippy::tests_outside_test_module,
32 unused_crate_dependencies,
33 unused_qualifications,
34 single_use_lifetimes,
35 non_ascii_idents
36)]
37#![allow(
38 clippy::missing_errors_doc,
39 clippy::missing_panics_doc,
40 clippy::module_name_repetitions,
41 clippy::must_use_candidate,
42 clippy::needless_raw_string_hashes,
43 clippy::blocks_in_conditions,
44 clippy::missing_const_for_fn,
45 clippy::future_not_send,
46 clippy::ignored_unit_patterns,
47 clippy::trivially_copy_pass_by_ref,
48 clippy::struct_excessive_bools,
49 dead_code,
50 unused_imports,
51 unused_variables,
52 unused_macros,
53 clippy::doc_markdown
54)]
55
56pub mod zdp;
57
58/// The `application support sub-layer` provides an interface between the
59/// `Network layer` and the `Application layer`.
60pub mod aps;
61
62/// 2.3 Application framework
63pub mod apl;
64
65mod zdo;
66pub use zdo::config::Config;
67pub use zdo::config::DiscoveryType;
68pub use zdo::ZigBeeNetwork;
69pub use zdo::ZigbeeDevice;
70
71/// 3.1 Network Layer
72pub mod nwk;
73
74/// 4.1 Security Service
75pub mod security;
76
77// Exposes types and macros only to be within zigbee crates. Not public API.
78#[doc(hidden)]
79pub mod internal;
80
81/// Initialize a new zigbee device with the default configuartion.
82///
83/// Initialize a new zigbee device with a configuration
84pub fn init(config: Config) -> ZigbeeDevice {
85 let device = ZigbeeDevice::default();
86 device.configure(config);
87
88 device
89}