Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
Revision 138:750eca573e18, committed 2015-05-08
- Comitter:
- rgrover1
- Date:
- Fri May 08 15:33:56 2015 +0100
- Parent:
- 137:aafab7b0a8bd
- Child:
- 139:b2f5c70b166e
- Commit message:
- Synchronized with git rev 590b9828
Author: Rohit Grover
add getLinkSecurity()
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
@@ -88,6 +88,33 @@
}
}
+ble_error_t
+btle_getLinkSecurity(Gap::Handle_t connectionHandle, Gap::LinkSecurityStatus_t *securityStatusP)
+{
+ dm_handle_t dmHandle;
+ ret_code_t rc;
+ if ((rc = dm_handle_get(connectionHandle, &dmHandle)) != NRF_SUCCESS) {
+ if (rc == NRF_ERROR_NOT_FOUND) {
+ return BLE_ERROR_INVALID_PARAM;
+ } else {
+ return BLE_ERROR_UNSPECIFIED;
+ }
+ }
+
+ if ((rc = dm_security_status_req(&dmHandle, reinterpret_cast<dm_security_status_t *>(securityStatusP))) != NRF_SUCCESS) {
+ 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;
+ }
+ }
+
+ return BLE_ERROR_NONE;
+}
+
ret_code_t
dm_handler(dm_handle_t const *p_handle, dm_event_t const *p_event, ret_code_t event_result)
{
--- 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 @@ -28,6 +28,19 @@ ble_error_t btle_initializeSecurity(); /** + * Get the security status of a link. + * + * @param[in] connectionHandle + * Handle to identify the connection. + * @param[out] securityStatusP + * security status. + * + * @return BLE_SUCCESS Or appropriate error code indicating reason for failure. + */ + +ble_error_t btle_getLinkSecurity(Gap::Handle_t connectionHandle, Gap::LinkSecurityStatus_t *securityStatusP); + +/** * Function for deleting all peer device context and all related bonding * information from the database. *
--- a/nRF51Gap.h Fri May 08 15:33:56 2015 +0100
+++ b/nRF51Gap.h Fri May 08 15:33:56 2015 +0100
@@ -56,6 +56,9 @@
virtual ble_error_t disconnect(DisconnectionReason_t reason);
virtual ble_error_t deleteAllBondedDevices(void) {return btle_deleteAllStoredDevices();}
+ virtual ble_error_t getLinkSecurity(Handle_t connectionHandle, LinkSecurityStatus_t *securityStatusP) {
+ return btle_getLinkSecurity(connectionHandle, securityStatusP);
+ }
virtual ble_error_t setDeviceName(const uint8_t *deviceName);
virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP);
