Program that uses the QuickStart Library to interface a SmartMesh IP mote: Connects to the default network and starts publishing a random walk value every 5 seconds.
Fork of QSL_SimplePublish by
QSL SimplePublish
SmartMesh IP QuickStart Library
- GitHub repository
- Current release used: REL-1.0.2.2
- Documentation
- Discussion
sm_qsl/dn_debug.h@9:f723949a18b7, 2016-11-04 (annotated)
- Committer:
- jhbr
- Date:
- Fri Nov 04 14:19:34 2016 +0000
- Revision:
- 9:f723949a18b7
- Parent:
- 1:89766ea2e99d
Deactivated DEBUG prints and updated mbed library to v128
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jhbr | 0:d3f5fdf2e6da | 1 | /* |
jhbr | 0:d3f5fdf2e6da | 2 | Copyright (c) 2016, Dust Networks. All rights reserved. |
jhbr | 0:d3f5fdf2e6da | 3 | |
jhbr | 0:d3f5fdf2e6da | 4 | Debug macros (based on http://c.learncodethehardway.org/book/ex20.html ). |
jhbr | 0:d3f5fdf2e6da | 5 | |
jhbr | 0:d3f5fdf2e6da | 6 | \license See attached DN_LICENSE.txt. |
jhbr | 0:d3f5fdf2e6da | 7 | */ |
jhbr | 0:d3f5fdf2e6da | 8 | |
jhbr | 0:d3f5fdf2e6da | 9 | #ifndef DN_DEBUG_H |
jhbr | 0:d3f5fdf2e6da | 10 | #define DN_DEBUG_H |
jhbr | 0:d3f5fdf2e6da | 11 | |
jhbr | 0:d3f5fdf2e6da | 12 | #include <stdio.h> |
jhbr | 0:d3f5fdf2e6da | 13 | #include <errno.h> |
jhbr | 0:d3f5fdf2e6da | 14 | #include <string.h> |
jhbr | 0:d3f5fdf2e6da | 15 | |
jhbr | 0:d3f5fdf2e6da | 16 | /* Comment out this define to include debug messages */ |
jhbr | 9:f723949a18b7 | 17 | #define NDEBUG |
jhbr | 0:d3f5fdf2e6da | 18 | |
jhbr | 0:d3f5fdf2e6da | 19 | /* Comment out this define to include log messages */ |
jhbr | 0:d3f5fdf2e6da | 20 | //#define NLOG |
jhbr | 0:d3f5fdf2e6da | 21 | |
jhbr | 0:d3f5fdf2e6da | 22 | #ifdef NDEBUG |
jhbr | 0:d3f5fdf2e6da | 23 | #define debug(M, ...) do {}while(0) |
jhbr | 0:d3f5fdf2e6da | 24 | #else |
jhbr | 0:d3f5fdf2e6da | 25 | #define debug(M, ...) fprintf(stderr, "DEBUG %s:%d: " M "\r\n", __FILE__, __LINE__, ##__VA_ARGS__) |
jhbr | 0:d3f5fdf2e6da | 26 | #endif |
jhbr | 0:d3f5fdf2e6da | 27 | |
jhbr | 0:d3f5fdf2e6da | 28 | #define clean_errno() (errno == 0 ? "None" : strerror(errno)) |
jhbr | 0:d3f5fdf2e6da | 29 | |
jhbr | 0:d3f5fdf2e6da | 30 | #ifdef NLOG |
jhbr | 0:d3f5fdf2e6da | 31 | #define log_err(M, ...) do {}while(0) |
jhbr | 0:d3f5fdf2e6da | 32 | #define log_warn(M, ...) do {}while(0) |
jhbr | 0:d3f5fdf2e6da | 33 | #define log_info(M, ...) do {}while(0) |
jhbr | 0:d3f5fdf2e6da | 34 | #else |
jhbr | 0:d3f5fdf2e6da | 35 | #define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\r\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) |
jhbr | 0:d3f5fdf2e6da | 36 | #define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d: errno: %s) " M "\r\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) |
jhbr | 0:d3f5fdf2e6da | 37 | #define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d) " M "\r\n", __FILE__, __LINE__, ##__VA_ARGS__) |
jhbr | 0:d3f5fdf2e6da | 38 | #endif |
jhbr | 0:d3f5fdf2e6da | 39 | |
jhbr | 0:d3f5fdf2e6da | 40 | #endif |
jhbr | 0:d3f5fdf2e6da | 41 |