Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
direct_bt::BDAddressAndType Class Reference

Unique Bluetooth EUI48 address and BDAddressType tuple. More...

#include <BTAddress.hpp>

Collaboration diagram for direct_bt::BDAddressAndType:

Public Member Functions

constexpr BDAddressAndType () noexcept
 
 BDAddressAndType (BDAddressAndType &&o) noexcept
 
 BDAddressAndType (const BDAddressAndType &o) noexcept
 
 BDAddressAndType (const jau::EUI48 &address_, BDAddressType type_)
 
void clear ()
 Method clears the underlying byte array b and cached hash value. More...
 
void clearHash ()
 Method clears the cached hash value. More...
 
BLERandomAddressType getBLERandomAddressType () const noexcept
 Returns the BLERandomAddressType. More...
 
std::size_t hash_code () const noexcept
 Implementation uses a lock-free volatile cache. More...
 
constexpr bool isBREDRAddress () const noexcept
 Returns true if the BDAddressType is a BREDR address type. More...
 
constexpr bool isIdentityAddress () const noexcept
 Returns true if this address and type refers to a public static identity address, which does not require address resolution via an Identity Resolving Key (IRK). More...
 
constexpr bool isIdentityLEAddress () const noexcept
 Returns true if this address and type refers to a static public LE identity address, which does not require address resolution via an Identity Resolving Key (IRK). More...
 
constexpr bool isLEAddress () const noexcept
 Returns true if the BDAddressType is a LE address type. More...
 
bool matches (const BDAddressAndType &o) const noexcept
 Returns true if both devices match, i.e. More...
 
BDAddressAndTypeoperator= (BDAddressAndType &&o) noexcept
 
constexpr BDAddressAndTypeoperator= (const BDAddressAndType &o) noexcept
 
std::string toString () const noexcept
 

Static Public Member Functions

static BLERandomAddressType getBLERandomAddressType (const jau::EUI48 &address, const BDAddressType addressType) noexcept
 Returns the BLERandomAddressType. More...
 
static std::string getBLERandomAddressTypeString (const jau::EUI48 &address, const BDAddressType addressType, const std::string &prefix) noexcept
 Returns the BLERandomAddressType std::string representation. More...
 

Public Attributes

jau::EUI48 address
 
BDAddressType type
 

Static Public Attributes

static const BDAddressAndType ANY_BREDR_DEVICE
 Using EUI48::ANY_DEVICE and BDAddressType::BDADDR_BREDR to match any BREDR device. More...
 
static const BDAddressAndType ANY_DEVICE
 Using EUI48::ANY_DEVICE and BDAddressType::BDADDR_UNDEFINED to match any device. More...
 

Detailed Description

Unique Bluetooth EUI48 address and BDAddressType tuple.

Bluetooth EUI48 address itself is not unique as it requires the BDAddressType bits.
E.g. there could be two devices with the same EUI48 address, one using BDAddressType::BDADDR_LE_PUBLIC and one using BDAddressType::BDADDR_LE_RANDOM being a BLERandomAddressType::RESOLVABLE_PRIVAT.

Definition at line 175 of file BTAddress.hpp.

Constructor & Destructor Documentation

◆ BDAddressAndType() [1/4]

direct_bt::BDAddressAndType::BDAddressAndType ( const jau::EUI48 address_,
BDAddressType  type_ 
)
inline

Definition at line 193 of file BTAddress.hpp.

◆ BDAddressAndType() [2/4]

constexpr direct_bt::BDAddressAndType::BDAddressAndType ( )
inlineconstexprnoexcept

Definition at line 196 of file BTAddress.hpp.

◆ BDAddressAndType() [3/4]

direct_bt::BDAddressAndType::BDAddressAndType ( const BDAddressAndType o)
inlinenoexcept

Definition at line 197 of file BTAddress.hpp.

◆ BDAddressAndType() [4/4]

direct_bt::BDAddressAndType::BDAddressAndType ( BDAddressAndType &&  o)
inlinenoexcept

Definition at line 198 of file BTAddress.hpp.

Member Function Documentation

◆ operator=() [1/2]

constexpr BDAddressAndType & direct_bt::BDAddressAndType::operator= ( const BDAddressAndType o)
inlineconstexprnoexcept

Definition at line 202 of file BTAddress.hpp.

◆ operator=() [2/2]

BDAddressAndType & direct_bt::BDAddressAndType::operator= ( BDAddressAndType &&  o)
inlinenoexcept

Definition at line 207 of file BTAddress.hpp.

◆ isLEAddress()

constexpr bool direct_bt::BDAddressAndType::isLEAddress ( ) const
inlineconstexprnoexcept

Returns true if the BDAddressType is a LE address type.

Definition at line 216 of file BTAddress.hpp.

◆ isIdentityLEAddress()

constexpr bool direct_bt::BDAddressAndType::isIdentityLEAddress ( ) const
inlineconstexprnoexcept

Returns true if this address and type refers to a static public LE identity address, which does not require address resolution via an Identity Resolving Key (IRK).


