HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
EspBluetooth Class Reference

ESP32 Bluetooth implementation class. More...

#include <EspBluetooth.h>

Inheritance diagram for EspBluetooth:
[legend]
Collaboration diagram for EspBluetooth:
[legend]

Public Member Functions

 EspBluetooth ()
 Constructor.
 
virtual ~EspBluetooth ()
 Destructor.
 
hf_bluetooth_err_t Initialize (hf_bluetooth_mode_t mode) noexcept override
 Initialize the Bluetooth subsystem.
 
hf_bluetooth_err_t Deinitialize () noexcept override
 Deinitialize the Bluetooth subsystem.
 
bool IsInitialized () const noexcept override
 Check if Bluetooth is initialized.
 
hf_bluetooth_err_t Enable () noexcept override
 Enable Bluetooth.
 
hf_bluetooth_err_t Disable () noexcept override
 Disable Bluetooth.
 
bool IsEnabled () const noexcept override
 Check if Bluetooth is enabled.
 
hf_bluetooth_err_t SetMode (hf_bluetooth_mode_t mode) noexcept override
 Set Bluetooth operating mode.
 
hf_bluetooth_mode_t GetMode () const noexcept override
 Get current Bluetooth operating mode.
 
hf_bluetooth_err_t GetLocalAddress (hf_bluetooth_address_t &address) const noexcept override
 Get local Bluetooth address.
 
hf_bluetooth_err_t SetDeviceName (const std::string &name) noexcept override
 Set local device name.
 
std::string GetDeviceName () const noexcept override
 Get local device name.
 
hf_bluetooth_err_t StartScan (uint32_t duration_ms=0, hf_bluetooth_scan_type_t type=hf_bluetooth_scan_type_t::HF_BLUETOOTH_SCAN_TYPE_ACTIVE) noexcept override
 Start device discovery/scanning.
 
hf_bluetooth_err_t StopScan () noexcept override
 Stop device discovery/scanning.
 
bool IsScanning () const noexcept override
 Check if currently scanning.
 
hf_bluetooth_err_t GetDiscoveredDevices (std::vector< hf_bluetooth_device_info_t > &devices) noexcept override
 Get list of discovered devices.
 
hf_bluetooth_err_t ClearDiscoveredDevices () noexcept override
 Clear discovered devices list.
 
hf_bluetooth_err_t StartAdvertising () noexcept override
 Start BLE advertising.
 
hf_bluetooth_err_t StopAdvertising () noexcept override
 Stop BLE advertising.
 
bool IsAdvertising () const noexcept override
 Check if currently advertising.
 
hf_bluetooth_err_t Connect (const hf_bluetooth_address_t &address, uint32_t timeout_ms=0) noexcept override
 Connect to a remote device.
 
hf_bluetooth_err_t Disconnect (const hf_bluetooth_address_t &address) noexcept override
 Disconnect from a remote device.
 
bool IsConnected (const hf_bluetooth_address_t &address) const noexcept override
 Check if connected to a device.
 
hf_bluetooth_err_t GetConnectedDevices (std::vector< hf_bluetooth_device_info_t > &devices) noexcept override
 Get list of connected devices.
 
hf_bluetooth_err_t Pair (const hf_bluetooth_address_t &address, const std::string &pin="") noexcept override
 Pair with a remote device.
 
hf_bluetooth_err_t Unpair (const hf_bluetooth_address_t &address) noexcept override
 Unpair from a remote device.
 
bool IsPaired (const hf_bluetooth_address_t &address) const noexcept override
 Check if paired with a device.
 
hf_bluetooth_err_t SendData (const hf_bluetooth_address_t &address, const std::vector< uint8_t > &data) noexcept override
 Send data to a connected device.
 
int GetAvailableData (const hf_bluetooth_address_t &address) const noexcept override
 Check if data is available to read.
 
