implement deleteAllBondedDevices()

This commit is contained in:
Rohit Grover 2015-04-22 13:19:00 +01:00
parent 85fcb2cbb3
commit 9e7dab432e
3 changed files with 24 additions and 1 deletions

View file

@ -74,8 +74,18 @@ ble_error_t
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

View file

@ -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_ */

View file

@ -26,6 +26,7 @@
#include "nrf_soc.h"
#include "ble_radio_notification.h"
#include "btle_security.h"
/**************************************************************************/
/*!
@ -54,6 +55,8 @@ public:
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);