m2mb API docs  25.21.002
m2mb API sets documentation
m2mb_wlan.h File Reference

Header file for m2mb_wlan APIs. More...

Go to the source code of this file.

Data Structures

struct  M2MB_WLAN_SSID_S
 
struct  M2MB_WLAN_MAC_S
 
struct  M2MB_WLAN_CONFIG_LEGACY_S
 
struct  M2MB_WLAN_SCAN_MSG_S
 Scan request. More...
 
struct  M2MB_WLAN_BSS_SCAN_INFO_S
 Structure of members for scan results. More...
 
struct  M2MB_WLAN_SCAN_IND_S
 Scan indication. More...
 
struct  M2MB_CON_IND_S
 Connection event info for both AP and STA modes. More...
 
struct  M2MB_DISCON_IND_S
 Disconnection event info for both AP and STA modes. More...
 
struct  M2MB_WLAN_AP_CLIENT_INFO_S
 AP client info. More...
 
struct  M2MB_WLAN_AP_CLIENT_MSG_S
 AP client info request. More...
 
struct  M2MB_WLAN_AP_CLIENT_IND_S
 Client info indication. More...
 
struct  M2MB_WLAN_MAC_ADDR_STRING_S
 
struct  M2MB_WLAN_MAC_ADDR_LIST_S
 
struct  M2MB_WLAN_ERROR_MSG_S
 WLAN error info request. More...
 
struct  M2MB_WLAN_PING_RESULT_T
 
struct  M2MB_WLAN_PING_COMPLETE_T
 
struct  M2MB_WLAN_CON_INFO_S
 

Macros

#define M2MB_WLAN_MAC_LEN   6
 
#define M2MB_WLAN_MAC_STR_LEN   18
 
#define M2MB_WLAN_MAC_SEPERATOR   ':'
 
#define M2MB_WLAN_MAX_SSID_LEN   32
 
#define M2MB_WLAN_MIN_PASSPHRASE_LEN   8
 
#define M2MB_WLAN_MAX_PASSPHRASE_LEN   64
 
#define M2MB_WLAN_MIN_WEP_KEY_SIZE   10
 
#define M2MB_WLAN_MAX_WEP_KEY_SIZE   26
 
#define M2MB_WLAN_WPS_MAX_KEY_LEN   64
 
#define M2MB_WLAN_SCAN_TYPE_BLOCKING   1
 
#define M2MB_WLAN_SCAN_TYPE_NON_BLOCKING   0
 
#define M2MB_WLAN_BROADCAST_ENABLE   1
 
#define M2MB_WLAN_BROADCAST_DISABLE   0
 
#define M2MB_WLAN_MIN_EAP_IDENTITY_LEN   8
 
#define M2MB_WLAN_MAX_EAP_IDENTITY_LEN   64
 
#define M2MB_WLAN_MIN_EAP_PASSWORD_LEN   8
 
#define M2MB_WLAN_MAX_EAP_PASSWORD_LEN   64
 
#define M2MB_WLAN_MIN_EAP_PRIV_KEY_PASSWD_LEN   8
 
#define M2MB_WLAN_MAX_EAP_PRIV_KEY_PASSWD_LEN   64
 
#define M2MB_MAX_FILE_READ_LEN   256
 
#define M2MB_WLAN_MAC_STR_MAX_SIZE   20
 

Typedefs

typedef HANDLE M2MB_WLAN_HANDLE
 
typedef HANDLE M2MB_WLAN_IF_HANDLE
 
typedef struct M2MB_WLAN_SSID_S M2MB_WLAN_SSID_T
 
typedef struct M2MB_WLAN_MAC_S M2MB_WLAN_MAC_T
 
typedef struct M2MB_WLAN_CONFIG_LEGACY_S M2MB_WLAN_CONFIG_LEGACY_T
 
typedef struct M2MB_WLAN_SCAN_MSG_S M2MB_WLAN_SCAN_MSG_T
 Scan request. More...
 
typedef struct M2MB_WLAN_BSS_SCAN_INFO_S M2MB_WLAN_BSS_SCAN_INFO_T
 Structure of members for scan results. More...
 
typedef struct M2MB_WLAN_SCAN_IND_S M2MB_WLAN_SCAN_IND_T
 Scan indication. More...
 
typedef struct M2MB_CON_IND_S M2MB_CON_IND_T
 Connection event info for both AP and STA modes. More...
 
typedef struct M2MB_DISCON_IND_S M2MB_DISCON_IND_T
 Disconnection event info for both AP and STA modes. More...
 
typedef struct M2MB_WLAN_AP_CLIENT_INFO_S M2MB_WLAN_AP_CLIENT_INFO_T
 AP client info. More...
 
typedef struct M2MB_WLAN_AP_CLIENT_MSG_S M2MB_WLAN_AP_CLIENT_MSG_T
 AP client info request. More...
 
typedef struct M2MB_WLAN_AP_CLIENT_IND_S M2MB_WLAN_AP_CLIENT_IND_T
 Client info indication. More...
 
typedef struct M2MB_WLAN_MAC_ADDR_STRING_S M2MB_WLAN_MAC_ADDR_STRING_T
 
typedef struct M2MB_WLAN_MAC_ADDR_LIST_S M2MB_WLAN_MAC_ADDR_LIST_T
 
typedef struct M2MB_WLAN_ERROR_MSG_S M2MB_WLAN_ERROR_MSG_T
 WLAN error info request. More...
 
typedef struct M2MB_WLAN_CON_INFO_S M2MB_WLAN_CON_INFO_T
 
typedef void(* m2mb_wlan_ind_callback) (M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *userdata)
 

Enumerations

enum  M2MB_WLAN_PROTOCOL_TYPE_E {
  M2MB_WLAN_PROTOCOL_TYPE_B_ONLY, M2MB_WLAN_PROTOCOL_TYPE_B_G, M2MB_WLAN_PROTOCOL_TYPE_B_G_N, M2MB_WLAN_PROTOCOL_TYPE_A_N,
  M2MB_WLAN_PROTOCOL_TYPE_A_N_AC
}
 
enum  M2MB_WLAN_AUTH_TYPE_E {
  M2MB_WLAN_AUTH_TYPE_NONE = 0, M2MB_WLAN_AUTH_TYPE_WPA = 1, M2MB_WLAN_AUTH_TYPE_WPA2 = 2, M2MB_WLAN_AUTH_TYPE_WPA_PSK = 3,
  M2MB_WLAN_AUTH_TYPE_WPA2_PSK = 4, M2MB_WLAN_AUTH_TYPE_WPA2_EAP = 5, M2MB_WLAN_AUTH_TYPE_WPA3 = 6, M2MB_WLAN_AUTH_TYPE_WEP = 8,
  M2MB_WLAN_AUTH_TYPE_INVALID
}
 Different authentication modes supported by WLAN. More...
 
enum  M2MB_WLAN_AP_SEC_TYPE_E {
  M2MB_WLAN_AP_SEC_TYPE_DISABLE = 0, M2MB_WLAN_AP_SEC_TYPE_WPA1 = 1, M2MB_WLAN_AP_SEC_TYPE_WPA2 = 2, M2MB_WLAN_AP_SEC_TYPE_WPA1_WPA2 = 3,
  M2MB_WLAN_AP_SEC_TYPE_WPA3 = 4, M2MB_WLAN_AP_SEC_TYPE_INVALID
}
 
enum  M2MB_WLAN_SECURITY_MODE_E {
  M2MB_WLAN_SECURITY_MODE_OPEN = 0, M2MB_WLAN_SECURITY_MODE_WEP = 1, M2MB_WLAN_SECURITY_MODE_WPA_PSK = 2, M2MB_WLAN_SECURITY_MODE_WPA_EAP = 3,
  M2MB_WLAN_SECURITY_MODE_WPA_EAP_PSK = 4, M2MB_WLAN_SECURITY_MODE_WPA3_SAE = 5, M2MB_WLAN_SECURITY_MODE_INVALID
}
 
enum  M2MB_WLAN_ENCRYPT_TYPE_E {
  M2MB_WLAN_ENCRYPT_TYPE_NONE = 0, M2MB_WLAN_ENCRYPT_TYPE_WEP = 1, M2MB_WLAN_ENCRYPT_TYPE_TKIP = 2, M2MB_WLAN_ENCRYPT_TYPE_AES = 3,
  M2MB_WLAN_ENCRYPT_TYPE_TKIP_AES = 4, M2MB_WLAN_ENCRYPT_TYPE_INVALID
}
 Different encryption modes supported by WLAN. More...
 
enum  M2MB_WLAN_RESPONSE_E {
  M2MB_WLAN_SUCCESS = 0, M2MB_WLAN_ERROR_BAD_ARG = -1, M2MB_WLAN_ERROR_OUT_OF_BUFFER = -2, M2MB_WLAN_ERROR_TIMEOUT = -3,
  M2MB_WLAN_ERROR_NETWORK = -4, M2MB_WLAN_ERROR_MEMORY = -5, M2MB_WLAN_ERROR_CALLBACK = -6, M2MB_WLAN_ERROR_ASYNC_THREAD = -7,
  M2MB_WLAN_ERROR_OP_NOT_ALLOWED = -8, M2MB_WLAN_ERROR_OP_FAILED = -9, M2MB_WLAN_ERROR_NO_INTERNET = -10, M2MB_WLAN_ERROR_SUPPORN_AP_MODE = -11,
  M2MB_WLAN_ERROR_SUPPORN_CLIENT_MODE = -12, M2MB_WLAN_ERROR_DRIVER_FAIELD = -13, M2MB_WLAN_ERROR_CONNECTION_FAILED = -14, M2MB_WLAN_ERROR_OP_NOT_SUPPORTED = -99
}
 WLAN APIs response enum. 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...
 
enum  M2MB_WLAN_CON_EVENT_ID_E { M2MB_WLAN_CON_STA, M2MB_WLAN_CON_AP, M2MB_WLAN_CON_PEER }
 WLAN connect event id. More...
 
enum  M2MB_WLAN_IND_E {
  M2MB_WLAN_SCAN_IND_CB, M2MB_WLAN_SCAN_COMPLETE_CB, M2MB_WLAN_CONNECT_CB, M2MB_WLAN_DISCONNECT_CB,
  M2MB_WLAN_PROFILE_PNO_CB, M2MB_WLAN_EVENT_WPS_CB, M2MB_WLAN_EVENT_PROMISCOUS_CB, M2MB_WLAN_AP_CLIENT_IND_CB,
  M2MB_WLAN_AP_CLIENT_INFO_DONE_CB, M2MB_WLAN_PING_IND_CB, M2MB_WLAN_PING_COMPLETE_CB, M2MB_WLAN_CLIENT_STATE_IND_CB,
  M2MB_WLAN_UNSOLICIT_IND_CB
}
 Events for an application registered CB functions. More...
 
enum  M2MB_WLAN_SCAN_TYPE_E { M2MB_WLAN_SCAN_ACTIVE, M2MB_WLAN_SCAN_PASSIVE }
 Scan method. More...
 
