Customized SNICInterface

Fork of NySNICInterface by Ryo Iizuka

Committer:
kishino
Date:
Tue Jul 15 10:13:53 2014 +0000
Revision:
41:1c1b5ad4d491
Parent:
39:a1233ca02edf
Child:
43:d80bbb12ffe6
Modified the module name of Copyright.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kishino 39:a1233ca02edf 1 /* Copyright (C) 2014 Murata Manufacturing Co.,Ltd., MIT License
kishino 41:1c1b5ad4d491 2 * muRata, SWITCH SCIENCE Wi-FI module TypeYD SNIC-UART.
kishino 20:dd736d328de6 3 *
kishino 39:a1233ca02edf 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
kishino 39:a1233ca02edf 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
kishino 39:a1233ca02edf 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
kishino 39:a1233ca02edf 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
kishino 39:a1233ca02edf 8 * furnished to do so, subject to the following conditions:
kishino 20:dd736d328de6 9 *
kishino 39:a1233ca02edf 10 * The above copyright notice and this permission notice shall be included in all copies or
kishino 39:a1233ca02edf 11 * substantial portions of the Software.
kishino 20:dd736d328de6 12 *
kishino 39:a1233ca02edf 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
kishino 39:a1233ca02edf 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
kishino 39:a1233ca02edf 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
kishino 39:a1233ca02edf 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
kishino 39:a1233ca02edf 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
kishino 39:a1233ca02edf 18 */
kishino 20:dd736d328de6 19 #ifndef _SNIC_CORE_H_
kishino 20:dd736d328de6 20 #define _SNIC_CORE_H_
kishino 20:dd736d328de6 21
kishino 25:67183ed15708 22 #include "MurataObject.h"
kishino 20:dd736d328de6 23 #include "mbed.h"
kishino 20:dd736d328de6 24 #include "rtos.h"
kishino 20:dd736d328de6 25 #include "RawSerial.h"
kishino 20:dd736d328de6 26 #include "CBuffer.h"
kishino 20:dd736d328de6 27
kishino 20:dd736d328de6 28 #include "SNIC_UartCommandManager.h"
kishino 20:dd736d328de6 29
kishino 36:f33fcf5975ab 30 #define UART_REQUEST_PAYLOAD_MAX 2048
kishino 20:dd736d328de6 31
kishino 20:dd736d328de6 32 #define MEMPOOL_BLOCK_SIZE 2048
kishino 20:dd736d328de6 33 #define MEMPOOL_PAYLOAD_NUM 1
kishino 20:dd736d328de6 34 #define MAX_SOCKET_ID 5
kishino 20:dd736d328de6 35
kishino 29:6a0ba999597d 36 #define MEMPOOL_UART_RECV_NUM 2
kishino 32:ae95309643aa 37 #define SNIC_UART_RECVBUF_SIZE 2048
kishino 29:6a0ba999597d 38
kishino 20:dd736d328de6 39 /** Wi-Fi security
kishino 20:dd736d328de6 40 */
kishino 20:dd736d328de6 41 typedef enum SECURITY {
kishino 20:dd736d328de6 42 /** Securiry Open */
kishino 20:dd736d328de6 43 e_SEC_OPEN = 0x00,
kishino 20:dd736d328de6 44 /** Securiry WEP */
kishino 20:dd736d328de6 45 e_SEC_WEP = 0x01,
kishino 20:dd736d328de6 46 /** Securiry WPA-PSK(TKIP) */
kishino 20:dd736d328de6 47 e_SEC_WPA_TKIP = 0x02,
kishino 20:dd736d328de6 48 /** Securiry WPA2-PSK(AES) */
kishino 20:dd736d328de6 49 e_SEC_WPA2_AES = 0x04,
kishino 20:dd736d328de6 50 /** Securiry WPA2-PSK(TKIP/AES) */
kishino 20:dd736d328de6 51 e_SEC_WPA2_MIXED = 0x06,
kishino 20:dd736d328de6 52 /** Securiry WPA-PSK(AES) */
kishino 20:dd736d328de6 53 e_SEC_WPA_AES = 0x07
kishino 20:dd736d328de6 54 }E_SECURITY;
kishino 20:dd736d328de6 55
kishino 20:dd736d328de6 56 /** Wi-Fi status
kishino 20:dd736d328de6 57 */
kishino 20:dd736d328de6 58 typedef enum WIFI_STATUS {
kishino 20:dd736d328de6 59 /** Wi-Fi OFF */
kishino 20:dd736d328de6 60 e_STATUS_OFF = 0,
kishino 20:dd736d328de6 61 /** No network */
kishino 20:dd736d328de6 62 e_NO_NETWORK,
kishino 20:dd736d328de6 63 /** Connected to AP (STA mode) */
kishino 20:dd736d328de6 64 e_STA_JOINED,
kishino 20:dd736d328de6 65 /** Started on AP mode */
kishino 20:dd736d328de6 66 e_AP_STARTED
kishino 20:dd736d328de6 67 }E_WIFI_STATUS;
kishino 20:dd736d328de6 68
kishino 29:6a0ba999597d 69 /** Memorypool
kishino 29:6a0ba999597d 70 */
kishino 29:6a0ba999597d 71 typedef struct
kishino 29:6a0ba999597d 72 {
kishino 29:6a0ba999597d 73 unsigned int size;
kishino 36:f33fcf5975ab 74 unsigned int demand_size;
kishino 29:6a0ba999597d 75 unsigned char buf[MEMPOOL_BLOCK_SIZE];
kishino 29:6a0ba999597d 76 }tagMEMPOOL_BLOCK_T;
kishino 29:6a0ba999597d 77
kishino 23:4ff2231ff9ba 78 /** Internal class used by any other classes. This class is singleton.
kishino 20:dd736d328de6 79 */
kishino 25:67183ed15708 80 class C_SNIC_Core: public C_MurataObject
kishino 20:dd736d328de6 81 {
kishino 21:dda155fe5048 82 friend class C_SNIC_UartCommandManager;
kishino 21:dda155fe5048 83 friend class C_SNIC_WifiInterface;
kishino 21:dda155fe5048 84 friend class TCPSocketConnection;
kishino 33:33f1bc919486 85 friend class TCPSocketServer;
kishino 33:33f1bc919486 86 friend class UDPSocket;
kishino 21:dda155fe5048 87 friend class Socket;
kishino 21:dda155fe5048 88
kishino 21:dda155fe5048 89 private:
kishino 22:a9ec0cad4f84 90 /** Wi-Fi Network type
kishino 22:a9ec0cad4f84 91 */
kishino 22:a9ec0cad4f84 92 typedef enum NETWORK_TYPE {
kishino 22:a9ec0cad4f84 93 /** Infrastructure */
kishino 22:a9ec0cad4f84 94 e_INFRA = 0,
kishino 22:a9ec0cad4f84 95 /** Adhoc */
kishino 22:a9ec0cad4f84 96 e_ADHOC = 1
kishino 22:a9ec0cad4f84 97 }E_NETWORK_TYPE;
kishino 22:a9ec0cad4f84 98
kishino 22:a9ec0cad4f84 99 /** Connection information
kishino 22:a9ec0cad4f84 100 */
kishino 22:a9ec0cad4f84 101 typedef struct {
kishino 29:6a0ba999597d 102 CircBuffer<char> *recvbuf_p;
kishino 22:a9ec0cad4f84 103 bool is_connected;
kishino 22:a9ec0cad4f84 104 bool is_received;
kishino 32:ae95309643aa 105 int parent_socket;
kishino 32:ae95309643aa 106 bool is_accept;
kishino 39:a1233ca02edf 107 Mutex mutex;
kishino 22:a9ec0cad4f84 108 }tagCONNECT_INFO_T;
kishino 22:a9ec0cad4f84 109
kishino 33:33f1bc919486 110 /** UDP Recv information
kishino 33:33f1bc919486 111 */
kishino 33:33f1bc919486 112 typedef struct {
kishino 33:33f1bc919486 113 CircBuffer<char> *recvbuf_p;
kishino 33:33f1bc919486 114 int from_ip;
kishino 33:33f1bc919486 115 short from_port;
kishino 33:33f1bc919486 116 int parent_socket;
kishino 33:33f1bc919486 117 bool is_received;
kishino 39:a1233ca02edf 118 Mutex mutex;
kishino 33:33f1bc919486 119 }tagUDP_RECVINFO_T;
kishino 33:33f1bc919486 120
kishino 22:a9ec0cad4f84 121 /** GEN_FW_VER_GET_REQ Command */
kishino 22:a9ec0cad4f84 122 typedef struct
kishino 22:a9ec0cad4f84 123 {
kishino 22:a9ec0cad4f84 124 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 125 unsigned char seq;
kishino 22:a9ec0cad4f84 126 }tagGEN_FW_VER_GET_REQ_T;
kishino 22:a9ec0cad4f84 127
kishino 22:a9ec0cad4f84 128 /** SNIC_INIT_REQ */
kishino 22:a9ec0cad4f84 129 typedef struct
kishino 22:a9ec0cad4f84 130 {
kishino 28:b796031f6519 131 unsigned char cmd_sid;
kishino 28:b796031f6519 132 unsigned char seq;
kishino 28:b796031f6519 133 unsigned char buf_size[2];
kishino 22:a9ec0cad4f84 134 }tagSNIC_INIT_REQ_T;
kishino 22:a9ec0cad4f84 135
kishino 31:15c22824cc46 136 /** SNIC_IP_CONFIG_REQ */
kishino 31:15c22824cc46 137 typedef struct
kishino 31:15c22824cc46 138 {
kishino 31:15c22824cc46 139 unsigned char cmd_sid;
kishino 31:15c22824cc46 140 unsigned char seq;
kishino 31:15c22824cc46 141 unsigned char interface;
kishino 31:15c22824cc46 142 unsigned char dhcp;
kishino 31:15c22824cc46 143 }tagSNIC_IP_CONFIG_REQ_DHCP_T;
kishino 31:15c22824cc46 144
kishino 31:15c22824cc46 145 /** SNIC_IP_CONFIG_REQ */
kishino 31:15c22824cc46 146 typedef struct
kishino 31:15c22824cc46 147 {
kishino 31:15c22824cc46 148 unsigned char cmd_sid;
kishino 31:15c22824cc46 149 unsigned char seq;
kishino 31:15c22824cc46 150 unsigned char interface;
kishino 31:15c22824cc46 151 unsigned char dhcp;
kishino 31:15c22824cc46 152 unsigned char ip_addr[4];
kishino 31:15c22824cc46 153 unsigned char netmask[4];
kishino 31:15c22824cc46 154 unsigned char gateway[4];
kishino 31:15c22824cc46 155 }tagSNIC_IP_CONFIG_REQ_STATIC_T;
kishino 31:15c22824cc46 156
kishino 22:a9ec0cad4f84 157 /** SNIC_TCP_CREATE_SOCKET_REQ */
kishino 22:a9ec0cad4f84 158 typedef struct
kishino 22:a9ec0cad4f84 159 {
kishino 22:a9ec0cad4f84 160 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 161 unsigned char seq;
kishino 22:a9ec0cad4f84 162 unsigned char bind;
kishino 22:a9ec0cad4f84 163 unsigned char local_addr[4];
kishino 22:a9ec0cad4f84 164 unsigned char local_port[2];
kishino 22:a9ec0cad4f84 165 }tagSNIC_TCP_CREATE_SOCKET_REQ_T;
kishino 27:dcc4f34448f0 166
kishino 27:dcc4f34448f0 167 /** SNIC_CLOSE_SOCKET_REQ */
kishino 27:dcc4f34448f0 168 typedef struct
kishino 27:dcc4f34448f0 169 {
kishino 27:dcc4f34448f0 170 unsigned char cmd_sid;
kishino 27:dcc4f34448f0 171 unsigned char seq;
kishino 27:dcc4f34448f0 172 unsigned char socket_id;
kishino 27:dcc4f34448f0 173 }tagSNIC_CLOSE_SOCKET_REQ_T;
kishino 22:a9ec0cad4f84 174
kishino 22:a9ec0cad4f84 175 /** SNIC_TCP_SEND_FROM_SOCKET_REQ */
kishino 22:a9ec0cad4f84 176 typedef struct
kishino 22:a9ec0cad4f84 177 {
kishino 22:a9ec0cad4f84 178 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 179 unsigned char seq;
kishino 22:a9ec0cad4f84 180 unsigned char socket_id;
kishino 22:a9ec0cad4f84 181 unsigned char option;
kishino 22:a9ec0cad4f84 182 unsigned char payload_len[2];
kishino 22:a9ec0cad4f84 183 }tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T;
kishino 22:a9ec0cad4f84 184
kishino 32:ae95309643aa 185 /** SNIC_TCP_CREATE_CONNECTION_REQ */
kishino 32:ae95309643aa 186 typedef struct
kishino 32:ae95309643aa 187 {
kishino 32:ae95309643aa 188 unsigned char cmd_sid;
kishino 32:ae95309643aa 189 unsigned char seq;
kishino 32:ae95309643aa 190 unsigned char socket_id;
kishino 32:ae95309643aa 191 unsigned char recv_bufsize[2];
kishino 32:ae95309643aa 192 unsigned char max_client;
kishino 32:ae95309643aa 193 }tagSNIC_TCP_CREATE_CONNECTION_REQ_T;
kishino 32:ae95309643aa 194
kishino 22:a9ec0cad4f84 195 /** SNIC_TCP_CONNECT_TO_SERVER_REQ */
kishino 22:a9ec0cad4f84 196 typedef struct
kishino 22:a9ec0cad4f84 197 {
kishino 22:a9ec0cad4f84 198 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 199 unsigned char seq;
kishino 22:a9ec0cad4f84 200 unsigned char socket_id;
kishino 22:a9ec0cad4f84 201 unsigned char remote_addr[4];
kishino 22:a9ec0cad4f84 202 unsigned char remote_port[2];
kishino 22:a9ec0cad4f84 203 unsigned char recv_bufsize[2];
kishino 22:a9ec0cad4f84 204 unsigned char timeout;
kishino 22:a9ec0cad4f84 205 }tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T;
kishino 22:a9ec0cad4f84 206
kishino 33:33f1bc919486 207 /** SNIC_UDP_SIMPLE_SEND_REQ */
kishino 33:33f1bc919486 208 typedef struct
kishino 33:33f1bc919486 209 {
kishino 33:33f1bc919486 210 unsigned char cmd_sid;
kishino 33:33f1bc919486 211 unsigned char seq;
kishino 33:33f1bc919486 212 unsigned char remote_ip[4];
kishino 33:33f1bc919486 213 unsigned char remote_port[2];
kishino 33:33f1bc919486 214 unsigned char payload_len[2];
kishino 33:33f1bc919486 215 }tagSNIC_UDP_SIMPLE_SEND_REQ_T;
kishino 33:33f1bc919486 216
kishino 33:33f1bc919486 217 /** SNIC_UDP_CREATE_SOCKET_REQ */
kishino 33:33f1bc919486 218 typedef struct
kishino 33:33f1bc919486 219 {
kishino 33:33f1bc919486 220 unsigned char cmd_sid;
kishino 33:33f1bc919486 221 unsigned char seq;
kishino 33:33f1bc919486 222 unsigned char bind;
kishino 33:33f1bc919486 223 unsigned char local_addr[4];
kishino 33:33f1bc919486 224 unsigned char local_port[2];
kishino 33:33f1bc919486 225 }tagSNIC_UDP_CREATE_SOCKET_REQ_T;
kishino 33:33f1bc919486 226
kishino 33:33f1bc919486 227 /** SNIC_UDP_START_RECV_REQ */
kishino 33:33f1bc919486 228 typedef struct
kishino 33:33f1bc919486 229 {
kishino 33:33f1bc919486 230 unsigned char cmd_sid;
kishino 33:33f1bc919486 231 unsigned char seq;
kishino 33:33f1bc919486 232 unsigned char socket_id;
kishino 33:33f1bc919486 233 unsigned char recv_bufsize[2];
kishino 33:33f1bc919486 234 }tagSNIC_UDP_START_RECV_REQ_T;
kishino 33:33f1bc919486 235
kishino 32:ae95309643aa 236 /** SNIC_GET_DHCP_INFO_REQ */
kishino 32:ae95309643aa 237 typedef struct
kishino 32:ae95309643aa 238 {
kishino 32:ae95309643aa 239 unsigned char cmd_sid;
kishino 32:ae95309643aa 240 unsigned char seq;
kishino 32:ae95309643aa 241 unsigned char interface;
kishino 32:ae95309643aa 242 }tagSNIC_GET_DHCP_INFO_REQ_T;
kishino 32:ae95309643aa 243
kishino 22:a9ec0cad4f84 244 /** WIFI_ON_REQ Command */
kishino 22:a9ec0cad4f84 245 typedef struct
kishino 22:a9ec0cad4f84 246 {
kishino 22:a9ec0cad4f84 247 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 248 unsigned char seq;
kishino 22:a9ec0cad4f84 249 char country[COUNTRYC_CODE_LENTH];
kishino 22:a9ec0cad4f84 250 }tagWIFI_ON_REQ_T;
kishino 22:a9ec0cad4f84 251
kishino 22:a9ec0cad4f84 252 /** WIFI_OFF_REQ Command */
kishino 22:a9ec0cad4f84 253 typedef struct
kishino 22:a9ec0cad4f84 254 {
kishino 22:a9ec0cad4f84 255 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 256 unsigned char seq;
kishino 22:a9ec0cad4f84 257 }tagWIFI_OFF_REQ_T;
kishino 22:a9ec0cad4f84 258
kishino 22:a9ec0cad4f84 259 /** WIFI_DISCONNECT_REQ Command */
kishino 22:a9ec0cad4f84 260 typedef struct
kishino 22:a9ec0cad4f84 261 {
kishino 22:a9ec0cad4f84 262 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 263 unsigned char seq;
kishino 22:a9ec0cad4f84 264 }tagWIFI_DISCONNECT_REQ_T;
kishino 22:a9ec0cad4f84 265
kishino 22:a9ec0cad4f84 266 /** WIFI_GET_STA_RSSI_REQ Command */
kishino 22:a9ec0cad4f84 267 typedef struct
kishino 22:a9ec0cad4f84 268 {
kishino 22:a9ec0cad4f84 269 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 270 unsigned char seq;
kishino 22:a9ec0cad4f84 271 }tagWIFI_GET_STA_RSSI_REQ_T;
kishino 22:a9ec0cad4f84 272
kishino 22:a9ec0cad4f84 273 /** WIFI_SCAN_REQ Command */
kishino 22:a9ec0cad4f84 274 typedef struct
kishino 22:a9ec0cad4f84 275 {
kishino 22:a9ec0cad4f84 276 unsigned char cmd_sid;
kishino 22:a9ec0cad4f84 277 unsigned char seq;
kishino 22:a9ec0cad4f84 278 unsigned char scan_type;
kishino 22:a9ec0cad4f84 279 unsigned char bss_type;
kishino 22:a9ec0cad4f84 280 unsigned char bssid[BSSID_MAC_LENTH];
kishino 22:a9ec0cad4f84 281 unsigned char chan_list;
kishino 22:a9ec0cad4f84 282 unsigned char ssid[SSID_MAX_LENGTH+1];
kishino 22:a9ec0cad4f84 283 }tagWIFI_SCAN_REQ_T;
kishino 22:a9ec0cad4f84 284
kishino 29:6a0ba999597d 285 /** WIFI_GET_STATUS_REQ Command */
kishino 29:6a0ba999597d 286 typedef struct
kishino 29:6a0ba999597d 287 {
kishino 29:6a0ba999597d 288 unsigned char cmd_sid;
kishino 29:6a0ba999597d 289 unsigned char seq;
kishino 29:6a0ba999597d 290 unsigned char interface;
kishino 29:6a0ba999597d 291 }tagWIFI_GET_STATUS_REQ_T;
kishino 29:6a0ba999597d 292
kishino 20:dd736d328de6 293 /** Get buffer for command from memory pool.
kishino 20:dd736d328de6 294 @return Pointer of buffer
kishino 20:dd736d328de6 295 */
kishino 29:6a0ba999597d 296 tagMEMPOOL_BLOCK_T *allocCmdBuf();
kishino 20:dd736d328de6 297
kishino 20:dd736d328de6 298 /** Release buffer to memory pool.
kishino 20:dd736d328de6 299 @param buf_p Pointer of buffer
kishino 20:dd736d328de6 300 */
kishino 20:dd736d328de6 301 void freeCmdBuf( tagMEMPOOL_BLOCK_T *buf_p );
kishino 20:dd736d328de6 302
kishino 29:6a0ba999597d 303 /** Get buffer for command from memory pool.
kishino 29:6a0ba999597d 304 @return Pointer of buffer
kishino 29:6a0ba999597d 305 */
kishino 29:6a0ba999597d 306 tagMEMPOOL_BLOCK_T *allocUartRcvBuf();
kishino 29:6a0ba999597d 307
kishino 29:6a0ba999597d 308 /** Release buffer to memory pool.
kishino 29:6a0ba999597d 309 @param buf_p Pointer of buffer
kishino 29:6a0ba999597d 310 */
kishino 29:6a0ba999597d 311 void freeUartRecvBuf( tagMEMPOOL_BLOCK_T *buf_p );
kishino 29:6a0ba999597d 312
kishino 29:6a0ba999597d 313 /** Module Reset
kishino 29:6a0ba999597d 314 */
kishino 29:6a0ba999597d 315 int resetModule( PinName reset );
kishino 29:6a0ba999597d 316
kishino 29:6a0ba999597d 317 /** Initialize UART
kishino 20:dd736d328de6 318 */
kishino 20:dd736d328de6 319 int initUart( PinName tx, PinName rx, int baud );
kishino 20:dd736d328de6 320
kishino 20:dd736d328de6 321 /** Send data to UART
kishino 20:dd736d328de6 322 @param len Length of send data
kishino 20:dd736d328de6 323 @param data Pointer of send data
kishino 20:dd736d328de6 324 @return 0:success/other:fail
kishino 20:dd736d328de6 325 */
kishino 20:dd736d328de6 326 int sendUart( unsigned int len, unsigned char *data );
kishino 20:dd736d328de6 327
kishino 20:dd736d328de6 328 /** Preparation of the UART command
kishino 20:dd736d328de6 329 @param cmd_id UART Command ID
kishino 20:dd736d328de6 330 @param cmd_sid UART Command SubID
kishino 20:dd736d328de6 331 @param req_buf_p Pointer of UART request buffer
kishino 20:dd736d328de6 332 @param req_buf_len Length of UART request buffer
kishino 20:dd736d328de6 333 @param response_buf_p Pointer of UART response buffer
kishino 20:dd736d328de6 334 @param command_p Pointer of UART command[output]
kishino 20:dd736d328de6 335 @return Length of UART command.
kishino 20:dd736d328de6 336 */
kishino 20:dd736d328de6 337 unsigned int preparationSendCommand( unsigned char cmd_id, unsigned char cmd_sid
kishino 20:dd736d328de6 338 , unsigned char *req_buf_p, unsigned int req_buf_len
kishino 20:dd736d328de6 339 , unsigned char *response_buf_p, unsigned char *command_p );
kishino 20:dd736d328de6 340
kishino 20:dd736d328de6 341 /**
kishino 20:dd736d328de6 342 Get pointer of connection information.
kishino 20:dd736d328de6 343 @param socket_id Socket ID
kishino 20:dd736d328de6 344 @return The pointer of connection information
kishino 20:dd736d328de6 345 */
kishino 22:a9ec0cad4f84 346 C_SNIC_Core::tagCONNECT_INFO_T *getConnectInfo( int socket_id );
kishino 20:dd736d328de6 347
kishino 33:33f1bc919486 348 /**
kishino 33:33f1bc919486 349 Get pointer of UDP Recv information.
kishino 33:33f1bc919486 350 @param socket_id Socket ID
kishino 33:33f1bc919486 351 @return The pointer of UDP Recv information
kishino 33:33f1bc919486 352 */
kishino 33:33f1bc919486 353 C_SNIC_Core::tagUDP_RECVINFO_T *getUdpRecvInfo( int socket_id );
kishino 33:33f1bc919486 354
kishino 33:33f1bc919486 355 /**
kishino 20:dd736d328de6 356 Get pointer of the instance of C_SNIC_UartCommandManager.
kishino 20:dd736d328de6 357 @return The pointer of the instance of C_SNIC_UartCommandManager.
kishino 20:dd736d328de6 358 */
kishino 20:dd736d328de6 359 C_SNIC_UartCommandManager *getUartCommand();
kishino 20:dd736d328de6 360
kishino 29:6a0ba999597d 361 unsigned char *getCommandBuf();
kishino 29:6a0ba999597d 362
kishino 20:dd736d328de6 363 /** Get an instance of the C_SNIC_Core class.
kishino 20:dd736d328de6 364 @return Instance of the C_SNIC_Core class
kishino 20:dd736d328de6 365 @note Please do not create an instance in the default constructor this class.
kishino 20:dd736d328de6 366 Please use this method when you want to get an instance.
kishino 20:dd736d328de6 367 */
kishino 20:dd736d328de6 368 static C_SNIC_Core *getInstance();
kishino 20:dd736d328de6 369
kishino 20:dd736d328de6 370 private:
kishino 20:dd736d328de6 371 static C_SNIC_Core *mInstance_p;
kishino 20:dd736d328de6 372 Thread *mUartRecvThread_p;
kishino 29:6a0ba999597d 373 Thread *mUartRecvDispatchThread_p;
kishino 20:dd736d328de6 374 RawSerial *mUart_p;
kishino 20:dd736d328de6 375 Mutex mUartMutex;
kishino 29:6a0ba999597d 376
kishino 20:dd736d328de6 377 // DigitalInOut mModuleReset;
kishino 20:dd736d328de6 378 C_SNIC_UartCommandManager *mUartCommand_p;
kishino 29:6a0ba999597d 379
kishino 29:6a0ba999597d 380 CircBuffer<char> *mUartRecvBuf_p; // UART RecvBuffer
kishino 29:6a0ba999597d 381
kishino 20:dd736d328de6 382 /** Socket buffer */
kishino 20:dd736d328de6 383 tagCONNECT_INFO_T mConnectInfo[MAX_SOCKET_ID+1];
kishino 20:dd736d328de6 384
kishino 33:33f1bc919486 385 /** UDP Information */
kishino 33:33f1bc919486 386 tagUDP_RECVINFO_T mUdpRecvInfo[MAX_SOCKET_ID+1];
kishino 33:33f1bc919486 387
kishino 36:f33fcf5975ab 388 /** Constructor
kishino 20:dd736d328de6 389 */
kishino 20:dd736d328de6 390 C_SNIC_Core();
kishino 20:dd736d328de6 391
kishino 26:f2e1030964e4 392 virtual ~C_SNIC_Core();
kishino 29:6a0ba999597d 393
kishino 29:6a0ba999597d 394 static void uartRecvCallback( void );
kishino 20:dd736d328de6 395 /** Receiving thread of UART
kishino 20:dd736d328de6 396 */
kishino 29:6a0ba999597d 397 static void uartRecvDispatchThread( void const *args_p );
kishino 20:dd736d328de6 398 };
kishino 20:dd736d328de6 399
kishino 20:dd736d328de6 400 #endif