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
operation/OperationSupport.h@65:a62dbef2f924, 2014-10-30 (annotated)
- Committer:
- vwochnik
- Date:
- Thu Oct 30 13:38:20 2014 +0000
- Revision:
- 65:a62dbef2f924
- Parent:
- 63:010bbbb4732a
- Child:
- 67:c360a2b2c948
operation support
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vwochnik | 57:4af5f1bec3a6 | 1 | #ifndef OPERATIONSUPPORT_H |
vwochnik | 57:4af5f1bec3a6 | 2 | #define OPERATIONSUPPORT_H |
vwochnik | 57:4af5f1bec3a6 | 3 | |
vwochnik | 60:3c822f97fc73 | 4 | #include "rtos.h" |
vwochnik | 65:a62dbef2f924 | 5 | #include "DeviceIO.h" |
vwochnik | 62:86a04c5bda18 | 6 | #include "OperationExecutor.h" |
vwochnik | 57:4af5f1bec3a6 | 7 | #include "AbstractSmartRest.h" |
vwochnik | 57:4af5f1bec3a6 | 8 | #include "SmartRestTemplate.h" |
vwochnik | 59:f96be79feccd | 9 | #include "ComposedRecord.h" |
vwochnik | 59:f96be79feccd | 10 | #include "CharValue.h" |
vwochnik | 59:f96be79feccd | 11 | #include "OperationStore.h" |
vwochnik | 59:f96be79feccd | 12 | #include "ParsedRecord.h" |
vwochnik | 57:4af5f1bec3a6 | 13 | |
vwochnik | 57:4af5f1bec3a6 | 14 | class OperationSupport |
vwochnik | 57:4af5f1bec3a6 | 15 | { |
vwochnik | 57:4af5f1bec3a6 | 16 | public: |
vwochnik | 65:a62dbef2f924 | 17 | OperationSupport(AbstractSmartRest&, SmartRestTemplate&, long&, DeviceIO&); |
vwochnik | 57:4af5f1bec3a6 | 18 | |
vwochnik | 57:4af5f1bec3a6 | 19 | bool init(); |
vwochnik | 57:4af5f1bec3a6 | 20 | bool run(); |
vwochnik | 57:4af5f1bec3a6 | 21 | |
vwochnik | 59:f96be79feccd | 22 | protected: |
vwochnik | 63:010bbbb4732a | 23 | bool requestPendingOperations(); |
vwochnik | 59:f96be79feccd | 24 | bool operationFromRecord(ParsedRecord&, OperationStore::Operation&); |
vwochnik | 59:f96be79feccd | 25 | bool updateOperation(OperationStore::Operation&); |
vwochnik | 59:f96be79feccd | 26 | CharValue& operationStateValue(OperationStore::Operation&); |
vwochnik | 59:f96be79feccd | 27 | |
vwochnik | 63:010bbbb4732a | 28 | void thread1(); |
vwochnik | 63:010bbbb4732a | 29 | void thread2(); |
vwochnik | 63:010bbbb4732a | 30 | |
vwochnik | 63:010bbbb4732a | 31 | static void thread1_func(void const*); |
vwochnik | 63:010bbbb4732a | 32 | static void thread2_func(void const*); |
vwochnik | 60:3c822f97fc73 | 33 | |
vwochnik | 57:4af5f1bec3a6 | 34 | private: |
vwochnik | 57:4af5f1bec3a6 | 35 | bool _init; |
vwochnik | 57:4af5f1bec3a6 | 36 | long& _deviceId; |
vwochnik | 57:4af5f1bec3a6 | 37 | SmartRestTemplate& _tpl; |
vwochnik | 57:4af5f1bec3a6 | 38 | AbstractSmartRest& _client; |
vwochnik | 62:86a04c5bda18 | 39 | OperationStore _store; |
vwochnik | 62:86a04c5bda18 | 40 | OperationExecutor _executor; |
vwochnik | 63:010bbbb4732a | 41 | Thread _thread1, _thread2; |
vwochnik | 57:4af5f1bec3a6 | 42 | }; |
vwochnik | 57:4af5f1bec3a6 | 43 | |
vwochnik | 59:f96be79feccd | 44 | extern CharValue aOperationStatePending; |
vwochnik | 59:f96be79feccd | 45 | extern CharValue aOperationStateExecuting; |
vwochnik | 59:f96be79feccd | 46 | extern CharValue aOperationStateSuccessful; |
vwochnik | 59:f96be79feccd | 47 | extern CharValue aOperationStateFailed; |
vwochnik | 59:f96be79feccd | 48 | |
vwochnik | 57:4af5f1bec3a6 | 49 | #endif |