Naoya Takamura / C027_Support_ForIM920

Fork of C027_Support by u-blox

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Wed May 28 07:09:38 2014 +0000
Parent:
80:34985b4d821e
Child:
82:055dcfcf9dcc
Commit message:
add verizon provisioning

Changed in this revision

MDM.cpp Show annotated file Show diff for this revision Revisions of this file
MDM.h Show annotated file Show diff for this revision Revisions of this file
--- 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 
 
--- a/MDM.h	Tue May 27 08:21:53 2014 +0000
+++ b/MDM.h	Wed May 28 07:09:38 2014 +0000
@@ -504,6 +504,7 @@
     static int _cbCSQ(int type, const char* buf, int len, NetStatus* status);
     static int _cbCOPS(int type, const char* buf, int len, NetStatus* status);
     static int _cbCNUM(int type, const char* buf, int len, char* num);
+    static int _cbUACTIND(int type, const char* buf, int len, int* i);
     // sockets
     static int _cbCMIP(int type, const char* buf, int len, IP* ip);
     static int _cbUPSND(int type, const char* buf, int len, int* act);