mirror of
https://github.com/esphome/esphome.git
synced 2026-08-31 01:56:01 +00:00
Address review: on_notify_state joins the node interface
notify_characteristic() had no completion path to the node that asked; the hook lands now while the surface has no external users, with the client fanning out after its breadcrumb.
This commit is contained in:
@@ -201,12 +201,13 @@ void BLEClient::on_notify_data(uint16_t handle, const uint8_t *data, uint16_t le
|
||||
}
|
||||
|
||||
void BLEClient::on_notify_state(uint16_t handle, bool enabled, int error) {
|
||||
// Breadcrumb only until the first notify node lands; a dropped failure
|
||||
// here would otherwise be silent on a frozen surface.
|
||||
if (error != 0) {
|
||||
ESP_LOGW(TAG, "[%s] Notify %s on handle 0x%04x failed, status=%d", this->address_str_,
|
||||
enabled ? "enable" : "disable", handle, error);
|
||||
}
|
||||
for (auto *node : this->nodes_) {
|
||||
node->on_notify_state(handle, enabled, error);
|
||||
}
|
||||
}
|
||||
|
||||
void BLEClient::on_pairing_result(int status) {
|
||||
|
||||
@@ -37,6 +37,7 @@ class BLEClientNode {
|
||||
virtual void on_connected(const ble_device_base::GattServiceTable &table) {}
|
||||
virtual void on_disconnected() {}
|
||||
virtual void on_notify(uint16_t handle, const uint8_t *data, uint16_t len) {}
|
||||
virtual void on_notify_state(uint16_t handle, bool enabled, int error) {}
|
||||
virtual void on_read_result(uint16_t handle, const uint8_t *data, uint16_t len, int error) {}
|
||||
virtual void on_write_result(uint16_t handle, int error) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user