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.

Files at this revision

API Documentation at this revision

Comitter:
ashleymills
Date:
Fri Mar 08 10:21:36 2013 +0000
Parent:
83:897a0de9d668
Parent:
74:b70519f17a22
Child:
85:d74a2a9d2b01
Commit message:
Merged MU509 and K3773 changes.

Changed in this revision

USBHostWANDongle.lib Show annotated file Show diff for this revision Revisions of this file
VodafoneUSBModem.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBHostWANDongle.lib	Tue Mar 05 14:54:15 2013 +0000
+++ b/USBHostWANDongle.lib	Fri Mar 08 10:21:36 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/ashleymills/code/USBHostWANDongle/#f4b676f61906
+http://mbed.org/users/donatien/code/USBHostWANDongle_bleedingedge/#b8739fd10faf
\ No newline at end of file
--- a/VodafoneUSBModem.cpp	Tue Mar 05 14:54:15 2013 +0000
+++ b/VodafoneUSBModem.cpp	Fri Mar 08 10:21:36 2013 +0000
@@ -17,7 +17,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+
 #define __DEBUG__ 0
+
 #ifndef __MODULE__
 #define __MODULE__ "VodafoneUSBModem.cpp"
 #endif
@@ -442,6 +444,7 @@
 
 int VodafoneUSBModem::getLinkState(int* pRssi, LinkMonitor::REGISTRATION_STATE* pRegistrationState, LinkMonitor::BEARER* pBearer)
 {
+  DBG("Entering getLinkState.");
   int ret = init();
   if(ret)
   {
@@ -504,8 +507,10 @@
 
 int VodafoneUSBModem::init()
 {
+  DBG("Entering init method for the VodafoneUSBModme");
   if( !m_dongleConnected )
   {
+    DBG("Dongle is not connected");
     if(!power())
     {
       //Obviously cannot initialize the dongle if it is disconnected...
@@ -513,11 +518,43 @@
       return NET_INVALID;
     }
     m_dongleConnected = true;
-    while( !m_dongle.connected() )
+    bool detectConnectedModem = false;          // local variable to use to create a while loop that we can break out of - this is used to detect if we can see a modem or not
+    
+    while(!detectConnectedModem)
     {
-      m_dongle.tryConnect();
-      Thread::wait(10);
+        for (int x=0; x<100;x++)
+        {
+            DBG("Trying to connect the dongle");
+            m_dongle.tryConnect();
+            if (m_dongle.connected())
+            {
+                DBG("Great the dongle is connected - I've tried %d times to connect", x);
+                detectConnectedModem = true;        // OK we can break out this while loop now - the dongle has been connected
+                break;                              // Break out of the for loop once the dongle is connected - otherwise try for a while more
+            }
+            Thread::wait(10);
+        }
+        if (!detectConnectedModem)
+        {
+            // OK we got this far - so give up trying and let someone know you can't see the modem
+            m_dongleConnected = false;                  // set the member variable of this object to false - so if we get called again we know we have to try to detect again
+            ERR("There is no dongle pluged into the board, or the module does not respond. Is the module/modem switched on?");
+            Thread:wait(1000);
+            //DBG("Last ditch attempt to re-initialise the USB Subsystem");
+            //m_dongle.init();
+            return HARDWARE_NO_RESPONSE;
+        }
     }
+        
+    
+    //while( !m_dongle.connected() )
+    //{
+    //  DBG("Trying to connect the dongle");
+    //  m_dongle.tryConnect();
+    //  Thread::wait(10);
+    //}
+    
+    
   }
 
   if(m_atOpen)
--- a/VodafoneUSBModem.h	Tue Mar 05 14:54:15 2013 +0000
+++ b/VodafoneUSBModem.h	Fri Mar 08 10:21:36 2013 +0000
@@ -22,7 +22,7 @@
 
 #include "core/fwk.h"
 
-#include "WANDongle.h"
+#include "USBHostWANDongle/USB3GModule/WANDongle.h"
 #include "at/ATCommandsInterface.h"
 #include "serial/usb/USBSerialStream.h"
 #include "ip/PPPIPInterface.h"
--- a/core/errors.h	Tue Mar 05 14:54:15 2013 +0000
+++ b/core/errors.h	Fri Mar 08 10:21:36 2013 +0000
@@ -43,5 +43,6 @@
 #define NET_CONN 17 //>Connection error
 #define NET_CLOSED 18 //>Connection was closed by remote end
 #define NET_TOOSMALL 19 //>Buffer is too small
+#define HARDWARE_NO_RESPONSE 20 //>No response from the hardware module. Could not be physically connected or maybe no power?
 
 #endif /* ERRORS_H_ */