Rework notify notation

This commit is contained in:
Rapsssito 2024-07-01 14:36:04 +02:00
parent 7c2bb058a5
commit 55c3b66ed8
2 changed files with 6 additions and 5 deletions

View file

@ -84,10 +84,10 @@ void BLECharacteristic::set_value(bool &data) {
this->set_value(temp, 1); this->set_value(temp, 1);
} }
void BLECharacteristic::notify(bool notification) { void BLECharacteristic::notify(bool require_ack) {
if (!notification) { if (require_ack) {
ESP_LOGW(TAG, "notification=false is not yet supported"); ESP_LOGW(TAG, "require_ack=true is not yet supported (i.e. INDICATE is not yet supported)");
// TODO: Handle when notification=false // TODO: Handle when require_ack=true
} }
if (this->service_->get_server()->get_connected_client_count() == 0) if (this->service_->get_server()->get_connected_client_count() == 0)
return; return;

View file

@ -45,7 +45,8 @@ class BLECharacteristic {
void set_write_property(bool value); void set_write_property(bool value);
void set_write_no_response_property(bool value); void set_write_no_response_property(bool value);
void notify(bool notification = true); void indicate() { this->notify(true); }
void notify(bool require_ack = false);
void do_create(BLEService *service); void do_create(BLEService *service);
void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param); void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);