Customized SNICInterface

Fork of NySNICInterface by Ryo Iizuka

Revision:
43:d80bbb12ffe6
Parent:
41:1c1b5ad4d491
diff -r 17d89443d899 -r d80bbb12ffe6 SNIC/SNIC_Core.h
--- a/SNIC/SNIC_Core.h	Fri Sep 19 01:46:17 2014 +0000
+++ b/SNIC/SNIC_Core.h	Fri Nov 14 00:52:31 2014 +0000
@@ -33,7 +33,7 @@
 #define MEMPOOL_PAYLOAD_NUM 1
 #define MAX_SOCKET_ID   5
 
-#define MEMPOOL_UART_RECV_NUM 2
+#define MEMPOOL_UART_RECV_NUM 6
 #define SNIC_UART_RECVBUF_SIZE         2048
 
 /** Wi-Fi security
@@ -102,7 +102,10 @@
         CircBuffer<char>    *recvbuf_p;
         bool                is_connected;
         bool                is_received;
+        bool                is_receive_complete;
         int                 parent_socket;
+        int                 from_ip;
+        short               from_port;
         bool                is_accept;
         Mutex               mutex;
     }tagCONNECT_INFO_T;
@@ -224,6 +227,26 @@
         unsigned char  local_port[2];
     }tagSNIC_UDP_CREATE_SOCKET_REQ_T;
     
+    /** SNIC_UDP_CREATE_SOCKET_REQ */
+    typedef struct
+    {
+        unsigned char  cmd_sid;
+        unsigned char  seq;
+        unsigned char  bind;
+    }tagSNIC_UDP_CREATE_SOCKET_REQ_CLIENT_T;
+
+    /** SNIC_UDP_SEND_FROM_SOCKET_REQ */
+    typedef struct
+    {
+        unsigned char cmd_sid;
+        unsigned char seq;
+        unsigned char remote_ip[4];
+        unsigned char remote_port[2];
+        unsigned char socket_id;
+        unsigned char connection_mode;
+        unsigned char payload_len[2];
+    }tagSNIC_UDP_SEND_FROM_SOCKET_REQ_T;
+
     /** SNIC_UDP_START_RECV_REQ */
     typedef struct
     {
@@ -367,12 +390,21 @@
     */
     static C_SNIC_Core *getInstance();
 
+    /** Mutex lock of API calls
+    */
+    void lockAPI( void );
+
+    /** Mutex unlock of API calls
+    */
+    void unlockAPI( void );
+
 private:
     static C_SNIC_Core        *mInstance_p;
     Thread                    *mUartRecvThread_p;
     Thread                    *mUartRecvDispatchThread_p;
     RawSerial                 *mUart_p;
     Mutex                      mUartMutex;
+    Mutex                      mAPIMutex;
     
 //    DigitalInOut             mModuleReset;
     C_SNIC_UartCommandManager *mUartCommand_p;
@@ -397,4 +429,4 @@
     static void uartRecvDispatchThread( void const *args_p );
 };
 
-#endif
\ No newline at end of file
+#endif