hf_bluetooth_err_t ReadData (const hf_bluetooth_address_t &address, std::vector< uint8_t > &data, size_t max_bytes=0) noexcept override
 Read available data from a connected device.
 
hf_bluetooth_err_t DiscoverServices (const hf_bluetooth_address_t &address, std::vector< hf_bluetooth_gatt_service_t > &services) noexcept override
 Discover GATT services on a connected device.
 
hf_bluetooth_err_t DiscoverCharacteristics (const hf_bluetooth_address_t &address, const std::string &service_uuid, std::vector< hf_bluetooth_gatt_characteristic_t > &characteristics) noexcept override
 Discover GATT characteristics for a service.
 
hf_bluetooth_err_t ReadCharacteristic (const hf_bluetooth_address_t &address, const std::string &service_uuid, const std::string &characteristic_uuid, std::vector< uint8_t > &value) noexcept override
 Read GATT characteristic value.
 
hf_bluetooth_err_t WriteCharacteristic (const hf_bluetooth_address_t &address, const std::string &service_uuid, const std::string &characteristic_uuid, const std::vector< uint8_t > &value, bool with_response=true) noexcept override
 Write GATT characteristic value.
 
hf_bluetooth_err_t SubscribeCharacteristic (const hf_bluetooth_address_t &address, const std::string &service_uuid, const std::string &characteristic_uuid, bool enable) noexcept override
 Subscribe to GATT characteristic notifications.
 
hf_bluetooth_state_t GetState () const noexcept override
 Get current Bluetooth state.
 
int8_t GetRssi (const hf_bluetooth_address_t &address) const noexcept override
 Get signal strength for a connected device.
 
hf_bluetooth_err_t RegisterEventCallback (hf_bluetooth_event_callback_t callback) noexcept override
 Register event callback function.
 
hf_bluetooth_err_t RegisterDataCallback (hf_bluetooth_data_callback_t callback) noexcept override
 Register data callback function.
 
hf_bluetooth_err_t UnregisterEventCallback () noexcept override
 Unregister event callback function.
 
hf_bluetooth_err_t UnregisterDataCallback () noexcept override
 Unregister data callback function.
 
hf_bluetooth_err_t ConfigureClassic (const hf_bluetooth_classic_config_t &config) noexcept override
 Configure Bluetooth Classic parameters.
 
hf_bluetooth_err_t SetDiscoverable (bool discoverable, uint32_t timeout_ms=0) noexcept override
 Make device discoverable.
 
bool IsDiscoverable () const noexcept override
 Check if device is discoverable.
 
hf_bluetooth_err_t ConfigureBle (const hf_bluetooth_ble_config_t &config) noexcept override
 Configure Bluetooth Low Energy parameters.
 
hf_bluetooth_err_t GetPairedDevices (std::vector< hf_bluetooth_device_info_t > &devices) noexcept override
 Get list of paired devices.
 
std::string GetImplementationInfo () const
 Get implementation-specific information.
 
uint32_t GetSupportedFeatures () const
 Get supported features for current target.
 
- Public Member Functions inherited from BaseBluetooth
virtual ~BaseBluetooth () noexcept=default
 Virtual destructor for proper cleanup of derived classes.
 

Private Member Functions

void TriggerEvent (hf_bluetooth_event_t event, const void *data=nullptr)
 
hf_bluetooth_err_t ValidateAddress (const hf_bluetooth_address_t &address) const
 
std::string AddressToString (const hf_bluetooth_address_t &address) const
 
hf_bluetooth_address_t StringToAddress (const std::string &address_str) const
 

Private Attributes

bool m_initialized
 
bool m_enabled
 
hf_bluetooth_mode_t m_mode
 
hf_bluetooth_state_t m_state
 
std::vector< hf_bluetooth_device_info_tm_discovered_devices
 
std::map< std::string, hf_bluetooth_device_info_tm_connected_devices
 
hf_bluetooth_ble_config_t m_ble_config
 
PlatformMutex m_device_mutex
 
PlatformMutex m_state_mutex
 
hf_bluetooth_event_callback_t m_event_callback
 
hf_bluetooth_data_callback_t m_data_callback
 
void * m_callback_context
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseBluetooth
static std::string_view GetErrorString (hf_bluetooth_err_t error)
 Get error description string.
 
- Protected Member Functions inherited from BaseBluetooth
 BaseBluetooth ()=default
 Protected constructor - only derived classes can instantiate.
 
 BaseBluetooth (const BaseBluetooth &)=delete
 Copy constructor - deleted to prevent copying.
 
BaseBluetoothoperator= (const BaseBluetooth &)=delete
 Assignment operator - deleted to prevent copying.
 

Detailed Description

ESP32 Bluetooth implementation class.

This class provides ESP32-specific Bluetooth functionality with conditional compilation for different ESP32 variants:

  • ESP32C6: BLE-only using NimBLE (optimized)
  • ESP32/ESP32S3: Full Bluetooth with Classic + BLE
  • ESP32C3/H2: BLE-only using Bluedroid
  • ESP32S2: No Bluetooth support

Constructor & Destructor Documentation

◆ EspBluetooth()

EspBluetooth::EspBluetooth ( )

Constructor.

◆ ~EspBluetooth()

EspBluetooth::~EspBluetooth ( )
virtual

Destructor.

Member Function Documentation

◆ AddressToString()

std::string EspBluetooth::AddressToString ( const hf_bluetooth_address_t & address) const
private

◆ ClearDiscoveredDevices()

hf_bluetooth_err_t EspBluetooth::ClearDiscoveredDevices ( )
overridevirtualnoexcept

Clear discovered devices list.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ ConfigureBle()

hf_bluetooth_err_t EspBluetooth::ConfigureBle ( const hf_bluetooth_ble_config_t & config)
overridevirtualnoexcept

Configure Bluetooth Low Energy parameters.

Parameters
configBLE configuration
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ ConfigureClassic()

hf_bluetooth_err_t EspBluetooth::ConfigureClassic ( const hf_bluetooth_classic_config_t & config)
overridevirtualnoexcept

Configure Bluetooth Classic parameters.

Parameters
configClassic configuration
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ Connect()

hf_bluetooth_err_t EspBluetooth::Connect ( const hf_bluetooth_address_t & address,
uint32_t timeout_ms = 0 )
overridevirtualnoexcept

Connect to a remote device.

Parameters
addressRemote device address
timeout_msConnection timeout in milliseconds (0 for default)
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ Deinitialize()

hf_bluetooth_err_t EspBluetooth::Deinitialize ( )
overridevirtualnoexcept

Deinitialize the Bluetooth subsystem.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ Disable()

hf_bluetooth_err_t EspBluetooth::Disable ( )
overridevirtualnoexcept

Disable Bluetooth.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ Disconnect()

hf_bluetooth_err_t EspBluetooth::Disconnect ( const hf_bluetooth_address_t & address)
overridevirtualnoexcept

Disconnect from a remote device.

Parameters
addressRemote device address
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ DiscoverCharacteristics()

hf_bluetooth_err_t EspBluetooth::DiscoverCharacteristics ( const hf_bluetooth_address_t & address,
const std::string & service_uuid,
std::vector< hf_bluetooth_gatt_characteristic_t > & characteristics )
overridevirtualnoexcept

Discover GATT characteristics for a service.

Parameters
addressRemote device address
service_uuidService UUID
characteristicsVector to store discovered characteristics
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ DiscoverServices()

hf_bluetooth_err_t EspBluetooth::DiscoverServices ( const hf_bluetooth_address_t & address,
std::vector< hf_bluetooth_gatt_service_t > & services )
overridevirtualnoexcept

Discover GATT services on a connected device.

Parameters
addressRemote device address
servicesVector to store discovered services
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ Enable()

hf_bluetooth_err_t EspBluetooth::Enable ( )
overridevirtualnoexcept

Enable Bluetooth.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ GetAvailableData()

int EspBluetooth::GetAvailableData ( const hf_bluetooth_address_t & address) const
overridevirtualnoexcept

Check if data is available to read.

Parameters
addressRemote device address
Returns
Number of bytes available, or -1 on error

Implements BaseBluetooth.

◆ GetConnectedDevices()

hf_bluetooth_err_t EspBluetooth::GetConnectedDevices ( std::vector< hf_bluetooth_device_info_t > & devices)
overridevirtualnoexcept

Get list of connected devices.

Parameters
devicesVector to store connected devices
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ GetDeviceName()

std::string EspBluetooth::GetDeviceName ( ) const
overridevirtualnoexcept

Get local device name.

Returns
Device name string

Implements BaseBluetooth.

◆ GetDiscoveredDevices()

hf_bluetooth_err_t EspBluetooth::GetDiscoveredDevices ( std::vector< hf_bluetooth_device_info_t > & devices)
overridevirtualnoexcept

Get list of discovered devices.

Parameters
devicesVector to store discovered devices
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ GetImplementationInfo()

std::string EspBluetooth::GetImplementationInfo ( ) const

Get implementation-specific information.

Returns
String containing implementation details

◆ GetLocalAddress()

hf_bluetooth_err_t EspBluetooth::GetLocalAddress ( hf_bluetooth_address_t & address) const
overridevirtualnoexcept

Get local Bluetooth address.

Parameters
addressReference to store the local address
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ GetMode()

hf_bluetooth_mode_t EspBluetooth::GetMode ( ) const
overridevirtualnoexcept

Get current Bluetooth operating mode.

Returns
Current Bluetooth mode

Implements BaseBluetooth.

◆ GetPairedDevices()

hf_bluetooth_err_t EspBluetooth::GetPairedDevices ( std::vector< hf_bluetooth_device_info_t > & devices)
overridevirtualnoexcept

Get list of paired devices.

Parameters
devicesVector to store paired devices
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ GetRssi()

int8_t EspBluetooth::GetRssi ( const hf_bluetooth_address_t & address) const
overridevirtualnoexcept

Get signal strength for a connected device.

Parameters
addressRemote device address
Returns
Signal strength in dBm, or INT8_MIN on error

Implements BaseBluetooth.

◆ GetState()

hf_bluetooth_state_t EspBluetooth::GetState ( ) const
overridevirtualnoexcept

Get current Bluetooth state.

Returns
Current Bluetooth state

Implements BaseBluetooth.

◆ GetSupportedFeatures()

uint32_t EspBluetooth::GetSupportedFeatures ( ) const

Get supported features for current target.

Returns
Bitmask of supported features

◆ Initialize()

hf_bluetooth_err_t EspBluetooth::Initialize ( hf_bluetooth_mode_t mode)
overridevirtualnoexcept

Initialize the Bluetooth subsystem.

Parameters
modeBluetooth operating mode
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise
Note
For ESP32C6, only BLE mode is supported

Implements BaseBluetooth.

◆ IsAdvertising()

bool EspBluetooth::IsAdvertising ( ) const
overridevirtualnoexcept

Check if currently advertising.

Returns
true if advertising, false otherwise

Implements BaseBluetooth.

◆ IsConnected()

bool EspBluetooth::IsConnected ( const hf_bluetooth_address_t & address) const
overridevirtualnoexcept

Check if connected to a device.

Parameters
addressRemote device address
Returns
true if connected, false otherwise

Implements BaseBluetooth.

◆ IsDiscoverable()

bool EspBluetooth::IsDiscoverable ( ) const
overridevirtualnoexcept

Check if device is discoverable.

Returns
true if discoverable, false otherwise

Implements BaseBluetooth.

◆ IsEnabled()

