Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
SnCommAfarTCP.h@110:d1da040a0cf2, 2015-11-24 (annotated)
- Committer:
- uci1
- Date:
- Tue Nov 24 21:52:27 2015 +0000
- Revision:
- 110:d1da040a0cf2
- Parent:
- 18:55f1581f2ee4
Stn32 (slow) with conf name. SD stall fix. No interface chip. Safety nets.
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 | 18:55f1581f2ee4 | 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 | 16:744ce85aede2 | 34 | public: |
uci1 | 16:744ce85aede2 | 35 | SnCommAfarTCP(const SnConfigFrame& conf); |
uci1 | 16:744ce85aede2 | 36 | virtual ~SnCommAfarTCP(); |
uci1 | 16:744ce85aede2 | 37 | |
uci1 | 8:95a325df1f6b | 38 | virtual SnConfigFrame::EDatPackBit GetCommType() const { |
uci1 | 8:95a325df1f6b | 39 | return SnConfigFrame::kAfar; |
uci1 | 8:95a325df1f6b | 40 | } |
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 | 18:55f1581f2ee4 | 50 | #ifdef DEBUG |
uci1 | 8:95a325df1f6b | 51 | printf("set conf done\r\n"); |
uci1 | 18:55f1581f2ee4 | 52 | #endif |
uci1 | 8:95a325df1f6b | 53 | } |
uci1 | 8:95a325df1f6b | 54 | |
uci1 | 3:24c5f0f50bf1 | 55 | virtual bool Connect(const uint32_t timeout); |
uci1 | 3:24c5f0f50bf1 | 56 | |
uci1 | 15:f2569d8e4176 | 57 | virtual bool CloseConn(const uint32_t); |
uci1 | 12:d472f9811262 | 58 | |
uci1 | 3:24c5f0f50bf1 | 59 | virtual SnCommWin::ECommWinResult OpenWindow(const uint32_t timeout, |
uci1 | 3:24c5f0f50bf1 | 60 | const bool sendStatus, |
uci1 | 3:24c5f0f50bf1 | 61 | const SnConfigFrame& conf, |
uci1 | 3:24c5f0f50bf1 | 62 | const SnEventFrame& evt, |
uci1 | 8:95a325df1f6b | 63 | const SnPowerFrame& pow, |
uci1 | 10:3c93db1cfb12 | 64 | const uint16_t seq, |
uci1 | 10:3c93db1cfb12 | 65 | const float thmrate, |
uci1 | 10:3c93db1cfb12 | 66 | const float evtrate, |
uci1 | 3:24c5f0f50bf1 | 67 | char* const genBuf); |
uci1 | 3:24c5f0f50bf1 | 68 | |
uci1 | 3:24c5f0f50bf1 | 69 | |
uci1 | 3:24c5f0f50bf1 | 70 | }; |
uci1 | 18:55f1581f2ee4 | 71 | */ |
uci1 | 3:24c5f0f50bf1 | 72 | #endif // SN_SnCommAfarTCP |