bt_hci/uuid/appearance/
mod.rs1#[allow(dead_code)]
6mod categories;
7
8pub use categories::*;
9
10use super::BluetoothUuid16;
11
12pub const fn from_category(category: u8, subcategory: u8) -> BluetoothUuid16 {
25 let uuid = ((category as u16) << 6) | (subcategory as u16);
26 BluetoothUuid16(uuid)
27}
28
29#[cfg(test)]
30mod test {
31 use super::*;
32
33 #[test]
34 fn test_appearance() {
35 const CUSTOM_UUID: BluetoothUuid16 = from_category(0x002, 0x007);
36 assert_eq!(u16::from(CUSTOM_UUID), 0x0087);
37 let uuid: u16 = aircraft::LARGE_PASSENGER_AIRCRAFT.into();
38 assert_eq!(uuid, 0x0984);
39 const LABEL_BYTES: [u8; 2] = signage::ELECTRONIC_LABEL.to_le_bytes();
40 assert_eq!(LABEL_BYTES, [0xc2, 0x0a]);
41 const GAMEPAD: BluetoothUuid16 = power_device::GENERIC_POWER_DEVICE;
42 assert_eq!(u16::from(GAMEPAD), 0x780);
43 }
44}