Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
SnCommAfarTCP.cpp
- Committer:
- uci1
- Date:
- 2012-07-31
- Revision:
- 3:24c5f0f50bf1
- Child:
- 4:a91682e19d6b
File content as of revision 3:24c5f0f50bf1:
/* #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; } */