Test serial console demonstrating various API functions of WiConnect library.

Dependencies:   WiConnect mbed

Files at this revision

API Documentation at this revision

Comitter:
dan_ackme
Date:
Mon Aug 11 04:53:00 2014 -0700
Parent:
1:5137ec8f4c45
Child:
3:dddd476d5967
Commit message:
warning fixes

Changed in this revision

ConsoleSerial.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
tests/blocking/network/NetworkTests.cpp Show annotated file Show diff for this revision Revisions of this file
tests/blocking/socket/TcpEchoTest.cpp Show annotated file Show diff for this revision Revisions of this file
tests/blocking/socket/UdpEchoTest.cpp Show annotated file Show diff for this revision Revisions of this file
tests/blocking/wiconnect/WiconnectTests.cpp Show annotated file Show diff for this revision Revisions of this file
util/CommandProcessor/Console.h Show annotated file Show diff for this revision Revisions of this file
--- a/ConsoleSerial.h	Mon Aug 11 04:39:25 2014 -0700
+++ b/ConsoleSerial.h	Mon Aug 11 04:53:00 2014 -0700
@@ -31,27 +31,29 @@
         this->baud(baud);
     }
 
-    virtual int read()
+    using FileHandle::read;
+    using FileHandle::write;
+    int read()
     {
         return getc();
     }
 
-    virtual void write(int c)
+    void write(int c)
     {
         putc(c);
     }
 
-    virtual void write(const char *s)
+    void write(const char *s)
     {
         puts(s);
     }
 
-    virtual void write(char *s)
+    void write(char *s)
     {
         puts(s);
     }
 
-    virtual void write(const void *data, int size)
+    void write(const void *data, int size)
     {
         Serial::write(data, size);
     }
--- a/main.cpp	Mon Aug 11 04:39:25 2014 -0700
+++ b/main.cpp	Mon Aug 11 04:53:00 2014 -0700
@@ -45,6 +45,7 @@
 int main(int argc, char *argv[])
 {
     WiconnectResult result;
+    bool running = true;
 
     consoleSerial.setBaud(CONSOLE_BAUD);
 
@@ -65,16 +66,15 @@
     }
 
     {
-        char version[WICONNECT_MAX_VERSION_SIZE];
-        if(!WICONNECT_FAILED(result, wiconnectIfc.getVersion(version, WICONNECT_MAX_VERSION_SIZE)))
+        if(!WICONNECT_FAILED(result, wiconnectIfc.getVersion()))
         {
-            LOG_INFO("Version: %s", version);
+            LOG_INFO("Version: %s", wiconnectIfc.getResponseBuffer());
         }
     }
 
     LOG_INFO("WiConnect test app ready...");
 
-    for(;;)
+    while(running)
     {
         Command cmd;
         cmdProcessor.waitForCommand(&cmd);
--- a/tests/blocking/network/NetworkTests.cpp	Mon Aug 11 04:39:25 2014 -0700
+++ b/tests/blocking/network/NetworkTests.cpp	Mon Aug 11 04:53:00 2014 -0700
@@ -22,7 +22,7 @@
     NetworkStatus status;
     NetworkSignalStrength signal;
     uint32_t ip, nm, gw;
-    bool dhcpEnabled;
+    bool dhcpEnabled = false;
 
     if(WICONNECT_FAILED(result, wiconnect->getIpSettings(&ip, &nm, &gw)))
     {
--- a/tests/blocking/socket/TcpEchoTest.cpp	Mon Aug 11 04:39:25 2014 -0700
+++ b/tests/blocking/socket/TcpEchoTest.cpp	Mon Aug 11 04:53:00 2014 -0700
@@ -74,7 +74,7 @@
 /*************************************************************************************************/
 static WiconnectResult processData(Socket &socket, uint32_t count, uint32_t delay, uint32_t size)
 {
-    WiconnectResult result;
+    WiconnectResult result = WICONNECT_ERROR;
     uint8_t *txBuffer = socket.getTxBuffer();
     const int txBufferLen = socket.getTxBufferSize();
     uint8_t writeCounter = 32;
--- a/tests/blocking/socket/UdpEchoTest.cpp	Mon Aug 11 04:39:25 2014 -0700
+++ b/tests/blocking/socket/UdpEchoTest.cpp	Mon Aug 11 04:53:00 2014 -0700
@@ -75,7 +75,7 @@
 /*************************************************************************************************/
 static WiconnectResult processData(Socket &socket, uint32_t count, uint32_t delay, uint32_t size)
 {
-    WiconnectResult result;
+    WiconnectResult result = WICONNECT_ERROR;
     uint8_t *txBuffer = socket.getTxBuffer();
     const int txBufferLen = socket.getTxBufferSize();
     uint8_t writeCounter = 32;
--- a/tests/blocking/wiconnect/WiconnectTests.cpp	Mon Aug 11 04:39:25 2014 -0700
+++ b/tests/blocking/wiconnect/WiconnectTests.cpp	Mon Aug 11 04:53:00 2014 -0700
@@ -67,10 +67,8 @@
 /*************************************************************************************************/
 WiconnectResult wiconnectSendRawNonBlockingCommand(int argc, char **argv)
 {
-
     WiconnectResult result;
     Wiconnect *wiconnect = Wiconnect::getInstance();
-    char *ptr = testBuffer;
 
     strcpy(testBuffer, argv[0]);
     --argc;
@@ -112,7 +110,6 @@
 WiconnectResult wiconnectDebugEnableCommand(int argc, char **argv)
 {
     extern int wiconnectLogDebug(const char *str);
-    WiconnectResult result;
     Wiconnect *wiconnect = Wiconnect::getInstance();
     bool enabled;
 
--- a/util/CommandProcessor/Console.h	Mon Aug 11 04:39:25 2014 -0700
+++ b/util/CommandProcessor/Console.h	Mon Aug 11 04:53:00 2014 -0700
@@ -156,7 +156,7 @@
     /*************************************************************************************************/
     bool process_escape_sequence(char c, bool echo)
     {
-        char previous_char;
+        static char previous_char = 0;
         bool still_in_esc_seq = false;
 
     #ifdef __WIN32__