1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-17 23:35:47 +00:00

[esp32_ble_server] Optimize notification and action managers for typical use cases (#10897)

This commit is contained in:
J. Nick Koston
2025-09-28 17:32:16 -05:00
committed by GitHub
parent ef73ae2116
commit ab79e596b5
4 changed files with 88 additions and 22 deletions

View File

@@ -6,7 +6,6 @@
#include "esphome/components/bytebuffer/bytebuffer.h"
#include <vector>
#include <unordered_map>
#ifdef USE_ESP32
@@ -89,7 +88,15 @@ class BLECharacteristic : public EventEmitter<BLECharacteristicEvt::VectorEvt, s
SemaphoreHandle_t set_value_lock_;
std::vector<BLEDescriptor *> descriptors_;
std::unordered_map<uint16_t, bool> clients_to_notify_;
struct ClientNotificationEntry {
uint16_t conn_id;
bool indicate; // true = indicate, false = notify
};
std::vector<ClientNotificationEntry> clients_to_notify_;
void remove_client_from_notify_list_(uint16_t conn_id);
ClientNotificationEntry *find_client_in_notify_list_(uint16_t conn_id);
esp_gatt_perm_t permissions_ = ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE;