From 36ccfa83dabed1b4ebbaba57bf1cbc74029e6c09 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 4 Aug 2020 10:55:36 +1000 Subject: [PATCH] extmod/nimble: Automatically notify subscribed connections on gatts_write(). --- extmod/nimble/modbluetooth_nimble.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extmod/nimble/modbluetooth_nimble.c b/extmod/nimble/modbluetooth_nimble.c index 843989b2b898..5166b5dae2b1 100644 --- a/extmod/nimble/modbluetooth_nimble.c +++ b/extmod/nimble/modbluetooth_nimble.c @@ -582,11 +582,11 @@ int mp_bluetooth_gatts_write(uint16_t value_handle, const uint8_t *value, size_t if (!mp_bluetooth_is_active()) { return ERRNO_BLUETOOTH_NOT_ACTIVE; } - return mp_bluetooth_gatts_db_write(MP_STATE_PORT(bluetooth_nimble_root_pointers)->gatts_db, value_handle, value, value_len); + int ret = mp_bluetooth_gatts_db_write(MP_STATE_PORT(bluetooth_nimble_root_pointers)->gatts_db, value_handle, value, value_len); + ble_gatts_chr_updated(value_handle); + return ret; } -// TODO: Could use ble_gatts_chr_updated to send to all subscribed centrals. - int mp_bluetooth_gatts_notify(uint16_t conn_handle, uint16_t value_handle) { if (!mp_bluetooth_is_active()) { return ERRNO_BLUETOOTH_NOT_ACTIVE;