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

BTAdapter represents one local Bluetooth Controller. More...

#include <BTAdapter.hpp>

Inheritance diagram for direct_bt::BTAdapter:
Collaboration diagram for direct_bt::BTAdapter:

Public Types

typedef jau::nsize_t size_type
 

Public Member Functions

 BTAdapter (const BTAdapter &)=delete
 
 BTAdapter (const BTAdapter::ctor_cookie &cc, BTManagerRef mgmt_, AdapterInfo adapterInfo_) noexcept
 Private ctor for private BTAdapter::make_shared() intended for friends. More...
 
 ~BTAdapter () noexcept override
 Releases this instance. More...
 
bool addDeviceToWhitelist (const BDAddressAndType &addressAndType, const HCIWhitelistConnectType ctype, const uint16_t conn_interval_min=12, const uint16_t conn_interval_max=12, const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15))
 Add the given device to the adapter's autoconnect whitelist. More...
 
bool addStatusListener (const AdapterStatusListenerRef &l) noexcept
 Add the given listener to the list if not already present. More...
 
bool addStatusListener (const BTDevice &d, const AdapterStatusListenerRef &l) noexcept
 
bool addStatusListener (const BTDeviceRef &d, const AdapterStatusListenerRef &l) noexcept
 Please use BTDevice::addStatusListener() for clarity, merely existing here to allow JNI access. More...
 
void close () noexcept
 Closes this instance, usually being called by destructor or when this adapter is being removed as recognized and handled by BTManager. More...
 
BTDeviceRef findDiscoveredDevice (const EUI48 &address, const BDAddressType addressType) noexcept
 Returns shared BTDevice if found, otherwise nullptr. More...
 
BTDeviceRef findSharedDevice (const EUI48 &address, const BDAddressType addressType) noexcept
 Returns shared BTDevice if found, otherwise nullptr. More...
 
std::string get_java_class () const noexcept override
 
BDAddressAndType const & getAddressAndType () const noexcept
 Returns the adapter's public BDAddressAndType, i.e. More...
 
constexpr uint16_t getBTMajorVersion () const noexcept
 Returns the Bluetooth major version of this adapter. More...
 
BTMode getBTMode () const noexcept
 Returns the current BTMode of this adapter. More...
 
DiscoveryPolicy getCurrentDiscoveryPolicy () const noexcept
 Return the current DiscoveryPolicy, set via startDiscovery(). More...
 
ScanType getCurrentNativeScanType () const noexcept
 Returns the adapter's current native discovering ScanType. More...
 
ScanType getCurrentScanType () const noexcept
 Returns the current meta discovering ScanType. More...
 
jau::darray< BTDeviceRefgetDiscoveredDevices () const noexcept
 Returns discovered devices from the last discovery. More...
 
DBGattServerRef getGATTServerData ()
 Return the user's DBGattServer shared reference if in BTRole::Slave mode as set via startAdvertising() and valid until subsequent disconnect. More...
 
HCIHandlergetHCI () noexcept
 Returns a reference to the aggregated HCIHandler instance. More...
 
constexpr LE_Features getLEFeatures () const noexcept
 Return LE_Features for this controller. More...
 
const BTManagerRefgetManager () const noexcept
 Returns a reference to the used singleton BTManager instance, used to create this adapter. More...
 
std::string getName () const noexcept
 Returns the name. More...
 
BTRole getRole () const noexcept
 Return the current BTRole of this adapter. More...
 
bool getSecureConnectionsEnabled () const noexcept
 Returns whether Secure Connections (SC) is enabled. More...
 
std::string getShortName () const noexcept
 Returns the short name. More...
 
BDAddressAndType const & getVisibleAddressAndType () const noexcept
 Returns the adapter's currently visible BDAddressAndType, i.e. More...
 
bool hasSecureConnections () const noexcept
 
bool hasSecureSimplePairing () const noexcept
 
HCIStatusCode initialize (const BTMode btMode, const bool powerOn) noexcept
 Initialize the adapter with default values, including power-on. More...
 
bool isAdvertising () const noexcept
 Returns the adapter's current advertising state. More...
 
bool isDeviceWhitelisted (const BDAddressAndType &addressAndType) noexcept
 Returns true, if the adapter's device is already whitelisted. More...
 
bool isDiscovering () const noexcept
 Returns true if the meta discovering state is not ScanType::NONE. More...
 
bool isInitialized () const noexcept
 Returns true, if initialize() has already been called for this adapter, otherwise false. More...
 
bool isPowered () const noexcept
 Returns whether the adapter is valid, plugged in and powered. More...
 
bool isSuspended () const noexcept
 Returns whether the adapter is suspended, i.e. More...
 
bool isValid () const noexcept
 Returns whether the adapter is valid, i.e. More...
 
void operator= (const BTAdapter &)=delete
 
void printDeviceLists () noexcept
 Print the internally maintained BTDevice lists to stderr: More...
 
void printStatusListenerList () noexcept
 
size_type removeAllStatusListener () noexcept
 Remove all status listener from the list. More...
 
bool removeDeviceFromWhitelist (const BDAddressAndType &addressAndType)
 Remove the given device from the adapter's autoconnect whitelist. More...
 
bool removeDevicePausingDiscovery (const BTDevice &device) noexcept
 Manual DiscoveryPolicy intervention point, allowing user to remove the ready device from the queue of pausing-discovery devices. More...
 
bool removeDiscoveredDevice (const BDAddressAndType &addressAndType) noexcept
 Discards matching discovered devices. More...
 
size_type removeDiscoveredDevices () noexcept
 Discards all discovered devices. More...
 
bool removeStatusListener (const AdapterStatusListener *l) noexcept
 Remove the given listener from the list. More...
 
bool removeStatusListener (const AdapterStatusListenerRef &l) noexcept
 Remove the given listener from the list. More...
 
