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:
28:c94ffb45a848
Parent:
26:d37501dc6c61
Child:
39:85dc5ca10b7f
--- a/sms/SMSInterface.cpp	Thu Aug 30 09:16:05 2012 +0000
+++ b/sms/SMSInterface.cpp	Thu Aug 30 10:48:35 2012 +0000
@@ -233,7 +233,7 @@
   {
     DBG("Header: %s", line);
     int msgRef;
-    if( std::sscanf(line, "+CMGL: %d", &msgRef) == 1 )
+    if( std::sscanf(line, "+CMGL: %d,\"REC", &msgRef) == 1 ) //Filter on REC READ and REC UNREAD messages 
     {
       m_state = SMS_GET_COUNT_HDR_RECEIVED;
       //Add message to list
@@ -355,12 +355,25 @@
 int SMSInterface::updateInbox()
 {
   //Get memory indexes of unread messages
-  m_state = SMS_GET_COUNT_CMD_SENT;
 
   DBG("Updating inbox");
   m_msgRefListCount = 0; //Reset list
 
-  int ret = m_pIf->execute("AT+CMGL=\"REC UNREAD\"", this, NULL, DEFAULT_TIMEOUT);
+  //First list the "REC READ" messages that were not processed in the previous session
+  m_state = SMS_GET_COUNT_CMD_SENT;
+  int ret = m_pIf->execute("AT+CMGL=\"REC READ\"", this, NULL, DEFAULT_TIMEOUT);
+  if( ret != OK )
+  {
+    WARN("AT+CMGL returned %d", ret);
+    m_state = SMS_IDLE;
+    m_msgRefListCount = 0; //List could be invalid
+    m_needsUpdate = true;
+    return NET_PROTOCOL;
+  }
+  
+  //Now list the "REC UNREAD" messages that were received modem since
+  m_state = SMS_GET_COUNT_CMD_SENT;
+  ret = m_pIf->execute("AT+CMGL=\"REC UNREAD\"", this, NULL, DEFAULT_TIMEOUT);
   if( ret != OK )
   {
     WARN("AT+CMGL returned %d", ret);