• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! An address with type (public / random)
2 
3 #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
4 #[repr(u8)]
5 /// The type of an LE address (see: 5.3 Vol 6B 1.3 Device Axddress)
6 pub enum AddressType {
7     /// A public address
8     Public = 0x0,
9     /// A random address (either random static or private)
10     Random = 0x1,
11 }
12 
13 /// An LE address
14 #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
15 #[repr(C)]
16 pub struct AddressWithType {
17     /// The 6 address bytes stored in little-endian format
18     pub address: [u8; 6],
19     /// The address type, either public or random
20     pub address_type: AddressType,
21 }
22 
23 impl AddressWithType {
24     /// An empty/invalid address
25     pub const EMPTY: Self = Self { address: [0, 0, 0, 0, 0, 0], address_type: AddressType::Public };
26 }
27