enum  M2MB_WLAN_SCAN_FORMAT_E { M2MB_WLAN_SCAN_NORMAL, M2MB_WLAN_SCAN_IW_RAW }
 Scan result format. More...
 
enum  M2MB_WLAN_OP_MODE_E {
  M2MB_WLAN_OP_MODE_STA, M2MB_WLAN_OP_MODE_AP, M2MB_WLAN_OP_MODE_AP_STA, M2MB_WLAN_OP_MODE_AP_AP,
  M2MB_WLAN_OP_MODE_STA_STA
}
 WLAN module operating modes. More...
 
enum  M2MB_WLAN_MODE_E { M2MB_WLAN_MODE_STATION, M2MB_WLAN_MODE_ACCESS_POINT, M2MB_WLAN_MODE_ADHOC, M2MB_WLAN_MODE_INVALID }
 WLAN interface operating modes. More...
 
enum  M2MB_WLAN_DEV_ID_E {
  M2MB_WLAN_DEV_0, M2MB_WLAN_DEV_1, M2MB_WLAN_DEV_2, M2MB_WLAN_DEV_3,
  M2MB_WLAN_DEV_MAX
}
 WLAN device id or interface id. More...
 
enum  M2MB_WLAN_BIN_ID_E { M2MB_WLAN_BIN_BDWLAN, M2MB_WLAN_BIN_OTP }
 
enum  M2MB_WLAN_START_STATUS_E { M2MB_WLAN_START_STATUS_OFF = 0, M2MB_WLAN_START_STATUS_ON, M2MB_WLAN_START_STATUS_AUTO }
 
enum  M2MB_WLAN_ACTION_E {
  M2MB_WLAN_SET_SSID, M2MB_WLAN_GET_SSID, M2MB_WLAN_SET_CHANNEL, M2MB_WLAN_GET_CHANNEL,
  M2MB_WLAN_SET_MAC_ADDRESS, M2MB_WLAN_GET_MAC_ADDRESS, M2MB_WLAN_SET_OPERATION_MODE, M2MB_WLAN_GET_OPERATION_MODE,
  M2MB_WLAN_SET_LISTEN_INTERVAL, M2MB_WLAN_GET_LISTEN_INTERVAL, M2MB_WLAN_SET_DTIM_INTERVAL, M2MB_WLAN_GET_DTIM_INTERVAL,
  M2MB_WLAN_SET_AP_ENABLE_HIDDEN_MODE, M2MB_WLAN_GET_AP_ENABLE_HIDDEN_MODE, M2MB_WLAN_SET_STA_KEEP_ALIVE_IN_SEC, M2MB_WLAN_GET_STA_KEEP_ALIVE_IN_SEC,
  M2MB_WLAN_SET_BEACON_INTERVAL_TU, M2MB_WLAN_GET_BEACON_INTERVAL_TU, M2MB_WLAN_SET_BMISS_CONFIG, M2MB_WLAN_GET_BMISS_CONFIG,
  M2MB_WLAN_SET_RSSI, M2MB_WLAN_GET_RSSI, M2MB_WLAN_SET_TX_POWER, M2MB_WLAN_GET_TX_POWER,
  M2MB_WLAN_SET_REG_DOMAIN, M2MB_WLAN_GET_REG_DOMAIN, M2MB_WLAN_SET_TX_RATE, M2MB_WLAN_GET_TX_RATE,
  M2MB_WLAN_SET_POWER_SAVE_MODE, M2MB_WLAN_GET_POWER_SAVE_MODE, M2MB_WLAN_SET_POWER_SAVE_POLICY, M2MB_WLAN_GET_POWER_SAVE_POLICY,
  M2MB_WLAN_SET_PHY_MODE, M2MB_WLAN_GET_PHY_MODE, M2MB_WLAN_SET_AUTH_TYPE, M2MB_WLAN_GET_AUTH_TYPE,
  M2MB_WLAN_SET_AUTH_TYPE_NUM, M2MB_WLAN_GET_AUTH_TYPE_NUM, M2MB_WLAN_SET_ENCRYPTION_TYPE, M2MB_WLAN_GET_ENCRYPTION_TYPE,
  M2MB_WLAN_SET_ENCRYPTION_TYPE_NUM, M2MB_WLAN_GET_ENCRYPTION_TYPE_NUM, M2MB_WLAN_SET_SECURITY_MODE, M2MB_WLAN_GET_SECURITY_MODE,
  M2MB_WLAN_SET_BSSID, M2MB_WLAN_GET_BSSID, M2MB_WLAN_SET_WPA_PSK, M2MB_WLAN_GET_WPA_PSK,
  M2MB_WLAN_SET_SECURITY_PASSPHRASE, M2MB_WLAN_GET_SECURITY_PASSPHRASE, M2MB_WLAN_SET_WEP_KEY_INDEX, M2MB_WLAN_GET_WEP_KEY_INDEX,
  M2MB_WLAN_SET_WEP_KEY_PAIR, M2MB_WLAN_GET_WEP_KEY_PAIR, M2MB_WLAN_SET_WPS_CREDENTIALS, M2MB_WLAN_GET_WPS_CREDENTIALS,
  M2MB_WLAN_SET_STATS, M2MB_WLAN_GET_STATS, M2MB_WLAN_SET_PNO_INFO, M2MB_WLAN_GET_PNO_INFO,
  M2MB_WLAN_SET_PROFILE_INFO, M2MB_WLAN_GET_PROFILE_INFO, M2MB_WLAN_SET_COUNTRY_CODE, M2MB_WLAN_GET_COUNTRY_CODE,
  M2MB_WLAN_SET_11N_HT, M2MB_WLAN_GET_11N_HT, M2MB_WLAN_SET_AP_WPS_SUPPORT, M2MB_WLAN_GET_AP_WPS_SUPPORT,
  M2MB_WLAN_SET_PROMISC_FILTER_INFO, M2MB_WLAN_GET_PROMISC_FILTER_INFO, M2MB_WLAN_SET_PROMISC_CMD, M2MB_WLAN_GET_PROMISC_CMD,
  M2MB_WLAN_SET_EAP_8021X, M2MB_WLAN_GET_EAP_8021X, M2MB_WLAN_SET_INACTIVITY_TIME_IN_MIN, M2MB_WLAN_GET_INACTIVITY_TIME_IN_MIN,
  M2MB_WLAN_SET_SCAN_TIME, M2MB_WLAN_GET_SCAN_TIME, M2MB_WLAN_SET_IND, M2MB_WLAN_GET_IND,
  M2MB_WLAN_SET_MAC_FILTER, M2MB_WLAN_GET_MAC_FILTER, M2MB_WLAN_SET_MAC_ACCEPT, M2MB_WLAN_GET_MAC_ACCEPT,
  M2MB_WLAN_SET_MAC_DENY, M2MB_WLAN_GET_MAC_DENY, M2MB_WLAN_SET_PDP_CID, M2MB_WLAN_GET_PDP_CID,
  M2MB_WLAN_SET_EAP_METHOD, M2MB_WLAN_GET_EAP_METHOD, M2MB_WLAN_SET_EAP_IDENTITY, M2MB_WLAN_GET_EAP_IDENTITY,
  M2MB_WLAN_SET_EAP_PASSWORD, M2MB_WLAN_GET_EAP_PASSWORD, M2MB_WLAN_SET_EAP_PRIV_KEY_PASSWD, M2MB_WLAN_GET_EAP_PRIV_KEY_PASSWD,
  M2MB_WLAN_ACTION_MAX
}
 WLAN interface set or get flags. More...
 
enum  M2MB_WLAN_ICMP_PING_CFG_E { M2MB_WLAN_ICMP_PING_DISABLE, M2MB_WLAN_ICMP_PING_ENABLE }
 
enum  M2MB_WLAN_EAP_METHOD_E {
  M2MB_WLAN_EAP_METHOD_PEAPV0_MSCHAPV2 = 0, M2MB_WLAN_EAP_METHOD_PEAPV1_GTC, M2MB_WLAN_EAP_METHOD_TTLS_MSCHAPV2, M2MB_WLAN_EAP_METHOD_TTLS_GTC,
  M2MB_WLAN_EAP_METHOD_TLS
}
 
enum  M2MB_WLAN_EAP_CERT_TYPE_E { M2MB_WLAN_EAP_CERT_TYPE_CA_CERT = 0, M2MB_WLAN_EAP_CERT_TYPE_CLI_CERT, M2MB_WLAN_EAP_CERT_TYPE_KEY }
 

Functions

M2MB_WLAN_RESPONSE_E m2mb_wlan_init (M2MB_WLAN_HANDLE *h)
 m2mb_wlan_init initializes WLAN service for current client More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_deinit (M2MB_WLAN_HANDLE h)
 m2mb_wlan_deinit deinitializes WLAN service. It will shut down the wlan module. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_init (M2MB_WLAN_IF_HANDLE *ifh, M2MB_WLAN_HANDLE h, M2MB_WLAN_DEV_ID_E device_id, m2mb_wlan_ind_callback callback, void *userdata)
 WLAN Interface Initialization. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_start (M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_MODE_E mode)
 WLAN Interface bring up or start. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_stop (M2MB_WLAN_IF_HANDLE ifh)
 WLAN Interface bring down or stop. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_deinit (M2MB_WLAN_IF_HANDLE ifh)
 Removes the interface from the WLAN driver. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_conf (M2MB_WLAN_IF_HANDLE ifh, UINT8 argc,...)
 m2mb_wlan_conf sets/gets some WLAN parameters. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_scan (M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_SCAN_MSG_T *scan_req)
 This API is used to initiate a wireless scan to find nearby access points m2mb_wlan_init, m2mb_wlan_interface_init and wlan_interface_start should call before calling m2mb_wlan_scan. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_scan_abort (M2MB_WLAN_IF_HANDLE ifh)
 Abort the current scan operation. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_connect (M2MB_WLAN_IF_HANDLE ifh, UINT8 *ssid)
 This API is part of connect process in non-AP station mode. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_disconnect (M2MB_WLAN_IF_HANDLE ifh)
 Disconnects a device from a network. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_mode_set (M2MB_WLAN_HANDLE h, M2MB_WLAN_OP_MODE_E mode)
 Configure WLAN mode. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_mode_get (M2MB_WLAN_HANDLE h, M2MB_WLAN_OP_MODE_E *mode)
 Get WLAN operating mode. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_hostapd_set (M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_DEV_ID_E dev_id, INT8 *conf_buf, UINT32 conf_size)
 Update hostapd.conf file. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_bd_set (M2MB_WLAN_HANDLE h, M2MB_WLAN_BIN_ID_E bin_id, INT8 *bin_buf, UINT32 bin_size, UINT32 offset, UINT8 eof_flag)
 Add or update wlan custom bin file. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_bd_get (M2MB_WLAN_HANDLE h, M2MB_WLAN_BIN_ID_E bin_id, UINT32 *bin_size)
 Get status of the currently added wlan board data firmware file or otp file. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_ap_client_info_get (M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_AP_CLIENT_MSG_T *client_req)
 This API is used to get client inofrmation in AP mode. m2mb_wlan_init, m2mb_wlan_interface_init and wlan_interface_start should call before calling m2mb_wlan_ap_client_info_get. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_error_info_get (M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_ERROR_MSG_T *err_msg)
 Get WLAN last error. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_hostapd_get_sec_config (M2MB_WLAN_HANDLE h, M2MB_WLAN_DEV_ID_E device_id, M2MB_WLAN_AP_SEC_TYPE_E *sec_type, M2MB_WLAN_SECURITY_MODE_E *key_mgmt, M2MB_WLAN_ENCRYPT_TYPE_E *pairwise, INT8 *key)
 Set Security Configuration in hostapd file. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_hostapd_set_sec_config (M2MB_WLAN_HANDLE h, M2MB_WLAN_DEV_ID_E device_id, M2MB_WLAN_AP_SEC_TYPE_E sec_type, M2MB_WLAN_SECURITY_MODE_E sec_mode, M2MB_WLAN_ENCRYPT_TYPE_E enc_type, INT8 *key)
 Set Security Configuration in hostapd file. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_ping_req (M2MB_WLAN_IF_HANDLE ifh, char *addrstr, INT32 retry_count, INT32 pkt_size, INT32 timeout, INT32 ttl)
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_status_get (M2MB_WLAN_HANDLE h, M2MB_WLAN_DEV_ID_E if_id, int *if_status)
 Get the status of WLAN Interface. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_cfg_get (M2MB_WLAN_HANDLE h, M2MB_WLAN_CONFIG_LEGACY_T *cfg_legacy)
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_cfg_set (M2MB_WLAN_HANDLE h, M2MB_WLAN_CONFIG_LEGACY_T *cfg_legacy)
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_clock_set (M2MB_WLAN_HANDLE wlan_hdl, int clock_val)
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_clock_get (M2MB_WLAN_HANDLE wlan_hdl, int *clock_val)
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_module_select (M2MB_WLAN_HANDLE wlan_hdl, int module_id)
 Select WE866Cx module. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_start_state_get (M2MB_WLAN_HANDLE wlan_hdl, int *wlan_start_state)
 Check WLAN start state. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_driver_cfg_restore (M2MB_WLAN_HANDLE wlan_hdl, int dfs_master_flag)
 Restore driver config. More...
 
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_dfs_set (M2MB_WLAN_HANDLE wlan_hdl, int dfs_enable)
 Dynamic Frequency Selection Master enable or disable. More...
 
