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:
81:3966a5c17037
Parent:
80:34985b4d821e
Child:
82:055dcfcf9dcc
--- a/MDM.cpp	Tue May 27 08:21:53 2014 +0000
+++ b/MDM.cpp	Wed May 28 07:09:38 2014 +0000
@@ -539,13 +539,46 @@
             sendFormated("AT+CSS?\r\n");
             if (RESP_OK != waitFinalResp())
                 return false;
-            // get the Telephone number
-            sendFormated("AT$MDN?\r\n");
-            if (RESP_OK != waitFinalResp(_cbString, _net.num))
-                return false;
-            // check if we have a Mobile Directory Number
-            if (!*_net.num || (memcmp(_net.num, "000000", 6) == 0))
-                return false;
+            while (1) {
+                // get the Telephone number
+                sendFormated("AT$MDN?\r\n");
+                if (RESP_OK != waitFinalResp(_cbString, _net.num))
+                    return false;
+                // check if we have a Mobile Directory Number
+                if (*_net.num && (memcmp(_net.num, "000000", 6) != 0))
+                    break;
+                    
+                INFO("Device not yet activated\r\n");
+                INFO("Make sure you have a valid contract with the network operator for this device.\r\n");
+                // Check if the the version contains a V for Verizon 
+                // Verizon: E0.V.xx.00.xxR, 
+                // Sprint E0.S.xx.00.xxR
+                if (_dev.ver[3] == 'V') { 
+                    int i;
+                    INFO("Start device over-the-air activation (this can take a few minutes)\r\n");
+                    sendFormated("AT+CDV=*22899\r\n");
+                    i = 1;
+                    if (RESP_OK != waitFinalResp(_cbUACTIND, &i, 120*1000) || (i == 1)) {
+                        ERROR("Device over-the-air activation failed\r\n");
+                        return false;
+                    }
+                    INFO("Device over-the-air activation successful\r\n");
+                    
+                    INFO("Start PRL over-the-air update (this can take a few minutes)\r\n");
+                    sendFormated("AT+CDV=*22891\r\n");
+                    i = 1;
+                    if (RESP_OK != waitFinalResp(_cbUACTIND, &i, 120*1000) || (i == 1)) {
+                        ERROR("PRL over-the-air update failed\r\n");
+                        return false;
+                    }
+                    INFO("PRL over-the-air update successful\r\n");
+                    
+                } else { 
+                    // Sprint or Aeris 
+                    INFO("Wait for OMA-DM over-the-air activation (this can take a few minutes)\r\n");
+                    RELAX_MS(120*1000);
+                }
+            }
             // get the the Network access identifier string
             char nai[64];
             sendFormated("AT$QCMIPNAI?\r\n");
@@ -610,6 +643,15 @@
     return WAIT;
 }
 
+int MDMParser::_cbUACTIND(int type, const char* buf, int len, int* i)
+{
+    if ((type == TYPE_PLUS) && i){
+        if (sscanf(buf, "\r\n+UACTIND: %d", i) == 1) {
+        }
+    }
+    return WAIT;
+}
+
 // ----------------------------------------------------------------
 // internet connection