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.

Fork of C027_Support by u-blox

Revision:
98:c786461edd40
Parent:
95:8282dbbe1492
Child:
99:3116d3e900ed
--- a/MDM.cpp	Tue Jun 17 07:03:48 2014 +0000
+++ b/MDM.cpp	Tue Jun 17 13:55:53 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;
 }
@@ -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);