int m2mb_wlan_le910cx_con_info_get (M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_CON_INFO_T *pConInfo)
 Device Information. More...
 
bool m2mb_wlan_le910cx_is_connected (M2MB_WLAN_IF_HANDLE ifh)
 Check if WLAN is already enabled. More...
 

Detailed Description

Header file for m2mb_wlan APIs.

m2m/m2m_generic/common/m2mb_inc/m2mb_wlan.h

m2mb_wlan APIs provide actions and events for WLAN management.

Note
Author
Bhaskar Naik
Date
06/02/2020

Macro Definition Documentation

◆ M2MB_WLAN_BROADCAST_DISABLE

#define M2MB_WLAN_BROADCAST_DISABLE   0

Disable wlan Broadcast

◆ M2MB_WLAN_BROADCAST_ENABLE

#define M2MB_WLAN_BROADCAST_ENABLE   1

Enable wlan Broadcast

◆ M2MB_WLAN_MAC_LEN

#define M2MB_WLAN_MAC_LEN   6

Length of MAC address

◆ M2MB_WLAN_MAX_EAP_IDENTITY_LEN

#define M2MB_WLAN_MAX_EAP_IDENTITY_LEN   64

Maximum length of EAP identity

◆ M2MB_WLAN_MAX_EAP_PASSWORD_LEN

#define M2MB_WLAN_MAX_EAP_PASSWORD_LEN   64

Maximum length of EAP password

◆ M2MB_WLAN_MAX_EAP_PRIV_KEY_PASSWD_LEN

#define M2MB_WLAN_MAX_EAP_PRIV_KEY_PASSWD_LEN   64

Maximum length of EAP Key password

◆ M2MB_WLAN_MAX_PASSPHRASE_LEN

#define M2MB_WLAN_MAX_PASSPHRASE_LEN   64

Maximum length of passphrase

◆ M2MB_WLAN_MAX_SSID_LEN

#define M2MB_WLAN_MAX_SSID_LEN   32

Maximum length of SSID

◆ M2MB_WLAN_MAX_WEP_KEY_SIZE

#define M2MB_WLAN_MAX_WEP_KEY_SIZE   26

Maximum WEP key size

◆ M2MB_WLAN_MIN_EAP_IDENTITY_LEN

#define M2MB_WLAN_MIN_EAP_IDENTITY_LEN   8

Minimum length of EAP identity

◆ M2MB_WLAN_MIN_EAP_PASSWORD_LEN

#define M2MB_WLAN_MIN_EAP_PASSWORD_LEN   8

Minimum length of EAP password

◆ M2MB_WLAN_MIN_EAP_PRIV_KEY_PASSWD_LEN

#define M2MB_WLAN_MIN_EAP_PRIV_KEY_PASSWD_LEN   8

Minimum length of EAP Key password

◆ M2MB_WLAN_MIN_PASSPHRASE_LEN

#define M2MB_WLAN_MIN_PASSPHRASE_LEN   8

Minimum length of passphrase

◆ M2MB_WLAN_MIN_WEP_KEY_SIZE

#define M2MB_WLAN_MIN_WEP_KEY_SIZE   10

Minimum WEP key size

◆ M2MB_WLAN_WPS_MAX_KEY_LEN

#define M2MB_WLAN_WPS_MAX_KEY_LEN   64

Maximum size of WPS key in bytes

Typedef Documentation

◆ M2MB_CON_IND_T

Connection event info for both AP and STA modes.

Data structure that presents connect event information from the driver to the application. The application uses this data structure to interpret the event payload received with an M2MB_WLAN_CONNECT_CB or M2MB_WLAN_CONNECT_FAIL_CB events.

◆ M2MB_DISCON_IND_T

Disconnection event info for both AP and STA modes.

Data structure that presents dis-connect event information from the driver to the application. The application uses this data structure to interpret the event payload received with an M2MB_WLAN_DISCONNECT_CB event.

◆ M2MB_WLAN_AP_CLIENT_IND_T

Client info indication.

Data structure that is used to send AP client information from driver to application

◆ M2MB_WLAN_AP_CLIENT_INFO_T

AP client info.

Data structure that presents AP client information. IT contains client information such as MAC addresses, IP addresses, Host names, Tx/Rx statistics.

◆ M2MB_WLAN_AP_CLIENT_MSG_T

AP client info request.

Data structure that is used to get AP client information from application to driver.

◆ M2MB_WLAN_BSS_SCAN_INFO_T

Structure of members for scan results.

Structure for storing scan results. User application should send the array of this structure as a parameter to get filled when scan completed by the driver. This structure can be passed as one of the parameters for the m2mb_wlan_scan function.

◆ M2MB_WLAN_ERROR_MSG_T

WLAN error info request.

Data structure that is used to get last error information from driver to application.

◆ M2MB_WLAN_SCAN_IND_T

Scan indication.

Data structure that is used to send scan result from driver to application

◆ M2MB_WLAN_SCAN_MSG_T

Scan request.

Data structure that is used to start scan operation from application to driver. The driver uses this data structure to start scan operation.

Enumeration Type Documentation

◆ M2MB_DISASSOC_REASON_T

Disconnection reason.

Identifies the disconnection reason.

Enumerator
M2MB_WLAN_NO_NETWORK_AVAIL 

No network available.

M2MB_WLAN_LOST_LINK 

Missed beacons.

M2MB_WLAN_DISCONNECT_CMD 

User disconnect command.

M2MB_WLAN_BSS_DISCONNECTED 

BSS disconnected.

M2MB_WLAN_AUTH_FAILED 

Authentication failed.

M2MB_WLAN_ASSOC_FAILED 

Association failed.

M2MB_WLAN_NO_RESOURCES_AVAIL 

No resources available.

M2MB_WLAN_CSERV_DISCONNECT 

Disconnection due to connection services.

M2MB_WLAN_INVALID_PROFILE 

RSNA failure.

M2MB_WLAN_DOT11H_CHANNEL_SWITCH 

802.11h channel switch.

M2MB_WLAN_PROFILE_MISMATCH 

Profile mismatched.

M2MB_WLAN_CONNECTION_EVICTED 

Connection evicted.

M2MB_WLAN_IBSS_MERGE 

Disconnection due to merging of IBSS.

M2MB_WLAN_EXCESS_TX_RETRY 

TX frames failed after excessive retries.

M2MB_WLAN_SEC_HS_TO_RECV_M1 

Security 4-way handshake timed out waiting for M1.

M2MB_WLAN_SEC_HS_TO_RECV_M3 

Security 4-way handshake timed out waiting for M3.

M2MB_WLAN_TKIP_COUNTERMEASURES 

TKIP counter-measures.

M2MB_WLAN_SCAN_FAIL 

scan fail

M2MB_L3_FAIL 

L3 FAIL

◆ M2MB_WLAN_ACTION_E

WLAN interface set or get flags.

Enumeration of flags which are used to set or get the parameters to the driver and from the driver. Some flags may support both set and get functionalities.

Enumerator
M2MB_WLAN_SET_SSID 

To GET or SET SSID, If the device is in AP mode, this SSID will acts like SSID for the network. If the device is in STA mode, SSID will be the SSID of the network to which STA wants to connect . M2MB_WLAN_MAX_SSID_LEN is the max length of SSID

M2MB_WLAN_GET_SSID 

To GET or SET the channel number. If the device is in AP mode, this channel number is used as network channel network and the network will start in this channel. If the device is in STA mode, then this channel number is used to scanning purpose in a particular channel. channel values are set in numbers[1-14][36-165] not in frequencies

M2MB_WLAN_GET_CHANNEL 

To GET the MAC address. This works for both AP mode and STA mode also. MAC address can be set before association in STA mode and before starting the network in AP mode. MAC address can also be got at any time, until device is up. M2MB_WLAN_MAC_LEN is MAC address length, and array must be declared with above mentioned size

M2MB_WLAN_GET_MAC_ADDRESS 

To GET or SET the operating mode. STA mode and soft AP mode are two modes. device identifier 0 will supports both STA and AP modes. The device identifier 1 will supports only STA mode, so when the user starts WLAN in STA mode device ID 1 is assigned and when the user starts WLAN in AP mode device id 0 is assigned

M2MB_WLAN_GET_OPERATION_MODE 

To SET the listen interval. Setting of listen interval only supports in STA mode i.e operating mode should be STA. This value is used in association request frame. Listen interval is multiple of beacon intervals. For example value of 1 corresponds to 1 beacon interval

M2MB_WLAN_GET_LISTEN_INTERVAL 

