Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Cellular_HelloMQTT UBLOXModemDriver UBLOXMQTTDriver
Fork of C027_Support by
Diff: MDM.cpp
- Revision:
- 117:74e4e0109a9e
- Parent:
- 115:d8d94b73c725
- Child:
- 118:c2c4b6b421c8
- Child:
- 121:8da935c2c08c
--- 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;
}
