This commit is contained in:
J. Nick Koston 2025-07-17 09:57:29 -10:00
parent 9291dc4e27
commit 1f0958e824
No known key found for this signature in database

View File

@ -32,6 +32,10 @@ std::vector<uint64_t> get_128bit_uuid_vec(esp_bt_uuid_t uuid_source) {
// This achieves ~97% WiFi MTU utilization while staying under the limit
static constexpr size_t FLUSH_BATCH_SIZE = 16;
// Verify BLE advertisement data array size matches the BLE specification (31 bytes adv + 31 bytes scan response)
static_assert(sizeof(((api::BluetoothLERawAdvertisement *) nullptr)->data) == 62,
"BLE advertisement data array size mismatch");
BluetoothProxy::BluetoothProxy() { global_bluetooth_proxy = this; }
void BluetoothProxy::setup() {
@ -77,12 +81,6 @@ bool BluetoothProxy::parse_devices(const esp32_ble::BLEScanResult *scan_results,
auto &result = scan_results[i];
uint8_t length = result.adv_data_len + result.scan_rsp_len;
// Validate length
if (length > 62) {
ESP_LOGW(TAG, "BLE advertisement too large: %d bytes (max 62)", length);
length = 62;
}
// Check if we need to expand the vector
if (this->advertisement_count_ >= advertisements.size()) {
if (this->advertisement_pool_.empty()) {