Test serial console demonstrating various API functions of WiConnect library.

Dependencies:   WiConnect mbed

Revision:
0:836c9a6383e0
Child:
1:5137ec8f4c45
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/log/log.cpp	Mon Aug 11 11:31:32 2014 +0000
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2014, ACKme Networks
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks;
+ * the contents of this file may not be disclosed to third parties, copied
+ * or duplicated in any form, in whole or in part, without the prior
+ * written permission of ACKme Networks.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+
+#include "Wiconnect.h"
+#include "log.h"
+#include "util/CommandProcessor/CommandProcessor.h"
+
+
+extern ConsoleSerial consoleSerial;
+
+
+/*************************************************************************************************/
+void logDebug(const char *msg, ...)
+{
+    va_list args;
+
+    consoleSerial.write("[DEBUG] ");
+    va_start(args, msg);
+    consoleSerial.vprintf(msg, args);
+    va_end(args);
+}
+
+/*************************************************************************************************/
+void logInfo(const char *msg, ...)
+{
+    va_list args;
+    consoleSerial.write("[INFO] ");
+    va_start(args, msg);
+    consoleSerial.vprintf(msg, args);
+    va_end(args);
+}
+
+/*************************************************************************************************/
+void logWrite(const void *data, int size)
+{
+    consoleSerial.write(data, size);
+}
+
+/*************************************************************************************************/
+void logInfoWriteStr(const char *msg, const char *s)
+{
+    consoleSerial.printf("[INFO] %s", msg);
+    consoleSerial.write(s);
+    consoleSerial.write("\r\n");
+}
+
+/*************************************************************************************************/
+void logError(const char *msg, ...)
+{
+    va_list args;
+    consoleSerial.write("[ERROR] ");
+    va_start(args, msg);
+    consoleSerial.vprintf(msg, args);
+    va_end(args);
+}
+
+/*************************************************************************************************/
+void logWiconnectError(WiconnectResult result, const char *msg, ...)
+{
+    va_list args;
+    consoleSerial.write("[ERROR] ");
+    va_start(args, msg);
+    consoleSerial.printf("%s, (%d) %s\r\n", msg, result, Wiconnect::getWiconnectResultStr(result));
+    va_end(args);
+}
+
+