Customized
Dependents: MurataTypeYD_RPC_Sample
Fork of SNICInterface_mod by
Diff: Socket/TCPSocketServer.cpp
- Revision:
- 38:f13e4e563d65
- Parent:
- 36:f33fcf5975ab
- Child:
- 39:a1233ca02edf
diff -r f3a2053627c2 -r f13e4e563d65 Socket/TCPSocketServer.cpp --- a/Socket/TCPSocketServer.cpp Tue Jun 24 06:24:23 2014 +0000 +++ b/Socket/TCPSocketServer.cpp Wed Jun 25 00:04:11 2014 +0000 @@ -48,10 +48,10 @@ // Get local ip address. // Get buffer for response payload from MemoryPool - tagMEMPOOL_BLOCK_T *payload_buf = snic_core_p->allocCmdBuf(); - if( payload_buf == NULL ) + tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); + if( payload_buf_p == NULL ) { - printf("bind payload_buf NULL\r\n"); + printf("bind payload_buf_p NULL\r\n"); return -1; } @@ -61,35 +61,35 @@ req.seq = mUartRequestSeq++; req.interface = 0; - unsigned char *command_array = snic_core_p->getCommandBuf(); + unsigned char *command_array_p = snic_core_p->getCommandBuf(); unsigned int command_len; // Preparation of command command_len = snic_core_p->preparationSendCommand( UART_CMD_ID_SNIC, req.cmd_sid, (unsigned char *)&req - , sizeof(C_SNIC_Core::tagSNIC_GET_DHCP_INFO_REQ_T), payload_buf->buf, command_array ); + , sizeof(C_SNIC_Core::tagSNIC_GET_DHCP_INFO_REQ_T), payload_buf_p->buf, command_array_p ); // Send uart command request - snic_core_p->sendUart( command_len, command_array ); + snic_core_p->sendUart( command_len, command_array_p ); // Wait UART response ret = uartCmdMgr_p->wait(); if( ret != 0 ) { printf( "bind failed\r\n" ); - snic_core_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != UART_CMD_RES_SNIC_SUCCESS ) { printf("bind status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); - snic_core_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } - snic_core_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf_p ); - unsigned int local_addr = (payload_buf->buf[9] << 24) - | (payload_buf->buf[10] << 16) - | (payload_buf->buf[11] << 8) - | (payload_buf->buf[12]); + unsigned int local_addr = (payload_buf_p->buf[9] << 24) + | (payload_buf_p->buf[10] << 16) + | (payload_buf_p->buf[11] << 8) + | (payload_buf_p->buf[12]); // Socket create ret = createSocket( 1, local_addr, port ); @@ -108,10 +108,10 @@ C_SNIC_UartCommandManager *uartCmdMgr_p = snic_core_p->getUartCommand(); // Get buffer for response payload from MemoryPool - tagMEMPOOL_BLOCK_T *payload_buf = snic_core_p->allocCmdBuf(); - if( payload_buf == NULL ) + tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); + if( payload_buf_p == NULL ) { - printf("listen payload_buf NULL\r\n"); + printf("listen payload_buf_p NULL\r\n"); return -1; } @@ -124,34 +124,34 @@ req.recv_bufsize[1] = (SNIC_UART_RECVBUF_SIZE & 0xFF); req.max_client = max; - unsigned char *command_array = snic_core_p->getCommandBuf(); + unsigned char *command_array_p = snic_core_p->getCommandBuf(); unsigned int command_len; // Preparation of command command_len = snic_core_p->preparationSendCommand( UART_CMD_ID_SNIC, req.cmd_sid, (unsigned char *)&req - , sizeof(C_SNIC_Core::tagSNIC_TCP_CREATE_CONNECTION_REQ_T), payload_buf->buf, command_array ); + , sizeof(C_SNIC_Core::tagSNIC_TCP_CREATE_CONNECTION_REQ_T), payload_buf_p->buf, command_array_p ); int ret; // Send uart command request - snic_core_p->sendUart( command_len, command_array ); + snic_core_p->sendUart( command_len, command_array_p ); // Wait UART response ret = uartCmdMgr_p->wait(); if( ret != 0 ) { printf( "listen failed\r\n" ); - snic_core_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { printf("listen status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); - snic_core_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf_p ); return -1; } - snic_core_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf_p ); return 0; }