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.
Fork of nRF51822 by
Diff: btle/btle.cpp
- Revision:
- 370:295f76db798e
- Parent:
- 362:6fa0d4d555f6
- Child:
- 371:8f7d2137727a
diff -r 7455428e5ddb -r 295f76db798e btle/btle.cpp --- a/btle/btle.cpp Thu Jul 02 09:08:45 2015 +0100 +++ b/btle/btle.cpp Mon Jul 06 10:13:26 2015 +0100 @@ -30,15 +30,12 @@ #include "softdevice_handler.h" #include "pstorage.h" -#include "ble/GapEvents.h" +#include "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); @@ -107,8 +104,6 @@ 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: { @@ -118,7 +113,6 @@ 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); @@ -153,11 +147,13 @@ } case BLE_GAP_EVT_PASSKEY_DISPLAY: - nRF51SecurityManager::getInstance().processPasskeyDisplayEvent(p_ble_evt->evt.gap_evt.conn_handle, p_ble_evt->evt.gap_evt.params.passkey_display.passkey); + nRF51Gap::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: - nRF51Gap::getInstance().processTimeoutEvent(static_cast<Gap::TimeoutSource_t>(p_ble_evt->evt.gap_evt.params.timeout.src)); + if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING) { + nRF51Gap::getInstance().processEvent(GapEvents::GAP_EVENT_TIMEOUT); + } break; case BLE_GATTC_EVT_TIMEOUT: @@ -172,7 +168,7 @@ nRF51Gap::getInstance().processAdvertisementReport(advReport->peer_addr.addr, advReport->rssi, advReport->scan_rsp, - static_cast<GapAdvertisingParams::AdvertisingType_t>(advReport->type), + static_cast<Gap::AdvertisementType_t>(advReport->type), advReport->dlen, advReport->data); break;