libhackrf/enums.rs
1pub enum DeviceType {
2 Jellybean = 0,
3 Jawbreaker = 1,
4 /// HackRF One prior to r9
5 Hackrf1Og = 2,
6 Rad1O = 3,
7 Hackrf1R9 = 4,
8 /// Tried detection but did not recognize board
9 Unrecognized = 0xFE,
10 /// detection not yet attempted
11 Undetected = 0xFF,
12}
13
14impl DeviceType {
15 pub fn from_id(id: u8) -> Self {
16 match id {
17 0 => DeviceType::Jellybean,
18 1 => DeviceType::Jawbreaker,
19 2 => DeviceType::Hackrf1Og,
20 3 => DeviceType::Rad1O,
21 4 => DeviceType::Hackrf1R9,
22 0xFE => DeviceType::Unrecognized,
23 0xFF => DeviceType::Undetected,
24 _ => DeviceType::Undetected,
25 }
26 }
27}