support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.

Dependents:   HTTPClient_Cellular_HelloWorld Cellular_HelloMQTT MbedSmartRestMain Car_Bon_car_module ... more

This library is intended to be used with u-blox products such as the C027 or a shield with u-blox cellular and GPS modules like the cellular and positioning shield from Embedded Artist.

For 2G/GSM and 3G/UMTS you need to:

  • have a SIM card and know its PIN number
  • need to know you network operators APN setting These setting should be passed to the connect or init and join functions. You can also extend the APN database in MDMAPN.h.

For CDMA products you need to make sure that you have provisioned and activated the modem with either Sprint or Verizon.

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Tue Jul 01 05:46:06 2014 +0000
Parent:
97:b82539535365
Parent:
99:3116d3e900ed
Child:
101:edfeb8af206e
Commit message:
detect more devices and fix APN test loop

Changed in this revision

--- a/MDM.cpp	Fri Jun 20 12:08:40 2014 +0000
+++ b/MDM.cpp	Tue Jul 01 05:46:06 2014 +0000
@@ -304,7 +304,7 @@
             pin = 0; ::wait_us(50);
             pin = 1; ::wait_ms(10); 
             
-            // SARA-G35 >5ms, LISA-C2 > 150ms
+            // SARA-G35 >5ms, LISA-C2 > 150ms, LEON-G2 >5ms
             pin = 0; ::wait_ms(150);
             pin = 1; ::wait_ms(100);
             
@@ -373,12 +373,13 @@
         }
 #endif
     } else {
-        if (_dev.dev == DEV_LISA_U200) {
+        if ((_dev.dev == DEV_LISA_U200) || (_dev.dev == DEV_LEON_G200)) {
             // enable the network identification feature 
             sendFormated("AT+UGPIOC=20,2\r\n");
             if (RESP_OK != waitFinalResp())
                 goto failure;
-        } else {
+        } else if ((_dev.dev == DEV_SARA_U260) || (_dev.dev == DEV_SARA_U270) || 
+                   (_dev.dev == DEV_SARA_G350)) {
             // enable the network identification feature 
             sendFormated("AT+UGPIOC=16,2\r\n");
             if (RESP_OK != waitFinalResp())
@@ -487,16 +488,12 @@
 int MDMParser::_cbATI(int type, const char* buf, int len, Dev* dev)
 {
     if ((type == TYPE_UNKNOWN) && dev) {
-        if (strstr(buf, "SARA-G350")) {
-            *dev = DEV_SARA_G350;
-            /*TRACE("Identified Device: SARA-G350 2G\\n")*/;
-        } else if (strstr(buf, "LISA-U200")) {
-            *dev = DEV_LISA_U200;
-            /*TRACE("Identified Device: LISA-U200 2G/3G\r\n")*/;
-        } else if (strstr(buf, "LISA-C200")) {
-            *dev= DEV_LISA_C200;
-            /*TRACE("Identified Device: LISA-C200 CDMA\r\n")*/;
-        }
+        if      (strstr(buf, "SARA-G350")) *dev = DEV_SARA_G350;
+        else if (strstr(buf, "LISA-U200")) *dev = DEV_LISA_U200;
+        else if (strstr(buf, "LISA-C200")) *dev = DEV_LISA_C200;
+        else if (strstr(buf, "SARA-U260")) *dev = DEV_SARA_U260;
+        else if (strstr(buf, "SARA-U270")) *dev = DEV_SARA_U270;
+        else if (strstr(buf, "LEON-G200")) *dev = DEV_LEON_G200;
     }
     return WAIT;
 }
@@ -768,7 +765,7 @@
                             ok = true;
                     }
                 }
-            } while (config && *config); // maybe use next setting ? 
+            } while (!ok && config && *config); // maybe use next setting ? 
             if (!ok) {
                 ERROR("Your modem APN/password/username may be wrong\r\n");
                 goto failure;
@@ -1351,14 +1348,14 @@
             _DPRINT dprint, void* param) 
 {
     dprint(param, "Modem::devStatus\r\n");
-    const char* txtDev[] = { "Unknown", "SARA-G350", "LISA-U200", "LISA-C200" };
-    if (status->dev < sizeof(txtDev)/sizeof(*txtDev) && (status->dev != MDMParser::DEV_UNKNOWN))
+    const char* txtDev[] = { "Unknown", "SARA-G350", "LISA-U200", "LISA-C200", "SARA-U260", "SARA-U270", "LEON-G200" };
+    if (status->dev < sizeof(txtDev)/sizeof(*txtDev) && (status->dev != DEV_UNKNOWN))
         dprint(param, "  Device:       %s\r\n", txtDev[status->dev]);
     const char* txtLpm[] = { "Disabled", "Enabled", "Active" };
     if (status->lpm < sizeof(txtLpm)/sizeof(*txtLpm))
         dprint(param, "  Power Save:   %s\r\n", txtLpm[status->lpm]);
     const char* txtSim[] = { "Unknown", "Missing", "Pin", "Ready" };
-    if (status->sim < sizeof(txtSim)/sizeof(*txtSim) && (status->sim != MDMParser::SIM_UNKNOWN))
+    if (status->sim < sizeof(txtSim)/sizeof(*txtSim) && (status->sim != SIM_UNKNOWN))
         dprint(param, "  SIM:          %s\r\n", txtSim[status->sim]);
     if (*status->ccid)  
         dprint(param, "  CCID:         %s\r\n", status->ccid);
@@ -1381,12 +1378,12 @@
 {
     dprint(param, "Modem::netStatus\r\n");
     const char* txtReg[] = { "Unknown", "Denied", "None", "Home", "Roaming" };
-    if (status->csd < sizeof(txtReg)/sizeof(*txtReg) && (status->csd != MDMParser::REG_UNKNOWN))
+    if (status->csd < sizeof(txtReg)/sizeof(*txtReg) && (status->csd != REG_UNKNOWN))
         dprint(param, "  CSD Registration:   %s\r\n", txtReg[status->csd]);
-    if (status->psd < sizeof(txtReg)/sizeof(*txtReg) && (status->psd != MDMParser::REG_UNKNOWN))
+    if (status->psd < sizeof(txtReg)/sizeof(*txtReg) && (status->psd != REG_UNKNOWN))
         dprint(param, "  PSD Registration:   %s\r\n", txtReg[status->psd]);
     const char* txtAct[] = { "Unknown", "GSM", "Edge", "3G", "CDMA" };
-    if (status->act < sizeof(txtAct)/sizeof(*txtAct) && (status->act != MDMParser::ACT_UNKNOWN))
+    if (status->act < sizeof(txtAct)/sizeof(*txtAct) && (status->act != ACT_UNKNOWN))
         dprint(param, "  Access Technology:  %s\r\n", txtAct[status->act]);
     if (status->rssi) 
         dprint(param, "  Signal Strength:    %d dBm\r\n", status->rssi);
--- a/MDM.h	Fri Jun 20 12:08:40 2014 +0000
+++ b/MDM.h	Tue Jul 01 05:46:06 2014 +0000
@@ -31,7 +31,8 @@
     // Types 
     // ----------------------------------------------------------------
     //! MT Device Types 
-    typedef enum { DEV_UNKNOWN, DEV_SARA_G350, DEV_LISA_U200, DEV_LISA_C200 } Dev; 
+    typedef enum { DEV_UNKNOWN, DEV_SARA_G350, DEV_LISA_U200, DEV_LISA_C200, 
+                   DEV_SARA_U260, DEV_SARA_U270, DEV_LEON_G200 } Dev; 
     //! SIM Status
     typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_READY } Sim;
     //! SIM Status