Originally from Donal's blog article. http://mbed.org/users/donalm/code/BLE_Health_Thermometer_Blog/ Changed low freq. clock source from XTAL to IRC.

Dependents:   BLE_Health_Thermometer_IRC BLE_RCBController_micono_test BLE_konashi_PIO_test BLE_ADT7410_TMP102_Sample ... more

Fork of BLE_API_Native_blog by Donal Morrissey

Revision:
8:b346eddb9346
Parent:
3:cb37056dbcc6
Child:
14:f3991f810e1b
--- a/hw/nRF51822n/btle/btle.cpp	Thu Feb 13 11:27:58 2014 +0000
+++ b/hw/nRF51822n/btle/btle.cpp	Fri Feb 14 10:50:45 2014 +0000
@@ -91,16 +91,16 @@
   ble_conn_params_on_ble_evt(p_ble_evt);
 
   /* Custom event handler */
-  static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID;
   switch (p_ble_evt->header.evt_id)
   {
     case BLE_GAP_EVT_CONNECTED:
-      m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
+      nRF51GattServer::getInstance().m_connectionHandle = p_ble_evt->evt.gap_evt.conn_handle;
       nRF51Gap::getInstance().handleEvent(GapEvents::GAP_EVENT_CONNECTED);
       break;
 
     case BLE_GAP_EVT_DISCONNECTED:
       // Since we are not in a connection and have not started advertising, store bonds
+      nRF51GattServer::getInstance().m_connectionHandle = p_ble_evt->evt.gap_evt.conn_handle;
       ASSERT_STATUS_RET_VOID ( ble_bondmngr_bonded_centrals_store() );
       nRF51Gap::getInstance().handleEvent(GapEvents::GAP_EVENT_DISCONNECTED);
       break;
@@ -117,7 +117,7 @@
         sec_params.min_key_size = CFG_BLE_SEC_PARAM_MIN_KEY_SIZE    ;
         sec_params.max_key_size = CFG_BLE_SEC_PARAM_MAX_KEY_SIZE    ;
 
-        ASSERT_STATUS_RET_VOID ( sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, &sec_params) );
+        ASSERT_STATUS_RET_VOID ( sd_ble_gap_sec_params_reply(nRF51GattServer::getInstance().m_connectionHandle, BLE_GAP_SEC_STATUS_SUCCESS, &sec_params) );
       }
       break;