5#ifndef ELEC_C7222_BLE_ADDRESS_H_
6#define ELEC_C7222_BLE_ADDRESS_H_
104 : type_(type), address_(address) {}
111 std::copy(address, address +
kLength, address_.begin());
132 return address_.data();
161 std::copy(address_.begin(), address_.end(), out);
168 return type_ == other.type_ && address_ == other.address_;
175 return !(*
this == other);
BLE address container with an associated address type.
Definition ble_address.hpp:43
bool operator!=(const BleAddress &other) const
Compares both address type and address bytes.
Definition ble_address.hpp:174
static constexpr size_t kLength
Number of bytes in a BLE device address.
Definition ble_address.hpp:48
void SetType(AddressType type)
Sets the address type.
Definition ble_address.hpp:124
static const RawAddress & NullAddress()
Returns a zero-filled address constant.
Definition ble_address.hpp:145
BleAddress()=default
Constructs an empty address with type Unknown and zero bytes.
const RawAddress & GetRaw() const
Returns a const reference to the raw address array.
Definition ble_address.hpp:138
bool operator==(const BleAddress &other) const
Compares both address type and address bytes.
Definition ble_address.hpp:167
void CopyTo(RawAddress &out) const
Copies the raw address into a caller-provided buffer.
Definition ble_address.hpp:153
AddressType
Bluetooth address types (BTstack-compatible values).
Definition ble_address.hpp:58
@ kUnknown
Unknown or not provided.
@ kAcl
BR/EDR (ACL) address type.
@ kLePublic
Public Device Address (Vol 3, Part C, 10.8.1).
@ kSco
BR/EDR (SCO) address type.
@ kLePublicIdentity
Public Identity Address (resolvable via IRK).
@ kLeRandomIdentity
Random (static or resolvable) Identity Address.
@ kLeRandom
Random Device Address (Vol 3, Part C, 10.8.2).
friend std::ostream & operator<<(std::ostream &os, const BleAddress &addr)
Stream output helper.
BleAddress(AddressType type, const uint8_t address[kLength])
Constructs from address type and a raw 6-byte buffer.
Definition ble_address.hpp:109
void CopyTo(uint8_t(&out)[kLength]) const
Copies the raw address into a caller-provided array.
Definition ble_address.hpp:160
AddressType GetType() const
Returns the stored address type.
Definition ble_address.hpp:117
std::array< uint8_t, kLength > RawAddress
Raw 6-byte address container.
Definition ble_address.hpp:53
BleAddress(AddressType type, const RawAddress &address)
Constructs from address type and raw Bluetooth address.
Definition ble_address.hpp:103
const uint8_t * GetBytes() const
Returns a pointer to the raw address bytes.
Definition ble_address.hpp:131
C7222 course abstractions namespace.
Definition ble.hpp:20
std::ostream & operator<<(std::ostream &os, const BleAddress &addr)