diff --git a/connectivity/FEATURE_BLE/include/ble/SecurityManager.h b/connectivity/FEATURE_BLE/include/ble/SecurityManager.h index b1fe3ba114..b8dfe5de9e 100644 --- a/connectivity/FEATURE_BLE/include/ble/SecurityManager.h +++ b/connectivity/FEATURE_BLE/include/ble/SecurityManager.h @@ -514,8 +514,7 @@ public: * Some or all of bonding information may be stored in memory while in use. This will write * bonding data to persistent storage. This will have no effect if no persistent storage is enabled. * - * @note You still need to call preserveBondingStateOnReset(true) before reset happens for data to be - * loaded when it's read. + * @note This implicitly also calls preserveBondingStateOnReset(true) inside. * * @note Depending on the driver used to implement the storage solution used this may be a disruptive * operation and may cause active connections to drop due to failed processing deadlines. diff --git a/connectivity/FEATURE_BLE/source/SecurityManager.cpp b/connectivity/FEATURE_BLE/source/SecurityManager.cpp index b7b981933e..0e3026a06e 100644 --- a/connectivity/FEATURE_BLE/source/SecurityManager.cpp +++ b/connectivity/FEATURE_BLE/source/SecurityManager.cpp @@ -49,6 +49,10 @@ ble_error_t SecurityManager::preserveBondingStateOnReset(bool enable) ble_error_t SecurityManager::writeBondingStateToPersistentStorage() { + ble_error_t err = impl->preserveBondingStateOnReset(true); + if (err) { + return err; + } return impl->writeBondingStateToPersistentStorage(); }