Beacon demo for the BLE API using the nRF51822 native mode drivers

Dependencies:   BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1

Fork of BLE_iBeacon by Bluetooth Low Energy

Revision:
23:b66fa312e926
Parent:
22:080d9bf2f5c0
Child:
24:9bcd0dbf0f41
diff -r 080d9bf2f5c0 -r b66fa312e926 main.cpp
--- a/main.cpp	Fri May 23 16:17:13 2014 +0100
+++ b/main.cpp	Fri May 23 17:04:34 2014 +0100
@@ -61,18 +61,14 @@
     ble.init();
     ble.reset();
 
-    /* Setup advertising data. This includes AD structures in the payload of
-     * advertising packets. */
-    {
-        GapAdvertisingData advData;
-        advData.addFlags(GapAdvertisingData::BREDR_NOT_SUPPORTED);
-        advData.addData(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA,
-                        beaconPayload,
-                        sizeof(beaconPayload));
-        ble.setAdvertisingData(advData);
-    }
+    ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
+    ble.accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA,
+                                     beaconPayload,
+                                     sizeof(beaconPayload));
 
     ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED);
+    ble.setAdvertisingTimeout(0);    /* disable timeout. */
+    ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
     ble.startAdvertising();
 
     /* Do blinky on mainloopLED while we're waiting for BLE events */