mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 09:54:19 -07:00
Merge branch 'constexpr-ble' into integration
This commit is contained in:
@@ -35,8 +35,8 @@ using namespace esp32_ble_client;
|
||||
// Version 3: New connection API
|
||||
// Version 4: Pairing support
|
||||
// Version 5: Cache clear support
|
||||
static const uint32_t LEGACY_ACTIVE_CONNECTIONS_VERSION = 5;
|
||||
static const uint32_t LEGACY_PASSIVE_ONLY_VERSION = 1;
|
||||
static constexpr uint32_t LEGACY_ACTIVE_CONNECTIONS_VERSION = 5;
|
||||
static constexpr uint32_t LEGACY_PASSIVE_ONLY_VERSION = 1;
|
||||
|
||||
enum BluetoothProxyFeature : uint32_t {
|
||||
FEATURE_PASSIVE_SCAN = 1 << 0,
|
||||
|
||||
@@ -16,17 +16,17 @@ static const char *const TAG = "esp32_ble_client";
|
||||
// Intermediate connection parameters for standard operation
|
||||
// ESP-IDF defaults (12.5-15ms) are too slow for stable connections through WiFi-based BLE proxies,
|
||||
// causing disconnections. These medium parameters balance responsiveness with bandwidth usage.
|
||||
static const uint16_t MEDIUM_MIN_CONN_INTERVAL = 0x07; // 7 * 1.25ms = 8.75ms
|
||||
static const uint16_t MEDIUM_MAX_CONN_INTERVAL = 0x09; // 9 * 1.25ms = 11.25ms
|
||||
static constexpr uint16_t MEDIUM_MIN_CONN_INTERVAL = 0x07; // 7 * 1.25ms = 8.75ms
|
||||
static constexpr uint16_t MEDIUM_MAX_CONN_INTERVAL = 0x09; // 9 * 1.25ms = 11.25ms
|
||||
// The timeout value was increased from 6s to 8s to address stability issues observed
|
||||
// in certain BLE devices when operating through WiFi-based BLE proxies. The longer
|
||||
// timeout reduces the likelihood of disconnections during periods of high latency.
|
||||
static const uint16_t MEDIUM_CONN_TIMEOUT = 800; // 800 * 10ms = 8s
|
||||
static constexpr uint16_t MEDIUM_CONN_TIMEOUT = 800; // 800 * 10ms = 8s
|
||||
|
||||
// Fastest connection parameters for devices with short discovery timeouts
|
||||
static const uint16_t FAST_MIN_CONN_INTERVAL = 0x06; // 6 * 1.25ms = 7.5ms (BLE minimum)
|
||||
static const uint16_t FAST_MAX_CONN_INTERVAL = 0x06; // 6 * 1.25ms = 7.5ms
|
||||
static const uint16_t FAST_CONN_TIMEOUT = 1000; // 1000 * 10ms = 10s
|
||||
static constexpr uint16_t FAST_MIN_CONN_INTERVAL = 0x06; // 6 * 1.25ms = 7.5ms (BLE minimum)
|
||||
static constexpr uint16_t FAST_MAX_CONN_INTERVAL = 0x06; // 6 * 1.25ms = 7.5ms
|
||||
static constexpr uint16_t FAST_CONN_TIMEOUT = 1000; // 1000 * 10ms = 10s
|
||||
static const esp_bt_uuid_t NOTIFY_DESC_UUID = {
|
||||
.len = ESP_UUID_LEN_16,
|
||||
.uuid =
|
||||
|
||||
@@ -57,12 +57,12 @@ class BLECharacteristic {
|
||||
ESPBTUUID get_uuid() { return this->uuid_; }
|
||||
std::vector<uint8_t> &get_value() { return this->value_; }
|
||||
|
||||
static const uint32_t PROPERTY_READ = 1 << 0;
|
||||
static const uint32_t PROPERTY_WRITE = 1 << 1;
|
||||
static const uint32_t PROPERTY_NOTIFY = 1 << 2;
|
||||
static const uint32_t PROPERTY_BROADCAST = 1 << 3;
|
||||
static const uint32_t PROPERTY_INDICATE = 1 << 4;
|
||||
static const uint32_t PROPERTY_WRITE_NR = 1 << 5;
|
||||
static constexpr uint32_t PROPERTY_READ = 1 << 0;
|
||||
static constexpr uint32_t PROPERTY_WRITE = 1 << 1;
|
||||
static constexpr uint32_t PROPERTY_NOTIFY = 1 << 2;
|
||||
static constexpr uint32_t PROPERTY_BROADCAST = 1 << 3;
|
||||
static constexpr uint32_t PROPERTY_INDICATE = 1 << 4;
|
||||
static constexpr uint32_t PROPERTY_WRITE_NR = 1 << 5;
|
||||
|
||||
bool is_created();
|
||||
bool is_failed();
|
||||
|
||||
Reference in New Issue
Block a user