To SET the DTIM interval. Setting of DTIM interval only supports in softAP mode i.e operating mode should be set to Soft AP and DTIM interval should set before the starting device in AP mode. DTIM interval is multiple of beacon intervals. For example, if it is set as 2 every beacon after 2 beacons is DTIM beacon, at which every station must wake and receive this DTIM beacon to know buffered packets is there or not for its association id

M2MB_WLAN_GET_DTIM_INTERVAL 

To enable or disable the hidden SSID feature. Setting this flag is only supports in softAP operating mode. Firstly, set the operating mode to AP mode and then enable or disable hidden SSID feature. This flag supports only to SET

M2MB_WLAN_GET_AP_ENABLE_HIDDEN_MODE 

To SET keep alive frame interval in sec. Setting this flag only supports in STA mode. If this value set to '0', the keep alive timer will be disabled

M2MB_WLAN_GET_STA_KEEP_ALIVE_IN_SEC 

To SET the beacon interval in TU(time units). This flag is set and applicable only if device is in softAP operating mode. One TU = 1024 microseconds. Number of TUs between every beacon

M2MB_WLAN_GET_BEACON_INTERVAL_TU 

To SET the beacon missing parameters. M2MB_STA_BMISS_CONFIG_T is used as the parameter to set to the driver. On receiving this request from user in STA mode, WLAN firmware reports a link loss after a specified interval. Either of the values will be set by user, bmiss_time_in_ms or num_beacons. The other value should be set to 0. Based on the values the WLAN firmware detects link loss and disconnected from the network

M2MB_WLAN_GET_BMISS_CONFIG 

To GET or SET the RSSI value. For setting, this RSSI value is used for setting the threshold. If the user wants to GET the RSSI value, it returns RSSI value in dB. TO DO Need some structure to set the threshold values

M2MB_WLAN_GET_RSSI 

To SET or GET the transmit power level in dBm. To set the transmit power level, the range is between 0-63. By default, the value is 63 (max)

M2MB_WLAN_GET_TX_POWER 

To GET the regulatory domain which driver is currently using. This flag is used to only get the regulatory domain

M2MB_WLAN_GET_REG_DOMAIN 

To GET or SET the WLAN rate of packets transmitted over radio. This flag is used to GET the transmission rate of received packets over radio, or to SET the transmission rate of the packets which is going to transmit over the radio. TO DO

M2MB_WLAN_GET_TX_RATE 

Need some clarification about setting values and setting power save

M2MB_WLAN_GET_POWER_SAVE_POLICY 

To GET or SET the wireless PHY mode(a|b|g|an|ag|gn|agn). The SET operation should be done before establishing the connection . The GET operation can be done before or after the connection

M2MB_WLAN_GET_PHY_MODE 

To GET or SET the authentication type. Authentication should be set before connecting to the peer. 0 for none , 3 for wpa_psk, 4 for wpa2_psk

M2MB_WLAN_GET_BSSID 

To SET the passphrase for upcoming WPA/WPA2 association procedure. This should be set before initiating the association. The length should be between 8 and 64

M2MB_WLAN_GET_SECURITY_PASSPHRASE 

To SET or GET the WEP key index. SET should be done before initiating an association. The value should be set between 1 to 4. If user has given key index as 1, driver uses key at index 1 for upcoming association. If key is not present , then it will return error

M2MB_WLAN_GET_WEP_KEY_INDEX 

To SET or GET the {keyindex and key} pair for upcoming association. SET should be done before initiating the association. This is like setting a key for the given key index. This flag is used for getting the key at particular key index

M2MB_WLAN_GET_WEP_KEY_PAIR 

To SET the WPS credentials

M2MB_WLAN_GET_SCAN_TIME 

Enable or disable specific async event from driver

M2MB_WLAN_GET_IND 

Enable/disable MAC address filtering. Only for AP mode.

M2MB_WLAN_GET_MAC_FILTER 

add or remove MAC address to or from accept list

M2MB_WLAN_GET_MAC_ACCEPT 

add or remove MAC address to or from deny list

M2MB_WLAN_GET_MAC_DENY 

WLAN PDP context ID

◆ M2MB_WLAN_AP_SEC_TYPE_E

Enumerator
M2MB_WLAN_AP_SEC_TYPE_DISABLE 

Disable security

M2MB_WLAN_AP_SEC_TYPE_WPA1 

WPA1

M2MB_WLAN_AP_SEC_TYPE_WPA2 

WPA2

M2MB_WLAN_AP_SEC_TYPE_WPA1_WPA2 

WPA1+WPA2

M2MB_WLAN_AP_SEC_TYPE_WPA3 

WPA3

◆ M2MB_WLAN_AUTH_TYPE_E

Different authentication modes supported by WLAN.

Enumeration that identifies authentication modes supported by the WLAN subsystem. The application sets the required authentication from one of these modes using m2mb_wlan_set_param() with M2MB_WLAN_PARAM_AUTH_TYPE as the flag.

Note
This should be set before calling m2mb_wlan_connect or m2mb_wlan_create API
Enumerator
M2MB_WLAN_AUTH_TYPE_NONE 

Open mode authentication

M2MB_WLAN_AUTH_TYPE_WPA 

Wi-Fi protected Access v1

M2MB_WLAN_AUTH_TYPE_WPA2 

Wi-Fi protected Access v2

M2MB_WLAN_AUTH_TYPE_WPA_PSK 

Wi-Fi protected Access v1 PSK

M2MB_WLAN_AUTH_TYPE_WPA2_PSK 

Wi-Fi protected Access v2 PSK

M2MB_WLAN_AUTH_TYPE_WPA2_EAP 

Wi-Fi protected Access v2 Enterprise

M2MB_WLAN_AUTH_TYPE_WPA3 

Wi-Fi protected Access v3

M2MB_WLAN_AUTH_TYPE_WEP 

WEP mode authentication

◆ M2MB_WLAN_CON_EVENT_ID_E

WLAN connect event id.

Enumeration that indicates connect event type

Enumerator
M2MB_WLAN_CON_STA 

STA mode connect event

M2MB_WLAN_CON_AP 

AP mode connect event

M2MB_WLAN_CON_PEER 

peer station with a MAC address in mac_Addr has connected to SoftAP

◆ M2MB_WLAN_DEV_ID_E

WLAN device id or interface id.

Enumeration that provides a list of supported device id or interface id

Enumerator
M2MB_WLAN_DEV_0 

Device ID 0

M2MB_WLAN_DEV_1 

Device ID 1

M2MB_WLAN_DEV_2 

Device ID 2

M2MB_WLAN_DEV_3 

Device ID 3

M2MB_WLAN_DEV_MAX 

Device ID max

◆ M2MB_WLAN_ENCRYPT_TYPE_E

Different encryption modes supported by WLAN.

Enumeration that identifies encryption modes supported by the WLAN subsystem. The application sets the required encryption from one of these modes using m2mb_wlan_set_param() with M2MB_WLAN_PARAM_ENCRYPTION_TYPE as the flag.

Note
This should be set before calling m2mb_wlan_connect or m2mb_wlan_create API
Enumerator
M2MB_WLAN_ENCRYPT_TYPE_NONE 

No encryption

M2MB_WLAN_ENCRYPT_TYPE_WEP 

WEP encryption

M2MB_WLAN_ENCRYPT_TYPE_TKIP 

TKIP encryption

M2MB_WLAN_ENCRYPT_TYPE_AES 

CCMP/AES encryption

M2MB_WLAN_ENCRYPT_TYPE_TKIP_AES 

TKIP-AES/CCMP encryption

◆ M2MB_WLAN_IND_E

Events for an application registered CB functions.

WLAN driver invokes an application-registered callback function to indicate various asynchronous events to the application. This data structure enumerates the list of various event IDs for which the WLAN driver invokes the application-registered callback function.

Enumerator
M2MB_WLAN_SCAN_IND_CB 

ID to indicate scan result

M2MB_WLAN_SCAN_COMPLETE_CB 

ID to indicate scan complete

M2MB_WLAN_CONNECT_CB 

ID to indicate assoc complete [only for client connect in AP mode]

M2MB_WLAN_DISCONNECT_CB 

ID to indicate disconnect

M2MB_WLAN_PROFILE_PNO_CB 

ID for PNO event

M2MB_WLAN_EVENT_WPS_CB 

ID for WPS event

M2MB_WLAN_EVENT_PROMISCOUS_CB 

ID for PROMISC event

M2MB_WLAN_AP_CLIENT_IND_CB 

ID to indicate client info

M2MB_WLAN_AP_CLIENT_INFO_DONE_CB 

ID to indicate end of client info result

M2MB_WLAN_PING_IND_CB 

ID to indicate ping result

M2MB_WLAN_PING_COMPLETE_CB 

ID to indicate end of ping

M2MB_WLAN_CLIENT_STATE_IND_CB 

ID to indicate client connect state change indication

◆ M2MB_WLAN_MODE_E

WLAN interface operating modes.

Enumeration that provides a list of supported operating modes for each virtual device.

Enumerator
M2MB_WLAN_MODE_STATION 

Infrastructure non-AP Station mode, supported in both Single Device mode and Concurrent mode. When operating in Concurrent mode, virtual device 1 must be used for the Station mode of operation.

M2MB_WLAN_MODE_ACCESS_POINT 

Infrastructure AP Station mode, supported in both Single Device mode and Concurrent mode. When operating in Concurrent mode, virtual device 0 must be used for the AP mode of operation.

M2MB_WLAN_MODE_ADHOC 

Independent BSS mode of operation, supported in Single Device mode only. Virtual device 0 must be used for the IBSS mode of operation.

M2MB_WLAN_MODE_INVALID 

Invalid device mode.

◆ M2MB_WLAN_OP_MODE_E

WLAN module operating modes.

Enumeration that provides a list of supported operating modes

◆ M2MB_WLAN_RESPONSE_E

WLAN APIs response enum.

Enumerator
M2MB_WLAN_SUCCESS 

Response is success

M2MB_WLAN_ERROR_BAD_ARG 

Bad argument was passed by the user

M2MB_WLAN_ERROR_OUT_OF_BUFFER 

Out of buffer

M2MB_WLAN_ERROR_TIMEOUT 

Timeout occurred

M2MB_WLAN_ERROR_NETWORK 

Error in Network

M2MB_WLAN_ERROR_MEMORY 

Out of Memory

M2MB_WLAN_ERROR_CALLBACK 

Callback Error

M2MB_WLAN_ERROR_ASYNC_THREAD 

Error inAsync thread

M2MB_WLAN_ERROR_OP_NOT_ALLOWED 

Opertaion not allowed

M2MB_WLAN_ERROR_OP_FAILED 

Generic error

M2MB_WLAN_ERROR_NO_INTERNET 

No internet

M2MB_WLAN_ERROR_SUPPORN_AP_MODE 

Support only on AP mode

M2MB_WLAN_ERROR_SUPPORN_CLIENT_MODE 

Support only on STA mode

M2MB_WLAN_ERROR_DRIVER_FAIELD 

Could not load WLAN driver

M2MB_WLAN_ERROR_CONNECTION_FAILED 

connection failure

M2MB_WLAN_ERROR_OP_NOT_SUPPORTED 

