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:
12:66dc2c8eba2d
Parent:
11:565b2ec40dea
Child:
18:1789a11d1892
--- a/VodafoneK3770.cpp	Wed Jul 11 12:47:53 2012 +0000
+++ b/VodafoneK3770.cpp	Wed Jul 11 21:25:03 2012 +0000
@@ -21,7 +21,7 @@
 SOFTWARE.
 */
 
-#define __DEBUG__ 4
+#define __DEBUG__ 0
 #ifndef __MODULE__
 #define __MODULE__ "VodafoneK3770.cpp"
 #endif
@@ -32,8 +32,8 @@
 
 VodafoneK3770::VodafoneK3770() : m_dongle(),
 m_atStream(m_dongle.getSerial(1)), m_pppStream(m_dongle.getSerial(0)), m_at(&m_atStream),
-m_sms(&m_at), m_ussd(&m_at), m_ppp(&m_pppStream), 
-m_dongleConnected(false), m_ipInit(false), m_smsInit(false), m_atOpen(false)
+m_sms(&m_at), m_ussd(&m_at), m_linkMonitor(&m_at), m_ppp(&m_pppStream), 
+m_dongleConnected(false), m_ipInit(false), m_smsInit(false), m_ussdInit(false), m_linkMonitorInit(false), m_atOpen(false)
 {
 
 }
@@ -81,6 +81,7 @@
   volatile REGISTERING_STATUS status;
 };
 
+#if 0
 class COPSProcessor : public IATCommandsProcessor
 {
 public:
@@ -159,7 +160,7 @@
   char apn[24];
   volatile bool valid;
 };
-
+#endif
 
 int VodafoneK3770::connect(const char* apn, const char* user, const char* password)
 {
@@ -179,6 +180,7 @@
   #if USE_ONE_PORT
   m_smsInit = false; //SMS status reset
   m_ussdInit = false; //USSD status reset
+  m_linkMonitorInit = false; //Link monitor status reset
   #endif
 
   ATCommandsInterface::ATResult result;
@@ -241,7 +243,7 @@
   #endif
   DBG("Connecting PPP");
 
-  ret = m_ppp.connect("*99#");
+  ret = m_ppp.connect();
   DBG("Result of connect: Err code=%d", ret);
   return ret;
 }
@@ -414,6 +416,34 @@
   return OK;
 }
 
+int VodafoneK3770::getLinkState(int* pRssi, LinkMonitor::REGISTRATION_STATE* pRegistrationState, LinkMonitor::BEARER* pBearer)
+{
+  int ret = init();
+  if(ret)
+  {
+    return ret;
+  }
+  
+  if(!m_linkMonitorInit)
+  {
+    ret = m_linkMonitor.init();
+    if(ret)
+    {
+      return ret;
+    }
+    m_linkMonitorInit = true;
+  }
+
+  ret = m_linkMonitor.getState(pRssi, pRegistrationState, pBearer);
+  if(ret)
+  {
+    return ret;
+  }
+
+  return OK;
+}
+
+
 ATCommandsInterface* VodafoneK3770::getATCommandsInterface()
 {
   return &m_at;
@@ -452,12 +482,19 @@
 
   #if USE_ONE_PORT
   DBG("Configuring unsolicited result codes support properly");
-  //Configuring port
+  //Configuring port to enable 3GPP-compliant unsollicited response codes but disable Huawei-specific unsollicited response codes
   ret = m_at.executeSimple("AT^CURC=0;^PORTSEL=1", NULL); //Huawei-specific, not 3GPP-compliant
   if(ret != OK)
   {
     return NET_PROTOCOL;
   }
+  #else
+  //Configuring port to disable Huawei-specific unsollicited response codes
+  ret = m_at.executeSimple("AT^CURC=0", NULL); //Huawei-specific, not 3GPP-compliant
+  if(ret != OK)
+  {
+    return NET_PROTOCOL;
+  }  
   #endif
 
   ATCommandsInterface::ATResult result;