ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
bluedroid_gattc_order.cpp
Go to the documentation of this file.
1// Linker wrap that puts a GATT discovery response back in handle order before Bluedroid parses it.
2// ESP-IDF 5.5.6, 6.0.3 and 6.1.1 end the whole discovery when a peer lists handles out of order (esphome#22518), which
3// earlier releases, Android and BlueZ accept.
4
6
7#ifdef USE_ESP32_BLE_GATTC_HANDLE_ORDER
8
10
11namespace esphome::esp32_ble {}
12
13// NOLINTBEGIN(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp,readability-identifier-naming)
14extern "C" {
15
16// tGATT_TCB is only passed through
17void __real_gatt_client_handle_server_rsp(void *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data,
18 uint16_t eatt_bearer_lcid);
19
20// Runs on the Bluetooth host task
21void __wrap_gatt_client_handle_server_rsp(void *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data,
22 uint16_t eatt_bearer_lcid) {
24 __real_gatt_client_handle_server_rsp(p_tcb, op_code, len, p_data, eatt_bearer_lcid);
25}
26
27} // extern "C"
28// NOLINTEND(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp,readability-identifier-naming)
29
30#endif // USE_ESP32_BLE_GATTC_HANDLE_ORDER
void __real_gatt_client_handle_server_rsp(void *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data, uint16_t eatt_bearer_lcid)
void __wrap_gatt_client_handle_server_rsp(void *p_tcb, uint8_t op_code, uint16_t len, uint8_t *p_data, uint16_t eatt_bearer_lcid)
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.
uint32_t len