HCIStatusCode reset () noexcept
 Reset the adapter. More...
 
HCIStatusCode setDefaultConnParam (const uint16_t conn_interval_min=8, const uint16_t conn_interval_max=40, const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 50)) noexcept
 Set default connection parameter of incoming connections for this adapter when in server mode, i.e. More...
 
HCIStatusCode setDefaultLE_PHY (const LE_PHYs Tx, const LE_PHYs Rx) noexcept
 Sets default preference of LE_PHYs. More...
 
HCIStatusCode setName (const std::string &name, const std::string &short_name) noexcept
 Sets the name and short-name. More...
 
bool setPowered (const bool power_on) noexcept
 Set the power state of the adapter. More...
 
HCIStatusCode setPrivacy (const bool enable) noexcept
 Toggle adapter privacy address mode, i.e. More...
 
HCIStatusCode setSecureConnections (const bool enable) noexcept
 Enable or disable Secure Connections (SC) of the adapter. More...
 
void setServerConnSecurity (const BTSecurityLevel sec_level, const SMPIOCapability io_cap) noexcept
 Sets the given BTSecurityLevel and SMPIOCapability for connecting device when in server (peripheral) mode, see adapter's role. More...
 
void setSMPKeyPath (const std::string path) noexcept
 Set the adapter's persistent storage directory for SMPKeyBin files. More...
 
HCIStatusCode startAdvertising (const DBGattServerRef &gattServerData_, const uint16_t adv_interval_min=160, const uint16_t adv_interval_max=480, const AD_PDU_Type adv_type=AD_PDU_Type::ADV_IND, const uint8_t adv_chan_map=0x07, const uint8_t filter_policy=0x00) noexcept
 Starts advertising. More...
 
HCIStatusCode startAdvertising (const DBGattServerRef &gattServerData_, EInfoReport &eir, EIRDataType adv_mask=EIRDataType::FLAGS|EIRDataType::SERVICE_UUID, EIRDataType scanrsp_mask=EIRDataType::NAME|EIRDataType::CONN_IVAL, const uint16_t adv_interval_min=160, const uint16_t adv_interval_max=480, const AD_PDU_Type adv_type=AD_PDU_Type::ADV_IND, const uint8_t adv_chan_map=0x07, const uint8_t filter_policy=0x00) noexcept
 Starts advertising. More...
 
HCIStatusCode startDiscovery (const DBGattServerRef &gattServerData_=nullptr, const DiscoveryPolicy policy=DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY, const bool le_scan_active=true, const uint16_t le_scan_interval=24, const uint16_t le_scan_window=24, const uint8_t filter_policy=0x00, const bool filter_dup=true) noexcept
 Starts discovery. More...
 
HCIStatusCode stopAdvertising () noexcept
 Ends advertising. More...
 
HCIStatusCode stopDiscovery () noexcept
 Ends discovery. More...
 
std::string toString () const noexcept override
 
std::string toString (bool includeDiscoveredDevices) const noexcept
 
HCIStatusCode uploadKeys (SMPKeyBin &bin, const bool write) noexcept
 Associate the given SMPKeyBin with the contained remote address, i.e. More...
 
- Public Member Functions inherited from direct_bt::BTObject
 ~BTObject () noexcept override
 
void checkValidInstance () const override
 Throws an IllegalStateException if instance is not valid. More...
 
bool isValidInstance () const noexcept
 Returns whether the object's reference is valid and in a general operational state. More...
 
std::string toString () const noexcept override
 

Static Public Member Functions

static std::string java_class () noexcept
 

Public Attributes

const uint16_t dev_id
 Adapter's internal temporary device id. More...
 

Friends

HCIStatusCode BTDevice::connectBREDR (const uint16_t pkt_type, const uint16_t clock_offset, const uint8_t role_switch) noexcept
 
bool BTDevice::connectGATT (const std::shared_ptr< BTDevice > &sthis) noexcept
 
HCIStatusCode BTDevice::connectLE (uint16_t interval, uint16_t window, uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t supervision_timeout) noexcept
 
HCIStatusCode BTDevice::disconnect (const HCIStatusCode reason) noexcept
 
std::shared_ptr< ConnectionInfoBTDevice::getConnectionInfo () noexcept
 
jau::darray< BTGattServiceRefBTDevice::getGattServices () noexcept
 
BTDeviceRef BTDevice::getSharedInstance () const noexcept
 
void BTDevice::hciSMPMsgCallback (const BTDeviceRef &sthis, const SMPPDUMsg &msg, const HCIACLData::l2cap_frame &source) noexcept
 
void BTDevice::processDeviceReady (BTDeviceRef sthis, const uint64_t timestamp)
 
void BTDevice::processL2CAPSetup (BTDeviceRef sthis)
 
void BTDevice::remove () noexcept
 
void BTDevice::sendMgmtEvDeviceDisconnected (std::unique_ptr< MgmtEvent > evt) noexcept
 
bool BTDevice::updateIdentityAddress (BDAddressAndType const &identityAddress, bool sendEvent) noexcept
 
bool BTDevice::updatePairingState (const BTDeviceRef &sthis, const MgmtEvent &evt, const HCIStatusCode evtStatus, SMPPairingState claimed_state) noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from direct_bt::BTObject
 BTObject () noexcept
 
- Protected Attributes inherited from direct_bt::BTObject
std::atomic_bool instance_valid
 

Detailed Description

BTAdapter represents one local Bluetooth Controller.

Local BTAdapter roles (see getRole()):

Note the remote BTDevice's opposite role.

Controlling Environment variables:

See also
BTDevice
BTDeviceRoles
BTGattHandlerRoles
Bluetooth Specification
Direct-BT Overview
Examples
dbt_peripheral00.cpp, dbt_repeater00.cpp, and dbt_scanner10.cpp.

Definition at line 323 of file BTAdapter.hpp.

Member Typedef Documentation

◆ size_type

