SNIC UART Interface library: Serial to Wi-Fi library for Murata TypeYD Wi-Fi module. For more information about TypeYD: http://www.murata.co.jp/products/microwave/module/lbwb1zzydz/index.html

Dependents:   SNIC-xively-jumpstart-demo SNIC-FluentLogger-example TCPEchoServer murataDemo ... more

Fork of YDwifiInterface by Takao Kishino

Revision:
39:a1233ca02edf
Parent:
38:f13e4e563d65
Child:
40:b6b10c22a121
--- a/SNIC_WifiInterface.cpp	Wed Jun 25 00:04:11 2014 +0000
+++ b/SNIC_WifiInterface.cpp	Tue Jul 15 02:08:42 2014 +0000
@@ -1,15 +1,21 @@
-/******************* Murata Manufacturing Co.,Ltd. 2014 *****************
+/* Copyright (C) 2014 Murata Manufacturing Co.,Ltd., MIT License
+ *  muRata, SWITCH SCIENCE Wi-FI module TypeYD-SNIC UART.
  *
- * Filename:   SNIC_WifiInterface.cpp
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
  *
- * Purpose:    This module has implementation of API for SNIC UART of Wi-Fi. 
- *              
- * $Author: kishino $
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
  *
- * $Date: 2014/03/26 $
- *
- * $Revision: 0.0.0.1 $
- * ***********************************************************************/
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
 #include "SNIC_WifiInterface.h"
 #include "SNIC_UartMsgUtil.h"
 
@@ -80,7 +86,8 @@
     if( uartCmdMgr_p->getCommandStatus() != 0 )
     {
         printf("snic_init status:%02x\r\n", uartCmdMgr_p->getCommandStatus());
-        ret = -1;
+        snic_core_p->freeCmdBuf( payload_buf_p );
+        return -1;
     }
     snic_core_p->freeCmdBuf( payload_buf_p );
     
@@ -215,7 +222,8 @@
         (uartCmdMgr_p->getCommandStatus() != UART_CMD_RES_WIFI_ERR_ALREADY_JOINED) )
     {
         printf("join status:%02x\r\n", uartCmdMgr_p->getCommandStatus());
-        ret = -1;
+        snic_core_p->freeCmdBuf( payload_buf_p );
+        return -1;
     }
     snic_core_p->freeCmdBuf( payload_buf_p );
 
@@ -341,7 +349,8 @@
     if( uartCmdMgr_p->getCommandStatus() != 0 )
     {
         printf("scan status:%02x\r\n", uartCmdMgr_p->getCommandStatus());
-        ret = -1;
+        snic_core_p->freeCmdBuf( payload_buf_p );
+        return -1;
     }
 
     snic_core_p->freeCmdBuf( payload_buf_p );
@@ -397,7 +406,8 @@
     if( uartCmdMgr_p->getCommandStatus() != 0 )
     {
         printf("wifi_on status:%02x\r\n", uartCmdMgr_p->getCommandStatus());
-        ret = -1;
+        snic_core_p->freeCmdBuf( payload_buf_p );
+        return -1;
     }
     snic_core_p->freeCmdBuf( payload_buf_p );
 
@@ -444,7 +454,8 @@
     if( uartCmdMgr_p->getCommandStatus() != 0 )
     {
         printf("wifi_off status:%02x\r\n", uartCmdMgr_p->getCommandStatus());
-        ret = -1;
+        snic_core_p->freeCmdBuf( payload_buf_p );
+        return -1;
     }
     snic_core_p->freeCmdBuf( payload_buf_p );
 
@@ -638,7 +649,8 @@
     if( uartCmdMgr_p->getCommandStatus() != 0 )
     {
         printf("setIPConfig status:%02x\r\n", uartCmdMgr_p->getCommandStatus());
-        ret = -1;
+        snic_core_p->freeCmdBuf( payload_buf_p );
+        return -1;
     }
 
     snic_core_p->freeCmdBuf( payload_buf_p );