feature not implemented

◆ M2MB_WLAN_SCAN_FORMAT_E

Scan result format.

Scan result can have one of the below format. Normal result is returned in standard message structure. raw result will be returned in char array buffer and raw format is used only for backward compatibilty.

Enumerator
M2MB_WLAN_SCAN_NORMAL 

Normal scan result

M2MB_WLAN_SCAN_IW_RAW 

Extended result in raw format

◆ M2MB_WLAN_SCAN_TYPE_E

Scan method.

A client can use two scanning methods: active and passive. During an active scan, the client radio transmits a probe request and listens for a probe response from an AP. With a passive scan, the client radio listens on each channel for beacons sent periodically by an AP. A passive scan generally takes more time, since the client must listen and wait for a beacon versus actively probing to find an AP

Enumerator
M2MB_WLAN_SCAN_ACTIVE 

Active scan

M2MB_WLAN_SCAN_PASSIVE 

Passive scan

◆ M2MB_WLAN_SECURITY_MODE_E

Enumerator
M2MB_WLAN_SECURITY_MODE_OPEN 

Security mode for open

M2MB_WLAN_SECURITY_MODE_WEP 

Security mode for WEP

M2MB_WLAN_SECURITY_MODE_WPA_PSK 

Security mode for WPA

M2MB_WLAN_SECURITY_MODE_WPA3_SAE 

Security mode for WPA

Function Documentation

◆ m2mb_wlan_ap_client_info_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_ap_client_info_get ( M2MB_WLAN_IF_HANDLE  ifh,
M2MB_WLAN_AP_CLIENT_MSG_T client_req 
)

This API is used to get client inofrmation in AP mode. m2mb_wlan_init, m2mb_wlan_interface_init and wlan_interface_start should call before calling m2mb_wlan_ap_client_info_get.

This function get the client information.

Blocking call: WLAN driver fill the user buffer with connected client information and result count. If number of connected clients is greater than application provided buffer then driver will fill only max available buffers ('max_cnt' entries).

Non-blocking call: User callback function gets the asynchronous event for client information. AP client info indication event is used by driver to send client info to application. Each indication may contain one or more client information which is informed using result count. At of the result is indicated via separate asynchronous event. Non-blocking method is useful if client list is large and application does not have enough memory.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]*client_reqRefer M2MB_WLAN_AP_CLIENT_MSG_T structure
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note
  1. Before calling m2mb_wlan_ap_client_info_get, m2mb_wlan_init and m2mb_wlan_interface_init should be called and should return successful.
  2. In case of non-blocking call m2mb_wlan_ap_client_info_get will return immediately and M2MB_WLAN_AP_CLIENT_INFO_DONE_CB will be indicated once all the client information is sent to application.

    M2MB_WLAN_AP_CLIENT_IND_CB will be generated for client result.

m2mb_wlan_ap_client_info_get( ifh, client_req);

void wlan_callback(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
switch(wlan_event)
{
{
M2MB_WLAN_AP_CLIENT_IND_T *client_ind_cb =
(M2MB_WLAN_AP_CLIENT_IND_T *)resp_struct;
int entries = 0, i = 0;
entries = client_ind_cb->no_of_entries;
for (i = 0; i < entries; i++)
{
//client_ind_cb->result_buff[i]
printf("client information \n");
}
}
break;
{
//end of ap client result
}
break;
}
}
#define DEMO_APP_MAX_CLIENT_BUF 16
M2MB_WLAN_AP_CLIENT_INFO_T resultBuffer[DEMO_APP_MAX_CLIENT_BUF];
int main()
{
M2MB_WLAN_HANDLE h;
struct myStruct myUserdata;
UINT8 *host_name = NULL;
UINT16 client_info_count=0;
M2MB_WLAN_IF_HANDLE ifh_ap;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_AP;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
retVal = m2mb_wlan_interface_init(&ifh_ap,h,device_id,wlan_callback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
//Blocking call example
memset(&client_req,0,sizeof(client_req));
client_req.blocking = 1 ; // blocking call
client_req.max_cnt = DEMO_APP_MAX_CLIENT_BUF;
client_req.result_cnt = &client_info_count;
client_req.result_buff = &resultBuffer[0];
retVal = m2mb_wlan_ap_client_info_get (ifh_ap, &client_req);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_ap_client_info_get failed");
return -1;
}
//Non-blocking call
memset(&client_req,0,sizeof(client_req));
client_req.blocking = 0 ; // non-blocking call
client_req.max_cnt = DEMO_APP_MAX_CLIENT_BUF;
client_req.result_cnt = &client_info_count;
client_req.result_buff = &resultBuffer[0];
retVal = m2mb_wlan_ap_client_info_get (ifh_sta, &client_req); //This call returns immediately
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_ap_client_info_get failed");
return -1;
}
// wait for client info indication events
// Note: M2MB_WLAN_AP_CLIENT_IND_CB will be generated by driver to send client info
// Note: client info events must be processed in user callback
// wait for M2MB_WLAN_AP_CLIENT_INFO_DONE_CB which indicates end of result
return 0;
}

◆ m2mb_wlan_bd_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_bd_get ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_BIN_ID_E  bin_id,
UINT32 *  bin_size 
)

Get status of the currently added wlan board data firmware file or otp file.

This API allows the user to read the sttaus of currently added firmware file. If it returns size as 0, it means there are no added wlan board data firmware file. If the size is lager than 0, it means there are added firmware file.

Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]bin_idBinary ID or binary index
[in]bin_sizeSize to write
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_bd_get(h, bin_id, bin_size):

int main()
{
M2MB_WLAN_HANDLE h;
INT8 *bin_buf;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
offset = 0;
//If file size is small then we can write in single chunk
eof_flag = 1;
//Get file size
bin_size = get_bin_size();
bin_buf = m2mb_os_malloc(bin_size);
// Get binary file data from user and store it in bin_buf[]
get_bin_file(bin_buf);
m2mb_wlan_bd_set(h,bin_id,bin_buf,bin_size,offset,eof_flag);
m2mb_wlan_bd_get(h,bin_id,&bin_size);
if(bin_size >0)
//added firmware file exist in the system
else
//there are no added wlan firmware file
return 0;
}


◆ m2mb_wlan_bd_set()

M2MB_WLAN_RESPONSE_E m2mb_wlan_bd_set ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_BIN_ID_E  bin_id,
INT8 *  bin_buf,
UINT32  bin_size,
UINT32  offset,
UINT8  eof_flag 
)

Add or update wlan custom bin file.

This API allows the user to allows to add or change the wlan board data firmware file or otp file.

Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]bin_idBinary ID or binary index
[in]bin_bufBuffer containing the file content
[in]bin_sizeSize to write
[in]offsetBinary offset
[in]eof_flagEnd of file flag which indicates its last chunk to write.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_bd_set(h, bin_id, bin_buf, bin_size, offset, eof_flag);

int main()
{
M2MB_WLAN_HANDLE h;
INT8 *bin_buf;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
offset = 0;
//If file size is small then we can write in single chunk
eof_flag = 1;
//Get file size
bin_size = get_bin_size();
bin_buf = m2mb_os_malloc(bin_size);
// Get binary file data from user and store it in bin_buf[]
get_bin_file(bin_buf);
m2mb_wlan_bd_set(h,bin_id,bin_buf,bin_size,offset,eof_flag);
return 0;
}


◆ m2mb_wlan_conf()

M2MB_WLAN_RESPONSE_E m2mb_wlan_conf ( M2MB_WLAN_IF_HANDLE  ifh,
UINT8  argc,
  ... 
)

m2mb_wlan_conf sets/gets some WLAN parameters.

m2mb_wlan_conf sets/gets WLAN parameters listed in the M2MB_WLAN_ACTION_E enum.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]argcIt determines the number of parameters that follows, plus one (e.g.: if two parameters follow, argc is 3)
[in]...It determines the action (among the ones listed in M2MB_WLAN_ACTION_E), while the parameters that follow depend on the action (see following note for further details)
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note
Action: M2MB_WLAN_SET_SSID

Description: set the SSID. If the device is in AP mode, this SSID will acts like SSID for the network. If the device is in STA mode, SSID will be the SSID of the network to which STA wants to connect

Params(in): ifh(M2MB_WLAN_IF_HANDLE), argc(UINT8), action(M2MB_WLAN_ACTION_E), dev_id(M2MB_WLAN_DEV_ID_E), ssid(M2MB_WLAN_SSID_T *)

  • example: set the SSID as "demoAP"

M2MB_WLAN_SSID_T ssid; m2mb_wlan_conf(ifh, 3, M2MB_WLAN_SET_SSID, &ssid);

Action: M2MB_WLAN_GET_SSID

Description: get the SSID.

Params(in): ifh(M2MB_WLAN_IF_HANDLE), argc(UINT8), action(M2MB_WLAN_ACTION_E), 
            ssid(M2MB_WLAN_SSID_T *)

- example: get SSID

M2MB_WLAN_SSID_T ssid;
m2mb_wlan_conf(ifh, 3, M2MB_WLAN_GET_SSID, &ssid);

Action: M2MB_WLAN_SET_IND
Description : To enable or disable specific async event indication

Params(in): h(M2MB_WLAN_IF_HANDLE), argc(UINT8), action(M2MB_WLAN_ACTION_E), 
                    indication, enable)
  • example: enable disconnect indication

    UINT8 enable_flag=1; M2MB_WLAN_IND_E ind = M2MB_WLAN_DISCONNECT_CB; m2mb_wlan_conf(ifh, 4, M2MB_WLAN_SET_IND, ind, enable_flag);

  • example: get current configuration of disconnect indication

    UINT8 enable_flag; M2MB_WLAN_IND_E ind = M2MB_WLAN_DISCONNECT_CB; m2mb_wlan_conf(ifh, 4, M2MB_WLAN_SET_IND, ind, &enable_flag); if(enable_flag == 1) enabled else disabled m2mb_wlan_conf(ifh, 4, M2MB_WLAN_SET_IND, ind, &enable_flag);

◆ m2mb_wlan_connect()

M2MB_WLAN_RESPONSE_E m2mb_wlan_connect ( M2MB_WLAN_IF_HANDLE  ifh,
UINT8 *  ssid 
)

This API is part of connect process in non-AP station mode.

This function scans for particular SSID given by user and try to connects to it.If SSID is set to a non-empty string before calling this API then it is considered as a connect request. Then, user callback gets called after connect event with status.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]ssidSSID of the particular Access Point to connect [mandatory]
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note
Before calling m2m_wlan_connect, m2mb_wlan_init, m2mb_wlan_interface_init and m2mb_wlan_interface_start should be called and should return successful. If user wants to connect to an secured network, then use m2mb_wlan_conf to configure parameters. Refer M2MB_WLAN_ACTION_E for setting secured parameters.

m2m_wlan_connect ( handle, ssid);