Definition at line 355 of file BTAdapter.hpp.

Constructor & Destructor Documentation

◆ BTAdapter() [1/2]

BTAdapter::BTAdapter ( const BTAdapter::ctor_cookie &  cc,
BTManagerRef  mgmt_,
AdapterInfo  adapterInfo_ 
)
noexcept

Private ctor for private BTAdapter::make_shared() intended for friends.

Definition at line 419 of file BTAdapter.cpp.

◆ BTAdapter() [2/2]

direct_bt::BTAdapter::BTAdapter ( const BTAdapter )
delete

◆ ~BTAdapter()

BTAdapter::~BTAdapter ( )
overridenoexcept

Releases this instance.

Definition at line 455 of file BTAdapter.cpp.

Member Function Documentation

◆ operator=()

void direct_bt::BTAdapter::operator= ( const BTAdapter )
delete

◆ close()

void BTAdapter::close ( )
noexcept

Closes this instance, usually being called by destructor or when this adapter is being removed as recognized and handled by BTManager.

In case initialize() has powered-on this adapter and was not powered-on before, it will be powered-off.

Renders this adapter's BTAdapter::isValid() state to false.

See also
initialize()
setPowered()

Definition at line 472 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ get_java_class()

std::string direct_bt::BTAdapter::get_java_class ( ) const
inlineoverridevirtualnoexcept

Implements jau::jni::JavaUplink.

Definition at line 613 of file BTAdapter.hpp.

◆ java_class()

static std::string direct_bt::BTAdapter::java_class ( )
inlinestaticnoexcept

Definition at line 616 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ isPowered()

bool direct_bt::BTAdapter::isPowered ( ) const
inlinenoexcept

Returns whether the adapter is valid, plugged in and powered.

Returns
true if BTAdapter::isValid(), HCIHandler::isOpen() and AdapterSetting::POWERED state is set.
See also
isSuspended()
isValid()

Definition at line 626 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ isSuspended()

bool direct_bt::BTAdapter::isSuspended ( ) const
inlinenoexcept

Returns whether the adapter is suspended, i.e.

valid and plugged in, but not powered.

Returns
true if BTAdapter::isValid(), HCIHandler::isOpen() and AdapterSetting::POWERED state is not set.
See also
isPowered()
isValid()

Definition at line 636 of file BTAdapter.hpp.

◆ hasSecureConnections()

bool direct_bt::BTAdapter::hasSecureConnections ( ) const
inlinenoexcept

Definition at line 640 of file BTAdapter.hpp.

◆ hasSecureSimplePairing()

bool direct_bt::BTAdapter::hasSecureSimplePairing ( ) const
inlinenoexcept

Definition at line 644 of file BTAdapter.hpp.

◆ getLEFeatures()

constexpr LE_Features direct_bt::BTAdapter::getLEFeatures ( ) const
inlineconstexprnoexcept

Return LE_Features for this controller.

BT Core Spec v5.2: Vol 6, Part B, 4.6 (LE LL) Feature Support
Examples
dbt_peripheral00.cpp.

Definition at line 654 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ getBTMajorVersion()

constexpr uint16_t direct_bt::BTAdapter::getBTMajorVersion ( ) const
inlineconstexprnoexcept

Returns the Bluetooth major version of this adapter.

Currently either 4 or 5.

Examples
dbt_peripheral00.cpp.

Definition at line 657 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ isValid()

bool direct_bt::BTAdapter::isValid ( ) const
inlinenoexcept

Returns whether the adapter is valid, i.e.

reference is valid, plugged in and generally operational, but not necessarily BTAdapter::isPowered() powered.

Returns
true if this adapter references are valid and hasn't been BTAdapter::close() 'ed
See also
isPowered()
isSuspended()

Definition at line 666 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ getRole()

BTRole direct_bt::BTAdapter::getRole ( ) const
inlinenoexcept

Return the current BTRole of this adapter.

See also
BTRole
BTAdapterRoles
Since
2.4.0

Definition at line 676 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ getBTMode()

BTMode direct_bt::BTAdapter::getBTMode ( ) const
inlinenoexcept

Returns the current BTMode of this adapter.

Definition at line 681 of file BTAdapter.hpp.

◆ getAddressAndType()

BDAddressAndType const & direct_bt::BTAdapter::getAddressAndType ( ) const
inlinenoexcept

Returns the adapter's public BDAddressAndType, i.e.

BDAddressType::BDADDR_LE_PUBLIC.

The adapter's address as initially reported by the system is always its public address, i.e. BDAddressType::BDADDR_LE_PUBLIC.

Since
2.2.8
See also
getVisibleAddressAndType()
Examples
dbt_peripheral00.cpp, dbt_repeater00.cpp, and dbt_scanner10.cpp.

Definition at line 691 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ getVisibleAddressAndType()

BDAddressAndType const & direct_bt::BTAdapter::getVisibleAddressAndType ( ) const
inlinenoexcept

Returns the adapter's currently visible BDAddressAndType, i.e.

BDAddressType::BDADDR_LE_RANDOM or BDAddressType::BDADDR_LE_PUBLIC.

The adapter's address as initially reported by the system is always its public address, i.e. BDAddressType::BDADDR_LE_PUBLIC.

The adapter's visible BDAddressAndType might be set to BDAddressType::BDADDR_LE_RANDOM before scanning / discovery mode via setPrivacy().

Since
3.2.8
See also
getAddressAndType()
setPrivacy()

Definition at line 705 of file BTAdapter.hpp.

◆ getName()

std::string direct_bt::BTAdapter::getName ( ) const
inlinenoexcept

Returns the name.

Can be changed via setName() while powered-off.

See also
setName()
Examples
dbt_peripheral00.cpp.

Definition at line 714 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ getShortName()

std::string direct_bt::BTAdapter::getShortName ( ) const
inlinenoexcept

Returns the short name.

