Nordic stack and drivers for the mbed BLE API. Version to work around build bug.

Dependents:   microbit_rubber_ducky microbit_mouse_BLE microbit_mouse_BLE_daybreak_version microbit_presenter

Fork of nRF51822 by Nordic Semiconductor

Revision:
361:d2405f5a4853
Parent:
356:55ede9fd5279
Child:
362:6fa0d4d555f6
--- a/btle/btle_security.cpp	Fri Jun 19 15:55:37 2015 +0100
+++ b/btle/btle_security.cpp	Thu Jul 02 09:08:44 2015 +0100
@@ -16,10 +16,7 @@
 
 #include "btle.h"
 #include "pstorage.h"
-
 #include "nRF51Gap.h"
-#include "nRF51SecurityManager.h"
-
 #include "device_manager.h"
 #include "btle_security.h"
 
@@ -27,10 +24,7 @@
 static ret_code_t dm_handler(dm_handle_t const *p_handle, dm_event_t const *p_event, ret_code_t event_result);
 
 ble_error_t
-btle_initializeSecurity(bool                                      enableBonding,
-                        bool                                      requireMITM,
-                        SecurityManager::SecurityIOCapabilities_t iocaps,
-                        const SecurityManager::Passkey_t          passkey)
+btle_initializeSecurity(bool enableBonding, bool requireMITM, Gap::SecurityIOCapabilities_t iocaps, const Gap::Passkey_t passkey)
 {
     /* guard against multiple initializations */
     static bool initialized = false;
@@ -120,7 +114,7 @@
 }
 
 ble_error_t
-btle_getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP)
+btle_getLinkSecurity(Gap::Handle_t connectionHandle, Gap::LinkSecurityStatus_t *securityStatusP)
 {
     ret_code_t rc;
     dm_handle_t dmHandle = {
@@ -154,52 +148,51 @@
     switch (p_event->event_id) {
         case DM_EVT_SECURITY_SETUP: /* started */ {
             const ble_gap_sec_params_t *peerParams = &p_event->event_param.p_gap_param->params.sec_params_request.peer_params;
-            nRF51SecurityManager::getInstance().processSecuritySetupInitiatedEvent(p_event->event_param.p_gap_param->conn_handle,
-                                                                                   peerParams->bond,
-                                                                                   peerParams->mitm,
-                                                                                   (SecurityManager::SecurityIOCapabilities_t)peerParams->io_caps);
+            nRF51Gap::getInstance().processSecuritySetupInitiatedEvent(p_event->event_param.p_gap_param->conn_handle,
+                                                                           peerParams->bond,
+                                                                           peerParams->mitm,
+                                                                           (Gap::SecurityIOCapabilities_t)peerParams->io_caps);
             break;
         }
         case DM_EVT_SECURITY_SETUP_COMPLETE:
-            nRF51SecurityManager::getInstance().
-                processSecuritySetupCompletedEvent(p_event->event_param.p_gap_param->conn_handle,
-                                                   (SecurityManager::SecurityCompletionStatus_t)(p_event->event_param.p_gap_param->params.auth_status.auth_status));
+            nRF51Gap::getInstance().processSecuritySetupCompletedEvent(p_event->event_param.p_gap_param->conn_handle,
+                                                                           (Gap::SecurityCompletionStatus_t)(p_event->event_param.p_gap_param->params.auth_status.auth_status));
             break;
         case DM_EVT_LINK_SECURED: {
             unsigned securityMode                    = p_event->event_param.p_gap_param->params.conn_sec_update.conn_sec.sec_mode.sm;
             unsigned level                           = p_event->event_param.p_gap_param->params.conn_sec_update.conn_sec.sec_mode.lv;
-            SecurityManager::SecurityMode_t resolvedSecurityMode = SecurityManager::SECURITY_MODE_NO_ACCESS;
+            Gap::SecurityMode_t resolvedSecurityMode = Gap::SECURITY_MODE_NO_ACCESS;
             switch (securityMode) {
                 case 1:
                     switch (level) {
                         case 1:
-                            resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK;
+                            resolvedSecurityMode = Gap::SECURITY_MODE_ENCRYPTION_OPEN_LINK;
                             break;
                         case 2:
-                            resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM;
+                            resolvedSecurityMode = Gap::SECURITY_MODE_ENCRYPTION_NO_MITM;
                             break;
                         case 3:
-                            resolvedSecurityMode = SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM;
+                            resolvedSecurityMode = Gap::SECURITY_MODE_ENCRYPTION_WITH_MITM;
                             break;
                     }
                     break;
                 case 2:
                     switch (level) {
                         case 1:
-                            resolvedSecurityMode = SecurityManager::SECURITY_MODE_SIGNED_NO_MITM;
+                            resolvedSecurityMode = Gap::SECURITY_MODE_SIGNED_NO_MITM;
                             break;
                         case 2:
-                            resolvedSecurityMode = SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM;
+                            resolvedSecurityMode = Gap::SECURITY_MODE_SIGNED_WITH_MITM;
                             break;
                     }
                     break;
             }
 
-            nRF51SecurityManager::getInstance().processLinkSecuredEvent(p_event->event_param.p_gap_param->conn_handle, resolvedSecurityMode);
+            nRF51Gap::getInstance().processLinkSecuredEvent(p_event->event_param.p_gap_param->conn_handle, resolvedSecurityMode);
             break;
         }
         case DM_EVT_DEVICE_CONTEXT_STORED:
-            nRF51SecurityManager::getInstance().processSecurityContextStoredEvent(p_event->event_param.p_gap_param->conn_handle);
+            nRF51Gap::getInstance().processSecurityContextStoredEvent(p_event->event_param.p_gap_param->conn_handle);
             break;
         default:
             break;