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:
vwochnik
Date:
Fri Oct 24 15:21:21 2014 +0000
Parent:
60:3c822f97fc73
Child:
62:86a04c5bda18
Commit message:
operation support

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
operation/OperationSupport.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Oct 24 15:00:36 2014 +0000
+++ b/main.cpp	Fri Oct 24 15:21:21 2014 +0000
@@ -27,7 +27,7 @@
     MDMRtos<MDMSerial> mdm;
     GPSI2C gps;
     
-    mdm.setDebug(4);
+    //mdm.setDebug(4);
 
     if (!mdm.init(SIM_PIN, &devStatus))
         status = 1;
--- 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)