An example of creating and updating a simple GATT Service using the BLE_API
Dependencies: BLE_API mbed nRF51822
Fork of BLE_BatteryLevel by
Revision 13:60e095fe4b45, committed 2014-12-16
- Comitter:
- rgrover1
- Date:
- Tue Dec 16 09:12:25 2014 +0000
- Parent:
- 12:4024aa3f72b0
- Child:
- 14:39b4b11d9cf5
- Commit message:
- minor re-ordering around the creation of BatteryService.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 15 08:10:46 2014 +0000
+++ b/main.cpp Tue Dec 16 09:12:25 2014 +0000
@@ -45,14 +45,14 @@
ble.init();
ble.onDisconnection(disconnectionCallback);
+ BatteryService batteryService(ble, batteryLevel);
+
/* setup advertising */
ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
ble.setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(1000)); /* 1000ms; in multiples of 0.625ms. */
ble.startAdvertising();
- BatteryService batteryService(ble, batteryLevel);
-
while (true) {
ble.waitForEvent(); // this will return upon any system event (such as an interrupt or a ticker wakeup)
