Nordic stack and drivers for the mbed BLE API Modified for HRM1017 for library 0.1.0

Fork of nRF51822 by Nordic Semiconductor

Files at this revision

API Documentation at this revision

Comitter:
Rohit Grover
Date:
Thu Jul 10 12:12:18 2014 +0100
Parent:
40:1cb3707fa798
Child:
42:120a96d10f90
Commit message:
connection and disconnection callbacks need to take a connection handle

Changed in this revision

btle/btle.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/btle/btle.cpp	Thu Jul 10 11:29:44 2014 +0100
+++ b/btle/btle.cpp	Thu Jul 10 12:12:18 2014 +0100
@@ -85,20 +85,24 @@
 
     /* Custom event handler */
     switch (p_ble_evt->header.evt_id) {
-        case BLE_GAP_EVT_CONNECTED:
-            nRF51Gap::getInstance().setConnectionHandle(p_ble_evt->evt.gap_evt.conn_handle);
-            nRF51Gap::getInstance().handleEvent(GapEvents::GAP_EVENT_CONNECTED);
+        case BLE_GAP_EVT_CONNECTED: {
+            Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle;
+            nRF51Gap::getInstance().setConnectionHandle(handle);
+            nRF51Gap::getInstance().processHandleSpecificEvent(GapEvents::GAP_EVENT_CONNECTED, handle);
             break;
+        }
 
-        case BLE_GAP_EVT_DISCONNECTED:
+        case BLE_GAP_EVT_DISCONNECTED: {
+            Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle;
             // Since we are not in a connection and have not started advertising,
             // store bonds
             nRF51Gap::getInstance().setConnectionHandle (BLE_CONN_HANDLE_INVALID);
 #if NEED_BOND_MANAGER /* disabled by default */
             ASSERT_STATUS_RET_VOID ( ble_bondmngr_bonded_centrals_store());
 #endif
-            nRF51Gap::getInstance().handleEvent(GapEvents::GAP_EVENT_DISCONNECTED);
+            nRF51Gap::getInstance().processHandleSpecificEvent(GapEvents::GAP_EVENT_DISCONNECTED, handle);
             break;
+        }
 
         case BLE_GAP_EVT_SEC_PARAMS_REQUEST: {
             ble_gap_sec_params_t sec_params = {0};
@@ -122,7 +126,7 @@
 
         case BLE_GAP_EVT_TIMEOUT:
             if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISEMENT) {
-                nRF51Gap::getInstance().handleEvent(GapEvents::GAP_EVENT_TIMEOUT);
+                nRF51Gap::getInstance().processEvent(GapEvents::GAP_EVENT_TIMEOUT);
             }
             break;