ESPHome 2026.8.0b4
Loading...
Searching...
No Matches
esphome::bluetooth_connection Namespace Reference

Data Structures

class  BluedroidGattClient
 
class  BluetoothConnection
 
class  RP2GattClient
 
struct  RP2GattEvent
 
struct  RP2GattNotifyEvent
 
class  StubGattBackend
 

Typedefs

using conn_err_t = esp_err_t
 
using ClientState = ble_device_base::ClientState
 
using ConnectionType = ble_device_base::ConnectionType
 

Enumerations

enum class  BatchClose : uint8_t { CONTINUE , SEND }
 Result of close_service_batch: keep filling the batch or send it now. More...
 
enum class  PendingAck : uint8_t { PENDING_ACK_NONE = 0 , PENDING_ACK_WRITE , PENDING_ACK_NOTIFY , PENDING_ACK_ERROR }
 A refused GATT reply owed to the current subscriber. More...
 

Functions

BatchClose close_service_batch (api::BluetoothGATTGetServicesResponse &resp, size_t &current_size, int16_t &send_service, uint8_t connection_index, const char *address_str)
 Close out the service just packed into resp (account its actual wire size, advance the cursor) and decide whether the batch must be sent now.
 
conn_err_t unpair_device (uint64_t address)
 
conn_err_t clear_gatt_cache (uint64_t address)
 
size_t estimate_service_size (uint16_t char_count, bool use_efficient_uuids)
 Estimate the wire size of a service (service overhead + its characteristics, assuming 128-bit UUIDs and one 128-bit descriptor per characteristic to be safe) before fetching/packing the full data.
 
void fill_128bit_uuid_array (std::array< uint64_t, 2 > &out, const ble_device_base::ESPBTUUID &uuid)
 
void fill_gatt_uuid (std::array< uint64_t, 2 > &uuid_128, uint32_t &short_uuid, const ble_device_base::ESPBTUUID &uuid, bool use_efficient_uuids)
 Fill the UUID in the appropriate wire format based on client support and UUID type (128-bit array for old clients or 128-bit UUIDs, short form otherwise).
 

Typedef Documentation

◆ ClientState

◆ conn_err_t

Definition at line 40 of file bluetooth_connection.h.

◆ ConnectionType

Enumeration Type Documentation

◆ BatchClose

enum class esphome::bluetooth_connection::BatchClose : uint8_t
strong

Result of close_service_batch: keep filling the batch or send it now.

An oversized service is packed alone; a failed (backpressured) send is retried from the batch start, so no service is silently skipped.

Enumerator
CONTINUE 
SEND 

Definition at line 159 of file bluetooth_connection.h.

◆ PendingAck

enum class esphome::bluetooth_connection::PendingAck : uint8_t
strong

A refused GATT reply owed to the current subscriber.

Payload-free only: these rebuild from address + handle + error, so a retry costs no buffered data. Read and notify-data carry payloads and are deliberately absent.

Enumerator
PENDING_ACK_NONE 
PENDING_ACK_WRITE 
PENDING_ACK_NOTIFY 
PENDING_ACK_ERROR 

Definition at line 31 of file bluetooth_connection_hub.h.

Function Documentation

◆ clear_gatt_cache()

conn_err_t esphome::bluetooth_connection::clear_gatt_cache ( uint64_t address)
inline

Definition at line 61 of file bluetooth_connection.cpp.

◆ close_service_batch()

BatchClose esphome::bluetooth_connection::close_service_batch ( api::BluetoothGATTGetServicesResponse & resp,
size_t & current_size,
int16_t & send_service,
uint8_t connection_index,
const char * address_str )

Close out the service just packed into resp (account its actual wire size, advance the cursor) and decide whether the batch must be sent now.

Shared tail of both platform streamers so the budget logic and its log lines cannot drift.

Definition at line 17 of file bluetooth_connection.cpp.

◆ estimate_service_size()

size_t esphome::bluetooth_connection::estimate_service_size ( uint16_t char_count,
bool use_efficient_uuids )
inline

Estimate the wire size of a service (service overhead + its characteristics, assuming 128-bit UUIDs and one 128-bit descriptor per characteristic to be safe) before fetching/packing the full data.

Definition at line 112 of file bluetooth_connection.h.

◆ fill_128bit_uuid_array()

void esphome::bluetooth_connection::fill_128bit_uuid_array ( std::array< uint64_t, 2 > & out,
const ble_device_base::ESPBTUUID & uuid )
inline

Definition at line 122 of file bluetooth_connection.h.

◆ fill_gatt_uuid()

void esphome::bluetooth_connection::fill_gatt_uuid ( std::array< uint64_t, 2 > & uuid_128,
uint32_t & short_uuid,
const ble_device_base::ESPBTUUID & uuid,
bool use_efficient_uuids )
inline

Fill the UUID in the appropriate wire format based on client support and UUID type (128-bit array for old clients or 128-bit UUIDs, short form otherwise).

Definition at line 143 of file bluetooth_connection.h.

◆ unpair_device()

conn_err_t esphome::bluetooth_connection::unpair_device ( uint64_t address)
inline

Definition at line 55 of file bluetooth_connection.cpp.