Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NySNICInterface by
Diff: Socket/Socket.cpp
- Revision:
- 38:f13e4e563d65
- Parent:
- 36:f33fcf5975ab
- Child:
- 39:a1233ca02edf
--- a/Socket/Socket.cpp Tue Jun 24 06:24:23 2014 +0000 +++ b/Socket/Socket.cpp Wed Jun 25 00:04:11 2014 +0000 @@ -73,14 +73,14 @@ req.seq = mUartRequestSeq++; req.socket_id = mSocketID; - 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_CLOSE_SOCKET_REQ_T), payload_buf->buf, command_array ); + , sizeof(C_SNIC_Core::tagSNIC_CLOSE_SOCKET_REQ_T), payload_buf->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 ); int ret; // Wait UART response @@ -103,13 +103,6 @@ return 0; } -#if 0 -int Socket::select(struct timeval *timeout, bool read, bool write) -{ - return 0; -} -#endif - int Socket::createSocket( unsigned char bind, unsigned int local_addr, unsigned short port ) { C_SNIC_Core *snic_core_p = C_SNIC_Core::getInstance(); @@ -142,13 +135,13 @@ req_len = sizeof(C_SNIC_Core::tagSNIC_TCP_CREATE_SOCKET_REQ_T); } - 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 - , req_len, payload_buf->buf, command_array ); + , req_len, payload_buf->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 ); int ret; // Wait UART response @@ -192,32 +185,32 @@ return -1; } - unsigned char *buf = (unsigned char *)getSocketSendBuf(); + unsigned char *buf_p = (unsigned char *)getSocketSendBuf(); unsigned int buf_len = 0; - memset( buf, 0, UART_REQUEST_PAYLOAD_MAX ); + memset( buf_p, 0, UART_REQUEST_PAYLOAD_MAX ); // Make request - buf[0] = UART_CMD_SID_SNIC_RESOLVE_NAME_REQ; + buf_p[0] = UART_CMD_SID_SNIC_RESOLVE_NAME_REQ; buf_len++; - buf[1] = mUartRequestSeq++; + buf_p[1] = mUartRequestSeq++; buf_len++; // Interface - buf[2] = 0; + buf_p[2] = 0; buf_len++; // Host name length int hostname_len = strlen(host_p); - buf[3] = (unsigned char)hostname_len; + buf_p[3] = (unsigned char)hostname_len; buf_len++; - memcpy( &buf[4], host_p, hostname_len ); + memcpy( &buf_p[4], host_p, hostname_len ); buf_len += hostname_len; - unsigned char *command_array = snic_core_p->getCommandBuf(); + unsigned char *command_array_p = snic_core_p->getCommandBuf(); unsigned int command_len; - command_len = snic_core_p->preparationSendCommand( UART_CMD_ID_SNIC, UART_CMD_SID_SNIC_RESOLVE_NAME_REQ, buf - , buf_len, payload_buf->buf, command_array ); + command_len = snic_core_p->preparationSendCommand( UART_CMD_ID_SNIC, UART_CMD_SID_SNIC_RESOLVE_NAME_REQ, buf_p + , buf_len, payload_buf->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 ); int ret; // Wait UART response