use num_traits::FromPrimitive;
use silizium::Status;
use super::transient_key::TransientKey;
use crate::Error;
use crate::ember::Eui64;
crate::frame::parameters::frame!(
0x0113,
{ eui: Eui64 },
impl {
impl Command {
#[must_use]
pub const fn new(eui: Eui64) -> Self {
Self { eui }
}
}
},
{ payload: TransientKey, status: u32 } => Security(security)::ExportTransientKeyByEui,
impl {
impl TryFrom<Response> for TransientKey {
type Error = Error;
fn try_from(response: Response) -> Result<Self, Self::Error> {
match Status::from_u32(response.status).ok_or(response.status) {
Ok(Status::Ok) => Ok(response.payload),
other => Err(other.into()),
}
}
}
}
);