WHD Wi-Fi SoftAP API

group wifisoftap

Wi-Fi APIs to perform SoftAP related functionalities.

Functions

uint32_t whd_wifi_init_ap(whd_interface_t ifp, whd_ssid_t *ssid, whd_security_t auth_type, const uint8_t *security_key, uint8_t key_length, uint8_t channel)

Initialises an infrastructure WiFi network (SoftAP)

Parameters
  • ifp – Pointer to handle instance of whd interface

  • ssid – A null terminated string containing the SSID name of the network to join

  • auth_type – Authentication type

  • security_key – A byte array containing the cleartext security key for the network

  • key_length – The length of the security_key in bytes.

  • channel – 802.11 channel number

Returns

WHD_SUCCESS if successfully initialises an AP Error code if an error occurred

uint32_t whd_wifi_start_ap(whd_interface_t ifp)

Start the infrastructure WiFi network (SoftAP) using the parameter set by whd_wifi_init_ap() and optionaly by whd_wifi_manage_custom_ie()

Returns

WHD_SUCCESS if successfully creates an AP Error code if an error occurred

uint32_t whd_wifi_stop_ap(whd_interface_t ifp)

Stops an existing infrastructure WiFi network.

Parameters

ifp – Pointer to handle instance of whd interface

Returns

WHD_SUCCESS if the AP is successfully stopped or if the AP has not yet been brought up Error code if an error occurred

uint32_t whd_wifi_ap_get_max_assoc(whd_interface_t ifp, uint32_t *max_assoc)

Get the maximum number of associations supported by AP interfaces.

Parameters
  • ifp – Pointer to handle instance of whd interface

  • max_assoc – The maximum number of associations supported by Soft AP interfaces.

Returns

WHD_SUCCESS if the maximum number of associated clients was successfully read WHD_ERROR if the maximum number of associated clients was not successfully read

uint32_t whd_wifi_get_associated_client_list(whd_interface_t ifp, void *client_list_buffer, uint16_t buffer_length)

Gets the current number of active connections.

Parameters
  • ifp – Pointer to handle instance of whd interface

  • client_list_buffer – Buffer to store list of associated clients

  • buffer_length – Length of client list buffer

Returns

WHD_SUCCESS if the active connections was successfully read WHD_ERROR if the active connections was not successfully read

uint32_t whd_wifi_deauth_sta(whd_interface_t ifp, whd_mac_t *mac, whd_dot11_reason_code_t reason)

Deauthenticates a STA which may or may not be associated to SoftAP.

Parameters
  • ifp – Pointer to handle instance of whd interface

  • mac – Pointer to a variable containing the MAC address to which the deauthentication will be sent NULL mac address will deauthenticate all the associated STAs

  • reason – Deauthentication reason code

Returns

WHD_SUCCESS On successful deauthentication of the other STA WHD_ERROR If an error occurred

uint32_t whd_wifi_get_ap_info(whd_interface_t ifp, whd_bss_info_t *ap_info, whd_security_t *security)

Retrieves AP information.

Parameters
  • ifp – Pointer to handle instance of whd interface

  • ap_info – Returns a whd_bss_info_t structure containing AP details

  • security – Authentication type

Returns

WHD_SUCCESS if the AP info was successfully retrieved Error code if the AP info was not successfully retrieved

uint32_t whd_wifi_ap_set_beacon_interval(whd_interface_t ifp, uint16_t interval)

Set the beacon interval.

Note that the value needs to be set before ap_start in order to beacon interval to take effect.

Parameters
  • ifp – Pointer to handle instance of whd interface

  • interval – Beacon interval in time units (Default: 100 time units = 102.4 ms)

Returns

WHD_SUCCESS or Error code

uint32_t whd_wifi_ap_set_dtim_interval(whd_interface_t ifp, uint16_t interval)

Set the DTIM interval.

Note that the value needs to be set before ap_start in order to DTIM interval to take effect.

Parameters
  • ifp – Pointer to handle instance of whd interface

  • interval – DTIM interval, in unit of beacon interval

Returns

WHD_SUCCESS or Error code