nordic

Fork of nRF51822 by Nordic Semiconductor

Revision:
599:814c1ce92947
Parent:
598:bcd5e287c494
Child:
600:3e66e1eb264d
--- a/source/btle/btle_security.cpp	Mon Jan 11 10:19:35 2016 +0000
+++ b/source/btle/btle_security.cpp	Mon Jan 11 10:19:35 2016 +0000
@@ -21,11 +21,13 @@
 extern "C" {
 #include "pstorage.h"
 #include "device_manager.h"
+#include "id_manager.h"
 }
 
 #include "btle_security.h"
 
 static dm_application_instance_t applicationInstance;
+static bool                      initialized = false;
 static ret_code_t dm_handler(dm_handle_t const *p_handle, dm_event_t const *p_event, ret_code_t event_result);
 
 // default security parameters
@@ -43,7 +45,7 @@
     },                             /**< Key distribution bitmap: keys that the peripheral device will distribute. */
 };
 
-ble_error_t btle_createWhitelistFromBonds(ble_gap_whitelist_t *p_whitelist)
+ble_error_t btle_createWhitelistFromBondTable(ble_gap_whitelist_t *p_whitelist)
 {
     ret_code_t err = dm_whitelist_create(&applicationInstance, p_whitelist);
     if (err == NRF_SUCCESS) {
@@ -55,6 +57,11 @@
     }
 }
 
+bool btle_hasInitializedSecurity(void)
+{
+    return initialized;
+}
+
 ble_error_t
 btle_initializeSecurity(bool                                      enableBonding,
                         bool                                      requireMITM,
@@ -62,7 +69,6 @@
                         const SecurityManager::Passkey_t          passkey)
 {
     /* guard against multiple initializations */
-    static bool initialized = false;
     if (initialized) {
         return BLE_ERROR_NONE;
     }
@@ -273,4 +279,9 @@
     }
 
     return NRF_SUCCESS;
+}
+
+bool btle_matchAddressAndIrk(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk)
+{
+    return im_address_resolve(p_addr, p_irk);
 }
\ No newline at end of file