diff --git a/esphome/components/esp32_ble/ble.cpp b/esphome/components/esp32_ble/ble.cpp index 501fc9d981..edf6f3254b 100644 --- a/esphome/components/esp32_ble/ble.cpp +++ b/esphome/components/esp32_ble/ble.cpp @@ -360,7 +360,7 @@ void ESP32BLE::loop() { } } -template static void enqueue_ble_event(Args... args) { +template void enqueue_ble_event(Args... args) { if (global_ble->ble_events_.size() >= MAX_BLE_QUEUE_SIZE) { ESP_LOGD(TAG, "BLE event queue full (%d), dropping event", MAX_BLE_QUEUE_SIZE); return; @@ -375,6 +375,11 @@ template static void enqueue_ble_event(Args... args) { global_ble->ble_events_.push(new_event); } // NOLINT(clang-analyzer-unix.Malloc) +// Explicit template instantiations for the friend function +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 *); + void ESP32BLE::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) { // Only queue the 4 GAP events we actually handle if (event != ESP_GAP_BLE_SCAN_RESULT_EVT && event != ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT &&