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:
116:4eb3c7e945cf
Parent:
109:2ec12f10ebf4
--- a/operation/ReportThread.h	Fri May 15 15:09:19 2015 +0000
+++ b/operation/ReportThread.h	Mon May 18 09:29:12 2015 +0000
@@ -11,23 +11,22 @@
         OperationDict(): count(0) {}
         const Operation& operator [](unsigned short i) const { return opl[i]; }
         Operation *set(long id, OperationState state) {
-                unsigned short i = 0;
-                for (; i < count; ++i) {
+                short i = count-1;
+                for (; i >= 0; --i) {
                         if (opl[i].identifier == id)
                                 break;
                 }
-                if (i < count) {
+                if (i >= 0) {
                         opl[i].identifier = id;
                         opl[i].state = state;
                         return &opl[i];
                 } else if (count < OPERATION_DICT_SIZE) {
+                        i = count++;
                         opl[i].identifier = id;
                         opl[i].state = state;
-                        ++count;
                         return &opl[i];
                 } else
                         return NULL;
-
         }
         void clear() { count = 0; }
         bool full() const { return count >= OPERATION_DICT_SIZE; }