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

Files at this revision

API Documentation at this revision

Comitter:
xinlei
Date:
Mon Jun 01 11:24:17 2015 +0000
Parent:
124:311fa85af2b3
Child:
126:e1fcf720c63a
Commit message:
Poti: sample interval extended to 10 ms.; Polling: pointer null checking in handshake

Changed in this revision

MbedAgent.cpp Show annotated file Show diff for this revision Revisions of this file
measurement/Potentiometer.cpp Show annotated file Show diff for this revision Revisions of this file
operation/PollThread.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MbedAgent.cpp	Fri May 29 12:05:01 2015 +0000
+++ b/MbedAgent.cpp	Mon Jun 01 11:24:17 2015 +0000
@@ -103,7 +103,7 @@
     while (true) {
         int l = 0;
         for (size_t i = 0; i < N; ++i) {
-//            if (reporters[i] == &ConfigSync::inst()) {
+            if (reporters[i] == &ConfigSync::inst()) {
             int l2 = reporters[i]->read(buf2+l, sizeof(buf2)-l, status, DISPLAY_LEN);
             if (l2) { // Refresh LCD display needed
                 LCDDisplay::inst().setThirdLine(status);
@@ -114,7 +114,7 @@
             }
             lcdThirdLineBlank = !l2;
             l += l2;
-//            }
+            }
         }
         if (l) {
             l = snprintf(buf, sizeof(buf), fmtSmartRest, "/s", l, buf2);
--- a/measurement/Potentiometer.cpp	Fri May 29 12:05:01 2015 +0000
+++ b/measurement/Potentiometer.cpp	Mon Jun 01 11:24:17 2015 +0000
@@ -38,7 +38,7 @@
                 min[1] = min[1] <= d1 ? min[1] : d1;
                 max[0] = max[0] >= d0 ? max[0] : d0;
                 max[1] = max[1] >= d1 ? max[1] : d1;
-                Thread::wait(5);
+                Thread::wait(10);
         }
         data[0] = (data[0]-min[0]-max[0]) / (N-2);
         data[1] = (data[1]-min[1]-max[1]) / (N-2);
--- a/operation/PollThread.cpp	Fri May 29 12:05:01 2015 +0000
+++ b/operation/PollThread.cpp	Mon Jun 01 11:24:17 2015 +0000
@@ -9,10 +9,11 @@
         l = snprintf(buf, sizeof(buf), fmtSmartRest, uri, l, buf2);
         sock.setBlocking(3000);
         l = sock.sendAndReceive(buf, l, sizeof(buf));
-        if (l <= 0)
-                return false;
+        if (l <= 0) return false;
+        const char* p = skipHTTPHeader(buf);
+        if (p == NULL) return false;
         size_t i = 0;
-        for (const char* p = skipHTTPHeader(buf); isalnum(*p); ++p, ++i) {
+        for (; isalnum(*p); ++p, ++i) {
                 bayeuxId[i] = *p;
         }
         bayeuxId[i] = 0;