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.

Dependencies:   mbed millis

Fork of QSL_SimplePublish by Jon-Håkon Bøe Røli

QSL SimplePublish

SmartMesh IP QuickStart Library

Revision:
1:89766ea2e99d
Parent:
0:d3f5fdf2e6da
Child:
9:f723949a18b7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sm_qsl/dn_debug.h	Thu Sep 01 15:00:28 2016 +0000
@@ -0,0 +1,41 @@
+/*
+Copyright (c) 2016, Dust Networks. All rights reserved.
+
+Debug macros (based on http://c.learncodethehardway.org/book/ex20.html ).
+
+\license See attached DN_LICENSE.txt.
+*/
+
+#ifndef DN_DEBUG_H
+#define DN_DEBUG_H
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+/* Comment out this define to include debug messages */
+//#define NDEBUG
+
+/* Comment out this define to include log messages */
+//#define NLOG
+
+#ifdef NDEBUG
+#define debug(M, ...)	do {}while(0)
+#else
+#define debug(M, ...)	fprintf(stderr, "DEBUG %s:%d: " M "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
+#endif
+
+#define clean_errno() (errno == 0 ? "None" : strerror(errno))
+
+#ifdef NLOG
+#define log_err(M, ...)		do {}while(0)
+#define log_warn(M, ...)	do {}while(0)
+#define log_info(M, ...)	do {}while(0)
+#else
+#define log_err(M, ...)		fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\r\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
+#define log_warn(M, ...)	fprintf(stderr, "[WARN] (%s:%d: errno: %s) " M "\r\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
+#define log_info(M, ...)	fprintf(stderr, "[INFO] (%s:%d) " M "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
+#endif
+
+#endif
+