Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
SnCommAfarTCP.h@8:95a325df1f6b, 2012-08-08 (annotated)
- Committer:
- uci1
- Date:
- Wed Aug 08 23:27:37 2012 +0000
- Revision:
- 8:95a325df1f6b
- Parent:
- 7:079617408fec
- Child:
- 10:3c93db1cfb12
Check power for low pow running. Average power over 500 readings. Use RTOS timers instead of tickers. Allow data taking of events, power readings or both, even if cards are off. Bug in EthernetInterface prevents IPs being reset. Lots of debug output.
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 | 3:24c5f0f50bf1 | 55 | virtual SnCommWin::ECommWinResult OpenWindow(const uint32_t timeout, |
uci1 | 3:24c5f0f50bf1 | 56 | const bool sendStatus, |
uci1 | 3:24c5f0f50bf1 | 57 | const SnConfigFrame& conf, |
uci1 | 3:24c5f0f50bf1 | 58 | const SnEventFrame& evt, |
uci1 | 8:95a325df1f6b | 59 | const SnPowerFrame& pow, |
uci1 | 3:24c5f0f50bf1 | 60 | char* const genBuf); |
uci1 | 3:24c5f0f50bf1 | 61 | |
uci1 | 3:24c5f0f50bf1 | 62 | |
uci1 | 3:24c5f0f50bf1 | 63 | }; |
uci1 | 7:079617408fec | 64 | |
uci1 | 3:24c5f0f50bf1 | 65 | #endif // SN_SnCommAfarTCP |