- Added setBaud() function - Added CheckNetworkStatus() function - Improved messaging system

Dependents:   IoT_Ex BatteryModelTester BatteryModelTester

Fork of WiflyInterface by Components

Revision:
25:36b2d76ca8d9
Parent:
14:5a9561156acc
Child:
26:eaaedb036df1
--- a/WiflyInterface.cpp	Thu Mar 31 14:13:07 2016 +0000
+++ b/WiflyInterface.cpp	Thu Mar 31 16:22:37 2016 +0000
@@ -1,5 +1,23 @@
 #include "WiflyInterface.h"
 
+#define DEBUG
+//Debug is disabled by default
+#ifdef DEBUG
+#define DBG(x, ...) pc.printf("[WiflyInterface : DBG] "x"\r\n", ##__VA_ARGS__);
+#define WARN(x, ...) pc.printf("[WiflyInterface : WARN] "x"\r\n", ##__VA_ARGS__);
+#define ERR(x, ...) pc.printf("[WiflyInterface : ERR] "x"\r\n", ##__VA_ARGS__);
+#else
+#define DBG(x, ...)
+#define WARN(x, ...)
+#define ERR(x, ...)
+#endif
+
+#ifdef DEBUG
+#define INFO(x, ...) pc.printf("[WiflyInterface : INFO] "x"\r\n", ##__VA_ARGS__);
+#else
+#define INFO(x, ...)
+#endif
+
 WiflyInterface::WiflyInterface( PinName tx, PinName rx, PinName reset, PinName tcp_status,
                                 const char * ssid, const char * phrase, Security sec) :
     Wifly(tx, rx, reset, tcp_status, ssid, phrase, sec)
@@ -11,6 +29,7 @@
 {
     state.dhcp = true;
     reset();
+    INFO("WiflyInterface Initialized.");
     return 0;
 }
 
@@ -31,7 +50,7 @@
 {
     // join() returns a boolean, it does not like it all the time, thus casting it as int
     int ii = (int) join();
-    pc.printf(">>> join() complete. %d\n\r",ii);
+    INFO("join() complete, return value: %d",ii);
     return ii;
 }