Basic message sending over an ad hoc ble network
Fork of mbed-os-example-ble-LEDBlinker by
Diff: source/main.cpp
- Revision:
- 12:059c7b7fb18a
- Parent:
- 4:9a6b0d5ea664
- Child:
- 28:64621b6587e1
diff -r 81616ecf4497 -r 059c7b7fb18a source/main.cpp --- a/source/main.cpp Wed Oct 05 05:16:07 2016 +0100 +++ b/source/main.cpp Mon Oct 24 11:15:41 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/DiscoveredCharacteristic.h" @@ -95,7 +95,7 @@ printf("terminated SD for handle %u\r\n", connectionHandle); if (triggerLedCharacteristic) { triggerLedCharacteristic = false; - eventQueue.post(updateLedCharacteristic); + eventQueue.call(updateLedCharacteristic); } } @@ -168,21 +168,19 @@ 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() { triggerLedCharacteristic = false; - eventQueue.post_every(500, periodicCallback); + eventQueue.call_every(500, periodicCallback); BLE &ble = BLE::Instance(); ble.onEventsToProcess(scheduleBleEventsProcessing); ble.init(bleInitComplete); - while (true) { - eventQueue.dispatch(); - } + eventQueue.dispatch_forever(); return 0; }