This example creates a BLE beacon: a method of advertising a small amount of information to nearby devices. The information doesn't have to be human-readable; it can be in a format that only an application can use. Beacons are very easy to set up: the code for all beacons is the same, and only the information you want to advertise - the beacon payload - needs to change. he canonical source for this example lives at https://github.com/ARMmbed/mbed-os-example-ble/tree/master/BLE_Beacon

Revision:
12:af576944a152
Parent:
3:41f6be68aefb
Child:
28:9090fe431353
--- a/source/main.cpp	Wed Oct 05 05:15:36 2016 +0100
+++ b/source/main.cpp	Mon Oct 24 11:15:13 2016 +0100
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <mbed-events/events.h>
+#include <events/mbed_events.h>
 #include <mbed.h>
 #include "ble/BLE.h"
 #include "ble/services/iBeacon.h"
@@ -73,7 +73,7 @@
 
 void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) {
     BLE &ble = BLE::Instance();
-    eventQueue.post(Callback<void()>(&ble, &BLE::processEvents));
+    eventQueue.call(Callback<void()>(&ble, &BLE::processEvents));
 }
 
 int main()
@@ -82,9 +82,7 @@
     ble.onEventsToProcess(scheduleBleEventsProcessing);
     ble.init(bleInitComplete);
 
-    while (true) {
-        eventQueue.dispatch();
-    }
+    eventQueue.dispatch_forever();
 
     return 0;
 }