Skip to content

Commit 470917f

Browse files
add implicit call to preserve state on reset
1 parent c9d0ff8 commit 470917f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

connectivity/FEATURE_BLE/include/ble/SecurityManager.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ class SecurityManager
514514
* Some or all of bonding information may be stored in memory while in use. This will write
515515
* bonding data to persistent storage. This will have no effect if no persistent storage is enabled.
516516
*
517-
* @note You still need to call preserveBondingStateOnReset(true) before reset happens for data to be
518-
* loaded when it's read.
517+
* @note This implicitly also calls preserveBondingStateOnReset(true) inside.
519518
*
520519
* @note Depending on the driver used to implement the storage solution used this may be a disruptive
521520
* operation and may cause active connections to drop due to failed processing deadlines.

connectivity/FEATURE_BLE/source/SecurityManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ ble_error_t SecurityManager::preserveBondingStateOnReset(bool enable)
4949

5050
ble_error_t SecurityManager::writeBondingStateToPersistentStorage()
5151
{
52+
ble_error_t err = impl->preserveBondingStateOnReset(true);
53+
if (err) {
54+
return err;
55+
}
5256
return impl->writeBondingStateToPersistentStorage();
5357
}
5458

0 commit comments

Comments
 (0)