Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
SnCommAfarTCP.h@16:744ce85aede2, 2012-09-12 (annotated)
- Committer:
- uci1
- Date:
- Wed Sep 12 04:47:22 2012 +0000
- Revision:
- 16:744ce85aede2
- Parent:
- 15:f2569d8e4176
- Child:
- 18:55f1581f2ee4
SBD comm seems to be working. USB comm seems to be working (at 115200 baud). AFAR comm seems to be working. This version is set for USB communication and has zero text 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 | 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 | 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 | 15:f2569d8e4176 | 55 | virtual bool CloseConn(const uint32_t); |
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 |