Merge branch 'bluetooth_namespace_cpp17' into integration

This commit is contained in:
J. Nick Koston 2025-07-22 19:17:18 -10:00
commit edeee42fd9
No known key found for this signature in database
15 changed files with 30 additions and 60 deletions

View File

@ -8,8 +8,7 @@
#include "bluetooth_proxy.h"
namespace esphome {
namespace bluetooth_proxy {
namespace esphome::bluetooth_proxy {
static const char *const TAG = "bluetooth_proxy.connection";
@ -422,7 +421,6 @@ esp32_ble_tracker::AdvertisementParserType BluetoothConnection::get_advertisemen
return this->proxy_->get_advertisement_parser_type();
}
} // namespace bluetooth_proxy
} // namespace esphome
} // namespace esphome::bluetooth_proxy
#endif // USE_ESP32

View File

@ -4,8 +4,7 @@
#include "esphome/components/esp32_ble_client/ble_client_base.h"
namespace esphome {
namespace bluetooth_proxy {
namespace esphome::bluetooth_proxy {
class BluetoothProxy;
@ -43,7 +42,6 @@ class BluetoothConnection : public esp32_ble_client::BLEClientBase {
// 1 byte used, 1 byte padding
};
} // namespace bluetooth_proxy
} // namespace esphome
} // namespace esphome::bluetooth_proxy
#endif // USE_ESP32

View File

@ -7,8 +7,7 @@
#ifdef USE_ESP32
namespace esphome {
namespace bluetooth_proxy {
namespace esphome::bluetooth_proxy {
static const char *const TAG = "bluetooth_proxy";
@ -502,7 +501,6 @@ void BluetoothProxy::bluetooth_scanner_set_mode(bool active) {
BluetoothProxy *global_bluetooth_proxy = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
} // namespace bluetooth_proxy
} // namespace esphome
} // namespace esphome::bluetooth_proxy
#endif // USE_ESP32

View File

@ -18,8 +18,7 @@
#include <esp_bt.h>
#include <esp_bt_device.h>
namespace esphome {
namespace bluetooth_proxy {
namespace esphome::bluetooth_proxy {
static const esp_err_t ESP_GATT_NOT_CONNECTED = -1;
static const int DONE_SENDING_SERVICES = -2;
@ -158,7 +157,6 @@ class BluetoothProxy : public esp32_ble_tracker::ESPBTDeviceListener, public Com
extern BluetoothProxy *global_bluetooth_proxy; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
} // namespace bluetooth_proxy
} // namespace esphome
} // namespace esphome::bluetooth_proxy
#endif // USE_ESP32

View File

@ -19,8 +19,7 @@
#include <esp32-hal-bt.h>
#endif
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
static const char *const TAG = "esp32_ble";
@ -538,7 +537,6 @@ uint64_t ble_addr_to_uint64(const esp_bd_addr_t address) {
ESP32BLE *global_ble = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -21,8 +21,7 @@
#include <esp_gattc_api.h>
#include <esp_gatts_api.h>
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
// Maximum number of BLE scan results to buffer
// Sized to handle bursts of advertisements while allowing for processing delays
@ -191,7 +190,6 @@ template<typename... Ts> class BLEDisableAction : public Action<Ts...> {
void play(Ts... x) override { global_ble->disable(); }
};
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -8,8 +8,7 @@
#include "esphome/core/log.h"
#include "esphome/core/application.h"
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
static const char *const TAG = "esp32_ble.advertising";
@ -160,7 +159,6 @@ void BLEAdvertising::register_raw_advertisement_callback(std::function<void(bool
this->raw_advertisements_callbacks_.push_back(std::move(callback));
}
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -10,8 +10,7 @@
#include <esp_gap_ble_api.h>
#include <esp_gatts_api.h>
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
using raw_adv_data_t = struct {
uint8_t *data;
@ -55,7 +54,6 @@ class BLEAdvertising {
int8_t current_adv_index_{-1}; // -1 means standard scan response
};
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -11,8 +11,7 @@
#include "ble_scan_result.h"
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
// Compile-time verification that ESP-IDF scan complete events only contain a status field
// This ensures our reinterpret_cast in ble.cpp is safe
@ -395,7 +394,6 @@ static_assert(sizeof(esp_ble_sec_t) <= 73, "esp_ble_sec_t is larger than BLEScan
// BLEEvent total size: 84 bytes (80 byte union + 1 byte type + 3 bytes padding)
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -4,8 +4,7 @@
#include <esp_gap_ble_api.h>
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
// Structure for BLE scan results - only fields we actually use
struct __attribute__((packed)) BLEScanResult {
@ -18,7 +17,6 @@ struct __attribute__((packed)) BLEScanResult {
uint8_t search_evt;
}; // ~73 bytes vs ~400 bytes for full esp_ble_gap_cb_param_t
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -7,8 +7,7 @@
#include <cinttypes>
#include "esphome/core/log.h"
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
static const char *const TAG = "esp32_ble";
@ -189,7 +188,6 @@ std::string ESPBTUUID::to_string() const {
return "";
}
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -8,8 +8,7 @@
#include <string>
#include <esp_bt_defs.h>
namespace esphome {
namespace esp32_ble {
namespace esphome::esp32_ble {
class ESPBTUUID {
public:
@ -41,7 +40,6 @@ class ESPBTUUID {
esp_bt_uuid_t uuid_;
};
} // namespace esp32_ble
} // namespace esphome
} // namespace esphome::esp32_ble
#endif

View File

@ -5,8 +5,7 @@
#ifdef USE_ESP32
namespace esphome {
namespace esp32_ble_tracker {
namespace esphome::esp32_ble_tracker {
#ifdef USE_ESP32_BLE_DEVICE
class ESPBTAdvertiseTrigger : public Trigger<const ESPBTDevice &>, public ESPBTDeviceListener {
public:
@ -108,7 +107,6 @@ template<typename... Ts> class ESP32BLEStopScanAction : public Action<Ts...>, pu
void play(Ts... x) override { this->parent_->stop_scan(); }
};
} // namespace esp32_ble_tracker
} // namespace esphome
} // namespace esphome::esp32_ble_tracker
#endif

View File

@ -35,8 +35,7 @@
// bt_trace.h
#undef TAG
namespace esphome {
namespace esp32_ble_tracker {
namespace esphome::esp32_ble_tracker {
static const char *const TAG = "esp32_ble_tracker";
@ -882,7 +881,6 @@ bool ESPBTDevice::resolve_irk(const uint8_t *irk) const {
}
#endif // USE_ESP32_BLE_DEVICE
} // namespace esp32_ble_tracker
} // namespace esphome
} // namespace esphome::esp32_ble_tracker
#endif // USE_ESP32

View File

@ -22,8 +22,7 @@
#include "esphome/components/esp32_ble/ble.h"
#include "esphome/components/esp32_ble/ble_uuid.h"
namespace esphome {
namespace esp32_ble_tracker {
namespace esphome::esp32_ble_tracker {
using namespace esp32_ble;
@ -321,7 +320,6 @@ class ESP32BLETracker : public Component,
// NOLINTNEXTLINE
extern ESP32BLETracker *global_esp32_ble_tracker;
} // namespace esp32_ble_tracker
} // namespace esphome
} // namespace esphome::esp32_ble_tracker
#endif