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:
donatien
Date:
Thu Aug 30 09:16:05 2012 +0000
Parent:
26:d37501dc6c61
Child:
28:c94ffb45a848
Commit message:
Power gating feature

Changed in this revision

USBHostWANDongleLib.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
VodafoneUSBModem.h Show annotated file Show diff for this revision Revisions of this file
ip/IPInterface.cpp Show annotated file Show diff for this revision Revisions of this file
ip/PPPIPInterface.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBHostWANDongleLib.lib	Wed Aug 29 16:28:13 2012 +0000
+++ b/USBHostWANDongleLib.lib	Thu Aug 30 09:16:05 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/donatien/code/USBHostWANDongle_bleedingedge/#c9e9817c398c
+http://mbed.org/users/donatien/code/USBHostWANDongle_bleedingedge/#08bce4cd973a
--- a/VodafoneUSBModem.cpp	Wed Aug 29 16:28:13 2012 +0000
+++ b/VodafoneUSBModem.cpp	Thu Aug 30 09:16:05 2012 +0000
@@ -455,25 +455,15 @@
   {
     return NET_INVALID; //A pin name has not been provided in the constructor
   }
-  
-  if(!enable && m_ppp.isConnected())
+
+  if(!enable) //Will force components to re-init
   {
-    WARN("Data connection is still open"); //Try to encourage good behaviour from the user
-    m_ppp.disconnect(); 
+    cleanup();
   }
   
   DigitalOut powerGatingOut(m_powerGatingPin);
   powerGatingOut = enable;
-  if(!enable) //Will force components to re-init
-  {
-    m_dongleConnected = false;
-    m_smsInit = false;
-    m_ussdInit = false;
-    m_linkMonitorInit = false;
-    m_atOpen = false;
-    //We don't reset m_ipInit as PPPIPInterface::init() only needs to be called once
-  }
-  
+
   return OK;
 }
 
@@ -589,4 +579,28 @@
   return OK;
 }
 
+int VodafoneUSBModem::cleanup()
+{
+  if(m_ppp.isConnected())
+  {
+    WARN("Data connection is still open"); //Try to encourage good behaviour from the user
+    m_ppp.disconnect(); 
+  }
+  
+  m_smsInit = false;
+  m_ussdInit = false;
+  m_linkMonitorInit = false;
+  //We don't reset m_ipInit as PPPIPInterface::init() only needs to be called once
+  
+  if(m_atOpen)
+  {
+    m_at.close();
+    m_atOpen = false;
+  }
+  
+  m_dongle.disconnect();
+  m_dongleConnected = false;
+  
+  return OK;
+}
 
--- a/VodafoneUSBModem.h	Wed Aug 29 16:28:13 2012 +0000
+++ b/VodafoneUSBModem.h	Thu Aug 30 09:16:05 2012 +0000
@@ -107,6 +107,7 @@
   bool power();
 
   int init();
+  int cleanup();
 
 private:
   WANDongle m_dongle;
--- a/ip/IPInterface.cpp	Wed Aug 29 16:28:13 2012 +0000
+++ b/ip/IPInterface.cpp	Thu Aug 30 09:16:05 2012 +0000
@@ -24,7 +24,7 @@
 #include <cstring> //For strcpy
 
 
-IPInterface::IPInterface()
+IPInterface::IPInterface() : m_connected(false)
 {
 
 }
--- a/ip/PPPIPInterface.cpp	Wed Aug 29 16:28:13 2012 +0000
+++ b/ip/PPPIPInterface.cpp	Thu Aug 30 09:16:05 2012 +0000
@@ -17,7 +17,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#define __DEBUG__ 0 //Maximum verbosity
+#define __DEBUG__ 0
 #ifndef __MODULE__
 #define __MODULE__ "PPPIPInterface.cpp"
 #endif