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
Diff: SNIC_WifiInterface.cpp
- Revision:
- 40:b6b10c22a121
- Parent:
- 39:a1233ca02edf
- Child:
- 43:d80bbb12ffe6
diff -r a1233ca02edf -r b6b10c22a121 SNIC_WifiInterface.cpp --- a/SNIC_WifiInterface.cpp Tue Jul 15 02:08:42 2014 +0000 +++ b/SNIC_WifiInterface.cpp Tue Jul 15 09:56:37 2014 +0000 @@ -53,7 +53,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("snic_init payload_buf_p NULL\r\n"); + DEBUG_PRINT("snic_init payload_buf_p NULL\r\n"); return -1; } @@ -78,14 +78,14 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "snic_init failed\r\n" ); + DEBUG_PRINT( "snic_init failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { - printf("snic_init status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("snic_init status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -103,7 +103,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("getFWVersion payload_buf_p NULL\r\n"); + DEBUG_PRINT("getFWVersion payload_buf_p NULL\r\n"); return -1; } @@ -127,7 +127,7 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "getFWversion failed\r\n" ); + DEBUG_PRINT( "getFWversion failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -150,14 +150,14 @@ // Parameter check(SSID) if( (ssid_p == NULL) || (ssid_len == 0) ) { - printf( "connect failed [ parameter NG:SSID ]\r\n" ); + DEBUG_PRINT( "connect failed [ parameter NG:SSID ]\r\n" ); return -1; } // Parameter check(Security key) if( (sec_type != e_SEC_OPEN) && ( (sec_key_len == 0) || (sec_key_p == NULL) ) ) { - printf( "connect failed [ parameter NG:Security key ]\r\n" ); + DEBUG_PRINT( "connect failed [ parameter NG:Security key ]\r\n" ); return -1; } @@ -165,7 +165,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("connect payload_buf_p NULL\r\n"); + DEBUG_PRINT("connect payload_buf_p NULL\r\n"); return -1; } @@ -213,7 +213,7 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "join failed\r\n" ); + DEBUG_PRINT( "join failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -221,7 +221,7 @@ if( (uartCmdMgr_p->getCommandStatus() != 0) && (uartCmdMgr_p->getCommandStatus() != UART_CMD_RES_WIFI_ERR_ALREADY_JOINED) ) { - printf("join status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("join status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -239,7 +239,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("disconnect payload_buf_p NULL\r\n"); + DEBUG_PRINT("disconnect payload_buf_p NULL\r\n"); return -1; } @@ -262,14 +262,14 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "disconnect failed\r\n" ); + DEBUG_PRINT( "disconnect failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { - printf("disconnect status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("disconnect status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); ret = -1; } snic_core_p->freeCmdBuf( payload_buf_p ); @@ -286,7 +286,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("scan payload_buf_p NULL\r\n"); + DEBUG_PRINT("scan payload_buf_p NULL\r\n"); return -1; } @@ -338,17 +338,17 @@ int ret; // Wait UART response ret = uartCmdMgr_p->wait(); - printf( "scan wait:%d\r\n", ret ); + DEBUG_PRINT( "scan wait:%d\r\n", ret ); if( ret != 0 ) { - printf( "scan failed\r\n" ); + DEBUG_PRINT( "scan failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { - printf("scan status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("scan status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -366,7 +366,7 @@ // Parameter check if( country_p == NULL ) { - printf("wifi_on parameter error\r\n"); + DEBUG_PRINT("wifi_on parameter error\r\n"); return -1; } @@ -374,7 +374,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("wifi_on payload_buf_p NULL\r\n"); + DEBUG_PRINT("wifi_on payload_buf_p NULL\r\n"); return -1; } @@ -398,14 +398,14 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "wifi_on failed\r\n" ); + DEBUG_PRINT( "wifi_on failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { - printf("wifi_on status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("wifi_on status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -423,7 +423,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("wifi_off payload_buf_p NULL\r\n"); + DEBUG_PRINT("wifi_off payload_buf_p NULL\r\n"); return -1; } @@ -446,14 +446,14 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "wifi_off failed\r\n" ); + DEBUG_PRINT( "wifi_off failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { - printf("wifi_off status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("wifi_off status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -468,7 +468,7 @@ C_SNIC_UartCommandManager *uartCmdMgr_p = snic_core_p->getUartCommand(); if( rssi_p == NULL ) { - printf("getRssi parameter error\r\n"); + DEBUG_PRINT("getRssi parameter error\r\n"); return -1; } @@ -476,7 +476,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("getRssi payload_buf_p NULL\r\n"); + DEBUG_PRINT("getRssi payload_buf_p NULL\r\n"); return -1; } @@ -499,7 +499,7 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "getRssi failed\r\n" ); + DEBUG_PRINT( "getRssi failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -517,7 +517,7 @@ if( status_p == NULL ) { - printf("getWifiStatus parameter error\r\n"); + DEBUG_PRINT("getWifiStatus parameter error\r\n"); return -1; } @@ -525,7 +525,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("getWifiStatus payload_buf_p NULL\r\n"); + DEBUG_PRINT("getWifiStatus payload_buf_p NULL\r\n"); return -1; } @@ -548,7 +548,7 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "getWifiStatus failed\r\n" ); + DEBUG_PRINT( "getWifiStatus failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -580,7 +580,7 @@ { if( (ip_p == NULL) || (mask_p == NULL) ||(gateway_p == NULL) ) { - printf("setIPConfig parameter error\r\n"); + DEBUG_PRINT("setIPConfig parameter error\r\n"); return -1; } } @@ -592,7 +592,7 @@ tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { - printf("setIPConfig payload_buf_p NULL\r\n"); + DEBUG_PRINT("setIPConfig payload_buf_p NULL\r\n"); return -1; } @@ -641,14 +641,14 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "setIPConfig failed\r\n" ); + DEBUG_PRINT( "setIPConfig failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { - printf("setIPConfig status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("setIPConfig status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; }