Demo for the LinkLoss Service.
Dependencies: BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1
Diff: main.cpp
- Revision:
- 4:88dca48b2397
- Parent:
- 1:88466c5aed5f
- Child:
- 5:04920b552c37
--- a/main.cpp Mon May 11 07:08:37 2015 +0000 +++ b/main.cpp Sat Jun 20 23:37:56 2015 +0000 @@ -15,14 +15,14 @@ */ #include "mbed.h" -#include "BLEDevice.h" +#include "BLE.h" #include "LinkLossService.h" -BLEDevice ble; +BLE ble; void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) { - ble.startAdvertising(); + ble.gap().startAdvertising(); } void linkLossCallback(LinkLossService::AlertLevel_t level) @@ -33,14 +33,14 @@ int main(void) { ble.init(); - ble.onDisconnection(disconnectionCallback); + ble.gap().onDisconnection(disconnectionCallback); LinkLossService linkLoss(ble, linkLossCallback, LinkLossService::HIGH_ALERT); - ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - ble.setAdvertisingInterval(1000); /* 1second. */ - ble.startAdvertising(); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); + ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); + ble.gap().setAdvertisingInterval(1000); /* 1second. */ + ble.gap().startAdvertising(); while (true) { ble.waitForEvent();