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

Collection of 'Extended Advertising Data' (EAD), 'Advertising Data' (AD) or 'Extended Inquiry Response' (EIR) information. More...

#include <BTTypes0.hpp>

Collaboration diagram for direct_bt::EInfoReport:

Public Types

typedef jau::nsize_t size_type
 
enum class  Source : int {
  NA = 0 , AD_IND = 1 , AD_SCAN_RSP = 2 , EIR = 3 ,
  EIR_MGMT = 4
}
 
typedef jau::snsize_t ssize_type
 

Public Member Functions

 EInfoReport () noexcept
 
 EInfoReport (const EInfoReport &)=default
 
void addFlags (GAPFlags f) noexcept
 
bool addService (const jau::uuid_t &uuid) noexcept
 
bool addService (const std::shared_ptr< const jau::uuid_t > &uuid) noexcept
 
void clear () noexcept
 Reset all data fields. More...
 
std::string eirDataMaskToString () const noexcept
 
ssize_type findService (const jau::uuid_t &uuid) const noexcept
 
uint8_t getADAddressType () const noexcept
 
jau::EUI48 const & getAddress () const noexcept
 
BDAddressType getAddressType () const noexcept
 
AppearanceCat getAppearance () const noexcept
 
void getConnInterval (uint16_t &min, uint16_t &max) const noexcept
 Get slave connection interval range. More...
 
uint32_t getDeviceClass () const noexcept
 
void getDeviceID (uint16_t &source_, uint16_t &vendor_, uint16_t &product_, uint16_t &version_) const noexcept
 
std::string getDeviceIDModalias () const noexcept
 
uint16_t getDeviceIDProduct () const noexcept
 
uint16_t getDeviceIDSource () const noexcept
 
uint16_t getDeviceIDVendor () const noexcept
 
uint16_t getDeviceIDVersion () const noexcept
 
EIRDataType getEIRDataMask () const noexcept
 
AD_PDU_Type getEvtType () const noexcept
 
EAD_Event_Type getExtEvtType () const noexcept
 
GAPFlags getFlags () const noexcept
 
const jau::TROOctetsgetHash () const noexcept
 
std::shared_ptr< ManufactureSpecificDatagetManufactureSpecificData () const noexcept
 
std::string const & getName () const noexcept
 
const jau::TROOctetsgetRandomizer () const noexcept
 
int8_t getRSSI () const noexcept
 
const jau::darray< std::shared_ptr< const jau::uuid_t > > & getServices () const noexcept
 
bool getServicesComplete () const noexcept
 
std::string const & getShortName () const noexcept
 
Source getSource () const noexcept
 
bool getSourceExt () const noexcept
 
uint64_t getTimestamp () const noexcept
 
int8_t getTxPower () const noexcept
 
bool isSet (EIRDataType bit) const noexcept
 
bool operator!= (const EInfoReport &o) const noexcept
 
EInfoReportoperator= (const EInfoReport &o)=default
 
bool operator== (const EInfoReport &o) const noexcept
 
int read_data (uint8_t const *data, uint8_t const data_length) noexcept
 Reads the Extended Inquiry Response (EIR) or (Extended) Advertising Data (EAD or AD) segments and returns the number of parsed data segments;. More...
 
EIRDataType set (const EInfoReport &eir) noexcept
 Merge all fields from given EInfoReport if set and different. More...
 
void setAddress (jau::EUI48 const &a) noexcept
 
void setAddressType (BDAddressType at) noexcept
 
void setAppearance (AppearanceCat a) noexcept
 
void setConnInterval (const uint16_t min, const uint16_t max) noexcept
 Set slave connection interval range. More...
 
void setDeviceClass (uint32_t c) noexcept
 
void setDeviceID (const uint16_t source, const uint16_t vendor, const uint16_t product, const uint16_t version) noexcept
 
void setEvtType (AD_PDU_Type et) noexcept
 
void setExtEvtType (EAD_Event_Type eadt) noexcept
 
void setFlags (GAPFlags f) noexcept
 
void setHash (const uint8_t *h) noexcept
 
void setManufactureSpecificData (const ManufactureSpecificData &msd_)
 
void setName (const std::string &name_) noexcept
 
void setRandomizer (const uint8_t *r) noexcept
 
void setRSSI (int8_t v) noexcept
 
void setServicesComplete (const bool v) noexcept
 
void setShortName (const std::string &name_short_) noexcept
 
void setSource (Source s, bool ext) noexcept
 
void setTimestamp (uint64_t ts) noexcept
 
