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