1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use zb_core::IeeeAddress;
pub use zb_hw::Clusters;
use zb_hw::Ncp;
use zb_zdp::SimpleDescriptor;
use crate::{Coordinator, Error};
/// Trait for reading local coordinator node information.
pub trait LocalNode {
/// Return the local application endpoints advertised by the NCP.
///
/// Each [`SimpleDescriptor`] contains the endpoint ID, profile, device ID, application version,
/// and input and output cluster lists used for local ZDP and binding operations.
///
/// # Errors
///
/// Returns an [`Error`] if the hardware request fails.
fn get_endpoints(&self) -> impl Future<Output = Result<Box<[SimpleDescriptor]>, Error>> + Send;
/// Return the PAN ID of the coordinator's current network.
///
/// # Errors
///
/// Returns an [`Error`] if the hardware request fails.
fn get_pan_id(&self) -> impl Future<Output = Result<u16, Error>> + Send;
/// Return the coordinator's IEEE address.
///
/// # Errors
///
/// Returns an [`Error`] if the hardware request fails.
fn get_ieee_address(&self) -> impl Future<Output = Result<IeeeAddress, Error>> + Send;
}
impl LocalNode for Coordinator {
async fn get_endpoints(&self) -> Result<Box<[SimpleDescriptor]>, Error> {
Ok(Ncp::get_endpoints(&self.ncp).await?)
}
async fn get_pan_id(&self) -> Result<u16, Error> {
Ok(Ncp::get_pan_id(&self.ncp).await?)
}
async fn get_ieee_address(&self) -> Result<IeeeAddress, Error> {
Ok(Ncp::get_ieee_address(&self.ncp).await?)
}
}