Can be changed via setName() while powered-off.

See also
setName()

Definition at line 723 of file BTAdapter.hpp.

◆ setName()

HCIStatusCode BTAdapter::setName ( const std::string &  name,
const std::string &  short_name 
)
noexcept

Sets the name and short-name.

The corresponding management event will change the name and short-name.

Shall be called while adapter is powered off, see setPowered(). If adapter is powered, method returns HCIStatusCode::COMMAND_DISALLOWED.

Parameters
name
short_name
Returns
HCIStatusCode::SUCCESS or an error state on failure
See also
getName()
getShortName()
setPowered()
Since
2.4.0

Definition at line 652 of file BTAdapter.cpp.

◆ setPowered()

bool BTAdapter::setPowered ( const bool  power_on)
noexcept

Set the power state of the adapter.

In case current power state is already as desired, method will not change the power state.

Parameters
power_ontrue will power on this adapter if it is powered-off and vice versa.
Returns
true if successfully powered-on, -off or unchanged, false on failure
See also
isInitialized()
close()
initialize()
Examples
dbt_repeater00.cpp.

Definition at line 660 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ setPrivacy()

HCIStatusCode BTAdapter::setPrivacy ( const bool  enable)
noexcept

Toggle adapter privacy address mode, i.e.

resolvable random address including IRK.

Parameters
enabletoggle to enable or disable (default)
Returns
HCIStatusCode::SUCCESS or an error state on failure
Since
3.2.0
See also
getVisibleAddressAndType()

Definition at line 674 of file BTAdapter.cpp.

◆ getSecureConnectionsEnabled()

bool direct_bt::BTAdapter::getSecureConnectionsEnabled ( ) const
inlinenoexcept

Returns whether Secure Connections (SC) is enabled.

See also
setSecureConnections()
Since
2.4.0

Definition at line 770 of file BTAdapter.hpp.

◆ setSecureConnections()

HCIStatusCode BTAdapter::setSecureConnections ( const bool  enable)
noexcept

Enable or disable Secure Connections (SC) of the adapter.

By default, Secure Connections (SC) is enabled if supported.

Shall be called while adapter is powered off, see setPowered(). If adapter is powered, method returns HCIStatusCode::COMMAND_DISALLOWED.

Parameters
enable
Returns
HCIStatusCode::SUCCESS or an error state on failure
See also
getSecureConnectionsEnabled()
setPowered()
Since
2.5.3

Definition at line 710 of file BTAdapter.cpp.

◆ setDefaultConnParam()

HCIStatusCode BTAdapter::setDefaultConnParam ( const uint16_t  conn_interval_min = 8,
const uint16_t  conn_interval_max = 40,
const uint16_t  conn_latency = 0,
const uint16_t  supervision_timeout = getHCIConnSupervisorTimeout(0, 50) 
)
noexcept

Set default connection parameter of incoming connections for this adapter when in server mode, i.e.

BTRole::Slave.

In case the incoming connection's parameter don't lie within the given default values, a reconnect is being requested.

Shall be called while adapter is powered off, see setPowered(). If adapter is powered, method returns HCIStatusCode::COMMAND_DISALLOWED.

BlueZ/Linux LE connection defaults are

  • conn_interval_min 24 -> 30ms
  • conn_interval_max 40 -> 50ms
  • conn_latency 0
  • supervision_timeout 42 -> 420ms

Supported on GNU/Linux since kernel 5.9.

Parameters
dev_id
conn_interval_minin units of 1.25ms, default value 8 for 10ms; Value range [6 .. 3200] for [7.5ms .. 4000ms].
conn_interval_maxin units of 1.25ms, default value 40 for 50ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
conn_latencyslave latency in units of connection events, default value 0; Value range [0 .. 0x01F3].
supervision_timeoutin units of 10ms, default value 500ms >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s].
Returns
HCIStatusCode::SUCCESS or an error state on failure
See also
setPowered()
Since
2.5.3

Definition at line 727 of file BTAdapter.cpp.

◆ setServerConnSecurity()

void BTAdapter::setServerConnSecurity ( const BTSecurityLevel  sec_level,
const SMPIOCapability  io_cap 
)
noexcept

Sets the given BTSecurityLevel and SMPIOCapability for connecting device when in server (peripheral) mode, see adapter's role.

Method either changes both parameter for the upcoming connection or none at all.

Parameters
[in]sec_levelBTSecurityLevel to be applied.
[in]io_capSMPIOCapability to be applied.
See also
BTSecurityLevel
SMPIOCapability
BTDevice::setConnSecurity()
startAdvertising()
Examples
dbt_peripheral00.cpp.

Definition at line 735 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ setSMPKeyPath()

void BTAdapter::setSMPKeyPath ( const std::string  path)
noexcept

Set the adapter's persistent storage directory for SMPKeyBin files.

  • if set, all SMPKeyBin instances will be managed and persistent.
  • if not set, all SMPKeyBin instances will be transient only.

When called, all keys within the path will be loaded, i.e. issuing uploadKeys() for all keys belonging to this BTAdapter.

Persistent SMPKeyBin management is only functional when BTAdapter is in BTRole::Slave peripheral mode.

For each SMPKeyBin file one shared BTDevice in BTRole::Master will be instantiated when uploadKeys() is called.

Parameters
pathpersistent storage path to SMPKeyBin files
See also
uploadKeys()

Definition at line 739 of file BTAdapter.cpp.

◆ uploadKeys()

HCIStatusCode BTAdapter::uploadKeys ( SMPKeyBin bin,
const bool  write 
)
noexcept

Associate the given SMPKeyBin with the contained remote address, i.e.

SMPKeyBin::getRemoteAddrAndType().

Further uploads the Long Term Key (LTK) and Link Key (LK) for a potential upcoming connection, if they are contained in the given SMPKeyBin file.

