Infineon Logo Wi-Fi Host Driver (WHD) Public API Reference Guide
 
WHD Wi-Fi Join, Scan and Halt API

General Description

Wi-Fi APIs for join, scan & leave.

Typedefs

typedef void(* whd_scan_result_callback_t) (whd_scan_result_t **result_ptr, void *user_data, whd_scan_status_t status)
 Scan result callback function pointer type. More...
 
typedef void(* whd_auth_result_callback_t) (void *result_ptr, uint32_t len, whd_auth_status_t status, uint8_t *flag, void *user_data)
 Auth result callback function pointer type. More...
 

Functions

whd_result_t whd_wifi_scan_synch (whd_interface_t ifp, whd_sync_scan_result_t *scan_result, uint32_t *count)
 Initiates a scan to search for 802.11 networks. More...
 
whd_result_t whd_wifi_scan (whd_interface_t ifp, whd_scan_type_t scan_type, whd_bss_type_t bss_type, const whd_ssid_t *optional_ssid, const whd_mac_t *optional_mac, const uint16_t *optional_channel_list, const whd_scan_extended_params_t *optional_extended_params, whd_scan_result_callback_t callback, whd_scan_result_t *result_ptr, void *user_data)
 Initiates a scan to search for 802.11 networks. More...
 
whd_result_t whd_wifi_stop_scan (whd_interface_t ifp)
 Abort a previously issued scan. More...
 
whd_result_t whd_wifi_external_auth_request (whd_interface_t ifp, whd_auth_result_callback_t callback, void *result_ptr, void *user_data)
 Initiates SAE auth. More...
 
whd_result_t whd_wifi_stop_external_auth_request (whd_interface_t ifp)
 Abort authentication request. More...
 
whd_result_t whd_wifi_join (whd_interface_t ifp, const whd_ssid_t *ssid, whd_security_t auth_type, const uint8_t *security_key, uint8_t key_length)
 Joins a Wi-Fi network. More...
 
whd_result_t whd_wifi_join_specific (whd_interface_t ifp, const whd_scan_result_t *ap, const uint8_t *security_key, uint8_t key_length)
 Joins a specific Wi-Fi network. More...
 
whd_result_t whd_wifi_set_chanspec (whd_interface_t ifp, wl_chanspec_t chanspec)
 Set the current chanspec on the WLAN radio. More...
 
whd_result_t whd_wifi_leave (whd_interface_t ifp)
 Disassociates from a Wi-Fi network. More...
 

Typedef Documentation

◆ whd_scan_result_callback_t

typedef void(* whd_scan_result_callback_t) (whd_scan_result_t **result_ptr, void *user_data, whd_scan_status_t status)

Scan result callback function pointer type.

Parameters
result_ptrA pointer to the pointer that indicates where to put the next scan result
user_dataUser provided data
statusStatus of scan process

◆ whd_auth_result_callback_t

typedef void(* whd_auth_result_callback_t) (void *result_ptr, uint32_t len, whd_auth_status_t status, uint8_t *flag, void *user_data)

Auth result callback function pointer type.

Parameters
result_ptrA pointer to the pointer that indicates where to put the auth result
lenthe size of result
statusStatus of auth process
flagflag of h2e will be indicated in auth request event, otherwise is NULL.
user_datauser specific data that will be passed directly to the callback function

Function Documentation

◆ whd_wifi_scan_synch()

whd_result_t whd_wifi_scan_synch ( whd_interface_t  ifp,
whd_sync_scan_result_t scan_result,
uint32_t *  count 
)

Initiates a scan to search for 802.11 networks.

This functions returns the scan results with limited sets of parameter in a buffer provided by the caller. It is also a blocking call. It is an simplified version of the whd_wifi_scan().

Parameters
ifpPointer to handle instance of whd interface
scan_resultPointer to user requested records buffer.
countPointer to the no of records user is interested in, and also to the no of record received.
Note
When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
Returns
WHD_SUCCESS or Error code

◆ whd_wifi_scan()

whd_result_t whd_wifi_scan ( whd_interface_t  ifp,
whd_scan_type_t  scan_type,
whd_bss_type_t  bss_type,
const whd_ssid_t optional_ssid,
const whd_mac_t optional_mac,
const uint16_t *  optional_channel_list,
const whd_scan_extended_params_t optional_extended_params,
whd_scan_result_callback_t  callback,
whd_scan_result_t result_ptr,
void *  user_data 
)

Initiates a scan to search for 802.11 networks.

The scan progressively accumulates results over time, and may take between 1 and 10 seconds to complete. The results of the scan will be individually provided to the callback function. Note: The callback function will be executed in the context of the WHD thread and so must not perform any actions that may cause a bus transaction.

