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:
- 65:a62dbef2f924
- Parent:
- 63:010bbbb4732a
- Child:
- 67:c360a2b2c948
--- a/operation/OperationSupport.cpp Thu Oct 30 12:30:04 2014 +0000 +++ b/operation/OperationSupport.cpp Thu Oct 30 13:38:20 2014 +0000 @@ -4,18 +4,17 @@ #include "ComposedRecord.h" #include "CharValue.h" #include "IntegerValue.h" -#include <stdio.h> CharValue aOperationStatePending("PENDING"); CharValue aOperationStateExecuting("EXECUTING"); CharValue aOperationStateSuccessful("SUCCESSFUL"); CharValue aOperationStateFailed("FAILED"); -OperationSupport::OperationSupport(AbstractSmartRest& client, SmartRestTemplate& tpl, long& deviceId) : +OperationSupport::OperationSupport(AbstractSmartRest& client, SmartRestTemplate& tpl, long& deviceId, DeviceIO& io) : _client(client), _tpl(tpl), _deviceId(deviceId), - _executor(client, tpl, deviceId), + _executor(client, tpl, deviceId, io), _thread1(OperationSupport::thread1_func, this), _thread2(OperationSupport::thread2_func, this) { @@ -83,21 +82,15 @@ } while ((ret = _client.receive(received)) == SMARTREST_SUCCESS) { - if (!operationFromRecord(received, op)) { - puts("Operation conversion failed."); + if (!operationFromRecord(received, op)) continue; - } - if (!_store.enqueue(op)) { - puts("Cannot enqueue operation."); + if (!_store.enqueue(op)) continue; - } - puts("Enqueued operation."); } _client.stop(); if ((ret != SMARTREST_END_OF_RESPONSE) && (ret != SMARTREST_CONNECTION_CLOSED)) { - puts("Failed receive."); return false; } @@ -223,9 +216,7 @@ continue; } - if (_client.send(aggr) != SMARTREST_SUCCESS) { - puts("Failed to update."); - } + if (_client.send(aggr) != SMARTREST_SUCCESS) { } _client.stop(); aggr.clear(); }