ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::esp32_ble Namespace Reference

Data Structures

class  BLEAdvertising
 
class  BLEEvent
 
struct  conn_status_t
 
class  ESP32BLE
 

Enumerations

enum  IoCapability {
  IO_CAP_OUT = ESP_IO_CAP_OUT , IO_CAP_IO = ESP_IO_CAP_IO , IO_CAP_IN = ESP_IO_CAP_IN , IO_CAP_NONE = ESP_IO_CAP_NONE ,
  IO_CAP_KBDISP = ESP_IO_CAP_KBDISP
}
 
enum  AuthReqMode {
  AUTH_REQ_NO_BOND = ESP_LE_AUTH_NO_BOND , AUTH_REQ_BOND = ESP_LE_AUTH_BOND , AUTH_REQ_MITM = ESP_LE_AUTH_REQ_MITM , AUTH_REQ_BOND_MITM = ESP_LE_AUTH_REQ_BOND_MITM ,
  AUTH_REQ_SC_ONLY = ESP_LE_AUTH_REQ_SC_ONLY , AUTH_REQ_SC_BOND = ESP_LE_AUTH_REQ_SC_BOND , AUTH_REQ_SC_MITM = ESP_LE_AUTH_REQ_SC_MITM , AUTH_REQ_SC_MITM_BOND = ESP_LE_AUTH_REQ_SC_MITM_BOND
}
 
enum  BLEComponentState : uint8_t {
  BLE_COMPONENT_STATE_OFF = 0 , BLE_COMPONENT_STATE_DISABLE , BLE_COMPONENT_STATE_DISABLED , BLE_COMPONENT_STATE_ENABLE ,
  BLE_COMPONENT_STATE_ACTIVE
}
 

Functions

 ESPHOME_LOG_TAG (TAG, "esp32_ble")
 
void load_ble_event (BLEEvent *event, esp_gap_ble_cb_event_t e, esp_ble_gap_cb_param_t *p)
 
void load_ble_event (BLEEvent *event, esp_gattc_cb_event_t e, esp_gatt_if_t i, esp_ble_gattc_cb_param_t *p)
 
void load_ble_event (BLEEvent *event, esp_gatts_cb_event_t e, esp_gatt_if_t i, esp_ble_gatts_cb_param_t *p)
 
template<typename... Args>
void enqueue_ble_event (Args... args)
 
template void enqueue_ble_event (esp_gap_ble_cb_event_t, esp_ble_gap_cb_param_t *)
 
template void enqueue_ble_event (esp_gatts_cb_event_t, esp_gatt_if_t, esp_ble_gatts_cb_param_t *)
 
template void enqueue_ble_event (esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t *)
 
uint64_t ble_addr_to_uint64 (const esp_bd_addr_t address)
 
 ESPHOME_LOG_TAG (TAG, "esp32_ble.advertising")
 
struct __attribute__ ((packed)) BLEScanResult
 
void sort_records_by_handle (uint8_t *records, size_t len, size_t size)
 Sort records of size bytes that each start with a little-endian handle, in place; a partial tail is left alone.
 
void sort_att_response_by_handle (uint8_t op_code, uint8_t *data, size_t len)
 Sort the records of an ATT discovery response by handle, in place; data is the PDU after the opcode.
 
bool parse_bdaddr (const char *str, uint8_t *addr)
 Parse "xx:xx:xx:xx:xx:xx" as Bluedroid's string_to_bdaddr does: one or two hex digits per byte, ':' between bytes, anything after the sixth byte ignored.
 
bool parse_config_bin (const char *str, size_t len, uint8_t *value, size_t *length)
 Decode a stored hex string as Bluedroid's btc_config_get_bin does: even length, at most *length bytes, hex digits only.
 
template<typename GetStr >
bool config_get_bin (GetStr get_str, const char *section, const char *key, uint8_t *value, size_t *length)
 btc_config_get_bin on top of btc_config_get_str, passed as get_str, which strlcpy's the stored string.
 

Variables

ESP32BLE * global_ble = nullptr
 

Enumeration Type Documentation

◆ AuthReqMode

Enumerator
AUTH_REQ_NO_BOND 
AUTH_REQ_BOND 
AUTH_REQ_MITM 
AUTH_REQ_BOND_MITM 
AUTH_REQ_SC_ONLY 
AUTH_REQ_SC_BOND 
AUTH_REQ_SC_MITM 
AUTH_REQ_SC_MITM_BOND 

Definition at line 65 of file ble.h.

◆ BLEComponentState

Enumerator
BLE_COMPONENT_STATE_OFF 

Nothing has been initialized yet.

BLE_COMPONENT_STATE_DISABLE 

BLE should be disabled on next loop.

BLE_COMPONENT_STATE_DISABLED 

BLE is disabled.

BLE_COMPONENT_STATE_ENABLE 