This method is provided to support BTRole::Slave peripheral adapter mode, allowing user to inject all required keys after initialize()

One shared BTDevice in BTRole::Master is instantiated.

Parameters
binSMPKeyBin instance, might be persistent in filesystem
writeif true, write file to persistent storage, otherwise not
Returns
HCIStatusCode::SUCCESS or an error state on failure
See also
setSMPKeyPath()
BTDevice::uploadKeys()

Definition at line 749 of file BTAdapter.cpp.

◆ initialize()

HCIStatusCode BTAdapter::initialize ( const BTMode  btMode,
const bool  powerOn 
)
noexcept

Initialize the adapter with default values, including power-on.

Method shall be issued on the desired adapter found via ChangedAdapterSetFunc.

While initialization, the adapter is first powered-off, setup and then powered-on.

Calling the method will allow close() to power-off the adapter, if not powered on before.

Parameters
btModethe desired adapter's BTMode, default is BTMode::DUAL
powerOntrue to leave adapter powered-on (default), otherwise leave it off *
Returns
HCIStatusCode::SUCCESS or an error state on failure (e.g. power-on)
See also
isInitialized()
close()
setPowered()
Since
3.2.0

Definition at line 794 of file BTAdapter.cpp.

◆ isInitialized()

bool direct_bt::BTAdapter::isInitialized ( ) const
inlinenoexcept

Returns true, if initialize() has already been called for this adapter, otherwise false.

See also
initialize()
Since
2.4.0

Definition at line 898 of file BTAdapter.hpp.

◆ reset()

HCIStatusCode BTAdapter::reset ( )
noexcept

Reset the adapter.

The semantics are specific to the HCI host implementation, however, it shall comply at least with the HCI Reset command and bring up the device from standby into a POWERED functional state afterwards.

BT Core Spec v5.2: Vol 4, Part E HCI: 7.3.2 Reset command
Examples
dbt_scanner10.cpp.

Definition at line 943 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ setDefaultLE_PHY()

HCIStatusCode BTAdapter::setDefaultLE_PHY ( const LE_PHYs  Tx,
const LE_PHYs  Rx 
)
noexcept

Sets default preference of LE_PHYs.

BT Core Spec v5.2: Vol 4, Part E, 7.8.49 LE Set PHY command

Parameters
Txtransmitter LE_PHYs bit mask of preference if not set to LE_PHYs::NONE (ignored).
Rxreceiver LE_PHYs bit mask of preference if not set to LE_PHYs::NONE (ignored).
Returns
See also
BTDevice::getTxPhys()
BTDevice::getRxPhys()
BTDevice::getConnectedLE_PHY()
BTDevice::setConnectedLE_PHY()
Since
2.4.0
Examples
dbt_peripheral00.cpp.

Definition at line 978 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ getManager()

const BTManagerRef & direct_bt::BTAdapter::getManager ( ) const
inlinenoexcept

Returns a reference to the used singleton BTManager instance, used to create this adapter.

Definition at line 932 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ getHCI()

HCIHandler & direct_bt::BTAdapter::getHCI ( )
inlinenoexcept

Returns a reference to the aggregated HCIHandler instance.

Definition at line 937 of file BTAdapter.hpp.

◆ isDeviceWhitelisted()

bool BTAdapter::isDeviceWhitelisted ( const BDAddressAndType addressAndType)
noexcept

Returns true, if the adapter's device is already whitelisted.

Definition at line 986 of file BTAdapter.cpp.

◆ addDeviceToWhitelist()

bool BTAdapter::addDeviceToWhitelist ( const BDAddressAndType addressAndType,
const HCIWhitelistConnectType  ctype,
const uint16_t  conn_interval_min = 12,
const uint16_t  conn_interval_max = 12,
const uint16_t  conn_latency = 0,
const uint16_t  supervision_timeout = getHCIConnSupervisorTimeout(0, 15) 
)

Add the given device to the adapter's autoconnect whitelist.

The given connection parameter will be uploaded to the kernel for the given device first.

Method will reject duplicate devices, in which case it should be removed first.

Parameters
address
address_type
ctype
conn_interval_minin units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
conn_interval_maxin units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
conn_latencyslave latency in units of connection events, default value 0; Value range [0 .. 0x01F3].
supervision_timeoutin units of 10ms, default value >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s].
Returns
true if the device was already added or has been newly added to the adapter's whitelist.

Definition at line 990 of file BTAdapter.cpp.

◆ removeDeviceFromWhitelist()

bool BTAdapter::removeDeviceFromWhitelist ( const BDAddressAndType addressAndType)

Remove the given device from the adapter's autoconnect whitelist.

Definition at line 1010 of file BTAdapter.cpp.

◆ addStatusListener() [1/3]

bool BTAdapter::addStatusListener ( const AdapterStatusListenerRef l)
noexcept

Add the given listener to the list if not already present.

In case the AdapterStatusListener's lifecycle and event delivery shall be constrained to this device, please use BTDevice::addStatusListener().

Returns true if the given listener is not element of the list and has been newly added, otherwise false.

The newly added AdapterStatusListener will receive an initial AdapterStatusListener::adapterSettingsChanged(..) event, passing an empty AdapterSetting::NONE oldMask and changedMask, as well as current AdapterSetting newMask.
This allows the receiver to be aware of this adapter's current settings.

See also
BTDevice::addStatusListener()
removeStatusListener()
removeAllStatusListener()

Definition at line 1017 of file BTAdapter.cpp.

◆ addStatusListener() [2/3]

bool BTAdapter::addStatusListener ( const BTDeviceRef d,
const AdapterStatusListenerRef l 
)
noexcept

Please use BTDevice::addStatusListener() for clarity, merely existing here to allow JNI access.

Definition at line 1034 of file BTAdapter.cpp.

◆ addStatusListener() [3/3]

bool BTAdapter::addStatusListener ( const BTDevice d,
const AdapterStatusListenerRef l 
)
noexcept

