Skip to content

GATT database hash + persistent caching#1685

Closed
gmarull wants to merge 3 commits into
coredevices:mainfrom
teslabs:gatt-hash
Closed

GATT database hash + persistent caching#1685
gmarull wants to merge 3 commits into
coredevices:mainfrom
teslabs:gatt-hash

Conversation

@gmarull

@gmarull gmarull commented Jul 10, 2026

Copy link
Copy Markdown
Member

No description provided.

gmarull and others added 3 commits July 13, 2026 20:54
Pull NimBLE support for the GATT Database Hash characteristic (0x2B2A,
Core spec v5.4, Vol 3, Part G, 7.3.1) 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>
@gmarull

gmarull commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

#1708

@gmarull gmarull closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant