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.

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Thu Jan 22 08:02:55 2015 +0000
Parent:
116:709a6386e685
Child:
118:c2c4b6b421c8
Child:
121:8da935c2c08c
Commit message:
improve debug api

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	Wed Dec 17 11:35:07 2014 +0000
+++ b/MDM.cpp	Thu Jan 22 08:02:55 2015 +0000
@@ -62,10 +62,24 @@
     ::printf("\"\r\n");
 }
  
- #define ERROR(...)     (_debugLevel < 0) ? : ::printf(RED), ::printf(__VA_ARGS__), ::printf(DEF) 
- #define TEST(...)                            ::printf(CYA), ::printf(__VA_ARGS__), ::printf(DEF)  
- #define INFO(...)      (_debugLevel < 1) ? : ::printf(GRE), ::printf(__VA_ARGS__), ::printf(DEF) 
- #define TRACE(...)     (_debugLevel < 2) ? : ::printf(__VA_ARGS__)
+void MDMParser::_debugPrint(int level, const char* color, const char* format, ...)
+{
+    if (_debugLevel >= level) 
+    {
+        ::printf("_debugPrint %d %d\r\n", _debugLevel, level); 
+        va_list args;
+        va_start (args, format);
+        if (color) ::printf(color);
+        ::vprintf(format, args);
+        if (color) ::printf(DEF);
+        va_end (args);
+    }
+}
+   
+ #define ERROR(...)     _debugPrint(0, RED, __VA_ARGS__)
+ #define INFO(...)      _debugPrint(1, GRE, __VA_ARGS__)
+ #define TRACE(...)     _debugPrint(2, DEF, __VA_ARGS__)
+ #define TEST(...)      _debugPrint(3, CYA, __VA_ARGS__)
  
 #else
  
@@ -1378,7 +1392,8 @@
 bool MDMParser::setDebug(int level) 
 {
 #ifdef MDM_DEBUG
-    if ((_debugLevel >= 0) && (level >= 0)) {
+    if ((_debugLevel >= -1) && (level >= -1) &&
+        (_debugLevel <=  3) && (level <=  3)) {
         _debugLevel = level;
         return true;
     }
--- a/MDM.h	Wed Dec 17 11:35:07 2014 +0000
+++ b/MDM.h	Thu Jan 22 08:02:55 2015 +0000
@@ -322,7 +322,7 @@
     // ----------------------------------------------------------------
     
     /*! Set the debug level 
-        \param level 0 = OFF, 1 = INFO(default), 2 = TRACE, 3 = ATCMD
+        \param level -1 = OFF, 0 = ERROR, 1 = INFO(default), 2 = TRACE, 3 = ATCMD,TEST
         \return true if successful, false not possible
     */ 
     bool setDebug(int level);
@@ -558,6 +558,7 @@
 #ifdef MDM_DEBUG
     int _debugLevel;
     Timer _debugTime;
+    void _debugPrint(int level, const char* color, const char* format, ...);
 #endif
 };