SNICInterface for ThingPlug Example

Dependents:   ThingPlug_WiFi_Example ThingPlug_WiFi_Example_2

Fork of SNICInterface by muRata

Revision:
38:f13e4e563d65
Parent:
37:f3a2053627c2
Child:
39:a1233ca02edf
diff -r f3a2053627c2 -r f13e4e563d65 Socket/TCPSocketConnection.cpp
--- a/Socket/TCPSocketConnection.cpp	Tue Jun 24 06:24:23 2014 +0000
+++ b/Socket/TCPSocketConnection.cpp	Wed Jun 25 00:04:11 2014 +0000
@@ -61,10 +61,10 @@
     }
         
     // 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("connect payload_buf NULL\r\n");
+        printf("connect payload_buf_p NULL\r\n");
         return -1;
     }
     
@@ -86,34 +86,34 @@
     req.recv_bufsize[1] = (SNIC_UART_RECVBUF_SIZE & 0xFF);
     req.timeout         = 60;
 
-    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_CONNECT_TO_SERVER_REQ_T), payload_buf->buf, command_array );
+                            , sizeof(C_SNIC_Core::tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T), payload_buf_p->buf, command_array_p );
 
     uartCmdMgr_p->setCommandSID( UART_CMD_SID_SNIC_TCP_CONNECTION_STATUS_IND );
 
     // 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( "connect 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_CONNECTION_UP )
     {
         printf("connect 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 );
 
     // Initialize connection information
     C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = snic_core_p->getConnectInfo( mSocketID );
@@ -141,10 +141,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("connect payload_buf NULL\r\n");
+        printf("connect payload_buf_p NULL\r\n");
         return -1;
     }
     
@@ -162,31 +162,31 @@
     memcpy( send_buf_p, &req, req_size );
     memcpy( &send_buf_p[req_size], data_p, length );
     
-    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 *)send_buf_p
-                            , req_size + length, payload_buf->buf, command_array );
+                            , req_size + length, 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
     int ret = uartCmdMgr_p->wait();
     if( ret != 0 )
     {
         printf( "send 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("send 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 );
 
     // SNIC_SEND_FROM_SOCKET_REQ
     return 0;