Definition at line 1055 of file BTAdapter.cpp.

◆ removeStatusListener() [1/2]

bool BTAdapter::removeStatusListener ( const AdapterStatusListenerRef l)
noexcept

Remove the given listener from the list.

Returns true if the given listener is an element of the list and has been removed, otherwise false.

See also
BTDevice::removeStatusListener()
addStatusListener()

Definition at line 1059 of file BTAdapter.cpp.

◆ removeStatusListener() [2/2]

bool BTAdapter::removeStatusListener ( const AdapterStatusListener l)
noexcept

Remove the given listener from the list.

Returns true if the given listener is an element of the list and has been removed, otherwise false.

See also
BTDevice::removeStatusListener()
addStatusListener()

Definition at line 1074 of file BTAdapter.cpp.

◆ removeAllStatusListener()

BTAdapter::size_type BTAdapter::removeAllStatusListener ( )
noexcept

Remove all status listener from the list.

Returns the number of removed status listener.

Definition at line 1120 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ startDiscovery()

HCIStatusCode BTAdapter::startDiscovery ( const DBGattServerRef gattServerData_ = nullptr,
const DiscoveryPolicy  policy = DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY,
const bool  le_scan_active = true,
const uint16_t  le_scan_interval = 24,
const uint16_t  le_scan_window = 24,
const uint8_t  filter_policy = 0x00,
const bool  filter_dup = true 
)
noexcept

Starts discovery.

Returns HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state;

Depending on given DiscoveryPolicy policy, the discovery mode may be turned-off, paused until a certain readiness stage has been reached or preserved at all times. Default is DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY.

+ --+-------+--------+-----------+----------------------------------------------------+
| # | meta  | native | keepAlive | Note
+---+-------+--------+-----------+----------------------------------------------------+
| 1 | true  | true   | false     | -
| 2 | false | false  | false     | -
+---+-------+--------+-----------+----------------------------------------------------+
| 3 | true  | true   | true      | -
| 4 | true  | false  | true      | temporarily disabled -> startDiscoveryBackground()
| 5 | false | false  | true      | [4] -> [5] requires manual DISCOVERING event
+---+-------+--------+-----------+----------------------------------------------------+

Default parameter values are chosen for using public address resolution and usual discovery intervals etc.

Method will always clear previous discovered devices via removeDiscoveredDevices().

Method fails if isAdvertising().

If successful, method also changes this adapter's role to BTRole::Master.

This adapter's HCIHandler instance is used to initiate scanning, see HCIHandler::le_start_scan().

Parameters
gattServerData_optional DBGattServer data to be offered via GattHandler as GATTRole::Client, may be nullptr (default). Its handles will be setup via DBGattServer::setServicesHandles(). Reference is held until next startDiscovery.
policydefaults to DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY, see DiscoveryPolicy
le_scan_activetrue enables delivery of active scanning PDUs like EIR w/ device name (default), otherwise no scanning PDUs shall be sent.
le_scan_intervalin units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]
le_scan_windowin units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]. Shall be <= le_scan_interval
filter_policy0x00 accepts all PDUs (default), 0x01 only of whitelisted, ...
filter_duptrue to filter out duplicate AD PDUs (default), otherwise all will be reported.
Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
stopDiscovery()
isDiscovering()
isAdvertising()
DiscoveryPolicy
BTAdapterRoles
Since
3.2.0
Examples
dbt_repeater00.cpp, and dbt_scanner10.cpp.

Definition at line 1150 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ stopDiscovery()

HCIStatusCode BTAdapter::stopDiscovery ( )
noexcept

Ends discovery.

This adapter's HCIHandler instance is used to stop scanning, see HCIHandler::le_enable_scan().

Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
startDiscovery()
isDiscovering()

Definition at line 1285 of file BTAdapter.cpp.

◆ getCurrentDiscoveryPolicy()

DiscoveryPolicy direct_bt::BTAdapter::getCurrentDiscoveryPolicy ( ) const
inlinenoexcept

Return the current DiscoveryPolicy, set via startDiscovery().

Since
2.5.1

Definition at line 1110 of file BTAdapter.hpp.

◆ removeDevicePausingDiscovery()

bool BTAdapter::removeDevicePausingDiscovery ( const BTDevice device)
noexcept

Manual DiscoveryPolicy intervention point, allowing user to remove the ready device from the queue of pausing-discovery devices.

Manual intervention might be desired, if using DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_DISCONNECTED, but allowing discovery at an earlier processing step from AdapterStatusListener::deviceReady().

Re-enabling discovery is performed on the current thread.

Parameters
devicethe BTDevice to remove from the pausing-discovery queue
Returns
true if this was the last BTDevice, re-enabling discovery. Otherwise false.
Since
2.5.1

Definition at line 183 of file BTAdapter.cpp.

◆ getCurrentScanType()

ScanType direct_bt::BTAdapter::getCurrentScanType ( ) const
inlinenoexcept

Returns the current meta discovering ScanType.

It can be modified through startDiscovery(..) and stopDiscovery().

Note that if startDiscovery(..) has been issued with keepAlive==true, the meta ScanType will still keep the desired ScanType enabled even if it has been temporarily disabled.

See also
startDiscovery()
stopDiscovery()

Definition at line 1137 of file BTAdapter.hpp.

◆ getCurrentNativeScanType()

ScanType direct_bt::BTAdapter::getCurrentNativeScanType ( ) const
inlinenoexcept

Returns the adapter's current native discovering ScanType.

It can be modified through startDiscovery(..) and stopDiscovery().

See also
startDiscovery()
stopDiscovery()

Definition at line 1147 of file BTAdapter.hpp.

◆ isDiscovering()

bool direct_bt::BTAdapter::isDiscovering ( ) const
inlinenoexcept

Returns true if the meta discovering state is not ScanType::NONE.

