BLE EddystoneService example
This example is a fork of the following mbed-os example:
https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-EddystoneService/
Please read the documentation in this page.
Diff: source/main.cpp
- Revision:
- 12:b31d7c0f906c
- Parent:
- 3:5120491ba317
- Child:
- 29:2dfc5cc8569b
diff -r 2a0c01fa536c -r b31d7c0f906c source/main.cpp --- a/source/main.cpp Wed Oct 05 05:15:50 2016 +0100 +++ b/source/main.cpp Mon Oct 24 11:15:27 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" @@ -67,7 +67,7 @@ eddyServicePtr->getEddystoneParams(params); saveEddystoneServiceConfigParams(¶ms); } else { - eventQueue.post_in(CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS * 1000, timeout); + eventQueue.call_in(CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS * 1000, timeout); } } @@ -116,12 +116,12 @@ /* Start Eddystone in config mode */ eddyServicePtr->startConfigService(); - eventQueue.post_in(CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS * 1000, timeout); + eventQueue.call_in(CONFIG_ADVERTISEMENT_TIMEOUT_SECONDS * 1000, timeout); } void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) { BLE &ble = BLE::Instance(); - eventQueue.post(Callback<void()>(&ble, &BLE::processEvents)); + eventQueue.call(Callback<void()>(&ble, &BLE::processEvents)); } @@ -132,14 +132,12 @@ setbuf(stderr, NULL); setbuf(stdin, NULL); - eventQueue.post_every(500, blinky); + eventQueue.call_every(500, blinky); BLE &ble = BLE::Instance(); ble.onEventsToProcess(scheduleBleEventsProcessing); ble.init(bleInitComplete); - while (true) { - eventQueue.dispatch(); - } + eventQueue.dispatch_forever(); return 0; }