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.h
- Revision:
- 93:0acd11870c6a
- Parent:
- 91:423177e8a401
- Child:
- 94:61d44636f020
--- a/operation/OperationSupport.h Fri Mar 20 14:27:10 2015 +0000 +++ b/operation/OperationSupport.h Mon Apr 13 14:24:58 2015 +0000 @@ -3,34 +3,36 @@ #include "rtos.h" #include "ConfigurationSynchronization.h" -#include "DeviceIO.h" #include "OperationExecutor.h" -#include "AbstractSmartRest.h" +//#include "AbstractSmartRest.h" +#include "RtosSmartRest.h" #include "SmartRestTemplate.h" #include "ComposedRecord.h" #include "CharValue.h" -#include "OperationStore.h" +#include "Operation.h" #include "ParsedRecord.h" +#include "IntegerValue.h" + +#define POOL_SIZE 64 class OperationSupport { public: - OperationSupport(AbstractSmartRest&, SmartRestTemplate&, long&, ConfigurationSynchronization&, DeviceIO&, DisplayInfo&); - + OperationSupport(RtosSmartRest&, SmartRestTemplate&, long&, ConfigurationSynchronization&, LCDDisplay&); + bool init(); bool run(); protected: bool requestPendingOperations(); - bool operationFromRecord(ParsedRecord&, OperationStore::Operation&); - bool updateOperation(OperationStore::Operation&); - CharValue& operationStateValue(OperationStore::Operation&); + bool operationFromRecord(ParsedRecord&, Operation&); + bool executePendingOperation(Operation&); +// CharValue& operationStateValue(OperationState state) const; + const char * getOperationStateChar(OperationState) const; - void thread1(); void thread2(); void thread3(); - static void thread1_func(void const*); static void thread2_func(void const*); static void thread3_func(void const*); @@ -38,17 +40,14 @@ bool _init, _firstRun; long& _deviceId; SmartRestTemplate& _tpl; - AbstractSmartRest& _client; - OperationStore _store; + RtosSmartRest& _client; + Mail<Operation, POOL_SIZE> opool; OperationExecutor _executor; - Thread _thread1; + TCPSocketConnection sock; + char buf[300]; + char buf2[50]; Thread _thread2; Thread _thread3; }; -extern CharValue aOperationStatePending; -extern CharValue aOperationStateExecuting; -extern CharValue aOperationStateSuccessful; -extern CharValue aOperationStateFailed; - #endif \ No newline at end of file