SNIC UART Interface library for Murata Type-YD module
Dependents: WebSocketServerTest
Fork of SNICInterface_mod by
Diff: SNIC/SNIC_UartCommandManager.cpp
- Revision:
- 32:ae95309643aa
- Parent:
- 29:6a0ba999597d
- Child:
- 33:33f1bc919486
diff -r 15c22824cc46 -r ae95309643aa SNIC/SNIC_UartCommandManager.cpp --- a/SNIC/SNIC_UartCommandManager.cpp Thu May 29 03:23:21 2014 +0000 +++ b/SNIC/SNIC_UartCommandManager.cpp Fri May 30 08:30:40 2014 +0000 @@ -183,3 +183,36 @@ } con_info_p->is_received = true; } + +void C_SNIC_UartCommandManager::connectedTCPClient( unsigned char *payload_p, int payload_len ) +{ + if( (payload_p == NULL) || (payload_len == 0) ) + { + return; + } + + C_SNIC_Core *instance_p = C_SNIC_Core::getInstance(); + int socket_id; + + // Get socket id of client from payload + socket_id = payload_p[3]; + + printf("[connectedTCPClient] socket id:%d\r\n", socket_id); + + // Get Connection information + C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = instance_p->getConnectInfo( socket_id ); + if( con_info_p == NULL ) + { + return; + } + + if( con_info_p->recvbuf_p == NULL ) + { + printf( "create recv buffer[socket:%d]\r\n", socket_id); + con_info_p->recvbuf_p = new CircBuffer<char>(SNIC_UART_RECVBUF_SIZE); + } + con_info_p->is_connected = true; + con_info_p->is_received = false; + con_info_p->is_accept = true; + con_info_p->parent_socket = payload_p[2]; +}