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@67:c360a2b2c948, 2014-11-30 (annotated)
- Committer:
- vwochnik
- Date:
- Sun Nov 30 19:34:49 2014 +0000
- Revision:
- 67:c360a2b2c948
- Parent:
- 65:a62dbef2f924
- Child:
- 68:0dc778a16d0d
refactor credentials persistence, add factory reset upon fire press button
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 | 67:c360a2b2c948 | 30 | void thread3(); |
vwochnik | 63:010bbbb4732a | 31 | |
vwochnik | 63:010bbbb4732a | 32 | static void thread1_func(void const*); |
vwochnik | 63:010bbbb4732a | 33 | static void thread2_func(void const*); |
vwochnik | 67:c360a2b2c948 | 34 | static void thread3_func(void const*); |
vwochnik | 60:3c822f97fc73 | 35 | |
vwochnik | 57:4af5f1bec3a6 | 36 | private: |
vwochnik | 67:c360a2b2c948 | 37 | bool _init, _firstRun; |
vwochnik | 57:4af5f1bec3a6 | 38 | long& _deviceId; |
vwochnik | 57:4af5f1bec3a6 | 39 | SmartRestTemplate& _tpl; |
vwochnik | 57:4af5f1bec3a6 | 40 | AbstractSmartRest& _client; |
vwochnik | 62:86a04c5bda18 | 41 | OperationStore _store; |
vwochnik | 62:86a04c5bda18 | 42 | OperationExecutor _executor; |
vwochnik | 67:c360a2b2c948 | 43 | Thread _thread1, _thread2, _thread3; |
vwochnik | 57:4af5f1bec3a6 | 44 | }; |
vwochnik | 57:4af5f1bec3a6 | 45 | |
vwochnik | 59:f96be79feccd | 46 | extern CharValue aOperationStatePending; |
vwochnik | 59:f96be79feccd | 47 | extern CharValue aOperationStateExecuting; |
vwochnik | 59:f96be79feccd | 48 | extern CharValue aOperationStateSuccessful; |
vwochnik | 59:f96be79feccd | 49 | extern CharValue aOperationStateFailed; |
vwochnik | 59:f96be79feccd | 50 | |
vwochnik | 57:4af5f1bec3a6 | 51 | #endif |