C027_Support library plus AT Comand for dialing.

Fork of C027_Support_New by irsan julfikar

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Tue May 20 11:40:07 2014 +0000
Parent:
77:55788e619858
Child:
79:291df065e345
Commit message:
remove some headers, parse CREG URC

Changed in this revision

MDM.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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)