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@91:423177e8a401, 2015-03-20 (annotated)
- Committer:
- xinlei
- Date:
- Fri Mar 20 13:55:21 2015 +0000
- Revision:
- 91:423177e8a401
- Parent:
- 82:ca7430f50b2b
- Child:
- 93:0acd11870c6a
Code refactoring to ease coupling
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 | 68:0dc778a16d0d | 5 | #include "ConfigurationSynchronization.h" |
vwochnik | 65:a62dbef2f924 | 6 | #include "DeviceIO.h" |
vwochnik | 62:86a04c5bda18 | 7 | #include "OperationExecutor.h" |
vwochnik | 57:4af5f1bec3a6 | 8 | #include "AbstractSmartRest.h" |
vwochnik | 57:4af5f1bec3a6 | 9 | #include "SmartRestTemplate.h" |
vwochnik | 59:f96be79feccd | 10 | #include "ComposedRecord.h" |
vwochnik | 59:f96be79feccd | 11 | #include "CharValue.h" |
vwochnik | 59:f96be79feccd | 12 | #include "OperationStore.h" |
vwochnik | 59:f96be79feccd | 13 | #include "ParsedRecord.h" |
vwochnik | 57:4af5f1bec3a6 | 14 | |
vwochnik | 57:4af5f1bec3a6 | 15 | class OperationSupport |
vwochnik | 57:4af5f1bec3a6 | 16 | { |
vwochnik | 57:4af5f1bec3a6 | 17 | public: |
xinlei | 82:ca7430f50b2b | 18 | OperationSupport(AbstractSmartRest&, SmartRestTemplate&, long&, ConfigurationSynchronization&, DeviceIO&, DisplayInfo&); |
vwochnik | 57:4af5f1bec3a6 | 19 | |
vwochnik | 57:4af5f1bec3a6 | 20 | bool init(); |
vwochnik | 57:4af5f1bec3a6 | 21 | bool run(); |
vwochnik | 57:4af5f1bec3a6 | 22 | |
vwochnik | 59:f96be79feccd | 23 | protected: |
vwochnik | 63:010bbbb4732a | 24 | bool requestPendingOperations(); |
vwochnik | 59:f96be79feccd | 25 | bool operationFromRecord(ParsedRecord&, OperationStore::Operation&); |
vwochnik | 59:f96be79feccd | 26 | bool updateOperation(OperationStore::Operation&); |
vwochnik | 59:f96be79feccd | 27 | CharValue& operationStateValue(OperationStore::Operation&); |
vwochnik | 59:f96be79feccd | 28 | |
vwochnik | 63:010bbbb4732a | 29 | void thread1(); |
vwochnik | 63:010bbbb4732a | 30 | void thread2(); |
vwochnik | 67:c360a2b2c948 | 31 | void thread3(); |
vwochnik | 63:010bbbb4732a | 32 | |
vwochnik | 63:010bbbb4732a | 33 | static void thread1_func(void const*); |
vwochnik | 63:010bbbb4732a | 34 | static void thread2_func(void const*); |
vwochnik | 67:c360a2b2c948 | 35 | static void thread3_func(void const*); |
vwochnik | 60:3c822f97fc73 | 36 | |
vwochnik | 57:4af5f1bec3a6 | 37 | private: |
vwochnik | 67:c360a2b2c948 | 38 | bool _init, _firstRun; |
vwochnik | 57:4af5f1bec3a6 | 39 | long& _deviceId; |
vwochnik | 57:4af5f1bec3a6 | 40 | SmartRestTemplate& _tpl; |
vwochnik | 57:4af5f1bec3a6 | 41 | AbstractSmartRest& _client; |
vwochnik | 62:86a04c5bda18 | 42 | OperationStore _store; |
vwochnik | 62:86a04c5bda18 | 43 | OperationExecutor _executor; |
xinlei | 91:423177e8a401 | 44 | Thread _thread1; |
xinlei | 91:423177e8a401 | 45 | Thread _thread2; |
xinlei | 91:423177e8a401 | 46 | Thread _thread3; |
vwochnik | 57:4af5f1bec3a6 | 47 | }; |
vwochnik | 57:4af5f1bec3a6 | 48 | |
vwochnik | 59:f96be79feccd | 49 | extern CharValue aOperationStatePending; |
vwochnik | 59:f96be79feccd | 50 | extern CharValue aOperationStateExecuting; |
vwochnik | 59:f96be79feccd | 51 | extern CharValue aOperationStateSuccessful; |
vwochnik | 59:f96be79feccd | 52 | extern CharValue aOperationStateFailed; |
vwochnik | 59:f96be79feccd | 53 | |
vwochnik | 57:4af5f1bec3a6 | 54 | #endif |