u-blox USB modems (GSM and CDMA)

Dependencies:   CellularUSBModem

Dependents:   C027_CANInterfaceComm C027_ModemTransparentUSBCDC_revb UbloxModemHTTPClientTest C027_HTTPClientTest ... more

Legacy Networking Libray

This is an mbed 2 networking library. For an mbed OS 5 compatible library, please see:

Import libraryC027Interface

Socket interface for C027Interface. Implements the NetworkSocketAPI

Revision:
6:5a1583d0e6cd
Parent:
5:60b48a013e86
Child:
8:45f5433cfa96
diff -r 60b48a013e86 -r 5a1583d0e6cd UbloxModem.cpp
--- a/UbloxModem.cpp	Mon Dec 16 09:00:36 2013 +0000
+++ b/UbloxModem.cpp	Tue Dec 17 14:30:25 2013 +0000
@@ -45,6 +45,36 @@
 {
 }
 
+
+class AtiProcessor : public IATCommandsProcessor
+{
+public:
+  AtiProcessor()
+  { 
+    i = 0; 
+    str[0] = '\0'; 
+  }
+  const char* getInfo(void) { return str; }
+private:
+  virtual int onNewATResponseLine(ATCommandsInterface* pInst, const char* line)
+  {
+    int l = strlen(line);
+    if (i + l + 2 > sizeof(str))
+        return NET_OVERFLOW;
+    if (i) str[i++] = ',';
+    strcat(&str[i], line);
+    i += l;
+    return OK;
+  }
+  virtual int onNewEntryPrompt(ATCommandsInterface* pInst)
+  {
+    return OK;
+  }
+protected:
+  char str[256];
+  int i;
+};
+
 class CREGProcessor : public IATCommandsProcessor
 {
 public:
@@ -309,6 +339,22 @@
   }
 
   ATCommandsInterface::ATResult result;
+  AtiProcessor atiProcessor;
+  do
+  {
+    ret = m_at.execute("ATI", &atiProcessor, &result);
+  }
+  while (ret != OK);
+  {
+    const char* info = atiProcessor.getInfo();
+    DBG("Modem Identification [%s]", info);
+    if (strstr(info, "LISA-C200"))
+    {
+        m_gsm = false;    // it is CDMA modem
+        m_onePort = true; // force use of only one port
+    }
+  }
+  
   CREGProcessor cregProcessor(m_gsm);
   //Wait for network registration
   do
@@ -393,6 +439,7 @@
   if(!m_linkMonitorInit)
   {
     ret = m_linkMonitor.init();
+    ret = m_linkMonitor.init(m_gsm);
     if(ret)
     {
       return ret;