Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: operation/PollThread.cpp
- Revision:
- 125:e1fcf720c63a
- Parent:
- 124:979ab0d075de
- Child:
- 126:871e6eb0fa76
--- a/operation/PollThread.cpp Mon Jun 01 11:24:17 2015 +0000 +++ b/operation/PollThread.cpp Mon Jun 01 12:56:41 2015 +0000 @@ -3,13 +3,18 @@ #include "PollThread.h" #include "logging.h" +static size_t _volSend = 0; +static size_t _volRecv = 0; + bool PollThread::handshake() { int l = snprintf(buf2, sizeof(buf2), "%s", "80\r\n"); l = snprintf(buf, sizeof(buf), fmtSmartRest, uri, l, buf2); sock.setBlocking(3000); + _volSend += l; l = sock.sendAndReceive(buf, l, sizeof(buf)); if (l <= 0) return false; + _volRecv += l; const char* p = skipHTTPHeader(buf); if (p == NULL) return false; size_t i = 0; @@ -25,8 +30,10 @@ int l = snprintf(buf2, sizeof(buf2), "81,%s,%s\r\n", bayeuxId, chn); l = snprintf(buf, sizeof(buf), fmtSmartRest, uri, l, buf2); sock.setBlocking(3000); + _volSend += l; l = sock.sendAndReceive(buf, l, sizeof(buf)); if (l <= 0) return false; + _volRecv += l; const char *p = skipHTTPHeader(buf); if (p == NULL) return false; for (; *p && !isgraph(*p); ++p); @@ -38,7 +45,11 @@ int l = snprintf(buf2, sizeof(buf2), "83,%s\r\n", bayeuxId); l = snprintf(buf, sizeof(buf), fmtSmartRest, uri, l, buf2); sock.setBlocking(300000); // Timeout after 5 minutes + _volSend += l; + aInfo("[SEND] poll: %d\n", _volSend); l = sock.sendAndReceive(buf, l, sizeof(buf)); + _volRecv += l; + aInfo("[RECV] poll: %d\n", _volRecv); return l>0; }