1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-15 17:52:19 +01:00
This commit is contained in:
J. Nick Koston
2025-06-11 11:17:01 -05:00
parent 2f8946f86c
commit 0331cb09e8

View File

@@ -326,15 +326,8 @@ void ESP32BLE::loop() {
gap_event == ESP_GAP_BLE_SCAN_START_COMPLETE_EVT || gap_event == ESP_GAP_BLE_SCAN_START_COMPLETE_EVT ||
gap_event == ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT) { gap_event == ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT) {
// All three scan complete events have the same structure with just status // All three scan complete events have the same structure with just status
// We can create a minimal structure that matches their layout // Cast is safe because all three ESP-IDF event structures are identical with just status field
struct { this->real_gap_event_handler_(gap_event, (esp_ble_gap_cb_param_t *) &ble_event->event_.gap.scan_complete);
esp_bt_status_t status;
} scan_complete_param;
scan_complete_param.status = ble_event->event_.gap.scan_complete.status;
// Cast is safe because all three event structures start with status
this->real_gap_event_handler_(gap_event, (esp_ble_gap_cb_param_t *) &scan_complete_param);
} else { } else {
// Unexpected GAP event - drop it // Unexpected GAP event - drop it
ESP_LOGV(TAG, "Unexpected GAP event type: %d", gap_event); ESP_LOGV(TAG, "Unexpected GAP event type: %d", gap_event);