SNICInterface for ThingPlug Example
Dependents: ThingPlug_WiFi_Example ThingPlug_WiFi_Example_2
Fork of SNICInterface by
Diff: Socket/TCPSocketConnection.cpp
- Revision:
- 40:b6b10c22a121
- Parent:
- 39:a1233ca02edf
- Child:
- 41:1c1b5ad4d491
diff -r a1233ca02edf -r b6b10c22a121 Socket/TCPSocketConnection.cpp --- a/Socket/TCPSocketConnection.cpp Tue Jul 15 02:08:42 2014 +0000 +++ b/Socket/TCPSocketConnection.cpp Tue Jul 15 09:56:37 2014 +0000 @@ -39,7 +39,7 @@ ret = createSocket(); if( ret != 0 ) { - printf("createSocket error : %d\r\n", ret); + DEBUG_PRINT("createSocket error : %d\r\n", ret); return -1; } @@ -47,7 +47,7 @@ //lcd_printf("connect to [%s](%08x)\r\n", host_p, ip_addr); if( ( ip_addr == 0) || (ip_addr == -1) ) { - printf("connect resolveHostName failed\r\n"); + DEBUG_PRINT("connect resolveHostName failed\r\n"); return -1; } @@ -55,7 +55,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; } @@ -92,14 +92,14 @@ ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "connect failed\r\n" ); + DEBUG_PRINT( "connect failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != UART_CMD_RES_SNIC_CONNECTION_UP ) { - printf("connect status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("connect status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -110,7 +110,7 @@ C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = snic_core_p->getConnectInfo( mSocketID ); if( con_info_p->recvbuf_p == NULL ) { - printf( "create recv buffer[socket:%d]\r\n", mSocketID); + DEBUG_PRINT( "create recv buffer[socket:%d]\r\n", mSocketID); con_info_p->recvbuf_p = new CircBuffer<char>(SNIC_UART_RECVBUF_SIZE); } con_info_p->is_connected = true; @@ -135,7 +135,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; } @@ -166,14 +166,14 @@ int ret = uartCmdMgr_p->wait(); if( ret != 0 ) { - printf( "send failed\r\n" ); + DEBUG_PRINT( "send failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != UART_CMD_RES_SNIC_SUCCESS ) { - printf("send status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); + DEBUG_PRINT("send status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } @@ -194,7 +194,7 @@ if( (data_p == NULL) || (length < 1) ) { - printf("TCPSocketConnection::receive parameter error\r\n"); + DEBUG_PRINT("TCPSocketConnection::receive parameter error\r\n"); return -1; } @@ -203,20 +203,20 @@ C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = snic_core_p->getConnectInfo( mSocketID ); if( con_info_p->recvbuf_p == NULL ) { - printf("TCPSocketConnection::receive Conncection info error\r\n"); + DEBUG_PRINT("TCPSocketConnection::receive Conncection info error\r\n"); return -1; } // Check connection if( con_info_p->is_connected == false ) { - printf(" Socket id \"%d\" is not connected\r\n", mSocketID); + DEBUG_PRINT(" Socket id \"%d\" is not connected\r\n", mSocketID); return -1; } if( con_info_p->is_received == false ) { -// printf(" Socket id \"%d\" is not received\r\n", mSocketID); +// DEBUG_PRINT(" Socket id \"%d\" is not received\r\n", mSocketID); return 0; }