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:
3:1d7e6ed11269
Parent:
0:55ec71dc0347
Child:
4:99e7aeaceae7
--- a/WNCInterface.cpp	Tue Sep 27 16:29:16 2016 +0000
+++ b/WNCInterface.cpp	Tue Sep 27 19:16:22 2016 +0000
@@ -57,30 +57,18 @@
 
 static MODSERIAL mdmUart(PTD3,PTD2,256,4096);       //UART for WNC Module
 
-#if WNC_DEBUG == 1
-static MODSERIAL debugUart(USBTX,USBRX,256,256);    //UART used for stdio/stderr
-static WncControllerK64F wnc(&wncPinList, &mdmUart, &debugUart);
-#else
-static WncControllerK64F wnc(&wncPinList, &mdmUart, NULL);
-#endif
-
-WncControllerK64F *WNCInterface::_pwnc = &wnc;
+WncControllerK64F *WNCInterface::_pwnc;
 WncIpStats WNCInterface::myNetStats;
 string WNCInterface::mac;
   
 WNCInterface::WNCInterface() {
-#if WNC_DEBUG == 1
-  debugUart.baud(115200);       // set stdio/stderr. use 115.2K since the WNC part uses this--keep up.
-#endif
 }
 
 void WNCInterface::doDebug( int v ) {
-#if WNC_DEBUG == 1
     //basic debug = 0x01
     //more debug  = 0x02
     //all debug   = 0x03
     _pwnc->enableDebug( (v&1), (v&2) );
-#endif
 }
     
 //
@@ -94,20 +82,18 @@
 // Returns: 0 if unable to initialize the WNC module
 //         -1 if successfully initialized
 //
-int WNCInterface::init(const char* apn, int debug) {
+int WNCInterface::init(const char* apn, MODSERIAL * debug) {
     int ret = 0;
     _pwnc = &wnc;   //set the pointer to the WNC controller class.  Used for all WNC accesses
 
+    if( debug )
+        _pwnc = new WncControllerK64F_fk::WncControllerK64F::WncControllerK64F(&wncPinList, &mdmUart, debug);
+    else
+        _pwnc = new WncControllerK64F_fk::WncControllerK64F::WncControllerK64F(&wncPinList, &mdmUart, NULL);
+
     if( apn==NULL )
         apn = APN_DEFAULT;
 
-#if WNC_DEBUG == 1
-    if( debug )
-        _pwnc->enableDebug( (debug&1), (debug&2) );
-#else
-    debug=debug;        //keep the compiler from complaining.
-#endif
-
     ret =  ( _pwnc->powerWncOn(apn,40) )? 2:0;
     ret |= ( _pwnc->setApnName(apn) )? 1:0;
     ret |= ( _pwnc->getWncNetworkingStats(&myNetStats) )? 4:0;
@@ -184,3 +170,4 @@
     return NULL;
 }
 
+