Fork of BLE_SecureHeartRate : should this 'work' i.e. require a secure connection on an nRF51-DK? Hopefully I'm just missing something obvious - or is this broken?
Dependencies: BLE_API mbed nRF51822
Fork of BLE_SecureHeartRate by
Diff: main.cpp
- Revision:
- 6:715150f7f293
- Parent:
- 5:ed2cb43f3589
- Child:
- 7:e8dfe1c97c71
diff -r ed2cb43f3589 -r 715150f7f293 main.cpp --- a/main.cpp Fri Jun 19 23:57:59 2015 +0000 +++ b/main.cpp Sat Jun 20 23:44:08 2015 +0000 @@ -19,7 +19,7 @@ #include "HeartRateSecService.h" #include "DeviceInformationService.h" -BLEDevice ble; +BLE ble; DigitalOut led1(LED1); const static char DEVICE_NAME[] = "HRM_SEC"; @@ -77,13 +77,13 @@ /* Initialize BLE security */ bool enableBonding = true; bool requireMITM = true; - ble.initializeSecurity(enableBonding, requireMITM, SecurityManager::IO_CAPS_DISPLAY_ONLY); + ble.securityManager().init(enableBonding, requireMITM, SecurityManager::IO_CAPS_DISPLAY_ONLY); /* Set callback functions */ - ble.onConnection(connectionCallback); - ble.onDisconnection(disconnectionCallback); - ble.onPasskeyDisplay(passkeyDisplayCallback); - ble.onSecuritySetupCompleted(securitySetupCompletedCallback); + ble.gap().onConnection(connectionCallback); + ble.gap().onDisconnection(disconnectionCallback); + ble.securityManager().onPasskeyDisplay(passkeyDisplayCallback); + ble.securityManager().onSecuritySetupCompleted(securitySetupCompletedCallback); /* Setup primary service. */ uint8_t hrmCounter = 100; // init HRM to 100bps @@ -93,14 +93,14 @@ DeviceInformationService deviceInfo(ble, "ARM", "Model1", "SN1", "hw-rev1", "fw-rev1", "soft-rev1"); /* Setup advertising. */ - ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); - ble.accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_HEART_RATE_SENSOR); - ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); - ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - ble.setAdvertisingInterval(1000); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_HEART_RATE_SENSOR); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); + ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); + ble.gap().setAdvertisingInterval(1000); - ble.startAdvertising(); + ble.gap().startAdvertising(); // infinite loop while (1) {