Skip to content

Conversation

@piotrnarajowski
Copy link
Contributor

@piotrnarajowski piotrnarajowski commented Aug 4, 2025

Add support for Robust GATT Caching.

Depends on #2114 #2088

@github-actions github-actions bot added host size/L Large PR labels Aug 4, 2025
@piotrnarajowski piotrnarajowski changed the title nimble/host: implement robust gatt caching (server side) [WIP] nimble/host: implement robust gatt caching (server side) Aug 4, 2025
@piotrnarajowski piotrnarajowski force-pushed the robust-gatt-cache branch 2 times, most recently from 23bf060 to aa0ae98 Compare August 25, 2025 12:46
@github-actions github-actions bot added the size/XL Extra large PR label Aug 25, 2025
@piotrnarajowski piotrnarajowski force-pushed the robust-gatt-cache branch 2 times, most recently from 447da04 to 74a3cc4 Compare September 4, 2025 13:24
@piotrnarajowski piotrnarajowski changed the title [WIP] nimble/host: implement robust gatt caching (server side) nimble/host: implement robust gatt caching (server side) Sep 4, 2025
@piotrnarajowski piotrnarajowski marked this pull request as ready for review September 4, 2025 13:33

/**
* Calculates database hash value
* @return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe return values for this function.


hash = ble_gatts_get_db_hash();

for (int i = 0; i < BLE_GATT_DB_HASH_SZ; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare the loop control variable at the beginning of the function with the rest of the variables.

Suggested change
for (int i = 0; i < BLE_GATT_DB_HASH_SZ; i++) {
for (i = 0; i < BLE_GATT_DB_HASH_SZ; i++) {


if (rc == 0) {
/* Peer will become change aware after first att request after
* reading hash*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* reading hash*/
* reading hash */

Comment on lines 211 to 217
int rc;
ble_svc_gatt_start_handle = start_handle;
ble_svc_gatt_end_handle = end_handle;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int rc;
ble_svc_gatt_start_handle = start_handle;
ble_svc_gatt_end_handle = end_handle;
int rc;
ble_svc_gatt_start_handle = start_handle;
ble_svc_gatt_end_handle = end_handle;

ble_svc_gatt_end_handle = end_handle;
ble_hs_lock();
rc = ble_gatts_calculate_db_hash();
if (rc != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (rc != 0) {
if (rc) {

for (entry = STAILQ_FIRST(&ble_att_svr_list); entry != NULL;
entry = STAILQ_NEXT(entry, ha_next)) {
rc = cb(entry, arg);
if (rc != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (rc != 0) {
if (rc) {

* to such a client until it becomes change-aware */
if (!is_change_aware(conn_handle)) {
rc = ble_att_svr_read_local(chr_val_handle - 1, &om);
if (rc != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (rc != 0) {
if (rc) {


#if MYNEWT_VAL(BLE_ATT_SVR_ROBUST_CACHE)
rc = ble_gatts_calculate_db_hash();
if (rc != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (rc != 0) {
if (rc) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies in multiple places further in the code.

}

diff = 0;
for (size_t i = 0; i < BLE_GATT_DB_HASH_SZ; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare control variable outside loop definition.

Suggested change
for (size_t i = 0; i < BLE_GATT_DB_HASH_SZ; ++i) {
for (i = 0; i < BLE_GATT_DB_HASH_SZ; ++i) {

value: 1

BLE_ATT_SVR_ROBUST_CACHE:
description: dupa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm

Add support for Robust GATT Caching.
Add support for BLE_STORE_OBJ_TYPE_PEER_CL_SUP_FEAT. This is used
for storing values of Client Supported Features for clients with a
trusted relationship.
This adds support for storing client supported features for
clients with a trusted relationship. Fixes Host qualification test
case GATT/SR/GAS/BV-04-C
Move BLE_GATT_CHR_CLI_SUP_FEAT_SZ to public header.
Extend storage unit tests to cover new object type PEER_CL_SUP_FEAT
Extend storage unit tests to test new object type DB_HASH.
@piotrnarajowski piotrnarajowski marked this pull request as draft December 4, 2025 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host size/L Large PR size/XL Extra large PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants