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
Diff: operation/OperationSupport.cpp
- Revision:
- 77:f6717e4eccc4
- Parent:
- 70:f489ca11f254
- Child:
- 81:4a7761914901
--- a/operation/OperationSupport.cpp Wed Feb 25 10:06:11 2015 +0000 +++ b/operation/OperationSupport.cpp Tue Mar 03 14:10:09 2015 +0000 @@ -1,5 +1,5 @@ +#include <string.h> #include "OperationSupport.h" -#include <string.h> #include "Aggregator.h" #include "ComposedRecord.h" #include "CharValue.h" @@ -62,7 +62,6 @@ if (!requestPendingOperations()) return false; } - return true; } @@ -94,8 +93,7 @@ if ((ret != SMARTREST_END_OF_RESPONSE) && (ret != SMARTREST_CONNECTION_CLOSED)) { return false; - } - + } return true; } @@ -129,10 +127,8 @@ bool OperationSupport::updateOperation(OperationStore::Operation& op) { - uint8_t ret; bool found; ComposedRecord record; - ParsedRecord received; - + ParsedRecord received; IntegerValue msgId(111); IntegerValue operationId(op.identifier); if ((!record.add(msgId)) || (!record.add(operationId)) || @@ -144,7 +140,8 @@ return false; } - found = false; + bool found = false; + uint8_t ret; while ((ret = _client.receive(received)) == SMARTREST_SUCCESS) { if ((received.values() == 4) && (received.value(0).valueType() == VALUE_INTEGER) && @@ -230,7 +227,6 @@ void OperationSupport::thread3() { char bayeuxId[33]; - ComposedRecord record; ParsedRecord received; OperationStore::Operation op; @@ -241,7 +237,6 @@ // request Bayeux ID { const char *str; - IntegerValue msgId(80); if (!record.add(msgId)) return; @@ -251,7 +246,6 @@ _client.stop(); return; } - _client.stop(); str = received.value(0).characterValue(); @@ -264,9 +258,8 @@ // set channel { - char chn[16]; int len; - - len = 0; + char chn[16]; + int len = 0; snprintf(chn, sizeof(chn), "/%ld%n", _deviceId, &len); if ((len == 0) || (len == sizeof(chn))) return;