BLE should be enabled on next loop.

BLE_COMPONENT_STATE_ACTIVE 

BLE is active.

Definition at line 77 of file ble.h.

◆ IoCapability

Enumerator
IO_CAP_OUT 
IO_CAP_IO 
IO_CAP_IN 
IO_CAP_NONE 
IO_CAP_KBDISP 

Definition at line 56 of file ble.h.

Function Documentation

◆ __attribute__()

struct esphome::esp32_ble::__attribute__ ( (packed) )

Definition at line 1 of file ble_scan_result.h.

◆ ble_addr_to_uint64()

uint64_t esphome::esp32_ble::ble_addr_to_uint64 ( const esp_bd_addr_t address)
inline

Definition at line 38 of file ble.h.

◆ config_get_bin()

template<typename GetStr >
bool esphome::esp32_ble::config_get_bin ( GetStr get_str,
const char * section,
const char * key,
uint8_t * value,
size_t * length )

btc_config_get_bin on top of btc_config_get_str, passed as get_str, which strlcpy's the stored string.

Definition at line 51 of file bluedroid_hex.h.

◆ enqueue_ble_event() [1/4]

template<typename... Args>
void esphome::esp32_ble::enqueue_ble_event ( Args... args)

Definition at line 682 of file ble.cpp.

◆ enqueue_ble_event() [2/4]

template void esphome::esp32_ble::enqueue_ble_event ( esp_gap_ble_cb_event_t ,
esp_ble_gap_cb_param_t *  )

◆ enqueue_ble_event() [3/4]

template void esphome::esp32_ble::enqueue_ble_event ( esp_gattc_cb_event_t ,
esp_gatt_if_t ,
esp_ble_gattc_cb_param_t *  )

◆ enqueue_ble_event() [4/4]

template void esphome::esp32_ble::enqueue_ble_event ( esp_gatts_cb_event_t ,
esp_gatt_if_t ,
esp_ble_gatts_cb_param_t *  )

◆ ESPHOME_LOG_TAG() [1/2]

esphome::esp32_ble::ESPHOME_LOG_TAG ( TAG ,
"esp32_ble"  )

◆ ESPHOME_LOG_TAG() [2/2]

esphome::esp32_ble::ESPHOME_LOG_TAG ( TAG ,
"esp32_ble.advertising"  )

◆ load_ble_event() [1/3]

void esphome::esp32_ble::load_ble_event ( BLEEvent * event,
esp_gap_ble_cb_event_t e,
esp_ble_gap_cb_param_t * p )

Definition at line 666 of file ble.cpp.

◆ load_ble_event() [2/3]

void esphome::esp32_ble::load_ble_event ( BLEEvent * event,
esp_gattc_cb_event_t e,
esp_gatt_if_t i,
esp_ble_gattc_cb_param_t * p )

Definition at line 671 of file ble.cpp.

◆ load_ble_event() [3/3]

void esphome::esp32_ble::load_ble_event ( BLEEvent * event,
esp_gatts_cb_event_t e,
esp_gatt_if_t i,
esp_ble_gatts_cb_param_t * p )

Definition at line 677 of file ble.cpp.

◆ parse_bdaddr()

bool esphome::esp32_ble::parse_bdaddr ( const char * str,
uint8_t * addr )
inline

Parse "xx:xx:xx:xx:xx:xx" as Bluedroid's string_to_bdaddr does: one or two hex digits per byte, ':' between bytes, anything after the sixth byte ignored.

addr (6 bytes) is written only on success.

Definition at line 13 of file bluedroid_hex.h.

◆ parse_config_bin()

bool esphome::esp32_ble::parse_config_bin ( const char * str,
size_t len,
uint8_t * value,
size_t * length )
inline

Decode a stored hex string as Bluedroid's btc_config_get_bin does: even length, at most *length bytes, hex digits only.

On success *length is the decoded size; on failure value and *length are untouched.

Definition at line 34 of file bluedroid_hex.h.

◆ sort_att_response_by_handle()

void esphome::esp32_ble::sort_att_response_by_handle ( uint8_t op_code,
uint8_t * data,
size_t len )
inline

Sort the records of an ATT discovery response by handle, in place; data is the PDU after the opcode.

A body longer than any ATT_MTU allows is left for Bluedroid to reject, so a peer cannot make the sort costly.

Definition at line 33 of file bluedroid_gattc_order.h.

◆ sort_records_by_handle()

void esphome::esp32_ble::sort_records_by_handle ( uint8_t * records,
size_t len,
size_t size )
inline

Sort records of size bytes that each start with a little-endian handle, in place; a partial tail is left alone.

Definition at line 18 of file bluedroid_gattc_order.h.

Variable Documentation

◆ global_ble

ESP32BLE * esphome::esp32_ble::global_ble = nullptr

Definition at line 908 of file ble.cpp.