WE310F5  39.00.000
m2mb_ncm.h File Reference

This file contains the public APIs and structures of the Network Connection Manager(NCM) module. More...

Go to the source code of this file.

Data Structures

struct  M2MB_NCM_AP_PROFILE
 AP profile information. More...
 
struct  M2MB_NCM_STA_CFG
 STA mode configuration information. More...
 
struct  M2MB_NCM_WPS_CFG
 Station mode WPS configuration information. More...
 
struct  M2MB_NCM_POWER_SAVE_CFG
 
struct  M2MB_NCM_AP_CFG
 AP mode configuration information. More...
 
struct  M2MB_NCM_DHCP_SERVER_CFG
 DHCP server configuration for the device in AP mode. More...
 
struct  M2MB_NCM_IP_CFG
 Generic IP configuration. More...
 
struct  M2MB_NCM_IFCFG
 Network Connect Manager Interface configuration. More...
 
struct  M2MB_NCM_RETRY_CFG
 Retry configuration. More...
 
struct  M2MB_NCM_ROAMING_CFG
 Roaming configuration. More...
 
struct  M2MB_NCM_DEVICE_STATS
 Packet count statistics. More...
 
struct  M2MB_NCM_CONNECTED_STA_INFO
 Connected station information. More...
 
union  M2MB_NCM_CFG_PTR
 Configuration pointer union. More...
 
#define M2MB_NCM_FLAG_KEEP_ALIVE   ( 1 << 0 )
 
#define M2MB_NCM_FLAG_DYNAMIC_KEEP_ALIVE   ( 1 << 1 )
 
#define M2MB_NCM_FLAG_ROAMING   ( 1 << 2 )
 
#define M2MB_NCM_FLAG_WITH_STAT   ( 1 << 3 )
 
#define M2MB_WPS_PIN_LENGTH   8
 
#define M2MB_SECURITY_KEY_LENGTH_MAX   64
 
enum  M2MB_NCM_CTX_STATES {
  M2MB_NCM_STATE_NOT_INITIALISED,
  M2MB_NCM_STATE_INITIALISED,
  M2MB_NCM_STATE_L2_DISCONNECTING,
  M2MB_NCM_STATE_L2_DISCONNECTED,
  M2MB_NCM_STATE_L2_CONCT_TO_KNOWN_AP,
  M2MB_NCM_STATE_L2_SCAN_KNOWN_CHNL,
  M2MB_NCM_STATE_L2_SCAN_SPECIFIC_CHNL,
  M2MB_NCM_STATE_L2_SCAN_ALL_CHNL,
  M2MB_NCM_STATE_L2_CONNECTED,
  M2MB_NCM_STATE_L3_CONNECTED,
  M2MB_NCM_STATE_IDLE,
  M2MB_NCM_STATE_L3_IP_FAIL
}
 Different states in NCM module. More...
 
enum  M2MB_NCM_IPFLAG_SETTING_E {
  M2MB_NCM_IPFLAG_V4_STATIC = (1 << 0),
  M2MB_NCM_IPFLAG_V4_DHCP = (1 << 1),
  M2MB_NCM_IPFLAG_V6_AUTO = (1 << 2),
  M2MB_NCM_IPFLAG_V6_DHCP = (1 << 3)
}
 IP configuration. More...
 
enum  M2MB_L2_L3_NCM_EVENTS_ID_E {
  M2MB_NCM_L2_DISASSOC_DONE,
  M2MB_NCM_L2_RESTART,
  M2MB_NCM_L2_SCAN_DONE,
  M2MB_NCM_L2_SCAN_FAIL,
  M2MB_NCM_L2_CONNECT_FAIL,
  M2MB_NCM_L2_CONNECT_DONE,
  M2MB_NCM_L3_CONNECT_DONE,
  M2MB_NCM_L3_DISCONNECT,
  M2MB_NCM_L3_CONNECT_FAIL,
  M2MB_NCM_L2_AP_START_DONE,
  M2MB_NCM_L3_AP_START_DONE,
  M2MB_NCM_L3_AP_START_FAIL,
  M2MB_NCM_L2_PNO_PROFILE_DONE,
  M2MB_NCM_AP_STOP_DONE,
  M2MB_NCM_L3_AUTO_IP_DONE,
  M2MB_NCM_L3_NEW_IP_DONE,
  M2MB_NCM_L3_CLIENT_CONNECTED,
  M2MB_NCM_L3_CLIENT_DISCONNECTED
}
 Events from NCM module. More...
 
