Customized SNICInterface

Fork of NySNICInterface by Ryo Iizuka

Revision:
32:ae95309643aa
Parent:
29:6a0ba999597d
Child:
33:33f1bc919486
--- a/SNIC/SNIC_UartCommandManager.cpp	Thu May 29 03:23:21 2014 +0000
+++ b/SNIC/SNIC_UartCommandManager.cpp	Fri May 30 08:30:40 2014 +0000
@@ -183,3 +183,36 @@
     }
     con_info_p->is_received = true;
 }
+
+void C_SNIC_UartCommandManager::connectedTCPClient( unsigned char *payload_p, int payload_len )
+{
+    if( (payload_p == NULL) || (payload_len == 0) )
+    {
+        return;
+    }
+    
+    C_SNIC_Core *instance_p = C_SNIC_Core::getInstance();
+    int          socket_id;
+    
+    // Get socket id of client from payload
+    socket_id = payload_p[3];
+
+    printf("[connectedTCPClient] socket id:%d\r\n", socket_id);
+    
+    // Get Connection information
+    C_SNIC_Core::tagCONNECT_INFO_T *con_info_p = instance_p->getConnectInfo( socket_id );
+    if( con_info_p == NULL )
+    {
+        return;
+    }
+
+    if( con_info_p->recvbuf_p == NULL )
+    {
+        printf( "create recv buffer[socket:%d]\r\n", socket_id);
+        con_info_p->recvbuf_p = new CircBuffer<char>(SNIC_UART_RECVBUF_SIZE);
+    }
+    con_info_p->is_connected  = true;
+    con_info_p->is_received   = false;
+    con_info_p->is_accept     = true;
+    con_info_p->parent_socket = payload_p[2];
+}