Cumulocity Official / Mbed 2 deprecated MbedSmartRestMain Featured

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Revision:
61:15719dbe8820
Parent:
60:3c822f97fc73
Child:
62:86a04c5bda18
--- a/operation/OperationSupport.cpp	Fri Oct 24 15:00:36 2014 +0000
+++ b/operation/OperationSupport.cpp	Fri Oct 24 15:21:21 2014 +0000
@@ -118,6 +118,7 @@
 
 bool OperationSupport::updateOperation(OperationStore::Operation& op)
 {
+    uint8_t ret; bool found;
     ComposedRecord record;
     ParsedRecord received;
     
@@ -132,15 +133,20 @@
         return false;
     }
     
-    if (_client.receive(received) != SMARTREST_SUCCESS) {
-        _client.stop();
-        return false;
+    found = false;
+    while ((ret = _client.receive(received)) == SMARTREST_SUCCESS) {
+        if ((received.values() == 4) &&
+            (received.value(0).valueType() == VALUE_INTEGER) &&
+            (received.value(0).integerValue() == 211) &&
+            (received.value(2).valueType() == VALUE_INTEGER) &&
+            (received.value(2).integerValue() == op.identifier)) {
+            found = true;
+            break;
+        }
     }
-    
     _client.stop();
-    
-    //TODO: assertions
-    return true;
+
+    return found;
 }
 
 CharValue& OperationSupport::operationStateValue(OperationStore::Operation& op)