Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/helpers/nrf52/SerialBLEInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ void SerialBLEInterface::onSecured(uint16_t connection_handle) {
} else {
BLE_DEBUG_PRINTLN("Failed to request connection parameter update: %lu", err_code);
}

// Once per boot, tell the bonded peer the attribute table may have changed (e.g. after a
// firmware update) so it re-discovers instead of using a stale GATT cache. Fails until the
// peer has enabled Service Changed indications, in which case the next secured link retries.
static bool service_changed_sent = false;
if (!service_changed_sent) {
uint16_t first_handle = 0;
if (sd_ble_gatts_initial_user_handle_get(&first_handle) == NRF_SUCCESS &&
sd_ble_gatts_service_changed(connection_handle, first_handle, 0xFFFF) == NRF_SUCCESS) {
service_changed_sent = true;
}
}
} else {
BLE_DEBUG_PRINTLN("onSecured: ignoring stale/duplicate callback");
}
Expand Down