bool EspBluetooth::IsEnabled ( ) const
overridevirtualnoexcept

Check if Bluetooth is enabled.

Returns
true if enabled, false otherwise

Implements BaseBluetooth.

◆ IsInitialized()

bool EspBluetooth::IsInitialized ( ) const
overridevirtualnoexcept

Check if Bluetooth is initialized.

Returns
true if initialized, false otherwise

Implements BaseBluetooth.

◆ IsPaired()

bool EspBluetooth::IsPaired ( const hf_bluetooth_address_t & address) const
overridevirtualnoexcept

Check if paired with a device.

Parameters
addressRemote device address
Returns
true if paired, false otherwise

Implements BaseBluetooth.

◆ IsScanning()

bool EspBluetooth::IsScanning ( ) const
overridevirtualnoexcept

Check if currently scanning.

Returns
true if scanning, false otherwise

Implements BaseBluetooth.

◆ Pair()

hf_bluetooth_err_t EspBluetooth::Pair ( const hf_bluetooth_address_t & address,
const std::string & pin = "" )
overridevirtualnoexcept

Pair with a remote device.

Parameters
addressRemote device address
pinPIN code (for Classic, empty for BLE)
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ ReadCharacteristic()

hf_bluetooth_err_t EspBluetooth::ReadCharacteristic ( const hf_bluetooth_address_t & address,
const std::string & service_uuid,
const std::string & characteristic_uuid,
std::vector< uint8_t > & value )
overridevirtualnoexcept

Read GATT characteristic value.

Parameters
addressRemote device address
service_uuidService UUID
characteristic_uuidCharacteristic UUID
valueVector to store characteristic value
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ ReadData()

hf_bluetooth_err_t EspBluetooth::ReadData ( const hf_bluetooth_address_t & address,
std::vector< uint8_t > & data,
size_t max_bytes = 0 )
overridevirtualnoexcept

Read available data from a connected device.

Parameters
addressRemote device address
dataVector to store received data
max_bytesMaximum bytes to read (0 for all available)
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ RegisterDataCallback()

hf_bluetooth_err_t EspBluetooth::RegisterDataCallback ( hf_bluetooth_data_callback_t callback)
overridevirtualnoexcept

Register data callback function.

Parameters
callbackCallback function
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ RegisterEventCallback()

hf_bluetooth_err_t EspBluetooth::RegisterEventCallback ( hf_bluetooth_event_callback_t callback)
overridevirtualnoexcept

Register event callback function.

Parameters
callbackCallback function
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ SendData()

hf_bluetooth_err_t EspBluetooth::SendData ( const hf_bluetooth_address_t & address,
const std::vector< uint8_t > & data )
overridevirtualnoexcept

Send data to a connected device.

Parameters
addressRemote device address
dataData to send
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ SetDeviceName()

hf_bluetooth_err_t EspBluetooth::SetDeviceName ( const std::string & name)
overridevirtualnoexcept

Set local device name.

Parameters
nameDevice name string
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ SetDiscoverable()

hf_bluetooth_err_t EspBluetooth::SetDiscoverable ( bool discoverable,
uint32_t timeout_ms = 0 )
overridevirtualnoexcept

Make device discoverable.

Parameters
discoverableTrue to make discoverable, false otherwise
timeout_msDiscoverable timeout in milliseconds (0 for indefinite)
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ SetMode()

hf_bluetooth_err_t EspBluetooth::SetMode ( hf_bluetooth_mode_t mode)
overridevirtualnoexcept

Set Bluetooth operating mode.

Parameters
modeBluetooth operating mode
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ StartAdvertising()

hf_bluetooth_err_t EspBluetooth::StartAdvertising ( )
overridevirtualnoexcept

Start BLE advertising.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ StartScan()

hf_bluetooth_err_t EspBluetooth::StartScan ( uint32_t duration_ms = 0,
hf_bluetooth_scan_type_t type = hf_bluetooth_scan_type_t::HF_BLUETOOTH_SCAN_TYPE_ACTIVE )
overridevirtualnoexcept