void wlan_callback(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
switch(wlan_event)
{
{//client connect event in AP mode
M2MB_CON_IND_T *con_ind =
(M2MB_CON_IND_T *)resp_struct;
//Process the connect event
}
break;
{
M2MB_DISCON_IND_T *con_ind =
(M2MB_DISCON_IND_T *)resp_struct;
//Process the disconnect event
}
break;
}
}
int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh_sta;
struct myStruct myUserdata;
UINT8 *ssid = "scan_ap";
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
retVal = m2mb_wlan_interface_init(&ifh_sta,h,device_id, wlan_callback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
retVal = m2mb_wlan_connect ( ifh_sta, ssid); //its blocking call. No call back to application
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_connect failed");
return -1;
}
return 0;
}

◆ m2mb_wlan_deinit()

M2MB_WLAN_RESPONSE_E m2mb_wlan_deinit ( M2MB_WLAN_HANDLE  h)

m2mb_wlan_deinit deinitializes WLAN service. It will shut down the wlan module.

m2mb_wlan_deinit deinitialize WLAN service for freeing the handle passed as first parameter. Calling the m2mb_wlan_deinit is useful after using the WLAN service in order to free memory space.

Parameters
[in]hfirst parameter is the handle to the WLAN service, that will be deinitialized by the function.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note

m2mb_wlan_deinit(&h);

M2MB_WLAN_HANDLE h;
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_init(&h);
//... use WLAN APIs ...
retVal = m2mb_wlan_deinit(h);
if ( retVal == M2MB_WLAN_SUCCESS )
printf( "m2mb_wlan_deinit succeeded");

◆ m2mb_wlan_disconnect()

M2MB_WLAN_RESPONSE_E m2mb_wlan_disconnect ( M2MB_WLAN_IF_HANDLE  ifh)

Disconnects a device from a network.

This API allows the user to disconnect a device, or abort the current connection process.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_disconnect(ifh);

int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh_sta;
struct myStruct myUserdata;
UINT8 *ssid = "scan_ap";
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_interface_init(&ifh_sta,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
retVal = m2mb_wlan_connect ( ifh_sta, ssid); //its blocking call
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_connect failed");
return -1;
}
retVal = m2mb_wlan_disconnect( ifh_sta ); //its blocking call
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_disconnect failed");
return -1;
}
return 0;
}


◆ m2mb_wlan_error_info_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_error_info_get ( M2MB_WLAN_IF_HANDLE  ifh,
M2MB_WLAN_ERROR_MSG_T err_msg 
)

Get WLAN last error.

This API allows the user to get last wlan error in detailed form. (string format)

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]*err_msgrefer M2MB_WLAN_ERROR_MSG_T structure
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_error_info_get(ifh,err_info);

#define DEMO_APP_ERR_INFO_MAX_SIZE 256
INT8 demo_app_err_buf[DEMO_APP_ERR_INFO_MAX_SIZE];
int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh_ap;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_AP;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
retVal = m2mb_wlan_interface_init(&ifh_ap,h,device_id,wlan_callback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
err_msg.max_size = DEMO_APP_ERR_INFO_MAX_SIZE;
err_msg.error_info = demo_app_err_buf;
retVal = m2mb_wlan_error_info_get(ifh,&err_msg);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_error_info_get failed");
return -1;
}
printf("WLAN Error Info : %s",err_msg.error_info);
return 0;
}


◆ m2mb_wlan_hostapd_get_sec_config()

M2MB_WLAN_RESPONSE_E m2mb_wlan_hostapd_get_sec_config ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_DEV_ID_E  device_id,
M2MB_WLAN_AP_SEC_TYPE_E sec_type,
M2MB_WLAN_SECURITY_MODE_E key_mgmt,
M2MB_WLAN_ENCRYPT_TYPE_E pairwise,
INT8 *  key 
)

Set Security Configuration in hostapd file.

API allows get security parameters configured for Access Point

Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]device_idUser should pass the mode using M2MB_WLAN_DEV_ID_E.
[in]*sec_typeRefer M2MB_WLAN_AP_SEC_TYPE_E Structure
[in]*key_mgmtRefer M2MB_WLAN_SECURITY_MODE_E Structure
[in]*pairwiseRefer M2MB_WLAN_ENCRYPT_TYPE_E Structure
[in]*keyLast parameter points to the pass-key that has to be updated.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_hostapd_get_sec_config(h,device_id,sec_type,sec_mode,enc_type,key);


◆ m2mb_wlan_hostapd_set()

M2MB_WLAN_RESPONSE_E m2mb_wlan_hostapd_set ( M2MB_WLAN_IF_HANDLE  ifh,
M2MB_WLAN_DEV_ID_E  dev_id,
INT8 *  conf_buf,
UINT32  conf_size 
)

Update hostapd.conf file.

This API allows the user to updated hostapd.conf file. Hostapd configuration file controls many options with regards to AP mode only.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]dev_idUser should pass the mode using M2MB_WLAN_DEV_ID_E
[in]conf_bufBuffer containing the hostapd configuration
[in]conf_sizeSize of hostapd configuration buffer
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_hostapd_set(ifh,conf_buf, conf_size);

int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh_ap;
struct myStruct myUserdata;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_AP;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_interface_init(&ifh_ap,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
m2mb_wlan_hostapd_set(ifh_ap,con_buf,conf_size);
return 0;
}


◆ m2mb_wlan_hostapd_set_sec_config()

M2MB_WLAN_RESPONSE_E m2mb_wlan_hostapd_set_sec_config ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_DEV_ID_E  device_id,
M2MB_WLAN_AP_SEC_TYPE_E  sec_type,
M2MB_WLAN_SECURITY_MODE_E  sec_mode,
M2MB_WLAN_ENCRYPT_TYPE_E  enc_type,
INT8 *  key 
)

Set Security Configuration in hostapd file.

API allows modification of security parameters for Access Point

Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]device_idUser should pass the mode using M2MB_WLAN_DEV_ID_E.
[in]sec_typeRefer M2MB_WLAN_AP_SEC_TYPE_E Structure
[in]sec_modeRefer M2MB_WLAN_SECURITY_MODE_E Structure
[in]enc_typeRefer M2MB_WLAN_ENCRYPT_TYPE_E Structure
[in]*keyLast parameter points to the pass-key that has to be updated.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_hostapd_set_sec_config(h,device_id,sec_type,sec_mode,enc_type,key);


◆ m2mb_wlan_init()

M2MB_WLAN_RESPONSE_E m2mb_wlan_init ( M2MB_WLAN_HANDLE *  h)

m2mb_wlan_init initializes WLAN service for current client

m2mb_wlan_init initialize WLAN module returning the handle that must be passed as first parameter for m2mb_wlan_interface_init function. Calling the m2mb_wlan_init is mandatory before using the WLAN service.

Parameters
[in]*hfirst parameter is the handle to the WLAN service, that will be initialized by the function.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note

m2mb_wlan_init(&h);

int main()
{
M2MB_WLAN_HANDLE h;
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_init(&h);
if ( retVal == M2MB_WLAN_SUCCESS )
printf( "m2mb_wlan_init succeeded");
}

◆ m2mb_wlan_interface_deinit()

M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_deinit ( M2MB_WLAN_IF_HANDLE  ifh)

Removes the interface from the WLAN driver.

This API used to remove the device id or interface from the WLAN driver. But, this API does not disable the WLAN module

Parameters
[in]ifhfirst parameter is the handle to the WLAN interface handle
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_interface_deinit(ifh);

void myCallback(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
//my code
}
int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh;
struct myStruct myUserdata;
M2MB_WLAN_DEV_ID_E device_id;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_interface_init(&ifh,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
retVal = m2mb_wlan_interface_stop(ifh);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_stop failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
return -1;
}
return 0;
}

◆ m2mb_wlan_interface_init()

M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_init ( M2MB_WLAN_IF_HANDLE *  ifh,
M2MB_WLAN_HANDLE  h,
M2MB_WLAN_DEV_ID_E  device_id,
m2mb_wlan_ind_callback  callback,
void *  userdata 
)

WLAN Interface Initialization.

This API initializes the interface for a given device id. Since, m2mb_wlan_init is the dependency for this API, so m2mb_wlan_init should be called before calling the m2m_wlan_interface_init.

Parameters
[in]*ifhFirst parameter is the handle to the WLAN interface handle, that will be initialized by the function.
[in]hSecond parameter is the handle to the WLAN service
[in]device_idUser should pass the mode using M2MB_WLAN_DEV_ID_E.
[in]callbackcallback that will be called if an event or a response happens.
[in]userdatapointer to generic user data that will be returned as it is in the callback.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note
m2mb_wlan_init function should be called properly before calling m2mb_wlan_interface_init

m2mb_wlan_interface_init(M2MB_WLAN_IF_HANDLE &ifh, M2MB_WLAN_HANDLE h, M2MB_WLAN_DEV_ID_E device_id);

void myCallback(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
//my code
}
int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh;
struct myStruct myUserdata;
M2MB_WLAN_DEV_ID_E device_id;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_interface_init(&ifh,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
return 0;
}

◆ m2mb_wlan_interface_start()

M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_start ( M2MB_WLAN_IF_HANDLE  ifh,
M2MB_WLAN_MODE_E  mode 
)

WLAN Interface bring up or start.

This API brings up the interface depend on the mode given by the user. Since, m2mb_wlan_init and m2mb_wlan_interface_init is the dependency for this API, so m2mb_wlan_init and m2mb_wlan_interface_init should be called before calling the m2m_wlan_interface_start.

Parameters
[in]ifhfirst parameter is the handle to the WLAN interface handle
[in]modeUser should pass the mode using M2MB_WLAN_MODE_E.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note
m2mb_wlan_init and m2mb_wlan_interface_init function should be called properly before calling m2mb_wlan_interface_start function

m2mb_wlan_interface_start(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_MODE_E mode);

void myCallback(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
//my code
}
int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh;
struct myStruct myUserdata;
M2MB_WLAN_DEV_ID_E device_id;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_interface_init(&ifh,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
return 0;
}

◆ m2mb_wlan_interface_status_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_status_get ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_DEV_ID_E  if_id,
int *  if_status 
)

Get the status of WLAN Interface.

API allows user to get the status of WLAN interface.

Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]if_idUser should pass the mode using M2MB_WLAN_DEV_ID_E.
[in]*if_statusPointer to read the interface status.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error. m2mb_wlan_interface_status_get(h,if_id,if_status);


◆ m2mb_wlan_interface_stop()

M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_stop ( M2MB_WLAN_IF_HANDLE  ifh)

WLAN Interface bring down or stop.

This API brings down the interface.

Parameters
[in]ifhfirst parameter is the handle to the WLAN interface
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note
m2mb_wlan_interface_start function should be called properly before calling m2mb_wlan_interface_stop function

m2mb_wlan_interface_stop(ifh );

void myCallback(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
//my code
}
int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh;
struct myStruct myUserdata;
M2MB_WLAN_DEV_ID_E device_id;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_interface_init(&ifh,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
retVal = m2mb_wlan_interface_stop(ifh);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_stop failed");
return -1;
}
return 0;
}