void setTxPower (int8_t v) noexcept
 
std::string toString (const bool includeServices=true) const noexcept
 
jau::nsize_t write_data (EIRDataType write_mask, uint8_t *data, jau::nsize_t const data_length) const noexcept
 Writes the Extended Inquiry Response (EIR) or (Extended) Advertising Data (EAD or AD) segments of existing EIRDataType of this instance into the given data up to data_length. More...
 

Static Public Member Functions

static constexpr int number (const Source rhs) noexcept
 
static jau::darray< std::unique_ptr< EInfoReport > > read_ext_ad_reports (uint8_t const *data, jau::nsize_t const data_length) noexcept
 Reads a complete Advertising Data (AD) Report and returns the number of AD reports in form of a sharable list of EInfoReport;. More...
 
static Source toSource (const AD_PDU_Type type)
 
static Source toSource (const EAD_Event_Type type)
 

Detailed Description

Collection of 'Extended Advertising Data' (EAD), 'Advertising Data' (AD) or 'Extended Inquiry Response' (EIR) information.

References:

Examples
dbt_peripheral00.cpp, and dbt_repeater00.cpp.

Definition at line 898 of file BTTypes0.hpp.

Member Typedef Documentation

◆ size_type

Definition at line 916 of file BTTypes0.hpp.

◆ ssize_type

Definition at line 917 of file BTTypes0.hpp.

Member Enumeration Documentation

◆ Source

enum class direct_bt::EInfoReport::Source : int
strong
Enumerator
NA 

Not Available.

AD_IND 

(Extended) Advertising Data (AD or EAD) Indication Variant, i.e.

initial passive scan data.

AD_SCAN_RSP 

(Extended) Advertising Data (AD or EAD) Scan Response, i.e.

optional active scanning data after AD_IND.

EIR 

Extended Inquiry Response (EIR)

EIR_MGMT 

Extended Inquiry Response (EIR) from Kernel Mgmt.

Definition at line 900 of file BTTypes0.hpp.

Constructor & Destructor Documentation

◆ EInfoReport() [1/2]

direct_bt::EInfoReport::EInfoReport ( )
inlinenoexcept

Definition at line 965 of file BTTypes0.hpp.

◆ EInfoReport() [2/2]

direct_bt::EInfoReport::EInfoReport ( const EInfoReport )
default

Member Function Documentation

◆ number()

static constexpr int direct_bt::EInfoReport::number ( const Source  rhs)
inlinestaticconstexprnoexcept

Definition at line 912 of file BTTypes0.hpp.

◆ toSource() [1/2]

EInfoReport::Source EInfoReport::toSource ( const AD_PDU_Type  type)
static

Definition at line 1305 of file BTTypes0.cpp.

◆ toSource() [2/2]

EInfoReport::Source EInfoReport::toSource ( const EAD_Event_Type  type)
static

Definition at line 1335 of file BTTypes0.cpp.

◆ operator=()

EInfoReport & direct_bt::EInfoReport::operator= ( const EInfoReport o)
default

◆ clear()

void EInfoReport::clear ( )
noexcept

Reset all data fields.

Definition at line 621 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ set()

EIRDataType EInfoReport::set ( const EInfoReport eir)
noexcept

Merge all fields from given EInfoReport if set and different.

Parameters
eir
Returns
The changed fields, i.e. EIRDataType bit field

Definition at line 626 of file BTTypes0.cpp.

◆ setSource()

void direct_bt::EInfoReport::setSource ( Source  s,
bool  ext 
)
inlinenoexcept

Definition at line 982 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ setTimestamp()

void direct_bt::EInfoReport::setTimestamp ( uint64_t  ts)
inlinenoexcept

Definition at line 983 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ setEvtType()

void direct_bt::EInfoReport::setEvtType ( AD_PDU_Type  et)
inlinenoexcept

Definition at line 984 of file BTTypes0.hpp.

◆ setExtEvtType()

void direct_bt::EInfoReport::setExtEvtType ( EAD_Event_Type  eadt)
inlinenoexcept

Definition at line 985 of file BTTypes0.hpp.

◆ setAddressType()

void EInfoReport::setAddressType ( BDAddressType  at)
noexcept

Definition at line 785 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ setAddress()

void direct_bt::EInfoReport::setAddress ( jau::EUI48 const &  a)
inlinenoexcept

Definition at line 987 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ setRSSI()

void direct_bt::EInfoReport::setRSSI ( int8_t  v)
inlinenoexcept

Definition at line 988 of file BTTypes0.hpp.