enum  M2MB_NCM_CFG_OPCODE_E {
  M2MB_NCM_CFG_OPCODE_AP_PROFILE,
  M2MB_NCM_CFG_OPCODE_AP_CFG,
  M2MB_NCM_CFG_OPCODE_STA_PROFILE,
  M2MB_NCM_CFG_OPCODE_STA_RETRY,
  M2MB_NCM_CFG_OPCODE_IP_CFG,
  M2MB_NCM_CFG_OPCODE_DNS_CFG,
  M2MB_NCM_CFG_OPCODE_DHCP_SERVER_CFG,
  M2MB_NCM_CFG_OPCODE_STA_ROAMING,
  M2MB_NCM_CFG_OPCODE_STAT_GET,
  M2MB_NCM_CFG_OPCODE_CLIENT_GET,
  M2MB_NCM_CFG_OPCODE_INTERFACE_GET,
  M2MB_NCM_CFG_OPCODE_STA_WPS_CFG,
  M2MB_NCM_CFG_OPCODE_STA_POWER_SAVE_CFG,
  M2MB_NCM_AP_MODE_CONNECTED_STA_INFO,
  M2MB_NCM_AP_MODE_DISCONNECTED_STA_INFO,
  M2MB_NCM_MODE_L2_ONLY
}
 Opcode to be used in configuration API. More...
 
enum  M2MB_NCM_INIT_MODE_E {
  M2MB_NCM_MODE_STATION,
  M2MB_NCM_MODE_AP,
  M2MB_NCM_MODE_BOTH
}
 Different modes. More...
 
enum  M2MB_DISASSOC_REASON_T {
  M2MB_WLAN_NO_NETWORK_AVAIL = 0x01,
  M2MB_WLAN_LOST_LINK = 0x02,
  M2MB_WLAN_DISCONNECT_CMD = 0x03,
  M2MB_WLAN_BSS_DISCONNECTED = 0x04,
  M2MB_WLAN_AUTH_FAILED = 0x05,
  M2MB_WLAN_ASSOC_FAILED = 0x06,
  M2MB_WLAN_NO_RESOURCES_AVAIL = 0x07,
  M2MB_WLAN_CSERV_DISCONNECT = 0x08,
  M2MB_WLAN_INVALID_PROFILE = 0x0a,
  M2MB_WLAN_DOT11H_CHANNEL_SWITCH = 0x0b,
  M2MB_WLAN_PROFILE_MISMATCH = 0x0c,
  M2MB_WLAN_CONNECTION_EVICTED = 0x0d,
  M2MB_WLAN_IBSS_MERGE = 0x0e,
  M2MB_WLAN_EXCESS_TX_RETRY = 0x0f,
  M2MB_WLAN_SEC_HS_TO_RECV_M1 = 0x10,
  M2MB_WLAN_SEC_HS_TO_RECV_M3 = 0x11,
  M2MB_WLAN_TKIP_COUNTERMEASURES = 0x12,
  M2MB_WLAN_SCAN_FAIL = 0x13,
  M2MB_L3_FAIL = 0x14
}
 Disconnection reason. More...
 
typedef enum M2MB_NCM_CTX_STATES M2MB_NCM_CTX_STATES_E
 Different states in NCM module. More...
 
typedef struct M2MB_NCM_AP_PROFILE M2MB_NCM_AP_PROFILE_T
 AP profile information. More...
 
typedef struct M2MB_NCM_STA_CFG M2MB_NCM_STA_CFG_T
 STA mode configuration information. More...
 
typedef struct M2MB_NCM_WPS_CFG M2MB_NCM_WPS_CFG_T
 Station mode WPS configuration information. More...
 
typedef struct M2MB_NCM_POWER_SAVE_CFG M2MB_NCM_POWER_SAVE_CFG_T
 
typedef struct M2MB_NCM_AP_CFG M2MB_NCM_AP_CFG_T
 AP mode configuration information. More...
 
typedef struct M2MB_NCM_DHCP_SERVER_CFG M2MB_NCM_DHCP_SERVER_CFG_T
 DHCP server configuration for the device in AP mode. More...
 
typedef struct M2MB_NCM_IP_CFG M2MB_NCM_IP_CFG_T
 Generic IP configuration. More...
 
typedef struct M2MB_NCM_IFCFG M2MB_NCM_IFCFG_T
 Network Connect Manager Interface configuration. More...
 
typedef struct M2MB_NCM_RETRY_CFG M2MB_NCM_RETRY_CFG_T
 Retry configuration. More...
 
typedef struct M2MB_NCM_ROAMING_CFG M2MB_NCM_ROAMING_CFG_T
 Roaming configuration. More...
 
