Add a bunch of APNs

Fork of C027_Support by Xinlei Cao

Revision:
78:caf0014375cb
Parent:
77:55788e619858
Child:
79:291df065e345
diff -r 55788e619858 -r caf0014375cb MDM.cpp
--- a/MDM.cpp	Mon May 19 16:18:29 2014 +0000
+++ b/MDM.cpp	Tue May 20 11:40:07 2014 +0000
@@ -1,6 +1,4 @@
 #include "mbed.h"
-#include <ctype.h>
-#include <string.h>
 #include "MDM.h"
 #include "Relax.h"
 #ifdef TARGET_UBLOX_C027
@@ -176,9 +174,12 @@
                     }
                 } else {
                     // GSM/UMTS Specific -------------------------------------------
-                    // +CREG: <n>, <stat>[,<lac>,<ci>[,AcT]]
+                    // +CREG: <n>,<stat>[,<lac>,<ci>[,AcT]] // reply to AT+CREG
+                    // +CREG: <stat>[,<lac>,<ci>[,AcT]] // URC
                     b = 255;
                     r = sscanf(cmd, "CREG: %*d,%d,\"%X\",\"%X\",%d",&a,&b,&c,&d);
+                    if (r <= 0)
+                        r = sscanf(cmd, "CREG: %d,\"%X\",\"%X\",%d",&a,&b,&c,&d);
                     if (r >= 1) {
                         // network status
                         if      (a == 0) _net.reg = REG_NONE;     // 0: not registered, home network
@@ -199,7 +200,6 @@
                             else if (d == 5) _net.act = ACT_UTRAN;    // 5: UTRAN with HSUPA availability
                             else if (d == 6) _net.act = ACT_UTRAN;    // 6: UTRAN with HSDPA and HSUPA availability
                         }
-                        
                     // +UUPSDD: <profile_id> 
                     } else if (sscanf(cmd, "UUPSDD: %d",&a) == 1) {
                         if (*PROFILE == a) _ip = NOIP;
@@ -602,7 +602,7 @@
 
 MDMParser::IP MDMParser::join(const char* apn /*= NULL*/, const char* username /*= NULL*/, const char* password /*= NULL*/)
 {
-    TRACE("Modem::join\r\n");
+    INFO("Modem::join\r\n");
     _ip = NOIP;
     if (_dev.dev == DEV_LISA_C200) {
         // make a dumy dns lookup (which will fail, so ignore the result)