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.

Revision:
28:4d9509e3b1cf
Parent:
27:e35f2118368f
Child:
29:53d346010624
--- a/MDM.cpp	Tue Apr 08 13:53:27 2014 +0000
+++ b/MDM.cpp	Tue Apr 08 14:11:03 2014 +0000
@@ -27,7 +27,6 @@
 
 MDMParser::MDMParser(void)
 {
-    
     // device info
     _model   = MODEL_UNKNOWN;
     _sim     = SIM_UNKNOWN;
@@ -197,19 +196,19 @@
     if ((type == TYPE_UNKNOWN) && model) {
         if (strstr(buf, "SARA-G350")) {
             *model = MODEL_SARA_G350;
-            TRACE("Identified Model: SARA-G350 2G\n");
+            /*TRACE("Identified Model: SARA-G350 2G\n")*/;
         } else if (strstr(buf, "LISA-U200")) {
             *model = MODEL_LISA_U200;
-            TRACE("Identified Model: LISA-U200 2G/3G\n");
+            /*TRACE("Identified Model: LISA-U200 2G/3G\n")*/;
         } else if (strstr(buf, "LISA-C200")) {
             *model= MODEL_LISA_C200;
-            TRACE("Identified Model: LISA-C200 CDMA\n");
+            /*TRACE("Identified Model: LISA-C200 CDMA\n")*/;
         }
     }
     return WAIT;
 }
 
-bool MDMParser::init(const char* pin)
+bool MDMParser::init(const char* pin, DevStatus* status)
 {
     for(int i = 0; i < 5; i++) {
         // check interface and disable local echo
@@ -306,6 +305,14 @@
     sendFormated("AT+CIMI\r\n");
     if (OK != waitFinalResp(_cbCIMI, _imsi))
         return false;
+    if (status)
+    {
+        status->model = _model;
+        status->sim   = _sim;
+        status->ccid  = _ccid;
+        status->imsi  = _imsi;    
+        status->imei  = _imei;
+    }
     return true; 
 }
 
@@ -313,7 +320,7 @@
 {
     if ((type == TYPE_PLUS) && ccid){
         if (sscanf(buf, "\r\n+CCID: %[^\r]\r\n", ccid) == 1)
-            TRACE("Got CCID: %s\n", ccid);
+            /*TRACE("Got CCID: %s\n", ccid)*/;
     }
     return WAIT;
 }
@@ -322,7 +329,7 @@
 {
     if ((type == TYPE_UNKNOWN) && imei){
         if (sscanf(buf, "\r\n%[^\r]\r\n%*[^\r]\r\n", imei) == 1)
-            TRACE("Got IMEI: %s\n", imei);
+            /*TRACE("Got IMEI: %s\n", imei)*/;
     }
     return WAIT;
 }
@@ -331,7 +338,7 @@
 {
     if ((type == TYPE_UNKNOWN) && imei){
         if (sscanf(buf, "\r\n%[^\r]\r\n", imei) == 1)
-            TRACE("Got IMEI: %s\n", imei);
+            /*TRACE("Got IMEI: %s\n", imei)*/;
     }
     return WAIT;
 }
@@ -340,12 +347,12 @@
 {
     if ((type == TYPE_UNKNOWN) && imsi) {
         if (sscanf(buf, "\r\n%[^\r]\r\n", imsi) == 1)
-            TRACE("Got IMSI: %s\n", imsi);
+            /*TRACE("Got IMSI: %s\n", imsi)*/;
     }
     return WAIT;
 }
 
-bool MDMParser::checkNetStatus(Status* info /*= NULL*/)
+bool MDMParser::checkNetStatus(NetStatus* status /*= NULL*/)
 {
     // check registration
     sendFormated("AT+CREG?\r\n");
@@ -374,12 +381,12 @@
     sendFormated("AT+CSQ\r\n");
     if (OK != waitFinalResp())
         return false;
-    if (info) {
-        info->num = _num;
-        info->opr = _opr;
-        info->rssi = _rssi;
-        info->net = _net;
-        info->act = _act;
+    if (status) {
+        status->num = _num;
+        status->opr = _opr;
+        status->rssi = _rssi;
+        status->net = _net;
+        status->act = _act;
     }
     return true;
 }
@@ -411,7 +418,7 @@
     return ip;
 }
 
-bool MDMParser::join(const char* apn, const char* user /*= NULL*/, const char* password /*= NULL*/)
+bool MDMParser::join(const char* apn /*= NULL*/, const char* user /*= NULL*/, const char* password /*= NULL*/)
 {
     if (_model == MODEL_LISA_C200) {
 #ifdef TODO // TODO implement