Nordic stack and drivers for the mbed BLE API
Fork of nRF51822 by
Revision 137:aafab7b0a8bd, committed 2015-05-08
- Comitter:
- rgrover1
- Date:
- Fri May 08 15:33:56 2015 +0100
- Parent:
- 136:9bb49953de6a
- Child:
- 138:750eca573e18
- Commit message:
- Synchronized with git rev 9e7dab43
Author: Rohit Grover
implement deleteAllBondedDevices()
Changed in this revision
--- a/btle/btle_security.cpp Fri May 08 15:33:56 2015 +0100 +++ b/btle/btle_security.cpp Fri May 08 15:33:56 2015 +0100 @@ -74,8 +74,18 @@ btle_deleteAllStoredDevices(void) { ret_code_t rc; + if ((rc = dm_device_delete_all(&applicationInstance)) == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } - return BLE_ERROR_NONE; + switch (rc) { + case NRF_ERROR_INVALID_STATE: + return BLE_ERROR_INVALID_STATE; + case NRF_ERROR_NO_MEM: + return BLE_ERROR_NO_MEM; + default: + return BLE_ERROR_UNSPECIFIED; + } } ret_code_t
--- a/btle/btle_security.h Fri May 08 15:33:56 2015 +0100 +++ b/btle/btle_security.h Fri May 08 15:33:56 2015 +0100 @@ -27,4 +27,14 @@ */ ble_error_t btle_initializeSecurity(); +/** + * Function for deleting all peer device context and all related bonding + * information from the database. + * + * @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure. + * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization and/or + * application registration. + */ +ble_error_t btle_deleteAllStoredDevices(void); + #endif /* _BTLE_SECURITY_H_ */ \ No newline at end of file
--- a/nRF51Gap.h Fri May 08 15:33:56 2015 +0100 +++ b/nRF51Gap.h Fri May 08 15:33:56 2015 +0100 @@ -26,6 +26,7 @@ #include "nrf_soc.h" #include "ble_radio_notification.h" +#include "btle_security.h" /**************************************************************************/ /*! @@ -54,6 +55,8 @@ virtual ble_error_t stopAdvertising(void); virtual ble_error_t disconnect(DisconnectionReason_t reason); + virtual ble_error_t deleteAllBondedDevices(void) {return btle_deleteAllStoredDevices();} + virtual ble_error_t setDeviceName(const uint8_t *deviceName); virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP); virtual ble_error_t setAppearance(uint16_t appearance);