comm/ble: implement GATT service-changed indication#1498
Conversation
b7f7a50 to
d580a8c
Compare
|
Suggestion on the driver-side connection lookup: on the nimble port, A cleaner shape, matching how void bt_driver_gatt_send_changed_indication(const BTDeviceInternal *device, const ATTHandleRange *data);The nimble implementation then reduces to The signature change is cheap: the only other implementations are empty stubs ( |
7947008 to
380c3d2
Compare
|
Ahh that could help explain a crash we were seeing in Kable on iOS |
yes, not sure how that went unnoticed for so long. We need to blow up the BLE pseudostack we have on top of NimBLE |
The service-changed path was an empty stub at both layers. The service layer now sends an indication when the GATT database changes, and the NimBLE driver emits it over the Service Changed characteristic (0x1801/0x2a05) via ble_gatts_indicate_custom with the affected handle range. Signed-off-by: Joseph Mearman <joseph@mearman.co.uk> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…akes Port the test off the deleted SS1 fakes onto fake_bt_driver_gatt, which records the indications the driver emits, and take it out of BROKEN_TESTS. Signed-off-by: Joseph Mearman <joseph@mearman.co.uk> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Use PBL_LOG_MODULE_DECLARE / PBL_LOG_ERR matching the pattern in gatt_client_operations.c and other bluetooth-fw files. LOG_DOMAIN_BT was removed from logging.h in 5483b6d; the new per-module logging doesn't need a domain argument. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Change the driver signature from (connection_id, range) to (device, range) so the NimBLE implementation resolves the connection handle through its own connection table (ble_gap_conn_find_by_addr) instead of reaching back into fw/comm/ble under bt_lock. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
a5ff8e3 to
d5f5b2f
Compare
The service-changed indication was an empty stub at both the service layer and the NimBLE driver. The GATT spec requires the server to send an indication over the Service Changed characteristic (0x1801/0x2a05) when its attribute database changes, so the client knows to rediscover. Without it, connected clients carry stale caches after a firmware update.
comm/ble: implement GATT service-changed indicationfills in both stubs. The service layer resolves the live connection under bt_lock, bails if it was torn down between the timer firing and the callback running, and sends a full-range invalidation (0x0001-0xFFFF) per BT Core Spec 2.5.2. The NimBLE driver looks up the Service Changed value handle via ble_gatts_find_chr, builds an os_mbuf from the ATTHandleRange, and emits it with ble_gatts_indicate_custom.test/comm/ble: re-enable gatt_service_changed_server with bt_driver fakesports the test off the deleted SS1 fakes onto fake_bt_driver_gatt, which now records the connection id and handle range from each indication rather than just counting them. Adds a test that the indication carries the subscribed connection and the full invalidation range. Removes the test from BROKEN_TESTS.Merge order: 1 (independent)