bluetooth: add server-side GATT caching support#1708
Draft
gmarull wants to merge 4 commits into
Draft
Conversation
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Pull NimBLE support for the GATT Database Hash characteristic (0x2B2A, Core spec v5.4, Vol 3, Part G, 7.3.1) by moving the submodule to the gatt-hash-new branch, which carries the GATT caching series on top of upstream master, and enable BLE_GATT_CACHING for both SoC targets, in the generated syscfg headers and in the syscfg generation project. Clients that cache the attribute database (notably iOS and Android) can now detect database changes across firmware updates deterministically by reading the hash on reconnection, instead of relying only on Service Changed indications. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Add storage for the GATT caching peer state table (an opaque driver-defined blob) and the local GATT database hash, stored as singleton records in the bonding settings file. PRF does not persist either, matching its CCCD storage stubs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Pull NimBLE support for server-side GATT robust caching (Vol 3, Part G, 2.5.2.1) and handle the new store object types in the NimBLE store glue. Per-bonded-peer Client Supported Features and change-aware state are kept in a RAM list, serialized as a fixed-layout blob into the new GATT caching persistent storage record, and lazily loaded on first access. Storage I/O happens outside the store mutex, since bt_persistent_storage holds its own lock while registering records back into this store. The database hash is read and written through storage directly. With this, a bonded phone that enabled robust caching gets a Database Out Of Sync ATT error when it operates on stale attribute handles after a firmware update changed the GATT database, instead of silently misbehaving, and its awareness state survives reboots on both sides. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1705 (the first two commits — Mbed TLS + NimBLE upstream master migration — belong to that PR; only the last three commits are new here). Will be rebased once #1705 merges.
Add server-side GATT caching (Core spec v5.4, Vol 3, Part G, 2.5.2 and 7.3):
third_party/nimble: move the submodule to thegatt-hash-newbranch, which carries the GATT caching series on top of upstream master (Database Hash characteristic 0x2B2A, CSFC/database hash store object types, Database Out Of Sync ATT error, robust caching state machine), and enableBLE_GATT_CACHINGfor both SoC targets.services/bluetooth: new persistent storage record for GATT caching state.bluetooth-fw/nimble: handle the new store object types in the NimBLE store glue. Per-bonded-peer Client Supported Features and change-aware state are kept in a RAM list, serialized into the new storage record, and lazily loaded on first access.With this, a bonded phone that enabled robust caching gets a Database Out Of Sync ATT error when it operates on stale attribute handles after a firmware update changed the GATT database, instead of silently misbehaving, and clients can detect database changes deterministically by reading the hash on reconnection. Awareness state survives reboots on both sides.
The NimBLE series is intended to be submitted to apache/mynewt-nimble; the submodule branch keeps it rebased on upstream master for that purpose.
Build-verified on asterix and obelix.
🤖 Generated with Claude Code