ACKme / Mbed 2 deprecated wiconnect-test-console

Dependencies:   WiConnect mbed

Revision:
0:836c9a6383e0
Child:
1:5137ec8f4c45
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 11 11:31:32 2014 +0000
@@ -0,0 +1,102 @@
+/*
+ * 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 "Wiconnect.h"
+#include "util/log/log.h"
+#include "util/CommandProcessor/CommandProcessor.h"
+#include "tests/Tests.h"
+#include "target_config.h"
+
+
+#if TEST_NONBLOCKING_API
+#error 'TEST_NONBLOCKING_API = true' NOT currently supported for the mbed sdk
+#endif
+
+
+int wiconnectLogDebug(const char *str);
+
+
+static const CommandListEntry commandList[] =
+{
+    CMD_HELP_ENTRY,
+    WICONNECT_TEST_CMD_LIST,
+    NETWORK_TEST_CMD_LIST,
+    SOCKET_TEST_CMD_LIST,
+    FILE_TEST_CMD_LIST,
+    CMD_LIST_TERMINATOR
+};
+
+static const SerialConfig serialConfig(WICONNECT_RX_PIN, WICONNECT_TX_PIN, WICONNECT_CTS_PIN, WICONNECT_RTS_PIN, WICONNECT_DEFAULT_BAUD, NULL, WICONNECT_SERIAL_RX_BUFFER_SIZE);
+static Wiconnect wiconnectIfc(serialConfig, NULL, WICONNECT_INTERNAL_BUFFER_SIZE, WICONNECT_RESET_PIN, WICONNECT_WAKE_PIN, TEST_NONBLOCKING_API);
+
+ConsoleSerial consoleSerial(SERIAL_TX, SERIAL_RX);
+CommandProcessor cmdProcessor(&consoleSerial, commandList);
+char testBuffer[TEST_BUFFER_LENGTH];
+
+
+/*************************************************************************************************/
+int main(int argc, char *argv[])
+{
+    WiconnectResult result;
+
+    consoleSerial.setBaud(CONSOLE_BAUD);
+
+#ifdef ENABLE_WICONNECT_DEBUG
+    wiconnectIfc.setDebugLogger(LogFunc(wiconnectLogDebug));
+#endif
+
+    initialize_loop:
+    {
+        LOG_INFO("\r\n\r\nInitializing WiConnect...");
+        if(WICONNECT_FAILED(result, wiconnectIfc.init(true)))
+        {
+            LOG_WICONNECT_ERROR(result, "Failed to initialize Wiconnect");
+            LOG_INFO("Press any key to retry initialization...");
+            int c = consoleSerial.getc();
+            goto initialize_loop;
+        }
+    }
+
+    {
+        char version[WICONNECT_MAX_VERSION_SIZE];
+        if(!WICONNECT_FAILED(result, wiconnectIfc.getVersion(version, WICONNECT_MAX_VERSION_SIZE)))
+        {
+            LOG_INFO("Version: %s", version);
+        }
+    }
+
+    LOG_INFO("WiConnect test app ready...");
+
+    for(;;)
+    {
+        Command cmd;
+        cmdProcessor.waitForCommand(&cmd);
+        if(WICONNECT_FAILED(result, cmd.execute()))
+        {
+            LOG_WICONNECT_ERROR(result, "Failed to execute command");
+            if(result == WICONNECT_CMD_RESPONSE_ERROR)
+            {
+                LOG_ERROR("WiConnect command response code: %s", wiconnectIfc.getLastCommandResponseCodeStr());
+            }
+        }
+    }
+
+    return 0;
+}
+
+
+/*************************************************************************************************/
+int wiconnectLogDebug(const char *str)
+{
+    logDebug(str);
+    return 0;
+}
+
+