From cc81069d0200eba02bdd6b412e24670691f2e38b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 9 Aug 2026 00:28:54 -0500 Subject: [PATCH] Keep the esp32 maintenance functions outside the gated surface --- .../bluetooth_connection/bluetooth_connection.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/esphome/components/bluetooth_connection/bluetooth_connection.cpp b/esphome/components/bluetooth_connection/bluetooth_connection.cpp index 327f430ab5..ed4a6e73ac 100644 --- a/esphome/components/bluetooth_connection/bluetooth_connection.cpp +++ b/esphome/components/bluetooth_connection/bluetooth_connection.cpp @@ -42,9 +42,16 @@ BatchClose close_service_batch(api::BluetoothGATTGetServicesResponse &resp, size return BatchClose::CONTINUE; } +} // namespace esphome::bluetooth_connection + +#endif // BLUETOOTH_CONNECTION_HAS_GATT + #ifdef USE_ESP32 +namespace esphome::bluetooth_connection { + // Address-scoped Bluedroid maintenance shared by every esp32 proxy build, -// including advertisement-only ones where no GATT backend is compiled. +// including advertisement-only ones where no GATT backend (and none of the +// gated surface above) is compiled - so this block sits outside that gate. conn_err_t unpair_device(uint64_t address) { esp_bd_addr_t bda; @@ -57,8 +64,6 @@ conn_err_t clear_gatt_cache(uint64_t address) { ble_device_base::uint64_to_mac_msb_first(address, bda); return esp_ble_gattc_cache_clean(bda); } -#endif // USE_ESP32 } // namespace esphome::bluetooth_connection - -#endif // BLUETOOTH_CONNECTION_HAS_GATT +#endif // USE_ESP32