Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
Diff: SnCommAfarTCP.cpp
- Revision:
- 3:24c5f0f50bf1
- Child:
- 4:a91682e19d6b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SnCommAfarTCP.cpp Tue Jul 31 04:59:16 2012 +0000 @@ -0,0 +1,65 @@ +/* +#include "SnCommAfarTCP.h" + +SnCommAfarTCP::SnCommAfarTCP(char* const b64buf, const uint32_t bblen) : + fB64buf(b64buf), fbblen(bblen), fRmtServ(remote), + fEth(new EthernetInterface), fSock(new TCPSocketConnection) { + + fEth->init("128.195.204.148", // my IP + "255.255.255.0", // mask + "128.195.204.1"); // gateway + + fRserv = "128.195.204.151"; + fRport = 6655; + +} + +SnCommAfarTCP::~SnCommAfarTCP() { + delete fEth; + delete fSock; +} + +int SnCommAfarTCP::SendAll(const char* const data, const uint32_t length, + const uint32_t timeout_clock) { + const char* dd = data; + int res=0; + uint32_t b=0; + while ( (length>b) && (time(0)<timeout_clock) ) { + res = fSock-> + } +} + + +bool SnCommAfarTCP::Connect(const uint32_t timeout) { + bool isConn = false; + + while ( (isConn==false) && ( time(0) < timeout) ) { + wait_ms(250); + isConn = (fEth->connect()==0); + } + + while ( (isConn==false) && ( time(0) < timeout) ) { + wait_ms(250); + isConn = (fSock->connect(fRserv.c_str(), fRport)==0);s + } + + return isConn; +} + +SnCommWin::ECommWinResult SnCommAfarTCP::OpenWindow(const uint32_t timeout, + const bool sendStatus, + const SnConfigFrame& conf, + const SnEventFrame& evt, + char* const genBuf) { + const bool canCon = Connect(timeout); + + SnCommWin::ECommWinResult ret = canCon ? SnCommWin::kConnected + : SnCommWin::kCanNotConnect; + + if (canCon && sendStatus) { + ret = SendStatus(conf, evt, genBuf); + } + + return ret; +} +*/ \ No newline at end of file