BLE Feedbakc Service

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
ReneM92
Date:
Fri Jun 12 09:07:19 2015 +0000
Parent:
64:4ced7a1586b0
Commit message:
Kicking MrFeedback out

Changed in this revision

ble_feedback.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4ced7a1586b0 -r 5a78321ef3d3 ble_feedback.cpp
--- a/ble_feedback.cpp	Fri Jun 12 08:30:07 2015 +0000
+++ b/ble_feedback.cpp	Fri Jun 12 09:07:19 2015 +0000
@@ -21,6 +21,10 @@
         setupService();                
     }
     
+bool FeedbackService::isConnected(){
+    return ble.getGapState().connected;
+}
+    
 void FeedbackService::setupService(){
         printf("setting up");
         static bool serviceAdded = false; /* We should only ever need to add the heart rate service once. */
diff -r 4ced7a1586b0 -r 5a78321ef3d3 main.cpp
--- a/main.cpp	Fri Jun 12 08:30:07 2015 +0000
+++ b/main.cpp	Fri Jun 12 09:07:19 2015 +0000
@@ -54,13 +54,13 @@
     //ble.onDisconnection(disconnectionCallback);
 
     /* Setup primary service. */
-    //uint8_t battery = 100; 
-    FeedbackService FService();
+    uint8_t battery = 100; 
+    FeedbackService* FService = new FeedbackService();
 
     // infinite loop
- /*   while (1) {
+    while (1) {
      // check for trigger from periodicCallback()
-        if ( ble.getGapState().connected) {
+        if ( FService->isConnected() && FService->newValue()) {
             triggerSensorPolling = false;
 
             battery--;
@@ -68,10 +68,10 @@
             if (battery == 0) {
                 battery = 100;
             }
-            pc.printf("\n\r geschreven %d \n\r", FService.getTest());
-            FService.updateBatteryValue(battery);
+            pc.printf("\n\r geschreven %d \n\r", FService->getTest());
+            FService->updateBatteryValue(battery);
         } else {
-            ble.waitForEvent(); // low power wait for event
+            //ble.waitForEvent(); // low power wait for event
         }
-    }*/
+    }
 }