use le_stream::FromLeStream;
use num_traits::FromPrimitive;
use crate::ember::node::Type;
use crate::ember::{Eui64, NodeId};
use crate::frame::Parameter;
const ID: u16 = 0x0023;
#[derive(Clone, Debug, Eq, PartialEq, FromLeStream)]
pub struct Handler {
index: u8,
joining: bool,
child_id: NodeId,
child_eui64: Eui64,
child_type: u8,
}
impl Handler {
#[must_use]
pub const fn index(&self) -> u8 {
self.index
}
#[must_use]
pub const fn joining(&self) -> bool {
self.joining
}
#[must_use]
pub const fn child_id(&self) -> NodeId {
self.child_id
}
#[must_use]
pub const fn child_eui64(&self) -> Eui64 {
self.child_eui64
}
pub fn child_type(&self) -> Result<Type, u8> {
Type::from_u8(self.child_type).ok_or(self.child_type)
}
}
impl Parameter for Handler {
const ID: u16 = ID;
}