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: BLE_API mbed nRF51822
Fork of BLE_Button by
Diff: main.cpp
- Revision:
- 6:18d8750f39ee
- Parent:
- 5:43a3ab27f2e4
- Child:
- 8:a7ba7aaba460
--- a/main.cpp Sat Jun 20 00:00:32 2015 +0000
+++ b/main.cpp Sat Jun 20 23:52:29 2015 +0000
@@ -18,7 +18,7 @@
#include "BLE.h"
#include "ButtonService.h"
-BLEDevice ble;
+BLE ble;
DigitalOut led1(LED1);
InterruptIn button(BUTTON1);
@@ -39,7 +39,7 @@
void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
{
- ble.startAdvertising();
+ ble.gap().startAdvertising();
}
void periodicCallback(void)
@@ -56,18 +56,18 @@
button.rise(buttonReleasedCallback);
ble.init();
- ble.onDisconnection(disconnectionCallback);
+ ble.gap().onDisconnection(disconnectionCallback);
ButtonService buttonService(ble, false /* initial value for button pressed */);
buttonServicePtr = &buttonService;
/* 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::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
- ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
- ble.setAdvertisingInterval(1000); /* 1000ms. */
- ble.startAdvertising();
+ 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::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
+ ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
+ ble.gap().setAdvertisingInterval(1000); /* 1000ms. */
+ ble.gap().startAdvertising();
while (true) {
ble.waitForEvent();
