Cumulocity Official / Mbed 2 deprecated MbedSmartRestMain Featured

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Committer:
xinlei
Date:
Mon Apr 13 14:24:58 2015 +0000
Revision:
93:0acd11870c6a
Parent:
91:423177e8a401
Child:
94:61d44636f020
v2.1rc1

Who changed what in which revision?

UserRevisionLine numberNew 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 62:86a04c5bda18 6 #include "OperationExecutor.h"
xinlei 93:0acd11870c6a 7 //#include "AbstractSmartRest.h"
xinlei 93:0acd11870c6a 8 #include "RtosSmartRest.h"
vwochnik 57:4af5f1bec3a6 9 #include "SmartRestTemplate.h"
vwochnik 59:f96be79feccd 10 #include "ComposedRecord.h"
vwochnik 59:f96be79feccd 11 #include "CharValue.h"
xinlei 93:0acd11870c6a 12 #include "Operation.h"
vwochnik 59:f96be79feccd 13 #include "ParsedRecord.h"
xinlei 93:0acd11870c6a 14 #include "IntegerValue.h"
xinlei 93:0acd11870c6a 15
xinlei 93:0acd11870c6a 16 #define POOL_SIZE 64
vwochnik 57:4af5f1bec3a6 17
vwochnik 57:4af5f1bec3a6 18 class OperationSupport
vwochnik 57:4af5f1bec3a6 19 {
vwochnik 57:4af5f1bec3a6 20 public:
xinlei 93:0acd11870c6a 21 OperationSupport(RtosSmartRest&, SmartRestTemplate&, long&, ConfigurationSynchronization&, LCDDisplay&);
xinlei 93:0acd11870c6a 22
vwochnik 57:4af5f1bec3a6 23 bool init();
vwochnik 57:4af5f1bec3a6 24 bool run();
vwochnik 57:4af5f1bec3a6 25
vwochnik 59:f96be79feccd 26 protected:
vwochnik 63:010bbbb4732a 27 bool requestPendingOperations();
xinlei 93:0acd11870c6a 28 bool operationFromRecord(ParsedRecord&, Operation&);
xinlei 93:0acd11870c6a 29 bool executePendingOperation(Operation&);
xinlei 93:0acd11870c6a 30 // CharValue& operationStateValue(OperationState state) const;
xinlei 93:0acd11870c6a 31 const char * getOperationStateChar(OperationState) const;
vwochnik 59:f96be79feccd 32
vwochnik 63:010bbbb4732a 33 void thread2();
vwochnik 67:c360a2b2c948 34 void thread3();
vwochnik 63:010bbbb4732a 35
vwochnik 63:010bbbb4732a 36 static void thread2_func(void const*);
vwochnik 67:c360a2b2c948 37 static void thread3_func(void const*);
vwochnik 60:3c822f97fc73 38
vwochnik 57:4af5f1bec3a6 39 private:
vwochnik 67:c360a2b2c948 40 bool _init, _firstRun;
vwochnik 57:4af5f1bec3a6 41 long& _deviceId;
vwochnik 57:4af5f1bec3a6 42 SmartRestTemplate& _tpl;
xinlei 93:0acd11870c6a 43 RtosSmartRest& _client;
xinlei 93:0acd11870c6a 44 Mail<Operation, POOL_SIZE> opool;
vwochnik 62:86a04c5bda18 45 OperationExecutor _executor;
xinlei 93:0acd11870c6a 46 TCPSocketConnection sock;
xinlei 93:0acd11870c6a 47 char buf[300];
xinlei 93:0acd11870c6a 48 char buf2[50];
xinlei 91:423177e8a401 49 Thread _thread2;
xinlei 91:423177e8a401 50 Thread _thread3;
vwochnik 57:4af5f1bec3a6 51 };
vwochnik 57:4af5f1bec3a6 52
vwochnik 57:4af5f1bec3a6 53 #endif