◆ m2mb_wlan_le910cx_cfg_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_cfg_get ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_CONFIG_LEGACY_T cfg_legacy 
)
Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]*cfg_legacyRefer M2MB_WLAN_CONFIG_LEGACY_T Structure
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error. m2mb_wlan_le910cx_cfg_get(h,cfg_legacy);


◆ m2mb_wlan_le910cx_cfg_set()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_cfg_set ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_CONFIG_LEGACY_T cfg_legacy 
)
Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]*cfg_legacyRefer M2MB_WLAN_CONFIG_LEGACY_T Structure
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error. m2mb_wlan_le910cx_cfg_set(h,cfg_legacy);


◆ m2mb_wlan_le910cx_clock_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_clock_get ( M2MB_WLAN_HANDLE  wlan_hdl,
int *  clock_val 
)
Parameters
[in]wlan_hdlHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]clock_valParameter to get WLAN SDIO Clock setting
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error. m2mb_wlan_le910cx_clock_get(wlan_hdl,clock_val);


◆ m2mb_wlan_le910cx_clock_set()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_clock_set ( M2MB_WLAN_HANDLE  wlan_hdl,
int  clock_val 
)
Parameters
[in]wlan_hdlHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]clock_valParameter sets WLAN SDIO Clock setting 1 - 400khz 2 - 20Mhz 3 - 25Mhz 4 - 50Mhz 5 - 100Mhz 6 - 200Mhz (default)
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error. m2mb_wlan_le910cx_clock_set(wlan_hdl,clock_val);


◆ m2mb_wlan_le910cx_con_info_get()

int m2mb_wlan_le910cx_con_info_get ( M2MB_WLAN_IF_HANDLE  ifh,
M2MB_WLAN_CON_INFO_T pConInfo 
)

Device Information.

This API is used to get the device information in the scan.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]*pConInfoRefer M2MB_WLAN_CON_INFO_T Structure
Returns
returns 0 on success, a different value on error.

m2mb_wlan_le910cx_con_info_get(ifh, pConInfo);


◆ m2mb_wlan_le910cx_dfs_set()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_dfs_set ( M2MB_WLAN_HANDLE  wlan_hdl,
int  dfs_enable 
)

Dynamic Frequency Selection Master enable or disable.

This API allows the user to enable or disable the DFS Master.

Parameters
[in]wlan_hdlHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]dfs_enableFlag indicates dfs master enable or disable . 1- Enable, 0- Disable
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error. m2mb_wlan_le910cx_dfs_set(g_wlan_hdl,dfs_enable);


◆ m2mb_wlan_le910cx_driver_cfg_restore()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_driver_cfg_restore ( M2MB_WLAN_HANDLE  wlan_hdl,
int  dfs_master_flag 
)

Restore driver config.

This API allows user to restore the driver configuration from the backup configuration file

Parameters
[in]wlan_hdlHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]dfs_master_flagFlag indicates dfs master enable or disable . 1- Enable, 0- Disable
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_le910cx_driver_cfg_restore(wlan_hdl, dfs_master_en);

◆ m2mb_wlan_le910cx_is_connected()

bool m2mb_wlan_le910cx_is_connected ( M2MB_WLAN_IF_HANDLE  ifh)

Check if WLAN is already enabled.

This API used to check if WLAN is already enabled.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
Returns
returns TRUE on success, FALSE on error.

m2mb_wlan_le910cx_is_connected(ifh);

int main()
{
M2MB_WLAN_IF_HANDLE ifh;
ifh = m2m_wlan_sta_interface_hld_get();
if(ifh == NULL)
return false;
}

◆ m2mb_wlan_le910cx_module_select()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_module_select ( M2MB_WLAN_HANDLE  wlan_hdl,
int  module_id 
)

Select WE866Cx module.

API allows user to select the module in LE910Cx. i.e, either WE866C3 or WE866C6

Parameters
[in]wlan_hdlHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]module_idParameter allows user to set the module id. 0- WE866C3, 1- WE866C6
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_le910cx_module_select(wlan_hdl,module_id);

static M2MB_WLAN_HANDLE g_wlan_hdl;
int main()
{
module_id = 0; //0- WE866C3, 1- We866C6
m2mb_wlan_le910cx_module_select(g_wlan_hdl,module_id);
}


◆ m2mb_wlan_le910cx_start_state_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_start_state_get ( M2MB_WLAN_HANDLE  wlan_hdl,
int *  wlan_start_state 
)

Check WLAN start state.

This API allows user to check the status of WLAN start command

Parameters
[in]wlan_hdlHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]*wlan_start_stateParameter indicates the status of WLAN start
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_le910cx_start_state_get(wlan_hdl,wlan_start_state);

int main()
{
M2MB_WLAN_PVT_CONTEXT_T *wlan_hdl = (M2MB_WLAN_PVT_CONTEXT_T *)h;
int wlan_start_state;
int *if_status
if( M2MB_WLAN_SUCCESS == m2mb_wlan_le910cx_start_state_get(wlan_hdl,&wlan_start_state ))
{
if((M2MB_WLAN_START_STATUS_E)wlan_start_state == M2MB_WLAN_START_STATUS_OFF)
{
*if_status = 1;
}
}
}

◆ m2mb_wlan_mode_get()

M2MB_WLAN_RESPONSE_E m2mb_wlan_mode_get ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_OP_MODE_E mode 
)

Get WLAN operating mode.

This API allows the user to get operational mode

Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]modeOperating mode of WLAN module
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_mode_get(h,op_mode);

int main()
{
M2MB_WLAN_HANDLE h;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_get(h,&op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode_get failed");
return -1;
}
if(op_mode == M2MB_WLAN_OP_MODE_STA)
{
//Single mode with station interface
}else
if(op_mode == M2MB_WLAN_OP_MODE_AP)
{
//Single mode with AP interface
}else
if(op_mode == M2MB_WLAN_OP_MODE_AP_STA)
{
//Concurrent mode with AP plus station interface
}else
if(op_mode == M2MB_WLAN_OP_MODE_AP_AP)
{
//Concurrent mode with AP plus AP interface
}
return 0;
}


◆ m2mb_wlan_mode_set()

M2MB_WLAN_RESPONSE_E m2mb_wlan_mode_set ( M2MB_WLAN_HANDLE  h,
M2MB_WLAN_OP_MODE_E  mode 
)

Configure WLAN mode.

This API allows the user to configure operational mode as STA, AP, AP_AP or AP_STA

Parameters
[in]hHandle to the WLAN module, previously initialized by the m2mb_wlan_init function.
[in]modeOperating mode of WLAN module [mandatory]
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_mode(h,op_mode);

int main()
{
M2MB_WLAN_HANDLE h;
M2MB_WLAN_IF_HANDLE ifh_ap;
M2MB_WLAN_IF_HANDLE ifh_sta;
struct myStruct myUserdata;
UINT8 *ssid = "scan_ap";
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_AP_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
device_id = M2MB_WLAN_DEV_0;
retVal = m2mb_wlan_interface_init(&ifh_ap,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
device_id = M2MB_WLAN_DEV_1;
retVal = m2mb_wlan_interface_init(&ifh_sta,h,device_id, myCallback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
return 0;
}


◆ m2mb_wlan_ping_req()

M2MB_WLAN_RESPONSE_E m2mb_wlan_ping_req ( M2MB_WLAN_IF_HANDLE  ifh,
char *  addrstr,
INT32  retry_count,
INT32  pkt_size,
INT32  timeout,
INT32  ttl 
)
Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]*addrstr
[in]retry_countParameter defines the number of Ping Echo Request to send.
[in]pkt_sizeParameter defines the lenght of Ping Echo Request message
[in]timeoutParameter defines the timeout, in 100 ms units, waiting a single Echo Reply
[in]ttlParameter defines time to live
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_ping_req(ifh,addrstr,retry_count,pkt_size,timeout,ttl);


◆ m2mb_wlan_scan()

M2MB_WLAN_RESPONSE_E m2mb_wlan_scan ( M2MB_WLAN_IF_HANDLE  ifh,
M2MB_WLAN_SCAN_MSG_T scan_req 
)

This API is used to initiate a wireless scan to find nearby access points m2mb_wlan_init, m2mb_wlan_interface_init and wlan_interface_start should call before calling m2mb_wlan_scan.

This function does the wireless scan depending on the parameters passed by the user. Blocking call: WLAN driver fill the user buffer with the most recent scan results and result count. Non-blocking call: User callback function gets the asynchronous event for scan indication and scan complete. Scan indication event is used by driver to send scan results to application. Each scan indication may contain one or more scan results which is informed using result count. Once scan is completed driver indicates this to application via separate asynchronous event.

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
[in]scan_reqRefer M2MB_WLAN_SCAN_MSG_T structure
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.
Note
  1. Before calling m2mb_wlan_scan, m2mb_wlan_init and m2mb_wlan_interface_init should be called and should return successful.
  2. In case of blocking call m2mb_wlan_scan will return, if a) time-out occurs or b) no of scan result exceeded the max_scan_entries or c) all channels are scanned
  3. In case of non-blocking call m2mb_wlan_scan will return immediately and M2MB_WLAN_SCAN_COMPLETE_CB will be indicated if, a) time-out occurs or b) all channels are scanned

    M2MB_WLAN_SCAN_IND_CB will be generated for scan entry.

m2m_wlan_scan( ifh, scan_req);

void wlan_callback(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_IND_E wlan_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
switch(wlan_event)
{
{
M2MB_WLAN_SCAN_IND_T *scan_ind_cb =
(M2MB_WLAN_SCAN_IND_T *)resp_struct;
int entries = 0, i = 0;
entries = scan_ind_cb->no_of_entries;
for (i = 0; i < entries; i++)
{
//scan_ind_cb->result_buff[i]
printf("scan results\n");
}
}
break;
{
//end of scan operation
}
break;
}
}
#define DEMO_APP_MAX_SCAN_BUF 16
M2MB_WLAN_BSS_SCAN_INFO_T resultBuffer[DEMO_APP_MAX_SCAN_BUF];
int main()
{
M2MB_WLAN_HANDLE h;
struct myStruct myUserdata;
UINT8 channel_list[3] = {1, 6, 11};
UINT8 *ssid = NULL;
UINT16 scan_entry_count=0;
M2MB_WLAN_IF_HANDLE ifh_sta;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
retVal = m2mb_wlan_interface_init(&ifh_sta,h,device_id,wlan_callback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
//Blocking call example
memset(&scan_req,0,sizeof(scan_req));
scan_req.scan_type = M2MB_WLAN_SCAN_ACTIVE;
scan_req.no_of_channels = 3;
scan_req.channel_list = &channel_list[0];
scan_req.time_out = 5000; // 5 seconds
scan_req.blocking = 1 ; // blocking call
scan_req.max_scan_entries = DEMO_APP_MAX_SCAN_BUF;
scan_req.no_of_scan_entries = &scan_entry_count;
scan_req.result_buff = &resultBuffer[0];
retVal = m2mb_wlan_scan (ifh_sta, &scan_req);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_scan failed");
return -1;
}
//Non-blocking call
memset(&scan_req,0,sizeof(scan_req));
scan_req.scan_type = M2MB_WLAN_SCAN_ACTIVE;
scan_req.time_out = 10000; // 10 seconds
scan_req.blocking = 0 ; // non-blocking call
scan_req.max_scan_entries = DEMO_APP_MAX_SCAN_BUF;
scan_req.result_buff = &resultBuffer[0];
retVal = m2mb_wlan_scan (ifh_sta, &scan_req); //This call returns immediately
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_scan failed");
return -1;
}
// wait for scan indication events
// Note: M2MB_WLAN_SCAN_IND_CB will be generated by driver to send scant result to application
// Note: scan events must be processed in user callback
// wait for M2MB_WLAN_SCAN_COMPLETE_CB which indicates end of scan operation
return 0;
}

