![]() |
WE310F5
39.00.000
|
This section describes the M2MB APIs to perform various Network Connection Manager(NCM) operations. More...
This section describes the M2MB APIs to perform various Network Connection Manager(NCM) operations.
Network Connection Manager handles both L2 and L3 level network connection for both Station (STA) and Access Point (AP) mode.
To connect to an AP (in STA mode), use the following API sequence:
To start an AP, use the following API sequence:
#define M2MB_NCM_FLAG_DYNAMIC_KEEP_ALIVE ( 1 << 1 ) |
Flag to learn the keep alive time dynamically and using it to maintain connection
Definition at line 105 of file m2mb_ncm.h.
#define M2MB_NCM_FLAG_KEEP_ALIVE ( 1 << 0 ) |
Flag for keep alive feature
Definition at line 104 of file m2mb_ncm.h.
#define M2MB_NCM_FLAG_ROAMING ( 1 << 2 ) |
Flag for roaming feature
Definition at line 107 of file m2mb_ncm.h.
#define M2MB_NCM_FLAG_WITH_STAT ( 1 << 3 ) |
Flag for storing NCM stat
Definition at line 108 of file m2mb_ncm.h.
#define M2MB_SECURITY_KEY_LENGTH_MAX 64 |
Definition at line 111 of file m2mb_ncm.h.
#define M2MB_WPS_PIN_LENGTH 8 |
Definition at line 110 of file m2mb_ncm.h.
typedef struct M2MB_NCM_AP_CFG M2MB_NCM_AP_CFG_T |
AP mode configuration information.
This data structure allows the application to set AP configuration information used in AP mode.
This data structure should be used to get/set the AP configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_AP_CFG.
typedef struct M2MB_NCM_AP_PROFILE M2MB_NCM_AP_PROFILE_T |
AP profile information.
This data structure allows the application to set AP profile information to search to connect to the network.
This data structure should be used to get/set the AP profile configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_AP_PROFILE.
NCM module user callback prototype.
Type definition of user callback to handle events received from NCM module.
Events are defined in M2MB_L2_L3_NCM_EVENTS_ID_E.
Definition at line 645 of file m2mb_ncm.h.
typedef union M2MB_NCM_CFG_PTR M2MB_NCM_CFG_PTR_T |
Configuration pointer union.
This union allows the application to pass pointer to the get/set API.
This union should be used to get/set various NCM configuration by calling m2mb_ncm_get/set_cfg.
typedef struct M2MB_NCM_CONNECTED_STA_INFO M2MB_NCM_CONNECTED_STA_INFO_T |
Connected station information.
This structure is used to get the connected station information .
This structure should be used to get connected station information by calling m2mb_ncm_get with M2MB_NCM_CFG_OPCODE_CLIENT_GET flag.
typedef enum M2MB_NCM_CTX_STATES M2MB_NCM_CTX_STATES_E |
Different states in NCM module.
This enumeration will be helpful in tracking the NCM module state
typedef struct M2MB_NCM_DEVICE_STATS M2MB_NCM_DEVICE_STATS_T |
Packet count statistics.
Data structure that represents WLAN statistics information.
This data structure contains counts of various types of packets transmitted/received on the particular device ID and also the active and power save time.
This data structure should be used only to get the statistics by calling m2mb_ncm_get using opcode M2MB_NCM_CFG_OPCODE_STAT_GET.
typedef struct M2MB_NCM_DHCP_SERVER_CFG M2MB_NCM_DHCP_SERVER_CFG_T |
DHCP server configuration for the device in AP mode.
This data structure allows the application to set DHCP server configuration information used in AP mode.
This data structure should be used to get/set the AP configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_DHCP_SERVER_CFG.
typedef struct M2MB_NCM_IFCFG M2MB_NCM_IFCFG_T |
Network Connect Manager Interface configuration.
This data structure allows the application to get the interface information.
This data structure should be used to get the interface configuration by calling m2mb_ncm_get using opcode M2MB_NCM_CFG_OPCODE_INTERFACE_GET.
typedef struct M2MB_NCM_IP_CFG M2MB_NCM_IP_CFG_T |
Generic IP configuration.
This data structure allows the application to set or get IP configuration information. Both AP and STA modes supported
This data structure should be used to get/set the generic IP configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_IP_CFG.
typedef struct M2MB_NCM_POWER_SAVE_CFG M2MB_NCM_POWER_SAVE_CFG_T |
typedef struct M2MB_NCM_RETRY_CFG M2MB_NCM_RETRY_CFG_T |
Retry configuration.
This data structure allows the application to set retry configuration for both WLAN and IP layer connection.
This data structure should be used to get/set the retry configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_STA_RETRY.
typedef struct M2MB_NCM_ROAMING_CFG M2MB_NCM_ROAMING_CFG_T |
Roaming configuration.
This data structure allows the application to set roaming configuration WLAN layer connection.
This data structure should be used to get/set the retry configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_STA_ROAMING.
Definition at line 646 of file m2mb_ncm.h.
typedef struct M2MB_NCM_STA_CFG M2MB_NCM_STA_CFG_T |
STA mode configuration information.
This data structure allows the application to set STA configuration information used in STA mode.
This data structure should be used to get/set the Station mode configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_STA_PROFILE.
typedef struct M2MB_NCM_WPS_CFG M2MB_NCM_WPS_CFG_T |
Station mode WPS configuration information.
This data structure allows the application to set STA WPS configuration information used in STA mode.
This data structure should be used to get/set the Station mode WPS configuration by calling m2mb_ncm_get/set_cfg using opcode M2MB_NCM_CFG_OPCODE_STA_WPS_CFG.
Disconnection reason.
Identifies the disconnection reason.
Definition at line 490 of file m2mb_ncm.h.
Events from NCM module.
This enum defines macros for different types of events from NCM in connection process and is helpful to user applications.
Definition at line 170 of file m2mb_ncm.h.
Opcode to be used in configuration API.
This enum is used in m2m_ncm_cfg.
This data type should be used to set/get the configuration for both in AP and STA mode.
Definition at line 208 of file m2mb_ncm.h.
enum M2MB_NCM_CTX_STATES |
Different states in NCM module.
This enumeration will be helpful in tracking the NCM module state
Definition at line 119 of file m2mb_ncm.h.
enum M2MB_NCM_INIT_MODE_E |
Different modes.
This enum is used to start the NCM module initialization. It depends on the user to start the NCM module in STATION or AP mode.
Enumerator | |
---|---|
M2MB_NCM_MODE_STATION | Station mode for NCM module initialization. |
M2MB_NCM_MODE_AP | AP mode for NCM module initialization. |
M2MB_NCM_MODE_BOTH | Both AP and STA mode |
Definition at line 239 of file m2mb_ncm.h.
IP configuration.
This enum defines macros for IP flag setting in NCM connection and will be referred by M2MB_NCM_IP_CFG_T structure.
Enumerator | |
---|---|
M2MB_NCM_IPFLAG_V4_STATIC | setting a static flag (no dhcp) |
M2MB_NCM_IPFLAG_V4_DHCP | setting DHCP flag |
M2MB_NCM_IPFLAG_V6_AUTO | V6 auto flag |
M2MB_NCM_IPFLAG_V6_DHCP | V6 dhcp flag |
Definition at line 151 of file m2mb_ncm.h.
This API is used to check the handle is initialized or not.
This API is used to check the operating mode in NCM module is properly initialized or not. This is the checking initialization API. m2mb_ncm_init should be called first before calling this API.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
m2mb_ncm_check_handle_init(handle);
M2MB_STATUS_T m2mb_ncm_deinit | ( | UINT8 | handle | ) |
This API is used to deintializes the NCM module.
m2mb_ncm_deinit is used to deinitializes the NCM module. If the device is already connected to the existing AP or else device is already created an AP then in either cases the device should first disconnect or down the network by using m2mb_ncm_disconnect function. If the device is in idle state after NCM initialization then user may directly deinitialize the NCM module.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
m2mb_ncm_deinit(handle);
This API is used to deregister the user callback in NCM module.
m2mb_ncm_deregister_cb is used by application to deregister the user callback. m2mb_ncm_deregister_cb will be applied for both callbacks registered by m2mb_ncm_init and m2mb_ncm_register_cb. This API will deregister user callback for either methods.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
m2mb_ncm_deregister_cb(ncm_handle);
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.
User can get the details of different configurations of NCM module by using this API. Refer M2MB_NCM_CFG_PTR_T for different types of configurations user can get. Some of the members of M2MB_NCM_CFG_PTR_T are used only to GET configurations. Refer M2MB_NCM_CFG_OPCODE_E for different opcodes and user should pass respective structure to get the configuration.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
[in] | opCode | Indicates which configuration opcode is used. Refer M2MB_NCM_CFG_OPCODE_E for different opcodes. |
[out] | p | pointer to the configuration structure. Should be typecasted with M2MB_NCM_CFG_PTR_T |
m2mb_ncm_get_cfg(handle, M2MB_NCM_CFG_OPCODE_INTERFACE_GET, (M2MB_NCM_CFG_PTR_T *)&pCfg);
Current state of NCM module.
This API is used to check the current state of NCM module. Refer M2MB_NCM_CTX_STATES_E to understand the state of NCM module.
[in] | device_id | Handle, received from the m2mb_ncm_init API. |
m2mb_ncm_get_state(device_id);
UINT8 m2mb_ncm_init | ( | UINT8 | mode, |
UINT8 | bandwidth, | ||
M2MB_NCM_CB_T | cb, | ||
VOID * | cb_ctx | ||
) |
NCM module initialization.
This API configures and initializes the NCM module. Refer M2MB_NCM_INIT_MODE_E to configure the mode for NMC module initialization. User can register the callback as second parameter for this API or else user can use m2mb_ncm_register_cb function after initialization of NCM module i.e after calling this API to register the callback. The counterpart function for this API is m2mb_ncm_deinit.
[in] | mode | Operating mode. Refer M2MB_NCM_INIT_MODE_E for different operating mode. |
[in] | cb | Callback of application to get indicated for any events from NCM module. |
[in] | cb_ctx | User callback context, passed along with the events to the callback. |
m2mb_ncm_init(M2MB_NCM_MODE_STATION, app_ncm_connect_cb, user_ctx);
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.
This API is the optional to register the application callback with NCM module. User can register application callback through m2mb_ncm_init or else user can use this API to register application callback. The counterpart for this API is m2mb_ncm_deregister_cb. Its user's choice to use either this API or m2mb_ncm_init function to register application callback.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
[in] | m2mb_ncm_cb | Callback of application to get indicated for any events from NCM module. |
[in] | Ctx | User callback context, passed along with the events to the user callback. |
m2mb_ncm_register_cb(handle, ncm_user_cb, NULL);
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.
This API is used to get the WLAN scan results, it can be used for replacement of m2mb_wlan_scan API at NCM level. If the user is passing the m2mb_ncm_scan_cb then the results will come to user callback asynchronously. If the user is passing NULL in user callback parameter then this API will acta s blocking call and user buffer will get filled.
[in] | device_id | Handle, received from the m2mb_ncm_init API. |
[in] | ssid | SSID of the particular Access Point to scan [optional] |
[in] | no_of_channels | Number of channels to scan [optional]. 0 for all channel scan |
[in] | channel_list | List of channels that user wants to scan. |
[in] | scan_type | Scanning type ; [active - 0] or [passive - 1] |
[in] | num_of_scan_entries | User can pass number of entries of scan results and he should provide buffer of that number of scan results. Array of M2MB_WLAN_BSS_SCAN_INFO_T structures |
[in,out] | result_buff | Buffer which is provided by the user to store scan results. |
m2mb_ncm_scan(device_id, SSID, 0, chnl, 0, 12, scan_entries, m2m_scan_cb,NULL);
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.
User can set different configurations of NCM module by using this API. Refer M2MB_NCM_CFG_PTR_T for different types of configurations user can set. Some of the members of M2MB_NCM_CFG_PTR_T are used only to SET configurations. Refer M2MB_NCM_CFG_OPCODE_E for different opcodes and user should pass respective structure filled with required parameters to set the configuration.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
[in] | opCode | Indicates which configuration opcode is used. Refer M2MB_NCM_CFG_OPCODE_E for different opcodes. |
[in] | p | Pointer to the structure with filled parameters to set. Should be typecasted with M2MB_NCM_CFG_PTR_T |
m2mb_ncm_set_cfg(handle, M2MB_NCM_CFG_OPCODE_IP_CFG, (M2MB_NCM_CFG_PTR_T *)&pCfg);
This API is used to start the NCM module after initialization.
This API starts the NCM module to connect to the existing network when the NCM is initiated in STA mode or else it create its own network when the NCM is initiated in AP mode. Either of these functionalities require AP profile. The AP profile should be set by user using m2mb_ncm_set_cfg with M2MB_NCM_CFG_OPCODE_AP_PROFILE opcode and respective structure in M2MB_NCM_CFG_PTR_T. User can set IP related parameters by using m2mb_ncm_set_cfg with M2MB_NCM_CFG_OPCODE_IP_CFG opcode and respective structure in M2MB_NCM_CFG_PTR_T. This API uses the configuration set by the user else it uses the default configuration. The counter part fro this API is m2mb_ncm_disconnect.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
m2mb_ncm_start( handle );
Disconnect or Down the NCM module.
This API is used to disconnect from the connected network in STA mode and down the created network in AP mode. This API is the counterpart of m2mb_ncm_start API. For deinitialization of NCM module, the user should give this API.
[in] | handle | Handle, received from the m2mb_ncm_init API. |
m2mb_ncm_deregister_cb(handle);