Parameters
ifpPointer to handle instance of whd interface
scan_typeSpecifies whether the scan should be Active, Passive or scan Prohibited channels
bss_typeSpecifies whether the scan should search for Infrastructure networks (those using an Access Point), Ad-hoc networks, or both types.
optional_ssidIf this is non-Null, then the scan will only search for networks using the specified SSID.
optional_macIf this is non-Null, then the scan will only search for networks where the BSSID (MAC address of the Access Point) matches the specified MAC address.
optional_channel_listIf this is non-Null, then the scan will only search for networks on the specified channels - array of channel numbers to search, terminated with a zero
optional_extended_paramsIf this is non-Null, then the scan will obey the specifications about dwell times and number of probes.
callbackThe callback function which will receive and process the result data.
result_ptrPointer to a pointer to a result storage structure.
user_datauser specific data that will be passed directly to the callback function
Note
- When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
  • Callback must not use blocking functions, nor use WHD functions, since it is called from the context of the WHD thread.
  • The callback, result_ptr and user_data variables will be referenced after the function returns. Those variables must remain valid until the scan is complete.
Returns
WHD_SUCCESS or Error code

◆ whd_wifi_stop_scan()

whd_result_t whd_wifi_stop_scan ( whd_interface_t  ifp)

Abort a previously issued scan.

Parameters
ifpPointer to handle instance of whd interface
Returns
WHD_SUCCESS or Error code

◆ whd_wifi_external_auth_request()

whd_result_t whd_wifi_external_auth_request ( whd_interface_t  ifp,
whd_auth_result_callback_t  callback,
void *  result_ptr,
void *  user_data 
)

Initiates SAE auth.

The results of the auth will be individually provided to the callback function. Note: The callback function will be executed in the context of the WHD thread and so must not perform any actions that may cause a bus transaction.

Parameters
ifpPointer to handle instance of whd interface
callbackThe callback function which will receive and process the result data.
result_ptrPointer to a pointer to a result storage structure.
user_datauser specific data that will be passed directly to the callback function
Note
- Callback must not use blocking functions, nor use WHD functions, since it is called from the context of the WHD thread.
  • The callback, result_ptr and user_data variables will be referenced after the function returns. Those variables must remain valid until the scan is complete.
Returns
WHD_SUCCESS or Error code

◆ whd_wifi_stop_external_auth_request()

whd_result_t whd_wifi_stop_external_auth_request ( whd_interface_t  ifp)

Abort authentication request.

Parameters
ifpPointer to handle instance of whd interface
Returns
WHD_SUCCESS or Error code

◆ whd_wifi_join()

whd_result_t whd_wifi_join ( whd_interface_t  ifp,
const whd_ssid_t ssid,
whd_security_t  auth_type,
const uint8_t *  security_key,
uint8_t  key_length 
)

Joins a Wi-Fi network.

Scans for, associates and authenticates with a Wi-Fi network. On successful return, the system is ready to send data packets.

Parameters
ifpPointer to handle instance of whd interface
ssidA null terminated string containing the SSID name of the network to join
auth_typeAuthentication type
security_keyA byte array containing either the cleartext security key for WPA/WPA2/WPA3 secured networks
key_lengthThe length of the security_key in bytes.
Note
In case of WPA3/WPA2 transition mode, the security_key value is WPA3 password.
Returns
WHD_SUCCESS when the system is joined and ready to send data packets Error code if an error occurred

◆ whd_wifi_join_specific()

whd_result_t whd_wifi_join_specific ( whd_interface_t  ifp,
const whd_scan_result_t ap,
const uint8_t *  security_key,
uint8_t  key_length 
)

Joins a specific Wi-Fi network.

Associates and authenticates with a specific Wi-Fi access point. On successful return, the system is ready to send data packets.

Parameters
ifpPointer to handle instance of whd interface
apA pointer to a whd_scan_result_t structure containing AP details and set ap.channel to 0 for unspecificed channel
security_keyA byte array containing either the cleartext security key for WPA/WPA2 secured networks
key_lengthThe length of the security_key in bytes.
Returns
WHD_SUCCESS when the system is joined and ready to send data packets Error code if an error occurred

◆ whd_wifi_set_chanspec()

whd_result_t whd_wifi_set_chanspec ( whd_interface_t  ifp,
wl_chanspec_t  chanspec 
)

Set the current chanspec on the WLAN radio.

Note
On most WLAN devices this will set the chanspec for both AP AND STA (since there is only one radio - it cannot be on two chanspec simulaneously)
Parameters
ifpPointer to handle instance of whd interface
chanspecThe desired chanspec
Returns
WHD_SUCCESS if the chanspec was successfully set Error code if the chanspec was not successfully set

◆ whd_wifi_leave()

whd_result_t whd_wifi_leave ( whd_interface_t  ifp)

Disassociates from a Wi-Fi network.

Applicable only for STA role

Parameters
ifpPointer to handle instance of whd interface.
Returns
WHD_SUCCESS On successful disassociation from the AP Error code If an error occurred