1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-04 19:03:47 +01:00
This commit is contained in:
J. Nick Koston
2025-06-19 01:14:05 +02:00
parent e99bc52756
commit a3400037d9

View File

@@ -232,7 +232,11 @@ class BLEEvent {
const BLEScanResult &scan_result() const { return event_.gap.scan_result; }
esp_bt_status_t scan_complete_status() const { return event_.gap.scan_complete.status; }
esp_bt_status_t adv_complete_status() const { return event_.gap.adv_complete.status; }
const esp_ble_gap_cb_param_t::ble_read_rssi_cmpl_evt_param &read_rssi_complete() const {
const struct {
esp_bt_status_t status;
int8_t rssi;
esp_bd_addr_t remote_addr;
} & read_rssi_complete() const {
return event_.gap.read_rssi_complete;
}
const esp_ble_sec_t &security() const { return event_.gap.security; }
@@ -390,8 +394,11 @@ class BLEEvent {
}
};
// Verify the gap_event union hasn't grown beyond expected size
static_assert(sizeof(BLEEvent::gap_event) <= 80, "gap_event union has grown beyond 80 bytes");
// Verify the gap_event struct hasn't grown beyond expected size
// Note: gap_event is a nested struct type, not directly accessible as BLEEvent::gap_event
// We check the size through the union member instead
static_assert(offsetof(BLEEvent, event_.gap) + sizeof(((BLEEvent *) 0)->event_.gap) <= 80,
"gap_event struct has grown beyond 80 bytes");
// Verify esp_ble_sec_t fits within our union
static_assert(sizeof(esp_ble_sec_t) <= 73, "esp_ble_sec_t is larger than BLEScanResult");