The WDCInterface is is a drop-in replacement for an EthernetInterface class that allows the user to connect to the Internet with a Wistron NeWeb Corporation (WNC) M14A2A Series data module using the standard network Socket API's. This interface class is used in the AT&T Cellular IoT Starter Kit which is sold by Avnet (http://cloudconnectkits.org/product/att-cellular-iot-starter-kit).
Dependencies: WncControllerK64F
Dependents: WNCProximityMqtt Pubnub_ATT_IoT_SK_WNC_sync BluemixDemo BluemixQS ... more
See the WNCInterface README in the Wiki tab for detailed information on this library.
Diff: Socket/TCPSocketConnection.cpp
- Revision:
- 11:75cf1e1c921c
- Parent:
- 9:9f0578ff157a
- Child:
- 18:198e9b0acf11
--- a/Socket/TCPSocketConnection.cpp Fri Oct 07 13:54:09 2016 +0000 +++ b/Socket/TCPSocketConnection.cpp Mon Oct 31 13:54:21 2016 +0000 @@ -23,6 +23,8 @@ #include "TCPSocketConnection.h" #include <cstring> +#define READ_EVERYMS 500 //number of milliseconds between WNC socket reads + TCPSocketConnection::TCPSocketConnection() : _is_blocking(0), _btimeout(0){ @@ -80,10 +82,11 @@ if( s != WncController_fk::WncController::WNC_ON ) return ret; + M_LOCK; t.start(); - M_LOCK; do { - cnt = WNCInterface::_pwnc->read(0, (uint8_t *)readBuf, (uint32_t) length); + if( !(t.read_ms() % READ_EVERYMS) ) + cnt = WNCInterface::_pwnc->read(0, (uint8_t *)readBuf, (uint32_t) length); if( _is_blocking ) done = cnt; else @@ -94,7 +97,7 @@ M_ULOCK; if( WNCInterface::_pwnc->getWncStatus() == WNC_GOOD ) { - readBuf[cnt] = '\0'; + //readBuf[cnt] = '\0'; ret = (int)cnt; } else