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:
61:0bcb8c5216d4
Parent:
59:593fb493172f
Child:
69:9b475f458fbc
Child:
75:ff3e5d1e82ca
diff -r 763eefc845b1 -r 0bcb8c5216d4 VodafoneUSBModem.cpp
--- a/VodafoneUSBModem.cpp	Wed Oct 24 14:15:53 2012 +0000
+++ b/VodafoneUSBModem.cpp	Thu Nov 01 13:01:03 2012 +0000
@@ -214,9 +214,13 @@
   {
     DBG("Connected to %s with %s", copsProcessor.getNetwork(), copsProcessor.getBearer());
     char cmd[48];
+    int tries = 3;
     sprintf(cmd, "AT+CGDCONT=1,\"IP\",\"%s\"", copsProcessor.getAPN());
-    ret = m_at.executeSimple(cmd, &result);
-    DBG("Result of command: Err code=%d", ret);
+    do //Try 3 times because for some reasons it can fail with the K3772-Z dongle
+    {
+      ret = m_at.executeSimple(cmd, &result);
+      DBG("Result of command: Err code=%d", ret);
+    } while(ret && --tries);
     DBG("ATResult: AT return=%d (code %d)", result.result, result.code);
     DBG("APN set to %s", copsProcessor.getAPN());
   }
@@ -224,9 +228,17 @@
   if(apn != NULL)
   {
     char cmd[48];
+    int tries = 30;
     sprintf(cmd, "AT+CGDCONT=1,\"IP\",\"%s\"", apn);
-    ret = m_at.executeSimple(cmd, &result);
-    DBG("Result of command: Err code=%d", ret);
+    do //Try 30 times because for some reasons it can fail *a lot* with the K3772-Z dongle
+    {
+      ret = m_at.executeSimple(cmd, &result);
+      DBG("Result of command: Err code=%d", ret);
+      if(ret)
+      {
+        Thread::wait(500);
+      }
+    } while(ret && --tries);
     DBG("ATResult: AT return=%d (code %d)", result.result, result.code);
     DBG("APN set to %s", apn);
   }