Send continuous stream to mobile

Dependencies:   MPU9250

Fork of pdiot-ble-notify-array by Andrew Bates

Revision:
14:014670ad5e18
Parent:
5:b630d2a88c51
Child:
30:84797119c14a
--- a/source/main.cpp	Wed Oct 05 05:15:43 2016 +0100
+++ b/source/main.cpp	Mon Oct 24 11:15:18 2016 +0100
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <mbed-events/events.h>
+#include <events/mbed_events.h>
 
 #include <mbed.h>
 #include "ble/BLE.h"
@@ -34,12 +34,12 @@
 
 void buttonPressedCallback(void)
 {
-    eventQueue.post(Callback<void(bool)>(buttonServicePtr, &ButtonService::updateButtonState), true);
+    eventQueue.call(Callback<void(bool)>(buttonServicePtr, &ButtonService::updateButtonState), true);
 }
 
 void buttonReleasedCallback(void)
 {
-    eventQueue.post(Callback<void(bool)>(buttonServicePtr, &ButtonService::updateButtonState), false);
+    eventQueue.call(Callback<void(bool)>(buttonServicePtr, &ButtonService::updateButtonState), false);
 }
 
 void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
@@ -92,20 +92,18 @@
 
 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()
 {
-    eventQueue.post_every(500, blinkCallback);
+    eventQueue.call_every(500, blinkCallback);
 
     BLE &ble = BLE::Instance();
     ble.onEventsToProcess(scheduleBleEventsProcessing);
     ble.init(bleInitComplete);
 
-    while (true) {
-        eventQueue.dispatch();
-    }
+    eventQueue.dispatch_forever();
 
     return 0;
 }