Customized SNICInterface

Fork of NySNICInterface by Ryo Iizuka

Committer:
kishino
Date:
Thu Jun 19 10:15:47 2014 +0000
Revision:
36:f33fcf5975ab
Parent:
33:33f1bc919486
Child:
39:a1233ca02edf
Supported a new command format of SNIC UART.

Who changed what in which revision?

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