SNICInterface for development
Fork of SNICInterface by
Diff: Socket/Socket.cpp
- Revision:
- 24:987e412ae879
- Parent:
- 22:a9ec0cad4f84
- Child:
- 27:dcc4f34448f0
diff -r 4ff2231ff9ba -r 987e412ae879 Socket/Socket.cpp --- a/Socket/Socket.cpp Thu Mar 27 10:11:59 2014 +0000 +++ b/Socket/Socket.cpp Fri Mar 28 00:45:15 2014 +0000 @@ -34,7 +34,6 @@ Socket::Socket() { - mSnicWifi_p = C_SNIC_Core::getInstance(); mSocketID = -1; } @@ -65,9 +64,10 @@ int Socket::createSocket( unsigned char bind, unsigned int local_addr, unsigned short port ) { - C_SNIC_UartCommandManager *uartCmdMgr_p = mSnicWifi_p->getUartCommand(); + C_SNIC_Core *snic_core_p = C_SNIC_Core::getInstance(); + C_SNIC_UartCommandManager *uartCmdMgr_p = snic_core_p->getUartCommand(); // Get buffer for response payload from MemoryPool - C_SNIC_Core::tagMEMPOOL_BLOCK_T *payload_buf = mSnicWifi_p->allocCmdBuf(); + C_SNIC_Core::tagMEMPOOL_BLOCK_T *payload_buf = snic_core_p->allocCmdBuf(); if( payload_buf == NULL ) { printf("createSocket payload_buf NULL\r\n"); @@ -97,11 +97,11 @@ unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; unsigned int command_len; // Preparation of command - command_len = mSnicWifi_p->preparationSendCommand( UART_CMD_ID_SNIC, req.cmd_sid, (unsigned char *)&req + command_len = snic_core_p->preparationSendCommand( UART_CMD_ID_SNIC, req.cmd_sid, (unsigned char *)&req , req_len, payload_buf->buf, command_array ); // Send uart command request - mSnicWifi_p->sendUart( command_len, command_array ); + snic_core_p->sendUart( command_len, command_array ); int ret; // Wait UART response @@ -109,18 +109,18 @@ if( ret != 0 ) { printf( "createSocket failed\r\n" ); - mSnicWifi_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf ); return -1; } if( uartCmdMgr_p->getCommandStatus() != 0 ) { printf("createSocket status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); - mSnicWifi_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf ); return -1; } mSocketID = payload_buf->buf[3]; - mSnicWifi_p->freeCmdBuf( payload_buf ); + snic_core_p->freeCmdBuf( payload_buf ); return 0; }