Either BDAddressType::BDADDR_LE_PUBLIC or BDAddressType::BDADDR_LE_RANDOM of sub-type BLERandomAddressType::STATIC_PUBLIC.

Definition at line 225 of file BTAddress.hpp.

◆ isIdentityAddress()

constexpr bool direct_bt::BDAddressAndType::isIdentityAddress ( ) const
inlineconstexprnoexcept

Returns true if this address and type refers to a public static identity address, which does not require address resolution via an Identity Resolving Key (IRK).


This includes BDAddressType::BDADDR_LE_RANDOM of sub-type BLERandomAddressType::STATIC_PUBLIC

Returns false if this address is of type BDAddressType::BDADDR_LE_RANDOM, excluding sub-type BLERandomAddressType::STATIC_PUBLIC and not of type BDAddressType::BDADDR_LE_PUBLIC or BDAddressType::BDADDR_BREDR.

Definition at line 243 of file BTAddress.hpp.

◆ isBREDRAddress()

constexpr bool direct_bt::BDAddressAndType::isBREDRAddress ( ) const
inlineconstexprnoexcept

Returns true if the BDAddressType is a BREDR address type.

Definition at line 255 of file BTAddress.hpp.

◆ getBLERandomAddressType() [1/2]

BLERandomAddressType BDAddressAndType::getBLERandomAddressType ( const jau::EUI48 address,
const BDAddressType  addressType 
)
staticnoexcept

Returns the BLERandomAddressType.

If BDAddressType is BDAddressType::BDADDR_LE_RANDOM, method shall return a valid value other than BLERandomAddressType::UNDEFINED.

If BDAddressType is not BDAddressType::BDADDR_LE_RANDOM, method shall return BLERandomAddressType::UNDEFINED.

Since
2.2.0

Definition at line 162 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ getBLERandomAddressTypeString()

std::string BDAddressAndType::getBLERandomAddressTypeString ( const jau::EUI48 address,
const BDAddressType  addressType,
const std::string &  prefix 
)
staticnoexcept

Returns the BLERandomAddressType std::string representation.

If BDAddressType is BDAddressType::BDADDR_LE_RANDOM, method shall return the given prefix and a valid string value other than BLERandomAddressType::UNDEFINED.

If BDAddressType is not BDAddressType::BDADDR_LE_RANDOM, method shall return an empty string.

Since
2.5.3

Definition at line 176 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ getBLERandomAddressType() [2/2]

BLERandomAddressType direct_bt::BDAddressAndType::getBLERandomAddressType ( ) const
inlinenoexcept

Returns the BLERandomAddressType.

If type is BDAddressType::BDADDR_LE_RANDOM}, method shall return a valid value other than BLERandomAddressType::UNDEFINED.

If type is not BDAddressType::BDADDR_LE_RANDOM, method shall return BLERandomAddressType::UNDEFINED.

Since
2.0.0

Definition at line 297 of file BTAddress.hpp.

Here is the caller graph for this function:

◆ matches()

bool direct_bt::BDAddressAndType::matches ( const BDAddressAndType o) const
inlinenoexcept

Returns true if both devices match, i.e.

equal address and equal type or at least one type is BDAddressType#BDADDR_UNDEFINED.

Definition at line 306 of file BTAddress.hpp.

◆ hash_code()

std::size_t direct_bt::BDAddressAndType::hash_code ( ) const
inlinenoexcept

Implementation uses a lock-free volatile cache.

Definition at line 319 of file BTAddress.hpp.

Here is the caller graph for this function:

◆ clearHash()

void direct_bt::BDAddressAndType::clearHash ( )
inline

Method clears the cached hash value.

See also
clear()

Definition at line 334 of file BTAddress.hpp.

Here is the caller graph for this function:

◆ clear()

void direct_bt::BDAddressAndType::clear ( )
inline

Method clears the underlying byte array b and cached hash value.

See also
clearHash()

Definition at line 340 of file BTAddress.hpp.

◆ toString()

std::string BDAddressAndType::toString ( ) const
noexcept

Definition at line 186 of file BTTypes0.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ ANY_BREDR_DEVICE

const BDAddressAndType direct_bt::BDAddressAndType::ANY_BREDR_DEVICE
static

Using EUI48::ANY_DEVICE and BDAddressType::BDADDR_BREDR to match any BREDR device.

Definition at line 178 of file BTAddress.hpp.

◆ ANY_DEVICE

const BDAddressAndType direct_bt::BDAddressAndType::ANY_DEVICE
static

Using EUI48::ANY_DEVICE and BDAddressType::BDADDR_UNDEFINED to match any device.


This constant is suitable to any device.

Definition at line 184 of file BTAddress.hpp.

◆ address

jau::EUI48 direct_bt::BDAddressAndType::address
Examples
dbt_peripheral00.cpp, dbt_repeater00.cpp, and dbt_scanner10.cpp.

Definition at line 186 of file BTAddress.hpp.

◆ type

BDAddressType direct_bt::BDAddressAndType::type

Definition at line 187 of file BTAddress.hpp.


The documentation for this class was generated from the following files: