Function esp_idf_svc::hal::sys::esp_wifi_scan_start

source ยท
pub unsafe extern "C" fn esp_wifi_scan_start(
    config: *const wifi_scan_config_t,
    block: bool,
) -> i32
Expand description

@brief Scan all available APs.

@attention If this API is called, the found APs are stored in WiFi driver dynamic allocated memory. And then can be freed in esp_wifi_scan_get_ap_records(), esp_wifi_scan_get_ap_record() or esp_wifi_clear_ap_list(), so call any one to free the memory once the scan is done. @attention The values of maximum active scan time and passive scan time per channel are limited to 1500 milliseconds. Values above 1500ms may cause station to disconnect from AP and are not recommended.

@param config configuration settings for scanning, if set to NULL default settings will be used of which default values are show_hidden:false, scan_type:active, scan_time.active.min:0, scan_time.active.max:120 miliseconds, scan_time.passive:360 miliseconds

@param block if block is true, this API will block the caller until the scan is done, otherwise it will return immediately

@return

  • ESP_OK: succeed
  • ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
  • ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
  • ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout
  • ESP_ERR_WIFI_STATE: wifi still connecting when invoke esp_wifi_scan_start
  • others: refer to error code in esp_err.h