mirror of
https://github.com/esphome/esphome.git
synced 2025-10-05 03:13:49 +01:00
fixes
This commit is contained in:
@@ -232,13 +232,7 @@ class BLEEvent {
|
|||||||
const BLEScanResult &scan_result() const { return event_.gap.scan_result; }
|
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 scan_complete_status() const { return event_.gap.scan_complete.status; }
|
||||||
esp_bt_status_t adv_complete_status() const { return event_.gap.adv_complete.status; }
|
esp_bt_status_t adv_complete_status() const { return event_.gap.adv_complete.status; }
|
||||||
const struct {
|
auto &read_rssi_complete() const -> decltype(event_.gap.read_rssi_complete) { return event_.gap.read_rssi_complete; }
|
||||||
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; }
|
const esp_ble_sec_t &security() const { return event_.gap.security; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -395,10 +389,8 @@ class BLEEvent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Verify the gap_event struct hasn't grown beyond expected size
|
// 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
|
// The gap member in the union should be 80 bytes (including the gap_event enum)
|
||||||
// We check the size through the union member instead
|
static_assert(sizeof(decltype(((BLEEvent *) nullptr)->event_.gap)) <= 80, "gap_event struct has grown beyond 80 bytes");
|
||||||
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
|
// 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");
|
static_assert(sizeof(esp_ble_sec_t) <= 73, "esp_ble_sec_t is larger than BLEScanResult");
|
||||||
|
Reference in New Issue
Block a user