Skip to main content

zigbee_core/
lib.rs

1//! Implements the Zigbee protocol stack in `no-std` based on the [Zigbee
2//! Specification R23]
3//!
4//! [Zigbee Specification R23]: https://csa-iot.org/wp-content/uploads/2024/07/docs-05-3474-23-csg-zigbee-specificationR23.1.pdf
5//!
6//! This crate contains the core network layer and security features.
7//! It deals with addressing, keys, trust center, formation and discovery
8//! mechanisms.
9#![no_std]
10#![deny(clippy::panic, unused_must_use)]
11#![warn(
12    clippy::missing_safety_doc,
13    clippy::pedantic,
14    clippy::nursery,
15    clippy::tests_outside_test_module,
16    unused_crate_dependencies,
17    unused_qualifications,
18    single_use_lifetimes,
19    non_ascii_idents
20)]
21#![allow(
22    clippy::missing_errors_doc,
23    clippy::missing_panics_doc,
24    clippy::module_name_repetitions,
25    clippy::must_use_candidate,
26    clippy::needless_raw_string_hashes,
27    clippy::blocks_in_conditions,
28    clippy::missing_const_for_fn,
29    clippy::future_not_send,
30    clippy::ignored_unit_patterns,
31    clippy::trivially_copy_pass_by_ref,
32    clippy::struct_excessive_bools,
33    dead_code,
34    unused_imports,
35    unused_macros,
36    clippy::doc_markdown,
37    clippy::cast_lossless,
38    private_interfaces,
39    clippy::cognitive_complexity,
40    clippy::new_without_default,
41    clippy::non_std_lazy_statics,
42    static_mut_refs,
43    clippy::needless_range_loop,
44    clippy::redundant_pub_crate,
45    clippy::too_many_arguments,
46    clippy::derive_partial_eq_without_eq,
47    clippy::too_long_first_doc_paragraph,
48    clippy::derivable_impls,
49    clippy::unused_self,
50    async_fn_in_trait
51)]
52
53#[cfg(test)]
54extern crate std;
55
56/// Serializes tests that touch the NIB or AIB.
57///
58/// Both are process-wide singletons shared by every test in this binary, so a
59/// per-module lock does not serialize against a sibling module holding its own.
60/// Every test that reads or writes them must hold *this* one.
61#[cfg(test)]
62pub(crate) static TEST_MUTEX: std::sync::Mutex<()> = std::sync::Mutex::new(());
63
64// dev-dependency only used by the storage tests
65#[cfg(all(test, not(feature = "storage")))]
66use sequential_storage as _;
67
68#[cfg(feature = "alloc")]
69extern crate alloc;
70
71#[cfg(feature = "alloc")]
72use alloc as _;
73
74pub mod apl;
75pub mod aps;
76pub mod nwk;
77pub mod security;
78pub mod storage;
79/// Zigbee Device Profile (2.4).
80pub mod zdp;
81
82// ZDO is not directly called by the application — it is controlled by BDB or
83// used internally by the stack.
84#[doc(hidden)]
85pub mod zdo;
86
87pub use apl::descriptors::node_descriptor::LogicalType;
88pub use apl::descriptors::node_power_descriptor::CurrentPowerMode;
89pub use apl::descriptors::node_power_descriptor::CurrentPowerSourceLevel;
90pub use apl::descriptors::node_power_descriptor::PowerSource;
91pub use zdo::config::Config;