typedef struct M2MB_NCM_DEVICE_STATS M2MB_NCM_DEVICE_STATS_T
 Packet count statistics. More...
 
typedef struct M2MB_NCM_CONNECTED_STA_INFO M2MB_NCM_CONNECTED_STA_INFO_T
 Connected station information. More...
 
typedef union M2MB_NCM_CFG_PTR M2MB_NCM_CFG_PTR_T
 Configuration pointer union. More...
 
typedef VOID(* M2MB_NCM_CB_T) (UINT8 device_id, UINT8 event, INT32 status_code, VOID *cb_Ctx)
 NCM module user callback prototype. More...
 
typedef VOID(* M2MB_NCM_SCAN_CB_T) (UINT8 device_id, UINT8 event_id, INT32 status, VOID *data)
 
UINT8 m2mb_ncm_init (UINT8 mode, UINT8 bandwidth, M2MB_NCM_CB_T cb, VOID *cb_ctx)
 NCM module initialization. More...
 
INT32 m2mb_ncm_get_cfg (UINT8 handle, M2MB_NCM_CFG_OPCODE_E opCode, M2MB_NCM_CFG_PTR_T *p)
 This API is used to get different configurations of NCM module. More...
 
INT32 m2mb_ncm_set_cfg (UINT8 handle, M2MB_NCM_CFG_OPCODE_E opCode, M2MB_NCM_CFG_PTR_T *p)
 This API is used to set the different configurations in NCM module. More...
 
INT32 m2mb_ncm_register_cb (UINT8 handle, M2MB_NCM_CB_T m2mb_ncm_cb, VOID *Ctx)
 This API is used to register application callback in NCM module. More...
 
INT32 m2mb_ncm_start (UINT8 handle)
 This API is used to start the NCM module after initialization. More...
 
INT32 m2mb_ncm_stop (UINT8 handle)
 Disconnect or Down the NCM module. More...
 
INT32 m2mb_ncm_deregister_cb (UINT8 handle)
 This API is used to deregister the user callback in NCM module. More...
 
M2MB_STATUS_T m2mb_ncm_deinit (UINT8 handle)
 This API is used to deintializes the NCM module. More...
 
UINT32 m2mb_ncm_check_handle_init (UINT32 handle)
 This API is used to check the handle is initialized or not. More...
 
INT32 m2mb_ncm_get_state (UINT8 device_id)
 Current state of NCM module. More...
 
INT32 m2mb_ncm_scan (UINT8 device_id, UINT8 *ssid, UINT8 no_of_channels, UINT8 *channel_list, UINT8 scan_type, UINT32 num_of_scan_entries, M2MB_WLAN_BSS_SCAN_INFO_T *scanentries, M2MB_NCM_SCAN_CB_T m2m_ncm_scan_cb, VOID *usr_ctx)
 This API is used to get the WLAN scan results. This API expects m2mb_ncm_init prior to it in STA mode. More...
 

Detailed Description

This file contains the public APIs and structures of the Network Connection Manager(NCM) module.

we866e4/epl/inc/nwk/m2mb_ncm.h

Network Connection Manager handles both L2 and L3 level network connection. NCM has two states: Connected and Disconnected state.

The disconnected state has the following sub states: Fast scan state: This is the initial state of NCM or once the L2 level connection breaks. In this state, NCM scans periodically for the configured AP. The scan time is less and the interval at which it scans are also less. If it does not find the configured AP, it moves to a slow scan state.

Slow Scan state: Here also NCM scans for the configured AP, but with a larger interval.

Once the preferred network is found, NCM connects to it, and initiate the L3 connection. It tries to do the L3 level connection maximum L3 Connect Count times with L3 Connect Retry Interval time delay between each retry. Retry interval and count both are configured from the application. Once the retry count is finished, NCM reports the error to the application, disconnects the L2 connection and starts a fresh L2+L3 connection. In this case, it goes to CPU wait state.

GSN NCM module supports Roaming feature. The application can enable/disable roaming while configuring NCM. In this feature Application periodically checks the AP RSSI level. If RSSI value is below the threshold values configured, it scans for other AP with optimum RSSI value. It disconnects with the current AP and roams to new AP found under following conditions:

  • APs have the Same SSID and same Security.
    • WPA/WPA2 Enterprise security is not supported.
  • APs can be on different channels.
  • The node can be in Radio PS-Poll or Active Receive Mode.
  • Only RSSI is used. PER and other statistics are not used.
Note
Dependencies:
"#include <m2mb_wlan_driver.h>"
"#include <m2mb_nwif.h>"
Author
Khaleel Ahmed
Date
12/10/2017

Definition in file m2mb_ncm.h.