1use core::fmt::Display;
4
5use num_derive::FromPrimitive;
6
7#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Ord, PartialOrd, FromPrimitive)]
9#[repr(u8)]
10pub enum Type {
11 UnknownDevice = 0x00,
13 Coordinator = 0x01,
15 Router = 0x02,
17 EndDevice = 0x03,
19 SleepyEndDevice = 0x04,
23}
24
25impl Display for Type {
26 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 match self {
28 Self::UnknownDevice => write!(f, "Unknown Device"),
29 Self::Coordinator => write!(f, "Coordinator"),
30 Self::Router => write!(f, "Router"),
31 Self::EndDevice => write!(f, "End Device"),
32 Self::SleepyEndDevice => write!(f, "Sleepy End Device"),
33 }
34 }
35}
36
37impl From<Type> for u8 {
38 fn from(typ: Type) -> Self {
39 typ as Self
40 }
41}