SNICInterface for ThingPlug Example

Dependents:   ThingPlug_WiFi_Example ThingPlug_WiFi_Example_2

Fork of SNICInterface by muRata

Revision:
43:d80bbb12ffe6
Parent:
40:b6b10c22a121
Child:
51:69a9cf901d54
--- a/SNIC_WifiInterface.cpp	Fri Sep 19 01:46:17 2014 +0000
+++ b/SNIC_WifiInterface.cpp	Fri Nov 14 00:52:31 2014 +0000
@@ -211,15 +211,21 @@
     int ret;
     // Wait UART response
     ret = uartCmdMgr_p->wait();
-    if( ret != 0 )
+    if(uartCmdMgr_p->getCommandStatus() != UART_CMD_RES_WIFI_ERR_ALREADY_JOINED)
+    {
+        DEBUG_PRINT( "Already connected\r\n" );
+    }
+    else
     {
-        DEBUG_PRINT( "join failed\r\n" );
-        snic_core_p->freeCmdBuf( payload_buf_p );
-        return -1;
+        if( ret != 0 )
+        {
+            DEBUG_PRINT( "join failed\r\n" );
+            snic_core_p->freeCmdBuf( payload_buf_p );
+            return -1;
+        }
     }
     
-    if( (uartCmdMgr_p->getCommandStatus() != 0) && 
-        (uartCmdMgr_p->getCommandStatus() != UART_CMD_RES_WIFI_ERR_ALREADY_JOINED) )
+    if(uartCmdMgr_p->getCommandStatus() != 0)
     {
         DEBUG_PRINT("join status:%02x\r\n", uartCmdMgr_p->getCommandStatus());
         snic_core_p->freeCmdBuf( payload_buf_p );