Vodafone K3770/K3772-Z modems driver & networking library

Dependencies:   Socket USBHostWANDongle lwip-sys lwip

Dependents:   VodafoneUSBModemHTTPClientTest VodafoneUSBModemNTPClientTest VodafoneUSBModemSMSTest VodafoneUSBModemUSSDTest ... more

Fork of VodafoneUSBModem_bleedingedge by Donatien Garnier

This is the driver for the Vodafone K3700 & K3772-Z Dongles:

K3770

More details and instructions can be found here.

Revision:
11:565b2ec40dea
Parent:
10:21a6f09d5631
Parent:
9:3f077dde13c9
Child:
12:66dc2c8eba2d
--- a/ip/PPPIPInterface.cpp	Fri Jul 06 08:56:32 2012 +0000
+++ b/ip/PPPIPInterface.cpp	Wed Jul 11 12:47:53 2012 +0000
@@ -65,9 +65,45 @@
   return OK;
 }
 
-/*virtual*/ int PPPIPInterface::connect()
+/*virtual*/ int PPPIPInterface::connect(const char* msisdn)
 {
+  int ret;
+  char buf[32];
+  size_t len;
   DBG("Trying to connect with PPP");
+  
+  do //Clear buf
+  {
+    ret = m_pStream->read(buf, &len, 32, 0) > 0
+  } while( (ret == OK) && (len > 0) );
+  
+  sprintf(buf, "ATD %16s\x0D");
+  
+  ret = m_pStream->write(buf, strlen(buf), osWaitForever);
+  if( ret != OK )
+  {
+    return NET_UNKNOWN;
+  }
+  
+  const char expected = "\x0D\0x0ACONNECT\x0D\0x0A";
+  
+  ret = m_pStream->read(buf, strlen(expected), &len, 3000);
+  if( ret != OK )
+  {
+    return NET_UNKNOWN;
+  }
+  
+  if( (len < strlen(expected)) || (memcmp(expected, buf) != 0) )
+  {
+    //Discard buffer
+    do //Clear buf
+    {
+      ret = m_pStream->read(buf, &len, 32, 0) > 0
+    } while( (ret == OK) && (len > 0) );
+    return NET_CONN;
+  }
+      
+  DBG("Transport link open");
   m_linkStatusSphre.wait(0);
   if((m_pppd != -1) && (m_pppErrCode == 0)) //Already connected
   {