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.
Revision 29:b278b745fb4f, committed 2017-03-24
- Comitter:
- JMF
- Date:
- Fri Mar 24 22:26:23 2017 +0000
- Parent:
- 28:dceb8da78e6d
- Commit message:
- updated Class name of TCPSocketConnection to WncTCPSocketConnection;
Changed in this revision
--- a/Socket/WncTCPSocketConnection.cpp Fri Mar 24 22:02:33 2017 +0000 +++ b/Socket/WncTCPSocketConnection.cpp Fri Mar 24 22:26:23 2017 +0000 @@ -25,16 +25,12 @@ #define READ_EVERYMS 500 //number of milliseconds between WNC socket reads -TCPSocketConnection::TCPSocketConnection() : - _is_blocking(0), - _btimeout(0){ -} // // blocking is used to make the WNC keep checking for incoming data for a // period of time. // -void TCPSocketConnection::set_blocking (bool blocking, unsigned int timeout) { +void WncTCPSocketConnection::set_blocking (bool blocking, unsigned int timeout) { _is_blocking = blocking; // true if we want to wait for request _btimeout = timeout; // user specs msec @@ -46,17 +42,17 @@ } -int TCPSocketConnection::connect(const char* host, const int port) { +int WncTCPSocketConnection::connect(const char* host, const int port) { WncSocket::connect((char*)host, SOCK_STREAM, port); _is_blocking = false; // start out not blocking, user will set it if desired return ( WNCInterface::_pwnc->getWncStatus() == WncController_fk::WncController::WNC_ON )? 0:-1; } -bool TCPSocketConnection::is_connected(void) { +bool WncTCPSocketConnection::is_connected(void) { return ( WNCInterface::_pwnc->getWncStatus() == WncController_fk::WncController::WNC_ON )? 1:0; } -int TCPSocketConnection::send(char* data, int length) { +int WncTCPSocketConnection::send(char* data, int length) { int ret = -1; WncController_fk::WncController::WncState_e s = WNCInterface::_pwnc->getWncStatus(); @@ -72,7 +68,7 @@ return ret; } -int TCPSocketConnection::receive(char *readBuf, int length) { +int WncTCPSocketConnection::receive(char *readBuf, int length) { Timer t; size_t done, cnt; int ret=-1; @@ -106,15 +102,15 @@ return ret; } -int TCPSocketConnection::send_all(char* data, int length) { +int WncTCPSocketConnection::send_all(char* data, int length) { return send(data,length); } -int TCPSocketConnection::receive_all(char* data, int length) { +int WncTCPSocketConnection::receive_all(char* data, int length) { return receive(data,length); } -int TCPSocketConnection::close(void) { +int WncTCPSocketConnection::close(void) { WncSocket::disconnect(); M_LOCK; int ret = ( WNCInterface::_pwnc->getWncStatus() == WncController_fk::WncController::WNC_ON )? 0:-1;
--- a/Socket/WncTCPSocketConnection.h Fri Mar 24 22:02:33 2017 +0000 +++ b/Socket/WncTCPSocketConnection.h Fri Mar 24 22:26:23 2017 +0000 @@ -31,10 +31,11 @@ /** TCP socket connection */ -class TCPSocketConnection : public WncSocket, public WncEndpoint { +class WncTCPSocketConnection : public WncSocket, public WncEndpoint { public: - TCPSocketConnection(); + WncTCPSocketConnection(void) : _is_blocking(0), + _btimeout(0); /** Connects this TCP socket to the server \param host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS.
--- a/WNCInterface.h Fri Mar 24 22:02:33 2017 +0000 +++ b/WNCInterface.h Fri Mar 24 22:26:23 2017 +0000 @@ -91,13 +91,13 @@ class WncSocket; class WncEndpoint; class WncUDPSocket; -class TCPSocketConnection; +class WncTCPSocketConnection; class WNCSms; class WNCInterface { class WncControllerK64F; //forward reference the Controller Class - friend class TCPSocketConnection; + friend class WncTCPSocketConnection; friend class WncUDPSocket; friend class WncEndpoint; friend class WncSocket;
--- a/WncControllerK64F.lib Fri Mar 24 22:02:33 2017 +0000 +++ b/WncControllerK64F.lib Fri Mar 24 22:26:23 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/fkellermavnet/code/WncControllerK64F/#36b2f37a8f52 +https://developer.mbed.org/users/fkellermavnet/code/WncControllerK64F/#b2be9ca45c05