|
HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
|
Abstract base class for Bluetooth functionality. More...
#include <BaseBluetooth.h>
Public Member Functions | |
| virtual | ~BaseBluetooth () noexcept=default |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual hf_bluetooth_err_t | Initialize (hf_bluetooth_mode_t mode) noexcept=0 |
| Initialize the Bluetooth subsystem. | |
| virtual hf_bluetooth_err_t | Deinitialize () noexcept=0 |
| Deinitialize the Bluetooth subsystem. | |
| virtual bool | IsInitialized () const noexcept=0 |
| Check if Bluetooth is initialized. | |
| virtual hf_bluetooth_err_t | Enable () noexcept=0 |
| Enable Bluetooth. | |
| virtual hf_bluetooth_err_t | Disable () noexcept=0 |
| Disable Bluetooth. | |
| virtual bool | IsEnabled () const noexcept=0 |
| Check if Bluetooth is enabled. | |
| virtual hf_bluetooth_err_t | SetMode (hf_bluetooth_mode_t mode) noexcept=0 |
| Set Bluetooth operating mode. | |
| virtual hf_bluetooth_mode_t | GetMode () const noexcept=0 |
| Get current Bluetooth operating mode. | |
| virtual hf_bluetooth_err_t | GetLocalAddress (hf_bluetooth_address_t &address) const noexcept=0 |
| Get local Bluetooth address. | |
| virtual hf_bluetooth_err_t | SetDeviceName (const std::string &name) noexcept=0 |
| Set local device name. | |
| virtual std::string | GetDeviceName () const noexcept=0 |
| Get local device name. | |
| virtual hf_bluetooth_err_t | ConfigureClassic (const hf_bluetooth_classic_config_t &config) noexcept=0 |
| Configure Bluetooth Classic parameters. | |
| virtual hf_bluetooth_err_t | SetDiscoverable (bool discoverable, uint32_t timeout_ms=0) noexcept=0 |
| Make device discoverable. | |
| virtual bool | IsDiscoverable () const noexcept=0 |
| Check if device is discoverable. | |
| virtual hf_bluetooth_err_t | ConfigureBle (const hf_bluetooth_ble_config_t &config) noexcept=0 |
| Configure Bluetooth Low Energy parameters. | |
| virtual hf_bluetooth_err_t | StartAdvertising () noexcept=0 |
| Start BLE advertising. | |
| virtual hf_bluetooth_err_t | StopAdvertising () noexcept=0 |
| Stop BLE advertising. | |
| virtual bool | IsAdvertising () const noexcept=0 |
| Check if BLE advertising is active. | |
| virtual 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=0 |
| Start device discovery/scanning. | |
| virtual hf_bluetooth_err_t | StopScan () noexcept=0 |
| Stop device discovery/scanning. | |
| virtual bool | IsScanning () const noexcept=0 |
| Check if scanning is in progress. | |
| virtual hf_bluetooth_err_t | GetDiscoveredDevices (std::vector< hf_bluetooth_device_info_t > &devices) noexcept=0 |
| Get discovered devices. | |
| virtual hf_bluetooth_err_t | ClearDiscoveredDevices () noexcept=0 |
| Clear discovered devices list. | |
| virtual hf_bluetooth_err_t | Connect (const hf_bluetooth_address_t &address, uint32_t timeout_ms=0) noexcept=0 |
| Connect to a remote device. | |
| virtual hf_bluetooth_err_t | Disconnect (const hf_bluetooth_address_t &address) noexcept=0 |
| Disconnect from a remote device. | |
| virtual bool | IsConnected (const hf_bluetooth_address_t &address) const noexcept=0 |
| Check if connected to a device. | |
| virtual hf_bluetooth_err_t | GetConnectedDevices (std::vector< hf_bluetooth_device_info_t > &devices) noexcept=0 |
| Get list of connected devices. | |
| virtual hf_bluetooth_err_t | Pair (const hf_bluetooth_address_t &address, const std::string &pin="") noexcept=0 |
| Pair with a remote device. | |
| virtual hf_bluetooth_err_t | Unpair (const hf_bluetooth_address_t &address) noexcept=0 |
| Unpair from a remote device. | |
| virtual bool | IsPaired (const hf_bluetooth_address_t &address) const noexcept=0 |
| Check if paired with a device. | |
| virtual hf_bluetooth_err_t | GetPairedDevices (std::vector< hf_bluetooth_device_info_t > &devices) noexcept=0 |
| Get list of paired devices. | |
| virtual hf_bluetooth_err_t | SendData (const hf_bluetooth_address_t &address, const std::vector< uint8_t > &data) noexcept=0 |
| Send data to a connected device. | |
| virtual int | GetAvailableData (const hf_bluetooth_address_t &address) const noexcept=0 |
| Check if data is available to read. | |
| virtual hf_bluetooth_err_t | ReadData (const hf_bluetooth_address_t &address, std::vector< uint8_t > &data, size_t max_bytes=0) noexcept=0 |
| Read available data from a connected device. | |
| virtual hf_bluetooth_err_t | DiscoverServices (const hf_bluetooth_address_t &address, std::vector< hf_bluetooth_gatt_service_t > &services) noexcept=0 |
| Discover GATT services on a connected device. | |
| virtual 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=0 |
| Discover GATT characteristics for a service. | |
| virtual 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=0 |
| Read GATT characteristic value. | |
| virtual 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=0 |
| Write GATT characteristic value. | |
| virtual hf_bluetooth_err_t | SubscribeCharacteristic (const hf_bluetooth_address_t &address, const std::string &service_uuid, const std::string &characteristic_uuid, bool enable) noexcept=0 |
| Subscribe to GATT characteristic notifications. | |
| virtual hf_bluetooth_state_t | GetState () const noexcept=0 |
| Get current Bluetooth state. | |
| virtual int8_t | GetRssi (const hf_bluetooth_address_t &address) const noexcept=0 |
| Get signal strength for a connected device. | |
| virtual hf_bluetooth_err_t | RegisterEventCallback (hf_bluetooth_event_callback_t callback) noexcept=0 |
| Register event callback. | |
| virtual hf_bluetooth_err_t | UnregisterEventCallback () noexcept=0 |
| Unregister event callback. | |
| virtual hf_bluetooth_err_t | RegisterDataCallback (hf_bluetooth_data_callback_t callback) noexcept=0 |
| Register data received callback. | |
| virtual hf_bluetooth_err_t | UnregisterDataCallback () noexcept=0 |
| Unregister data received callback. | |
Static Public Member Functions | |
| static std::string_view | GetErrorString (hf_bluetooth_err_t error) |
| Get error description string. | |
Protected Member Functions | |
| BaseBluetooth ()=default | |
| Protected constructor - only derived classes can instantiate. | |
| BaseBluetooth (const BaseBluetooth &)=delete | |
| Copy constructor - deleted to prevent copying. | |
| BaseBluetooth & | operator= (const BaseBluetooth &)=delete |
| Assignment operator - deleted to prevent copying. | |
Abstract base class for Bluetooth functionality.
This class provides the interface for Bluetooth operations including:
|
virtualdefaultnoexcept |
Virtual destructor for proper cleanup of derived classes.
|
protecteddefault |
Protected constructor - only derived classes can instantiate.
|
protecteddelete |
Copy constructor - deleted to prevent copying.
|
pure virtualnoexcept |
Clear discovered devices list.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Configure Bluetooth Low Energy parameters.
| config | BLE configuration |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Configure Bluetooth Classic parameters.
| config | Classic configuration |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Connect to a remote device.
| address | Remote device address |
| timeout_ms | Connection timeout in milliseconds (0 for default) |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Deinitialize the Bluetooth subsystem.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Disable Bluetooth.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Disconnect from a remote device.
| address | Remote device address |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Discover GATT characteristics for a service.
| address | Remote device address |
| service_uuid | Service UUID |
| characteristics | Vector to store discovered characteristics |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Discover GATT services on a connected device.
| address | Remote device address |
| services | Vector to store discovered services |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Enable Bluetooth.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Check if data is available to read.
| address | Remote device address |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Get list of connected devices.
| devices | Vector to store connected devices |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Get discovered devices.
| devices | Vector to store discovered devices |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Get local Bluetooth address.
| address | Reference to store local address |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Get list of paired devices.
| devices | Vector to store paired devices |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Get signal strength for a connected device.
| address | Remote device address |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Initialize the Bluetooth subsystem.
| mode | Bluetooth operating mode |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Check if BLE advertising is active.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Check if connected to a device.
| address | Remote device address |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Check if device is discoverable.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Check if Bluetooth is initialized.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Check if paired with a device.
| address | Remote device address |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Check if scanning is in progress.
Implemented in EspBluetooth.
|
protecteddelete |
Assignment operator - deleted to prevent copying.
|
pure virtualnoexcept |
Pair with a remote device.
| address | Remote device address |
| pin | PIN code (for Classic, empty for BLE) |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Read GATT characteristic value.
| address | Remote device address |
| service_uuid | Service UUID |
| characteristic_uuid | Characteristic UUID |
| value | Vector to store characteristic value |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Read available data from a connected device.
| address | Remote device address |
| data | Vector to store received data |
| max_bytes | Maximum bytes to read (0 for all available) |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Register data received callback.
| callback | Data callback function |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Register event callback.
| callback | Event callback function |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Send data to a connected device.
| address | Remote device address |
| data | Data to send |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Set local device name.
| name | Device name |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Make device discoverable.
| discoverable | True to make discoverable, false otherwise |
| timeout_ms | Discoverable timeout in milliseconds (0 for indefinite) |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Set Bluetooth operating mode.
| mode | Bluetooth operating mode |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Start BLE advertising.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Start device discovery/scanning.
| duration_ms | Scan duration in milliseconds (0 for indefinite) |
| type | Scan type (BLE only) |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Stop BLE advertising.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Stop device discovery/scanning.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Subscribe to GATT characteristic notifications.
| address | Remote device address |
| service_uuid | Service UUID |
| characteristic_uuid | Characteristic UUID |
| enable | True to enable notifications, false to disable |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Unpair from a remote device.
| address | Remote device address |
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Unregister data received callback.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Unregister event callback.
Implemented in EspBluetooth.
|
pure virtualnoexcept |
Write GATT characteristic value.
| address | Remote device address |
| service_uuid | Service UUID |
| characteristic_uuid | Characteristic UUID |
| value | Value to write |
| with_response | True to wait for write response |
Implemented in EspBluetooth.