◆ m2mb_wlan_scan_abort()

M2MB_WLAN_RESPONSE_E m2mb_wlan_scan_abort ( M2MB_WLAN_IF_HANDLE  ifh)

Abort the current scan operation.

This API allows the user to abort or stop the non-blcking scan operation which is started using wlan_scan

Parameters
[in]ifhHandle to the WLAN interface, previously initialized by the m2mb_wlan_interface_init function.
Returns
returns M2MB_WLAN_SUCCESS on success, a different value on error.

m2mb_wlan_scan_abort(ifh);

#define DEMO_APP_MAX_SCAN_BUF 16
M2MB_WLAN_BSS_SCAN_INFO_T resultBuffer[DEMO_APP_MAX_SCAN_BUF];
int main()
{
M2MB_WLAN_HANDLE h;
struct myStruct myUserdata;
UINT8 channel_list[3] = {1, 6, 11};
UINT8 *ssid = NULL;
UINT16 scan_entry_count=0;
M2MB_WLAN_IF_HANDLE ifh_sta;
M2MB_WLAN_OP_MODE_E op_mode = M2MB_WLAN_OP_MODE_STA;
retVal = m2mb_wlan_init(&h);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_init failed");
return -1;
}
retVal = m2mb_wlan_mode_set(h,op_mode);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_mode failed");
return -1;
}
retVal = m2mb_wlan_interface_init(&ifh_sta,h,device_id,wlan_callback, (void*)myUserdata);
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_init failed");
return -1;
}
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_interface_start failed");
return -1;
}
//Non-blocking call
memset(&scan_req,0,sizeof(scan_req));
scan_req.scan_type = M2MB_WLAN_SCAN_ACTIVE;
scan_req.result_format = scan_format;
scan_req.time_out = 10000; // 10 seconds
scan_req.blocking = 0 ; // non-blocking call
scan_req.max_scan_entries = DEMO_APP_MAX_SCAN_BUF;
scan_req.result_buff = &resultBuffer[0];
retVal = m2mb_wlan_scan (ifh_sta, &scan_req); //This call returns immediately
if ( retVal != M2MB_WLAN_SUCCESS )
{
printf( "m2mb_wlan_scan failed");
return -1;
}
// wait for scan indication events
// Note: M2MB_WLAN_SCAN_IND_CB will be generated by driver to send scant
// result to application
// Note: abort can be called before recieving M2MB_WLAN_SCAN_COMPLETE_CB event
return 0;
}


m2mb_wlan_interface_init
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_init(M2MB_WLAN_IF_HANDLE *ifh, M2MB_WLAN_HANDLE h, M2MB_WLAN_DEV_ID_E device_id, m2mb_wlan_ind_callback callback, void *userdata)
WLAN Interface Initialization.
M2MB_WLAN_AP_CLIENT_MSG_S
AP client info request.
Definition: m2mb_wlan.h:763
m2mb_wlan_hostapd_set
M2MB_WLAN_RESPONSE_E m2mb_wlan_hostapd_set(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_DEV_ID_E dev_id, INT8 *conf_buf, UINT32 conf_size)
Update hostapd.conf file.
m2mb_wlan_scan
M2MB_WLAN_RESPONSE_E m2mb_wlan_scan(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_SCAN_MSG_T *scan_req)
This API is used to initiate a wireless scan to find nearby access points m2mb_wlan_init,...
M2MB_WLAN_CONNECT_CB
Definition: m2mb_wlan.h:244
M2MB_WLAN_AP_CLIENT_INFO_S
AP client info.
Definition: m2mb_wlan.h:735
M2MB_WLAN_RESPONSE_E
M2MB_WLAN_RESPONSE_E
WLAN APIs response enum.
Definition: m2mb_wlan.h:164
m2mb_wlan_interface_start
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_start(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_MODE_E mode)
WLAN Interface bring up or start.
M2MB_WLAN_AP_CLIENT_INFO_DONE_CB
Definition: m2mb_wlan.h:250
m2mb_wlan_mode_set
M2MB_WLAN_RESPONSE_E m2mb_wlan_mode_set(M2MB_WLAN_HANDLE h, M2MB_WLAN_OP_MODE_E mode)
Configure WLAN mode.
m2mb_wlan_mode_get
M2MB_WLAN_RESPONSE_E m2mb_wlan_mode_get(M2MB_WLAN_HANDLE h, M2MB_WLAN_OP_MODE_E *mode)
Get WLAN operating mode.
m2mb_wlan_interface_deinit
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_deinit(M2MB_WLAN_IF_HANDLE ifh)
Removes the interface from the WLAN driver.
M2MB_WLAN_AP_CLIENT_IND_CB
Definition: m2mb_wlan.h:249
m2mb_wlan_ap_client_info_get
M2MB_WLAN_RESPONSE_E m2mb_wlan_ap_client_info_get(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_AP_CLIENT_MSG_T *client_req)
This API is used to get client inofrmation in AP mode. m2mb_wlan_init, m2mb_wlan_interface_init and w...
M2MB_WLAN_BSS_SCAN_INFO_S
Structure of members for scan results.
Definition: m2mb_wlan.h:628
m2mb_wlan_error_info_get
M2MB_WLAN_RESPONSE_E m2mb_wlan_error_info_get(M2MB_WLAN_IF_HANDLE ifh, M2MB_WLAN_ERROR_MSG_T *err_msg)
Get WLAN last error.
m2mb_wlan_bd_get
M2MB_WLAN_RESPONSE_E m2mb_wlan_bd_get(M2MB_WLAN_HANDLE h, M2MB_WLAN_BIN_ID_E bin_id, UINT32 *bin_size)
Get status of the currently added wlan board data firmware file or otp file.
M2MB_WLAN_ERROR_MSG_S
WLAN error info request.
Definition: m2mb_wlan.h:814
M2MB_WLAN_SCAN_TYPE_E
M2MB_WLAN_SCAN_TYPE_E
Scan method.
Definition: m2mb_wlan.h:269
m2mb_wlan_disconnect
M2MB_WLAN_RESPONSE_E m2mb_wlan_disconnect(M2MB_WLAN_IF_HANDLE ifh)
Disconnects a device from a network.
m2mb_wlan_connect
M2MB_WLAN_RESPONSE_E m2mb_wlan_connect(M2MB_WLAN_IF_HANDLE ifh, UINT8 *ssid)
This API is part of connect process in non-AP station mode.
m2mb_os_malloc
void * m2mb_os_malloc(UINT32 size)
Allocates bytes of memory.
M2MB_WLAN_AP_CLIENT_IND_S
Client info indication.
Definition: m2mb_wlan.h:785
M2MB_WLAN_SCAN_FORMAT_E
M2MB_WLAN_SCAN_FORMAT_E
Scan result format.
Definition: m2mb_wlan.h:283
M2MB_WLAN_SCAN_IND_CB
Definition: m2mb_wlan.h:242
M2MB_WLAN_DEV_0
Definition: m2mb_wlan.h:335
m2mb_wlan_deinit
M2MB_WLAN_RESPONSE_E m2mb_wlan_deinit(M2MB_WLAN_HANDLE h)
m2mb_wlan_deinit deinitializes WLAN service. It will shut down the wlan module.
m2mb_wlan_interface_stop
M2MB_WLAN_RESPONSE_E m2mb_wlan_interface_stop(M2MB_WLAN_IF_HANDLE ifh)
WLAN Interface bring down or stop.
M2MB_CON_IND_S
Connection event info for both AP and STA modes.
Definition: m2mb_wlan.h:673
M2MB_WLAN_OP_MODE_E
M2MB_WLAN_OP_MODE_E
WLAN module operating modes.
Definition: m2mb_wlan.h:294
M2MB_WLAN_SUCCESS
Definition: m2mb_wlan.h:166
M2MB_WLAN_IND_E
M2MB_WLAN_IND_E
Events for an application registered CB functions.
Definition: m2mb_wlan.h:240
M2MB_WLAN_DEV_1
Definition: m2mb_wlan.h:336
M2MB_WLAN_SCAN_NORMAL
Definition: m2mb_wlan.h:285
m2mb_wlan_le910cx_is_connected
bool m2mb_wlan_le910cx_is_connected(M2MB_WLAN_IF_HANDLE ifh)
Check if WLAN is already enabled.
M2MB_WLAN_DEV_ID_E
M2MB_WLAN_DEV_ID_E
WLAN device id or interface id.
Definition: m2mb_wlan.h:333
M2MB_WLAN_SCAN_ACTIVE
Definition: m2mb_wlan.h:271
M2MB_WLAN_DISCONNECT_CB
Definition: m2mb_wlan.h:245
M2MB_WLAN_SCAN_IND_S
Scan indication.
Definition: m2mb_wlan.h:656
M2MB_WLAN_SCAN_MSG_S
Scan request.
Definition: m2mb_wlan.h:598
M2MB_WLAN_MODE_STATION
Definition: m2mb_wlan.h:311
m2mb_wlan_bd_set
M2MB_WLAN_RESPONSE_E m2mb_wlan_bd_set(M2MB_WLAN_HANDLE h, M2MB_WLAN_BIN_ID_E bin_id, INT8 *bin_buf, UINT32 bin_size, UINT32 offset, UINT8 eof_flag)
Add or update wlan custom bin file.
M2MB_DISCON_IND_S
Disconnection event info for both AP and STA modes.
Definition: m2mb_wlan.h:705
M2MB_WLAN_MODE_ACCESS_POINT
Definition: m2mb_wlan.h:316
M2MB_WLAN_SCAN_COMPLETE_CB
Definition: m2mb_wlan.h:243
m2mb_wlan_le910cx_module_select
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_module_select(M2MB_WLAN_HANDLE wlan_hdl, int module_id)
Select WE866Cx module.
m2mb_wlan_le910cx_start_state_get
M2MB_WLAN_RESPONSE_E m2mb_wlan_le910cx_start_state_get(M2MB_WLAN_HANDLE wlan_hdl, int *wlan_start_state)
Check WLAN start state.
m2mb_wlan_init
M2MB_WLAN_RESPONSE_E m2mb_wlan_init(M2MB_WLAN_HANDLE *h)
m2mb_wlan_init initializes WLAN service for current client
m2mb_wlan_scan_abort
M2MB_WLAN_RESPONSE_E m2mb_wlan_scan_abort(M2MB_WLAN_IF_HANDLE ifh)
Abort the current scan operation.