◆ setTxPower()

void direct_bt::EInfoReport::setTxPower ( int8_t  v)
inlinenoexcept

Definition at line 989 of file BTTypes0.hpp.

◆ setFlags()

void direct_bt::EInfoReport::setFlags ( GAPFlags  f)
inlinenoexcept

Definition at line 991 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ addFlags()

void direct_bt::EInfoReport::addFlags ( GAPFlags  f)
inlinenoexcept
Examples
dbt_peripheral00.cpp.

Definition at line 992 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ setName()

void EInfoReport::setName ( const std::string &  name_)
noexcept

Definition at line 800 of file BTTypes0.cpp.

◆ setShortName()

void EInfoReport::setShortName ( const std::string &  name_short_)
noexcept

Definition at line 809 of file BTTypes0.cpp.

◆ setManufactureSpecificData()

void EInfoReport::setManufactureSpecificData ( const ManufactureSpecificData msd_)

Definition at line 822 of file BTTypes0.cpp.

◆ addService() [1/2]

bool EInfoReport::addService ( const std::shared_ptr< const jau::uuid_t > &  uuid)
noexcept
Examples
dbt_peripheral00.cpp.

Definition at line 834 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ addService() [2/2]

bool EInfoReport::addService ( const jau::uuid_t uuid)
noexcept

Definition at line 847 of file BTTypes0.cpp.

◆ setServicesComplete()

void direct_bt::EInfoReport::setServicesComplete ( const bool  v)
inlinenoexcept
Examples
dbt_peripheral00.cpp.

Definition at line 999 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ setDeviceClass()

void direct_bt::EInfoReport::setDeviceClass ( uint32_t  c)
inlinenoexcept

Definition at line 1000 of file BTTypes0.hpp.

◆ setAppearance()

void direct_bt::EInfoReport::setAppearance ( AppearanceCat  a)
inlinenoexcept

Definition at line 1001 of file BTTypes0.hpp.

◆ setHash()

void direct_bt::EInfoReport::setHash ( const uint8_t *  h)
inlinenoexcept

Definition at line 1002 of file BTTypes0.hpp.

◆ setRandomizer()

void direct_bt::EInfoReport::setRandomizer ( const uint8_t *  r)
inlinenoexcept

Definition at line 1003 of file BTTypes0.hpp.

◆ setDeviceID()

void EInfoReport::setDeviceID ( const uint16_t  source,
const uint16_t  vendor,
const uint16_t  product,
const uint16_t  version 
)
noexcept

Definition at line 826 of file BTTypes0.cpp.

◆ setConnInterval()

void direct_bt::EInfoReport::setConnInterval ( const uint16_t  min,
const uint16_t  max 
)
inlinenoexcept

Set slave connection interval range.

Bluetooth Supplement, Part A, section 1.9

Parameters
minconn_interval_min in units of 1.25ms, default value 10 for 12.5ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
maxconn_interval_max in units of 1.25ms, default value 24 for 30.0ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
Examples
dbt_peripheral00.cpp.

Definition at line 1014 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ read_ext_ad_reports()

jau::darray< std::unique_ptr< EInfoReport > > EInfoReport::read_ext_ad_reports ( uint8_t const *  data,
jau::nsize_t const  data_length 
)
staticnoexcept

Reads a complete Advertising Data (AD) Report and returns the number of AD reports in form of a sharable list of EInfoReport;.

   BT Core Spec v5.2: Vol 4, Part E, 7.7.65.2 LE Advertising Report event
   BT Core Spec v5.2: Vol 3, Part C, 11 ADVERTISING AND SCAN RESPONSE DATA FORMAT
   BT Core Spec v5.2: Vol 3, Part C, 8  EXTENDED INQUIRY RESPONSE DATA FORMAT
   
   https://www.bluetooth.com/specifications/archived-specifications/
   
 */
static jau::darray<std::unique_ptr<EInfoReport>> read_ad_reports(uint8_t const * data, jau::nsize_t const data_length) noexcept;

