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
48
49
use num_traits::FromPrimitive;
use crate::ember::duty_cycle::State;
crate::frame::parameters::handler!(
0x004D,
{ channel_page: u8, channel: u8, state: u8, total_devices: u8 },
impl {
impl Handler {
/// The channel page whose duty cycle state has changed.
#[must_use]
pub const fn channel_page(&self) -> u8 {
self.channel_page
}
/// The channel number whose duty cycle state has changed.
#[must_use]
pub const fn channel(&self) -> u8 {
self.channel
}
/// The current duty cycle state.
///
/// # Errors
///
/// Returns an error if the state is invalid.
pub fn state(&self) -> Result<State, u8> {
State::from_u8(self.state).ok_or(self.state)
}
/// The total number of connected end devices that are being monitored for duty cycle.
#[must_use]
pub const fn total_devices(&self) -> u8 {
self.total_devices
}
/// Consumed duty cycles of end devices that are being monitored.
///
/// The first entry always be the local stack's nodeId,
/// and thus the total aggregate duty cycle for the device.
#[must_use]
pub fn array_of_device_duty_cycles(&self) -> &[u8] {
todo!(
"https://community.silabs.com/s/question/0D5Vm00000OKBVFKA5/ambiguities-in-ezsp-protocol-definition"
)
}
}
}
);