It can be modified through startDiscovery(..) and stopDiscovery().

See also
startDiscovery()
stopDiscovery()
Since
2.4.0

Definition at line 1158 of file BTAdapter.hpp.

◆ getDiscoveredDevices()

jau::darray< BTDeviceRef > BTAdapter::getDiscoveredDevices ( ) const
noexcept

Returns discovered devices from the last discovery.

Note that this list will be cleared when a new discovery is started over via startDiscovery().

Note that devices in this list might be no more available, use 'DeviceStatusListener::deviceFound(..)' callback.

Definition at line 1440 of file BTAdapter.cpp.

◆ removeDiscoveredDevices()

BTAdapter::size_type BTAdapter::removeDiscoveredDevices ( )
noexcept

Discards all discovered devices.

Returns number of removed discovered devices.

Definition at line 1415 of file BTAdapter.cpp.

◆ removeDiscoveredDevice()

bool BTAdapter::removeDiscoveredDevice ( const BDAddressAndType addressAndType)
noexcept

Discards matching discovered devices.

Returns true if found and removed, otherwise false.

Definition at line 1400 of file BTAdapter.cpp.

◆ findDiscoveredDevice()

BTDeviceRef BTAdapter::findDiscoveredDevice ( const EUI48 address,
const BDAddressType  addressType 
)
noexcept

Returns shared BTDevice if found, otherwise nullptr.

Definition at line 1385 of file BTAdapter.cpp.

◆ findSharedDevice()

BTDeviceRef BTAdapter::findSharedDevice ( const EUI48 address,
const BDAddressType  addressType 
)
noexcept

Returns shared BTDevice if found, otherwise nullptr.

Definition at line 1475 of file BTAdapter.cpp.

◆ startAdvertising() [1/2]

HCIStatusCode BTAdapter::startAdvertising ( const DBGattServerRef gattServerData_,
EInfoReport eir,
EIRDataType  adv_mask = EIRDataType::FLAGS | EIRDataType::SERVICE_UUID,
EIRDataType  scanrsp_mask = EIRDataType::NAME | EIRDataType::CONN_IVAL,
const uint16_t  adv_interval_min = 160,
const uint16_t  adv_interval_max = 480,
const AD_PDU_Type  adv_type = AD_PDU_Type::ADV_IND,
const uint8_t  adv_chan_map = 0x07,
const uint8_t  filter_policy = 0x00 
)
noexcept

Starts advertising.

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.53 LE Set Extended Advertising Parameters command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.54 LE Set Extended Advertising Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.55 LE Set Extended Scan Response Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0)

if available, otherwise using

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.5 LE Set Advertising Parameters command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.7 LE Set Advertising Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.8 LE Set Scan Response Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command

Method fails if isDiscovering() or has any open or pending connected remote BTDevices.

If successful, method also changes this adapter's role to BTRole::Slave and treat connected BTDevice as BTRole::Master while service GATTRole::Server.

Advertising is active until either disabled via stopAdvertising() or a connection has been made, see isAdvertising().

This adapter's HCIHandler instance is used to initiate scanning, see HCIHandler::le_start_adv().

The given ADV EIR EInfoReport will be updated with getName() and at least GAPFlags::LE_Gen_Disc set.

The given adv_mask and scanrsp_mask will be updated to have at least EIRDataType::FLAGS and EIRDataType::NAME set in total.

Parameters
gattServerData_the DBGattServer data to be advertised and offered via GattHandler as GATTRole::Server. Its handles will be setup via DBGattServer::setServicesHandles(). Reference is held until next disconnect.
eirFull ADV EIR EInfoReport, will be updated with getName() and at least GAPFlags::LE_Gen_Disc set.
adv_maskEIRDataType mask for EInfoReport to select advertisement EIR PDU data, defaults to EIRDataType::FLAGS | EIRDataType::SERVICE_UUID
scanrsp_maskEIRDataType mask for EInfoReport to select scan-response (active scanning) EIR PDU data, defaults to EIRDataType::NAME | EIRDataType::CONN_IVAL
adv_interval_minin units of 0.625ms, default value 160 for 100ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_interval_maxin units of 0.625ms, default value 480 for 300ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_typesee AD_PDU_Type, default AD_PDU_Type::ADV_IND
adv_chan_mapbit 0: chan 37, bit 1: chan 38, bit 2: chan 39, default is 0x07 (all 3 channels enabled)
filter_policy0x00 accepts all PDUs (default), 0x01 only of whitelisted, ...
Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
stopAdvertising()
isAdvertising()
isDiscovering()
BTAdapterRoles
DBGattServer::setServicesHandles()
Since
2.5.3
Examples
dbt_peripheral00.cpp.

Definition at line 1557 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ startAdvertising() [2/2]

HCIStatusCode BTAdapter::startAdvertising ( const DBGattServerRef gattServerData_,
const uint16_t  adv_interval_min = 160,
const uint16_t  adv_interval_max = 480,
const AD_PDU_Type  adv_type = AD_PDU_Type::ADV_IND,
const uint8_t  adv_chan_map = 0x07,
const uint8_t  filter_policy = 0x00 
)
noexcept

Starts advertising.

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.53 LE Set Extended Advertising Parameters command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.54 LE Set Extended Advertising Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.55 LE Set Extended Scan Response Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0)

if available, otherwise using

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.5 LE Set Advertising Parameters command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.7 LE Set Advertising Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.8 LE Set Scan Response Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command

Method fails if isDiscovering() or has any open or pending connected remote BTDevices.

If successful, method also changes this adapter's role to BTRole::Slave and treat connected BTDevice as BTRole::Master while service GATTRole::Server.

Advertising is active until either disabled via stopAdvertising() or a connection has been made, see isAdvertising().

This adapter's HCIHandler instance is used to initiate scanning, see HCIHandler::le_start_adv().