/**
   Reads a complete Extended Advertising Data (AD) Report
   and returns the number of AD reports in form of a sharable list of EInfoReport;
   
   BT Core Spec v5.2: Vol 4, Part E, 7.7.65.13 LE Extended Advertising Report event
   BT Core Spec v5.2: Vol 3, Part C, 11 ADVERTISING AND SCAN RESPONSE DATA FORMAT
   BT Core Spec v5.2: Vol 3, Part C, 8  EXTENDED INQUIRY RESPONSE DATA FORMAT
   
   https://www.bluetooth.com/specifications/archived-specifications/
   

Definition at line 1435 of file BTTypes0.cpp.

◆ read_data()

int EInfoReport::read_data ( uint8_t const *  data,
uint8_t const  data_length 
)
noexcept

Reads the Extended Inquiry Response (EIR) or (Extended) Advertising Data (EAD or AD) segments and returns the number of parsed data segments;.

AD as well as EIR information is passed in little endian order in the same fashion data block:

a -> {
            uint8_t len
            uint8_t type
            uint8_t data[len-1];
        }
b -> next block = a + 1 + len;

References:

  • BT Core Spec v5.2: Vol 3, Part C, 11 ADVERTISING AND SCAN RESPONSE DATA FORMAT
  • BT Core Spec v5.2: Vol 3, Part C, 8 EXTENDED INQUIRY RESPONSE DATA FORMAT
  • BT Core Spec Supplement v9, Part A: Section 1 + 2 Examples, p25..
  • Assigned Numbers - Generic Access Profile

https://www.bluetooth.com/specifications/archived-specifications/

Definition at line 1003 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ write_data()

jau::nsize_t EInfoReport::write_data ( EIRDataType  write_mask,
uint8_t *  data,
jau::nsize_t const  data_length 
) const
noexcept

Writes the Extended Inquiry Response (EIR) or (Extended) Advertising Data (EAD or AD) segments of existing EIRDataType of this instance into the given data up to data_length.

Only fields in the given EIRDataType write_mask and getEIRDataMask() will be written, hence write_mask allows to select the fields to be written/advertised.

Usually only up to 31 bytes are supported to be advertised, i.e. data_length may be lower or equal 31.

Elements exceeding the data_length will be cut off.

References:

  • BT Core Spec v5.2: Vol 3, Part C, 11 ADVERTISING AND SCAN RESPONSE DATA FORMAT
  • BT Core Spec v5.2: Vol 3, Part C, 8 EXTENDED INQUIRY RESPONSE DATA FORMAT
  • BT Core Spec Supplement v9, Part A: Section 1 + 2 Examples, p25..
  • Assigned Numbers - Generic Access Profile
Parameters
write_maskEIRDataType selection mask
datadestination
data_lengthdestination length
Returns
number of bytes written
See also
read_data()

Definition at line 1149 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ getSource()

Source direct_bt::EInfoReport::getSource ( ) const
inlinenoexcept

Definition at line 1106 of file BTTypes0.hpp.

◆ getSourceExt()

bool direct_bt::EInfoReport::getSourceExt ( ) const
inlinenoexcept

Definition at line 1107 of file BTTypes0.hpp.

◆ getTimestamp()

uint64_t direct_bt::EInfoReport::getTimestamp ( ) const
inlinenoexcept

Definition at line 1109 of file BTTypes0.hpp.

◆ isSet()

bool direct_bt::EInfoReport::isSet ( EIRDataType  bit) const
inlinenoexcept

Definition at line 1110 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ getEIRDataMask()

EIRDataType direct_bt::EInfoReport::getEIRDataMask ( ) const
inlinenoexcept

Definition at line 1111 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ getEvtType()

AD_PDU_Type direct_bt::EInfoReport::getEvtType ( ) const
inlinenoexcept

Definition at line 1113 of file BTTypes0.hpp.

◆ getExtEvtType()

EAD_Event_Type direct_bt::EInfoReport::getExtEvtType ( ) const
inlinenoexcept

Definition at line 1114 of file BTTypes0.hpp.

◆ getFlags()

GAPFlags direct_bt::EInfoReport::getFlags ( ) const
inlinenoexcept

Definition at line 1115 of file BTTypes0.hpp.

◆ getADAddressType()

uint8_t direct_bt::EInfoReport::getADAddressType ( ) const
inlinenoexcept

Definition at line 1116 of file BTTypes0.hpp.

◆ getAddressType()

BDAddressType direct_bt::EInfoReport::getAddressType ( ) const
inlinenoexcept

Definition at line 1117 of file BTTypes0.hpp.

◆ getAddress()

jau::EUI48 const & direct_bt::EInfoReport::getAddress ( ) const
inlinenoexcept

Definition at line 1118 of file BTTypes0.hpp.

◆ getName()

std::string const & direct_bt::EInfoReport::getName ( ) const
inlinenoexcept

Definition at line 1119 of file BTTypes0.hpp.

Here is the caller graph for this function:

◆ getShortName()

std::string const & direct_bt::EInfoReport::getShortName ( ) const
inlinenoexcept

Definition at line 1120 of file BTTypes0.hpp.

◆ getRSSI()

int8_t direct_bt::EInfoReport::getRSSI ( ) const
inlinenoexcept

Definition at line 1121 of file BTTypes0.hpp.

◆ getTxPower()

int8_t direct_bt::EInfoReport::getTxPower ( ) const
inlinenoexcept

Definition at line 1122 of file BTTypes0.hpp.

◆ getManufactureSpecificData()

std::shared_ptr< ManufactureSpecificData > direct_bt::EInfoReport::getManufactureSpecificData ( ) const
inlinenoexcept

Definition at line 1124 of file BTTypes0.hpp.

◆ getServices()

const jau::darray< std::shared_ptr< const jau::uuid_t > > & direct_bt::EInfoReport::getServices ( ) const
inlinenoexcept

Definition at line 1126 of file BTTypes0.hpp.

◆ getServicesComplete()

bool direct_bt::EInfoReport::getServicesComplete ( ) const
inlinenoexcept

Definition at line 1127 of file BTTypes0.hpp.

◆ findService()

EInfoReport::ssize_type EInfoReport::findService ( const jau::uuid_t uuid) const
noexcept

Definition at line 750 of file BTTypes0.cpp.

◆ getDeviceClass()

uint32_t direct_bt::EInfoReport::getDeviceClass ( ) const
inlinenoexcept

Definition at line 1130 of file BTTypes0.hpp.

◆ getAppearance()

AppearanceCat direct_bt::EInfoReport::getAppearance ( ) const
inlinenoexcept

Definition at line 1131 of file BTTypes0.hpp.

◆ getHash()

const jau::TROOctets & direct_bt::EInfoReport::getHash ( ) const
inlinenoexcept

Definition at line 1132 of file BTTypes0.hpp.

◆ getRandomizer()

const jau::TROOctets & direct_bt::EInfoReport::getRandomizer ( ) const
inlinenoexcept

Definition at line 1133 of file BTTypes0.hpp.

◆ getDeviceID()

void direct_bt::EInfoReport::getDeviceID ( uint16_t &  source_,
uint16_t &  vendor_,
uint16_t &  product_,
uint16_t &  version_ 
) const
inlinenoexcept

Definition at line 1134 of file BTTypes0.hpp.

◆ getDeviceIDSource()

uint16_t direct_bt::EInfoReport::getDeviceIDSource ( ) const
inlinenoexcept

Definition at line 1137 of file BTTypes0.hpp.

◆ getDeviceIDVendor()

uint16_t direct_bt::EInfoReport::getDeviceIDVendor ( ) const
inlinenoexcept

Definition at line 1138 of file BTTypes0.hpp.

◆ getDeviceIDProduct()

uint16_t direct_bt::EInfoReport::getDeviceIDProduct ( ) const
inlinenoexcept

Definition at line 1139 of file BTTypes0.hpp.

◆ getDeviceIDVersion()

uint16_t direct_bt::EInfoReport::getDeviceIDVersion ( ) const
inlinenoexcept

Definition at line 1140 of file BTTypes0.hpp.

◆ getConnInterval()

void direct_bt::EInfoReport::getConnInterval ( uint16_t &  min,
uint16_t &  max 
) const
inlinenoexcept

Get slave connection interval range.

Bluetooth Supplement, Part A, section 1.9

Parameters
minconn_interval_min in units of 1.25ms, default value 10 for 12.5ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
maxconn_interval_max in units of 1.25ms, default value 24 for 30.0ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]

Definition at line 1150 of file BTTypes0.hpp.

◆ getDeviceIDModalias()

std::string EInfoReport::getDeviceIDModalias ( ) const
noexcept

Definition at line 950 of file BTTypes0.cpp.

◆ eirDataMaskToString()

std::string EInfoReport::eirDataMaskToString ( ) const
noexcept

Definition at line 851 of file BTTypes0.cpp.

◆ toString()

std::string EInfoReport::toString ( const bool  includeServices = true) const
noexcept
Examples
dbt_peripheral00.cpp, and dbt_repeater00.cpp.

Definition at line 854 of file BTTypes0.cpp.

Here is the caller graph for this function:

◆ operator==()

bool EInfoReport::operator== ( const EInfoReport o) const
noexcept

Definition at line 917 of file BTTypes0.cpp.

◆ operator!=()

bool direct_bt::EInfoReport::operator!= ( const EInfoReport o) const
inlinenoexcept

Definition at line 1157 of file BTTypes0.hpp.


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