Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
SnCommAfarTCP.h@12:d472f9811262, 2012-08-18 (annotated)
- Committer:
- uci1
- Date:
- Sat Aug 18 05:00:32 2012 +0000
- Revision:
- 12:d472f9811262
- Parent:
- 10:3c93db1cfb12
- Child:
- 15:f2569d8e4176
Fixed bug in throttling timers. Now evt stores dt of triggers but throttle works on dt of events. AfarTCP communication possibly done. Debug output put behind precompiler macros.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
uci1 | 3:24c5f0f50bf1 | 1 | #ifndef SN_SnCommAfarTCP |
uci1 | 3:24c5f0f50bf1 | 2 | #define SN_SnCommAfarTCP |
uci1 | 7:079617408fec | 3 | |
uci1 | 3:24c5f0f50bf1 | 4 | #include "SnCommWin.h" |
uci1 | 6:6f002d202f59 | 5 | #include "string" |
uci1 | 3:24c5f0f50bf1 | 6 | |
uci1 | 3:24c5f0f50bf1 | 7 | class SnEventFrame; |
uci1 | 3:24c5f0f50bf1 | 8 | |
uci1 | 3:24c5f0f50bf1 | 9 | class EthernetInterface; |
uci1 | 3:24c5f0f50bf1 | 10 | class TCPSocketConnection; |
uci1 | 3:24c5f0f50bf1 | 11 | |
uci1 | 3:24c5f0f50bf1 | 12 | class SnCommAfarTCP : public SnCommWin { |
uci1 | 5:9cea89700c66 | 13 | public: |
uci1 | 6:6f002d202f59 | 14 | typedef int (TCPSocketConnection::*TCPSendRecv)(char*, int); |
uci1 | 5:9cea89700c66 | 15 | |
uci1 | 3:24c5f0f50bf1 | 16 | protected: |
uci1 | 6:6f002d202f59 | 17 | bool fUseB64; |
uci1 | 6:6f002d202f59 | 18 | std::string fRserv; |
uci1 | 8:95a325df1f6b | 19 | uint16_t fRport; |
uci1 | 8:95a325df1f6b | 20 | std::string fMyIp; |
uci1 | 8:95a325df1f6b | 21 | std::string fMyMask; |
uci1 | 8:95a325df1f6b | 22 | std::string fMyGate; |
uci1 | 3:24c5f0f50bf1 | 23 | EthernetInterface* fEth; |
uci1 | 3:24c5f0f50bf1 | 24 | TCPSocketConnection* fSock; |
uci1 | 3:24c5f0f50bf1 | 25 | |
uci1 | 6:6f002d202f59 | 26 | int DoIO(char* const data, |
uci1 | 6:6f002d202f59 | 27 | const uint32_t length, |
uci1 | 6:6f002d202f59 | 28 | const uint32_t timeout_clock, |
uci1 | 6:6f002d202f59 | 29 | TCPSendRecv fcn); |
uci1 | 8:95a325df1f6b | 30 | virtual int32_t ReceiveAll(char* const buf, const uint32_t mlen, |
uci1 | 8:95a325df1f6b | 31 | const uint32_t timeout_clock); |
uci1 | 8:95a325df1f6b | 32 | virtual int32_t SendAll(char* const data, const uint32_t length, |
uci1 | 8:95a325df1f6b | 33 | const uint32_t timeout_clock); |
uci1 | 8:95a325df1f6b | 34 | virtual SnConfigFrame::EDatPackBit GetCommType() const { |
uci1 | 8:95a325df1f6b | 35 | return SnConfigFrame::kAfar; |
uci1 | 8:95a325df1f6b | 36 | } |
uci1 | 3:24c5f0f50bf1 | 37 | |
uci1 | 3:24c5f0f50bf1 | 38 | public: |
uci1 | 8:95a325df1f6b | 39 | SnCommAfarTCP(const SnConfigFrame& conf); |
uci1 | 3:24c5f0f50bf1 | 40 | virtual ~SnCommAfarTCP(); |
uci1 | 3:24c5f0f50bf1 | 41 | |
uci1 | 8:95a325df1f6b | 42 | void Set(const char* remote, const uint16_t rport, |
uci1 | 8:95a325df1f6b | 43 | const char* myip, const char* mask, |
uci1 | 8:95a325df1f6b | 44 | const char* gate, const bool useb64); |
uci1 | 8:95a325df1f6b | 45 | |
uci1 | 8:95a325df1f6b | 46 | virtual void Set(const SnConfigFrame& conf) { |
uci1 | 8:95a325df1f6b | 47 | Set(conf.GetRemoteServer(), conf.GetRemotePort(), |
uci1 | 8:95a325df1f6b | 48 | conf.GetMbedIP(), conf.GetMbedMask(), conf.GetMbedGate(), |
uci1 | 8:95a325df1f6b | 49 | false); |
uci1 | 8:95a325df1f6b | 50 | printf("set conf done\r\n"); |
uci1 | 8:95a325df1f6b | 51 | } |
uci1 | 8:95a325df1f6b | 52 | |
uci1 | 3:24c5f0f50bf1 | 53 | virtual bool Connect(const uint32_t timeout); |
uci1 | 3:24c5f0f50bf1 | 54 | |
uci1 | 12:d472f9811262 | 55 | virtual bool CloseConn(); |
uci1 | 12:d472f9811262 | 56 | |
uci1 | 3:24c5f0f50bf1 | 57 | virtual SnCommWin::ECommWinResult OpenWindow(const uint32_t timeout, |
uci1 | 3:24c5f0f50bf1 | 58 | const bool sendStatus, |
uci1 | 3:24c5f0f50bf1 | 59 | const SnConfigFrame& conf, |
uci1 | 3:24c5f0f50bf1 | 60 | const SnEventFrame& evt, |
uci1 | 8:95a325df1f6b | 61 | const SnPowerFrame& pow, |
uci1 | 10:3c93db1cfb12 | 62 | const uint16_t seq, |
uci1 | 10:3c93db1cfb12 | 63 | const float thmrate, |
uci1 | 10:3c93db1cfb12 | 64 | const float evtrate, |
uci1 | 3:24c5f0f50bf1 | 65 | char* const genBuf); |
uci1 | 3:24c5f0f50bf1 | 66 | |
uci1 | 3:24c5f0f50bf1 | 67 | |
uci1 | 3:24c5f0f50bf1 | 68 | }; |
uci1 | 7:079617408fec | 69 | |
uci1 | 3:24c5f0f50bf1 | 70 | #endif // SN_SnCommAfarTCP |