use core::fmt::Display;
use num_derive::FromPrimitive;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd, FromPrimitive)]
#[repr(u8)]
pub enum Type {
UnknownDevice = 0x00,
Coordinator = 0x01,
Router = 0x02,
EndDevice = 0x03,
SleepyEndDevice = 0x04,
}
impl Display for Type {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::UnknownDevice => write!(f, "Unknown Device"),
Self::Coordinator => write!(f, "Coordinator"),
Self::Router => write!(f, "Router"),
Self::EndDevice => write!(f, "End Device"),
Self::SleepyEndDevice => write!(f, "Sleepy End Device"),
}
}
}
impl From<Type> for u8 {
fn from(typ: Type) -> Self {
typ as Self
}
}