Official reference client implementation for Cumulocity SmartREST on u-blox C027.

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Revision:
137:a52821cdb108
Parent:
135:c4009ecaf5c0
--- a/MbedAgent.cpp	Mon Aug 10 14:20:40 2015 +0000
+++ b/MbedAgent.cpp	Mon Feb 15 09:49:35 2016 +0000
@@ -99,21 +99,25 @@
     pollThread.setChannel(deviceID);
 
     Watchdog wdt;
-    wdt.kick(60.0);    // set a 60.0 seconds watchdog
+    wdt.kick(300.0);    // set a 60.0 seconds watchdog
     while (true) {
         int l = 0;
+        bool flag = false;
         for (size_t i = 0; i < N; ++i) {
 //            if (reporters[i] == &ConfigSync::inst()) {
             int l2 = reporters[i]->read(buf2+l, sizeof(buf2)-l, status, DISPLAY_LEN);
-            if (l2) { // Refresh LCD display needed
+            if (l2 < 0) {
+                flag |= reporters[i] == &signal;
+            } else if (l2 > 0) { // Refresh LCD display needed
+                l += l2;
                 LCDDisplay::inst().setThirdLine(status);
+                lcdThirdLineBlank = false;
                 Thread::wait(400);
-            } else if (!lcdThirdLineBlank && !l2) { // Clear LCD display needed
+            } else if (!lcdThirdLineBlank) { // Clear LCD display needed
                 LCDDisplay::inst().setThirdLine("");
+                lcdThirdLineBlank = true;
                 Thread::wait(100);
             }
-            lcdThirdLineBlank = !l2;
-            l += l2;
 //            }
         }
         if (l) {
@@ -123,6 +127,7 @@
             if (l < 0)
                 aWarning("%s\n", status);
         }
-        wdt.kick();    // reset watchdog timer
+        if (!flag)
+            wdt.kick();    // reset watchdog timer
     }
 }
\ No newline at end of file