use num_traits::FromPrimitive;
use crate::Error;
use crate::ember::{Eui64, NodeId, Status};
crate::frame::parameters::frame!(
0x0061,
{ node_id: NodeId },
impl {
impl Command {
#[must_use]
pub const fn new(node_id: NodeId) -> Self {
Self { node_id }
}
}
},
{ status: u8, eui64: Eui64 } => Messaging(messaging)::LookupEui64ByNodeId,
impl {
impl TryFrom<Response> for Eui64 {
type Error = Error;
fn try_from(response: Response) -> Result<Self, Self::Error> {
match Status::from_u8(response.status).ok_or(response.status) {
Ok(Status::Success) => Ok(response.eui64),
other => Err(other.into()),
}
}
}
}
);