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.
Dependencies: nrf51-sdk
Dependents: microbit-dal microbit-ble-open microbit-dal-eddystone microbit-dal-ble-accelerometer-example ... more
Diff: btle/btle.cpp
- Revision:
- 362:6fa0d4d555f6
- Parent:
- 361:d2405f5a4853
- Child:
- 370:295f76db798e
diff -r d2405f5a4853 -r 6fa0d4d555f6 btle/btle.cpp
--- a/btle/btle.cpp Thu Jul 02 09:08:44 2015 +0100
+++ b/btle/btle.cpp Thu Jul 02 09:08:44 2015 +0100
@@ -30,12 +30,15 @@
#include "softdevice_handler.h"
#include "pstorage.h"
-#include "GapEvents.h"
+#include "ble/GapEvents.h"
#include "nRF51Gap.h"
#include "nRF51GattServer.h"
+#include "nRF51SecurityManager.h"
+
#include "device_manager.h"
#include "ble_hci.h"
+#include "btle_discovery.h"
extern "C" void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name);
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name);
@@ -104,6 +107,8 @@
dm_ble_evt_handler(p_ble_evt);
+ bleGattcEventHandler(p_ble_evt);
+
/* Custom event handler */
switch (p_ble_evt->header.evt_id) {
case BLE_GAP_EVT_CONNECTED: {
@@ -113,6 +118,7 @@
const ble_gap_addr_t *peer = &p_ble_evt->evt.gap_evt.params.connected.peer_addr;
const ble_gap_addr_t *own = &p_ble_evt->evt.gap_evt.params.connected.own_addr;
nRF51Gap::getInstance().processConnectionEvent(handle,
+ static_cast<Gap::Role_t>(p_ble_evt->evt.gap_evt.params.connected.role),
static_cast<Gap::AddressType_t>(peer->addr_type), peer->addr,
static_cast<Gap::AddressType_t>(own->addr_type), own->addr,
params);
@@ -147,13 +153,11 @@
}
case BLE_GAP_EVT_PASSKEY_DISPLAY:
- nRF51Gap::getInstance().processPasskeyDisplayEvent(p_ble_evt->evt.gap_evt.conn_handle, p_ble_evt->evt.gap_evt.params.passkey_display.passkey);
+ nRF51SecurityManager::getInstance().processPasskeyDisplayEvent(p_ble_evt->evt.gap_evt.conn_handle, p_ble_evt->evt.gap_evt.params.passkey_display.passkey);
break;
case BLE_GAP_EVT_TIMEOUT:
- if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING) {
- nRF51Gap::getInstance().processEvent(GapEvents::GAP_EVENT_TIMEOUT);
- }
+ nRF51Gap::getInstance().processTimeoutEvent(static_cast<Gap::TimeoutSource_t>(p_ble_evt->evt.gap_evt.params.timeout.src));
break;
case BLE_GATTC_EVT_TIMEOUT:
@@ -168,7 +172,7 @@
nRF51Gap::getInstance().processAdvertisementReport(advReport->peer_addr.addr,
advReport->rssi,
advReport->scan_rsp,
- static_cast<Gap::AdvertisementType_t>(advReport->type),
+ static_cast<GapAdvertisingParams::AdvertisingType_t>(advReport->type),
advReport->dlen,
advReport->data);
break;