SNIC UART Interface library for Murata Type-YD module
Dependents: WebSocketServerTest
Fork of SNICInterface_mod by
Diff: SNIC/SNIC_Core.cpp
- Revision:
- 33:33f1bc919486
- Parent:
- 32:ae95309643aa
- Child:
- 35:e4e7f86fd975
--- a/SNIC/SNIC_Core.cpp Fri May 30 08:30:40 2014 +0000 +++ b/SNIC/SNIC_Core.cpp Tue Jun 03 08:53:07 2014 +0000 @@ -61,6 +61,9 @@ { mConnectInfo[i].recvbuf_p = NULL; mConnectInfo[i].is_connected = false; + + mUdpRecvInfo[i].recvbuf_p = NULL; + mUdpRecvInfo[i].is_received = false; } mUartRecvThread_p = NULL; @@ -176,6 +179,15 @@ return &mConnectInfo[socket_id]; } +C_SNIC_Core::tagUDP_RECVINFO_T *C_SNIC_Core::getUdpRecvInfo( int socket_id ) +{ + if( (socket_id < 0) || (socket_id > MAX_SOCKET_ID) ) + { + return NULL; + } + return &mUdpRecvInfo[socket_id]; +} + C_SNIC_UartCommandManager *C_SNIC_Core::getUartCommand() { return mUartCommand_p; @@ -276,7 +288,7 @@ // Get payload from received data from UART. int payload_len = C_SNIC_UartMsgUtil::getResponsePayload( uartRecvBuf_p->size, uartRecvBuf_p->buf , &command_id, gUART_TEMP_BUF ); - // Check receive a TCP or UDP packet + // Check receive a TCP packet if( (command_id == UART_CMD_ID_SNIC) && (gUART_TEMP_BUF[0] == UART_CMD_SID_SNIC_CONNECTION_RECV_IND) ) { // Packet buffering @@ -288,6 +300,12 @@ // Connected from TCP client uartCmdMgr_p->connectedTCPClient( gUART_TEMP_BUF, payload_len ); } + // Check receive UDP packet + else if( (command_id == UART_CMD_ID_SNIC) && (gUART_TEMP_BUF[0] == UART_CMD_SID_SNIC_UDP_RECV_IND) ) + { + // UDP packet buffering + uartCmdMgr_p->bufferredUDPPacket( gUART_TEMP_BUF, payload_len ); + } // Check scan results indication else if( (command_id == UART_CMD_ID_WIFI) && (gUART_TEMP_BUF[0] == UART_CMD_SID_WIFI_SCAN_RESULT_IND) ) {