Start device discovery/scanning.

Parameters
duration_msScan duration in milliseconds (0 for indefinite)
typeScan type (BLE only)
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ StopAdvertising()

hf_bluetooth_err_t EspBluetooth::StopAdvertising ( )
overridevirtualnoexcept

Stop BLE advertising.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ StopScan()

hf_bluetooth_err_t EspBluetooth::StopScan ( )
overridevirtualnoexcept

Stop device discovery/scanning.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ StringToAddress()

hf_bluetooth_address_t EspBluetooth::StringToAddress ( const std::string & address_str) const
private

◆ SubscribeCharacteristic()

hf_bluetooth_err_t EspBluetooth::SubscribeCharacteristic ( const hf_bluetooth_address_t & address,
const std::string & service_uuid,
const std::string & characteristic_uuid,
bool enable )
overridevirtualnoexcept

Subscribe to GATT characteristic notifications.

Parameters
addressRemote device address
service_uuidService UUID
characteristic_uuidCharacteristic UUID
enableTrue to enable notifications, false to disable
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ TriggerEvent()

void EspBluetooth::TriggerEvent ( hf_bluetooth_event_t event,
const void * data = nullptr )
private

◆ Unpair()

hf_bluetooth_err_t EspBluetooth::Unpair ( const hf_bluetooth_address_t & address)
overridevirtualnoexcept

Unpair from a remote device.

Parameters
addressRemote device address
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ UnregisterDataCallback()

hf_bluetooth_err_t EspBluetooth::UnregisterDataCallback ( )
overridevirtualnoexcept

Unregister data callback function.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ UnregisterEventCallback()

hf_bluetooth_err_t EspBluetooth::UnregisterEventCallback ( )
overridevirtualnoexcept

Unregister event callback function.

Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

◆ ValidateAddress()

hf_bluetooth_err_t EspBluetooth::ValidateAddress ( const hf_bluetooth_address_t & address) const
private

◆ WriteCharacteristic()

hf_bluetooth_err_t EspBluetooth::WriteCharacteristic ( const hf_bluetooth_address_t & address,
const std::string & service_uuid,
const std::string & characteristic_uuid,
const std::vector< uint8_t > & value,
bool with_response = true )
overridevirtualnoexcept

Write GATT characteristic value.

Parameters
addressRemote device address
service_uuidService UUID
characteristic_uuidCharacteristic UUID
valueValue to write
with_responseTrue to wait for write response
Returns
hf_bluetooth_err_t::BLUETOOTH_SUCCESS on success, error code otherwise

Implements BaseBluetooth.

Member Data Documentation

◆ m_ble_config

hf_bluetooth_ble_config_t EspBluetooth::m_ble_config
private

◆ m_callback_context

void* EspBluetooth::m_callback_context
private

◆ m_connected_devices

std::map<std::string, hf_bluetooth_device_info_t> EspBluetooth::m_connected_devices
private

◆ m_data_callback

hf_bluetooth_data_callback_t EspBluetooth::m_data_callback
private

◆ m_device_mutex

PlatformMutex EspBluetooth::m_device_mutex
mutableprivate

◆ m_discovered_devices

std::vector<hf_bluetooth_device_info_t> EspBluetooth::m_discovered_devices
private

◆ m_enabled

bool EspBluetooth::m_enabled
private

◆ m_event_callback

hf_bluetooth_event_callback_t EspBluetooth::m_event_callback
private

◆ m_initialized

bool EspBluetooth::m_initialized
private

◆ m_mode

hf_bluetooth_mode_t EspBluetooth::m_mode
private

◆ m_state

hf_bluetooth_state_t EspBluetooth::m_state
private

◆ m_state_mutex

PlatformMutex EspBluetooth::m_state_mutex
mutableprivate

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