The ADV EIR EInfoReport will be generated on the default EIRDataType adv_mask using EIRDataType::FLAGS | EIRDataType::SERVICE_UUID and EIRDataType scanrsp_mask using scan-response (active scanning) EIRDataType::NAME | EIRDataType::CONN_IVAL.

Parameters
gattServerData_the DBGattServer data to be advertised and offered via GattHandler as GATTRole::Server. Its handles will be setup via DBGattServer::setServicesHandles(). Reference is held until next disconnect.
adv_interval_minin units of 0.625ms, default value 160 for 100ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_interval_maxin units of 0.625ms, default value 480 for 300ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_typesee AD_PDU_Type, default AD_PDU_Type::ADV_IND
adv_chan_mapbit 0: chan 37, bit 1: chan 38, bit 2: chan 39, default is 0x07 (all 3 channels enabled)
filter_policy0x00 accepts all PDUs (default), 0x01 only of whitelisted, ...
Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
stopAdvertising()
isAdvertising()
isDiscovering()
BTAdapterRoles
DBGattServer::setServicesHandles()
Since
2.4.0

Definition at line 1637 of file BTAdapter.cpp.

◆ stopAdvertising()

HCIStatusCode BTAdapter::stopAdvertising ( )
noexcept

Ends advertising.

Closes the advertising session.

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0)

if available, otherwise using

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command

Advertising is active until either disabled via stopAdvertising() or a connection has been made, see isAdvertising().

This adapter's HCIHandler instance is used to stop scanning, see HCIHandler::le_enable_adv().

Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
startAdvertising()
isAdvertising()
Since
2.4.0

This adapter's HCIHandler instance is used to stop advertising, see HCIHandler::le_enable_adv().

Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
Examples
dbt_peripheral00.cpp.

Definition at line 1671 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ isAdvertising()

bool direct_bt::BTAdapter::isAdvertising ( ) const
inlinenoexcept

Returns the adapter's current advertising state.

It can be modified through startAdvertising(..) and stopAdvertising().

Advertising is active until either disabled via stopAdvertising() or a connection has been made.

See also
startAdvertising()
stopAdvertising()
Since
2.4.0

Definition at line 1319 of file BTAdapter.hpp.

◆ getGATTServerData()

DBGattServerRef direct_bt::BTAdapter::getGATTServerData ( )
inline

Return the user's DBGattServer shared reference if in BTRole::Slave mode as set via startAdvertising() and valid until subsequent disconnect.

Returns nullptr if in BTRole::Master mode.

Definition at line 1329 of file BTAdapter.hpp.

◆ toString() [1/2]

std::string direct_bt::BTAdapter::toString ( ) const
inlineoverridevirtualnoexcept

Reimplemented from jau::jni::JavaUplink.

Examples
dbt_peripheral00.cpp, dbt_repeater00.cpp, and dbt_scanner10.cpp.

Definition at line 1331 of file BTAdapter.hpp.

Here is the caller graph for this function:

◆ toString() [2/2]

std::string BTAdapter::toString ( bool  includeDiscoveredDevices) const
noexcept

Definition at line 1688 of file BTAdapter.cpp.

◆ printDeviceLists()

void BTAdapter::printDeviceLists ( )
noexcept

Print the internally maintained BTDevice lists to stderr:

  • sharedDevices
  • connectedDevice
  • discoveredDevices
  • StatusListener

This is intended as a debug facility.

Definition at line 618 of file BTAdapter.cpp.

Here is the caller graph for this function:

◆ printStatusListenerList()

void BTAdapter::printStatusListenerList ( )
noexcept

Definition at line 644 of file BTAdapter.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ BTDevice::getSharedInstance

◆ BTDevice::remove

void BTDevice::remove ( )
friend

◆ BTDevice::getConnectionInfo

std::shared_ptr< ConnectionInfo > BTDevice::getConnectionInfo ( )
friend

◆ BTDevice::sendMgmtEvDeviceDisconnected

void BTDevice::sendMgmtEvDeviceDisconnected ( std::unique_ptr< MgmtEvent evt)
friend

◆ BTDevice::disconnect

◆ BTDevice::connectLE

HCIStatusCode BTDevice::connectLE ( uint16_t  interval,
uint16_t  window,
uint16_t  min_interval,
uint16_t  max_interval,
uint16_t  latency,
uint16_t  supervision_timeout 
)
friend

◆ BTDevice::connectBREDR

HCIStatusCode BTDevice::connectBREDR ( const uint16_t  pkt_type,
const uint16_t  clock_offset,
const uint8_t  role_switch 
)
friend

◆ BTDevice::processL2CAPSetup

void BTDevice::processL2CAPSetup ( BTDeviceRef  sthis)
friend

◆ BTDevice::updateIdentityAddress

bool BTDevice::updateIdentityAddress ( BDAddressAndType const &  identityAddress,
bool  sendEvent 
)
friend

◆ BTDevice::updatePairingState

bool BTDevice::updatePairingState ( const BTDeviceRef sthis,
const MgmtEvent evt,
const HCIStatusCode  evtStatus,
SMPPairingState  claimed_state 
)
friend

◆ BTDevice::hciSMPMsgCallback

void BTDevice::hciSMPMsgCallback ( const BTDeviceRef sthis,
const SMPPDUMsg msg,
const HCIACLData::l2cap_frame source 
)
friend

◆ BTDevice::processDeviceReady

void BTDevice::processDeviceReady ( BTDeviceRef  sthis,
const uint64_t  timestamp 
)
friend

◆ BTDevice::connectGATT

bool BTDevice::connectGATT ( const std::shared_ptr< BTDevice > &  sthis)
friend

◆ BTDevice::getGattServices

Member Data Documentation

◆ dev_id

const uint16_t direct_bt::BTAdapter::dev_id

Adapter's internal temporary device id.

The internal device id is constant across the adapter lifecycle, but may change after its destruction.

Definition at line 363 of file BTAdapter.hpp.


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