SNICInterface for ThingPlug Example
Dependents: ThingPlug_WiFi_Example ThingPlug_WiFi_Example_2
Fork of SNICInterface by
Diff: Socket/TCPSocketConnection.cpp
- Revision:
- 22:a9ec0cad4f84
- Parent:
- 20:dd736d328de6
- Child:
- 24:987e412ae879
--- a/Socket/TCPSocketConnection.cpp Thu Mar 27 07:14:21 2014 +0000 +++ b/Socket/TCPSocketConnection.cpp Thu Mar 27 07:37:55 2014 +0000 @@ -50,14 +50,14 @@ } // Get buffer for response payload from MemoryPool - tagMEMPOOL_BLOCK_T *payload_buf = mSnicWifi_p->allocCmdBuf(); + C_SNIC_Core::tagMEMPOOL_BLOCK_T *payload_buf = mSnicWifi_p->allocCmdBuf(); if( payload_buf == NULL ) { printf("connect payload_buf NULL\r\n"); return -1; } - tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T req; + C_SNIC_Core::tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T req; // Make request req.cmd_sid = UART_CMD_SID_SNIC_TCP_CONNECT_TO_SERVER_REQ; req.seq = mUartRequestSeq++; @@ -78,7 +78,7 @@ unsigned int command_len; // Preparation of command command_len = mSnicWifi_p->preparationSendCommand( UART_CMD_ID_SNIC, req.cmd_sid, (unsigned char *)&req - , sizeof(tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T), payload_buf->buf, command_array ); + , sizeof(C_SNIC_Core::tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T), payload_buf->buf, command_array ); // Send uart command request mSnicWifi_p->sendUart( command_len, command_array ); @@ -103,7 +103,7 @@ mSnicWifi_p->freeCmdBuf( payload_buf ); // Initialize connection information - tagCONNECT_INFO_T *con_info_p = mSnicWifi_p->getConnectInfo( mSocketID ); + C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = mSnicWifi_p->getConnectInfo( mSocketID ); if( con_info_p->recvbuf_p == NULL ) { printf( "create recv buffer[socket:%d]\r\n", mSocketID); @@ -117,7 +117,7 @@ bool TCPSocketConnection::is_connected(void) { - tagCONNECT_INFO_T *con_info_p = mSnicWifi_p->getConnectInfo( mSocketID ); + C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = mSnicWifi_p->getConnectInfo( mSocketID ); return con_info_p->is_connected; } @@ -127,14 +127,14 @@ C_SNIC_UartCommandManager *uartCmdMgr_p = mSnicWifi_p->getUartCommand(); // Get buffer for response payload from MemoryPool - tagMEMPOOL_BLOCK_T *payload_buf = mSnicWifi_p->allocCmdBuf(); + C_SNIC_Core::tagMEMPOOL_BLOCK_T *payload_buf = mSnicWifi_p->allocCmdBuf(); if( payload_buf == NULL ) { printf("connect payload_buf NULL\r\n"); return -1; } - tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T req; + C_SNIC_Core::tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T req; // Make request req.cmd_sid = UART_CMD_SID_SNIC_SEND_FROM_SOCKET_REQ; req.seq = mUartRequestSeq++; @@ -143,7 +143,7 @@ req.payload_len[0]= ( (length & 0xFF00) >> 8 ); req.payload_len[1]= (length & 0xFF); - int req_size = sizeof(tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T); + int req_size = sizeof(C_SNIC_Core::tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T); memcpy( gTCP_SEND_BUF, &req, req_size ); memcpy( &gTCP_SEND_BUF[req_size], data_p, length ); @@ -156,8 +156,6 @@ // Send uart command request mSnicWifi_p->sendUart( command_len, command_array ); -// mSnicWifi_p->mUartCommand.setCommandSID( req.cmd_sid ); - // Wait UART response int ret = uartCmdMgr_p->wait(); if( ret != 0 ) @@ -190,7 +188,7 @@ } // Initialize connection information - tagCONNECT_INFO_T *con_info_p = mSnicWifi_p->getConnectInfo( mSocketID ); + C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = mSnicWifi_p->getConnectInfo( mSocketID ); if( con_info_p->recvbuf_p == NULL ) { printf("TCPSocketConnection::receive Conncection info error\r\n");