Merge branch 'bugfix/fix_issuse_in_scan_and_mesh_v5.1' into 'release/v5.1'

fix(wifi): fix issues in scan and wifi mesh (backport v5.1)

See merge request espressif/esp-idf!27844
This commit is contained in:
Jiang Jiang Jian 2023-12-14 12:09:31 +08:00
commit 87cd764d6c
2 changed files with 27 additions and 6 deletions

View File

@ -411,9 +411,9 @@ esp_err_t esp_wifi_deauth_sta(uint16_t aid);
/** /**
* @brief Scan all available APs. * @brief Scan all available APs.
* *
* @attention If this API is called, the found APs are stored in WiFi driver dynamic allocated memory and the * @attention If this API is called, the found APs are stored in WiFi driver dynamic allocated memory. And then
* will be freed in esp_wifi_scan_get_ap_records, so generally, call esp_wifi_scan_get_ap_records to cause * can be freed in esp_wifi_scan_get_ap_records(), esp_wifi_scan_get_ap_record() or esp_wifi_clear_ap_list(),
* the memory to be freed once the scan is done * 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. * @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. * Values above 1500ms may cause station to disconnect from AP and are not recommended.
* *
@ -460,7 +460,9 @@ esp_err_t esp_wifi_scan_stop(void);
esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number); esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
/** /**
* @brief Get AP list found in last scan * @brief Get AP list found in last scan.
*
* @attention This API will free all memory occupied by scanned AP list.
* *
* @param[inout] number As input param, it stores max AP number ap_records can hold. * @param[inout] number As input param, it stores max AP number ap_records can hold.
* As output param, it receives the actual AP number this API returns. * As output param, it receives the actual AP number this API returns.
@ -475,11 +477,30 @@ esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
*/ */
esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);
/**
* @brief Get one AP record from the scanned AP list.
*
* @attention Different from esp_wifi_scan_get_ap_records(), this API only gets one AP record
* from the scanned AP list each time. This API will free the memory of one AP record,
* if the user doesn't get all records in the scannned AP list, then needs to call esp_wifi_clear_ap_list()
* to free the remaining memory.
*
* @param[out] ap_record pointer to one AP record
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_FAIL: scan APs is NULL, means all AP records fetched or no AP found
*/
esp_err_t esp_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record);
/** /**
* @brief Clear AP list found in last scan * @brief Clear AP list found in last scan
* *
* @attention When the obtained ap list fails,bss info must be cleared,otherwise it may cause memory leakage. * @attention This API will free all memory occupied by scanned AP list.
* When the obtained AP list fails, AP records must be cleared,otherwise it may cause memory leakage.
* *
* @return * @return
* - ESP_OK: succeed * - ESP_OK: succeed

@ -1 +1 @@
Subproject commit 6360e9c71a1aa7bd5452627c4dd810acf784913b Subproject commit b9944486f94cb80c5ec8a1fac2bbc9a6dcae8d6a