Add a bunch of APNs

Fork of C027_Support by Xinlei Cao

Revision:
90:3915192f6d7e
Parent:
88:135fb4bb7aac
Child:
95:8282dbbe1492
diff -r ea396f9f90a2 -r 3915192f6d7e MDM.cpp
--- a/MDM.cpp	Fri Jun 06 10:42:47 2014 +0000
+++ b/MDM.cpp	Fri Jun 06 15:01:03 2014 +0000
@@ -431,10 +431,6 @@
         sendFormated("AT+CGREG=2\r\n");
         if (RESP_OK != waitFinalResp())
             return false;
-        // set operator selection 
-        sendFormated("AT+COPS=0,0\r\n");
-        if (RESP_OK != waitFinalResp(NULL,NULL,180*1000))
-            return false;
     } 
     // enable the network registration unsolicited result code
     sendFormated("AT+CREG=%d\r\n", (_dev.dev == DEV_LISA_C200) ? 1 : 2);
@@ -714,15 +710,21 @@
                     TRACE("Testing APN Settings(\"%s\",\"%s\",\"%s\")\r\n", apn, username, password);
                 }
                 // Set up the APN
-                sendFormated("AT+UPSD=" PROFILE ",1,\"%s\"\r\n", apn?apn:"");
-                if (RESP_OK != waitFinalResp())
-                    return NOIP;
-                sendFormated("AT+UPSD=" PROFILE ",2,\"%s\"\r\n", username?username:"");
-                if (RESP_OK != waitFinalResp())
-                    return NOIP;
-                sendFormated("AT+UPSD=" PROFILE ",3,\"%s\"\r\n", password?password:"");
-                if (RESP_OK != waitFinalResp())
-                    return NOIP;
+                if (apn && *apn) {
+                    sendFormated("AT+UPSD=" PROFILE ",1,\"%s\"\r\n", apn);
+                    if (RESP_OK != waitFinalResp())
+                        return NOIP;
+                }
+                if (username && *username) {
+                    sendFormated("AT+UPSD=" PROFILE ",2,\"%s\"\r\n", username);
+                    if (RESP_OK != waitFinalResp())
+                        return NOIP;
+                }
+                if (password && *password) {
+                    sendFormated("AT+UPSD=" PROFILE ",3,\"%s\"\r\n", password);
+                    if (RESP_OK != waitFinalResp())
+                        return NOIP;
+                }
                 // try different Authentication Protocols
                 // 0 = none 
                 // 1 = PAP (Password Authentication Protocol)