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:
95:010b0f7a0a1a
Parent:
94:61d44636f020
Child:
99:e369fc75c000
--- a/operation/ReportThread.cpp	Mon Apr 20 15:04:23 2015 +0000
+++ b/operation/ReportThread.cpp	Wed Apr 22 11:22:25 2015 +0000
@@ -1,7 +1,7 @@
 #include "ReportThread.h"
 #include "logging.h"
 
-const char fmt2[] = "111,%ld,%s\r\n";
+const char *fmt2 = "111,%ld,%s\r\n";
 
 void ReportThread::threadFunc()
 {
@@ -13,10 +13,22 @@
             OperationState state = op->state;
             ipool.free(op);
             int l = snprintf(buf2, sizeof(buf2), fmt2, id, strOperationState(state));
+            for (unsigned short i = 0; i < 10; ++i) {
+                osEvent e = ipool.get(200);
+                if (e.status == osEventMail) {
+                    op = (Operation*)e.value.p;
+                    id = op->identifier;
+                    OperationState state = op->state;
+                    ipool.free(op);
+                    l += snprintf(buf2+l, SMARRESTBODY_SIZE-l, fmt2, id, strOperationState(state));
+                } else {
+                    break;
+                }
+            }
             l = snprintf(buf, sizeof(buf), getSmartRestFmt(), uri, l, buf2);
             l = sock.sendOnly(buf, l);
             if (l < 0) {
-                    aError("Report: <%ld, %s>\n", id, strOperationState(state));
+                aError("Report: <%ld, %s>\n", id, strOperationState(state));
             }
         }
     }