Skip to main content

ezsp/frame/parameters/green_power/handler/
sent.rs

1use num_traits::FromPrimitive;
2
3use crate::Error;
4use crate::ember::Status;
5
6crate::frame::parameters::handler!(
7    0x00C7,
8    { status: u8, gpep_handle: u8 },
9    impl {
10        impl TryFrom<Handler> for u8 {
11            type Error = Error;
12
13            fn try_from(handler: Handler) -> Result<Self, Self::Error> {
14                match Status::from_u8(handler.status).ok_or(handler.status) {
15                    Ok(Status::Success) => Ok(handler.gpep_handle),
16                    other => Err(other.into()),
17                }
18            }
19        }
20    }
21);