SNIC UART Interface library: Serial to Wi-Fi library for Murata TypeYD Wi-Fi module. For more information about TypeYD: http://www.murata.co.jp/products/microwave/module/lbwb1zzydz/index.html
Dependents: SNIC-xively-jumpstart-demo SNIC-FluentLogger-example TCPEchoServer murataDemo ... more
Fork of YDwifiInterface by
Diff: SNIC/SNIC_Core.h
- Revision:
- 22:a9ec0cad4f84
- Parent:
- 21:dda155fe5048
- Child:
- 23:4ff2231ff9ba
--- a/SNIC/SNIC_Core.h Thu Mar 27 07:14:21 2014 +0000
+++ b/SNIC/SNIC_Core.h Thu Mar 27 07:37:55 2014 +0000
@@ -26,21 +26,8 @@
#define MEMPOOL_BLOCK_SIZE 2048
#define MEMPOOL_PAYLOAD_NUM 1
-typedef struct
-{
- unsigned char buf[MEMPOOL_BLOCK_SIZE];
-}tagMEMPOOL_BLOCK_T;
-
#define MAX_SOCKET_ID 5
-/** Connection information
-*/
-typedef struct {
- CircBuffer<unsigned char> *recvbuf_p;
- bool is_connected;
- bool is_received;
-}tagCONNECT_INFO_T;
-
/** Wi-Fi security
*/
typedef enum SECURITY {
@@ -58,15 +45,6 @@
e_SEC_WPA_AES = 0x07
}E_SECURITY;
-/** Wi-Fi Network type
- */
-typedef enum NETWORK_TYPE {
- /** Infrastructure */
- e_INFRA = 0,
- /** Adhoc */
- e_ADHOC = 1
-}E_NETWORK_TYPE;
-
/** Wi-Fi status
*/
typedef enum WIFI_STATUS {
@@ -80,102 +58,6 @@
e_AP_STARTED
}E_WIFI_STATUS;
-/** GEN_FW_VER_GET_REQ Command */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
-}tagGEN_FW_VER_GET_REQ_T;
-
-/** SNIC_INIT_REQ */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
- unsigned short buf_size;
-}tagSNIC_INIT_REQ_T;
-
-/** SNIC_TCP_CREATE_SOCKET_REQ */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
- unsigned char bind;
- unsigned char local_addr[4];
- unsigned char local_port[2];
-}tagSNIC_TCP_CREATE_SOCKET_REQ_T;
-
-/** SNIC_TCP_SEND_FROM_SOCKET_REQ */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
- unsigned char socket_id;
- unsigned char option;
- unsigned char payload_len[2];
-}tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T;
-
-/** SNIC_TCP_CONNECT_TO_SERVER_REQ */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
- unsigned char socket_id;
- unsigned char remote_addr[4];
- unsigned char remote_port[2];
- unsigned char recv_bufsize[2];
- unsigned char timeout;
-}tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T;
-
-/** WIFI_ON_REQ Command */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
- char country[COUNTRYC_CODE_LENTH];
-}tagWIFI_ON_REQ_T;
-
-/** WIFI_OFF_REQ Command */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
-}tagWIFI_OFF_REQ_T;
-
-/** WIFI_DISCONNECT_REQ Command */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
-}tagWIFI_DISCONNECT_REQ_T;
-
-/** WIFI_GET_STA_RSSI_REQ Command */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
-}tagWIFI_GET_STA_RSSI_REQ_T;
-
-/** WIFI_GET_STATUS_REQ Command */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
- unsigned char interface;
-}tagWIFI_GET_STATUS_REQ_T;
-
-/** WIFI_SCAN_REQ Command */
-typedef struct
-{
- unsigned char cmd_sid;
- unsigned char seq;
- unsigned char scan_type;
- unsigned char bss_type;
- unsigned char bssid[BSSID_MAC_LENTH];
- unsigned char chan_list;
- unsigned char ssid[SSID_MAX_LENGTH+1];
-}tagWIFI_SCAN_REQ_T;
-
/** C_SNIC_Core class
*/
class C_SNIC_Core
@@ -186,11 +68,131 @@
friend class Socket;
private:
+ /** Memorypool for SNIC UART Response
+ */
+ typedef struct
+ {
+ unsigned char buf[MEMPOOL_BLOCK_SIZE];
+ }tagMEMPOOL_BLOCK_T;
+
+ /** Wi-Fi Network type
+ */
+ typedef enum NETWORK_TYPE {
+ /** Infrastructure */
+ e_INFRA = 0,
+ /** Adhoc */
+ e_ADHOC = 1
+ }E_NETWORK_TYPE;
+
+ /** Connection information
+ */
+ typedef struct {
+ CircBuffer<unsigned char> *recvbuf_p;
+ bool is_connected;
+ bool is_received;
+ }tagCONNECT_INFO_T;
+
+ /** GEN_FW_VER_GET_REQ Command */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ }tagGEN_FW_VER_GET_REQ_T;
+
+ /** SNIC_INIT_REQ */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ unsigned short buf_size;
+ }tagSNIC_INIT_REQ_T;
+
+ /** SNIC_TCP_CREATE_SOCKET_REQ */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ unsigned char bind;
+ unsigned char local_addr[4];
+ unsigned char local_port[2];
+ }tagSNIC_TCP_CREATE_SOCKET_REQ_T;
+
+ /** SNIC_TCP_SEND_FROM_SOCKET_REQ */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ unsigned char socket_id;
+ unsigned char option;
+ unsigned char payload_len[2];
+ }tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T;
+
+ /** SNIC_TCP_CONNECT_TO_SERVER_REQ */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ unsigned char socket_id;
+ unsigned char remote_addr[4];
+ unsigned char remote_port[2];
+ unsigned char recv_bufsize[2];
+ unsigned char timeout;
+ }tagSNIC_TCP_CONNECT_TO_SERVER_REQ_T;
+
+ /** WIFI_ON_REQ Command */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ char country[COUNTRYC_CODE_LENTH];
+ }tagWIFI_ON_REQ_T;
+
+ /** WIFI_OFF_REQ Command */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ }tagWIFI_OFF_REQ_T;
+
+ /** WIFI_DISCONNECT_REQ Command */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ }tagWIFI_DISCONNECT_REQ_T;
+
+ /** WIFI_GET_STA_RSSI_REQ Command */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ }tagWIFI_GET_STA_RSSI_REQ_T;
+
+ /** WIFI_GET_STATUS_REQ Command */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ unsigned char interface;
+ }tagWIFI_GET_STATUS_REQ_T;
+
+ /** WIFI_SCAN_REQ Command */
+ typedef struct
+ {
+ unsigned char cmd_sid;
+ unsigned char seq;
+ unsigned char scan_type;
+ unsigned char bss_type;
+ unsigned char bssid[BSSID_MAC_LENTH];
+ unsigned char chan_list;
+ unsigned char ssid[SSID_MAX_LENGTH+1];
+ }tagWIFI_SCAN_REQ_T;
+
/** Get buffer for command from memory pool.
@return Pointer of buffer
*/
- tagMEMPOOL_BLOCK_T *allocCmdBuf();
+ C_SNIC_Core::tagMEMPOOL_BLOCK_T *allocCmdBuf();
/** Release buffer to memory pool.
@param buf_p Pointer of buffer
@@ -226,7 +228,7 @@
@param socket_id Socket ID
@return The pointer of connection information
*/
- tagCONNECT_INFO_T *getConnectInfo( int socket_id );
+ C_SNIC_Core::tagCONNECT_INFO_T *getConnectInfo( int socket_id );
/**
Get pointer of the instance of C_SNIC_UartCommandManager.
muRata

Murata TypeYD