From b0498569c82aa4e4c37a7cc113a87ed6812a18f7 Mon Sep 17 00:00:00 2001 From: Nachiket Kukade Date: Wed, 17 Sep 2025 00:00:27 +0530 Subject: [PATCH] fix(esp_wifi): Remove deprecated fields in NAN & FTM API's - Update wifi libs to remove references to deprecated API's, enums and variables --- components/esp_wifi/include/esp_wifi.h | 3 +-- .../esp_wifi/include/esp_wifi_types_generic.h | 25 ++++++------------- .../wifi_apps/nan_app/include/esp_nan.h | 7 +++--- .../migration-guides/release-6.x/6.0/wifi.rst | 22 +++++++++++++--- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index 171b2e4655..7a50c8b011 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -1410,8 +1410,7 @@ esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm); * (sizeof(wifi_ftm_report_entry_t) * num_entries) where the API will fill up to num_entries * valid FTM measurements in the buffer. Total number of entries can be found in the event * WIFI_EVENT_FTM_REPORT as ftm_report_num_entries - * @attention 2. The internal FTM report is freed upon use of this API which means the API can only be used - * once after every FTM session initiated + * @attention 2. The internal FTM report is freed upon use of this API OR after initiating a fresh FTM session * @attention 3. Passing the buffer as NULL merely frees the FTM report * * @param report Pointer to the buffer for receiving the FTM report diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index 9e568e174d..ea69624896 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -841,8 +841,6 @@ typedef struct { uint8_t channel; /**< Primary channel of the FTM Responder */ uint8_t frm_count; /**< No. of FTM frames requested in terms of 4 or 8 bursts (allowed values - 0(No pref), 16, 24, 32, 64) */ uint16_t burst_period; /**< Requested period between FTM bursts in 100's of milliseconds (allowed values 0(No pref) - 100) */ - bool use_get_report_api; /**< True - Using esp_wifi_ftm_get_report to get FTM report, False - Using ftm_report_data from - WIFI_EVENT_FTM_REPORT to get FTM report */ } wifi_ftm_initiator_cfg_t; #define ESP_WIFI_NAN_MAX_SVC_SUPPORTED 2 /**< Maximum number of NAN services supported */ @@ -900,12 +898,12 @@ typedef struct { char service_name[ESP_WIFI_MAX_SVC_NAME_LEN]; /**< Service name identifier */ wifi_nan_service_type_t type; /**< Service type */ char matching_filter[ESP_WIFI_MAX_FILTER_LEN]; /**< Comma separated filters for filtering services */ - char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]; /**< To be deprecated in next major release, use ssi instead */ uint8_t single_replied_event: 1; /**< Give single Replied event or every time */ uint8_t datapath_reqd: 1; /**< NAN Datapath required for the service */ uint8_t fsd_reqd: 1; /**< Further Service Discovery(FSD) required */ uint8_t fsd_gas: 1; /**< 0 - Follow-up used for FSD, 1 - GAS used for FSD */ - uint8_t reserved: 4; /**< Reserved */ + uint8_t ndp_resp_needed: 1; /**< 0 - Auto-Accept NDP Requests, 1 - Require explicit response with esp_wifi_nan_datapath_resp */ + uint8_t reserved: 3; /**< Reserved */ uint16_t ssi_len; /**< Length of service specific info, maximum allowed length - ESP_WIFI_MAX_SVC_SSI_LEN */ uint8_t *ssi; /**< Service Specific Info of type wifi_nan_wfa_ssi_t for WFA defined protocols, otherwise proprietary and defined by Applications */ } wifi_nan_publish_cfg_t; @@ -918,7 +916,6 @@ typedef struct { char service_name[ESP_WIFI_MAX_SVC_NAME_LEN]; /**< Service name identifier */ wifi_nan_service_type_t type; /**< Service type */ char matching_filter[ESP_WIFI_MAX_FILTER_LEN]; /**< Comma separated filters for filtering services */ - char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]; /**< To be deprecated in next major release, use ssi instead */ uint8_t single_match_event: 1; /**< Give single Match event(per SSI update) or every time */ uint8_t datapath_reqd: 1; /**< NAN Datapath required for the service */ uint8_t fsd_reqd: 1; /**< Further Service Discovery(FSD) required */ @@ -936,7 +933,6 @@ typedef struct { uint8_t inst_id; /**< Own service instance id */ uint8_t peer_inst_id; /**< Peer's service instance id */ uint8_t peer_mac[6]; /**< Peer's MAC address */ - char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]; /**< To be deprecated in next major release, use ssi instead */ uint16_t ssi_len; /**< Length of service specific info, maximum allowed length - ESP_WIFI_MAX_FUP_SSI_LEN */ uint8_t *ssi; /**< Service Specific Info of type wifi_nan_wfa_ssi_t for WFA defined protocols, otherwise proprietary and defined by Applications */ } wifi_nan_followup_params_t; @@ -1281,9 +1277,7 @@ typedef struct { uint32_t rtt_raw; /**< Raw average Round-Trip-Time with peer in Nano-Seconds */ uint32_t rtt_est; /**< Estimated Round-Trip-Time with peer in Nano-Seconds */ uint32_t dist_est; /**< Estimated one-way distance in Centi-Meters */ - wifi_ftm_report_entry_t *ftm_report_data; /**< Pointer to FTM Report, should be freed after use. Note: Highly recommended - to use API esp_wifi_ftm_get_report to get the report instead of using this */ - uint8_t ftm_report_num_entries; /**< Number of entries in the FTM Report data */ + uint8_t ftm_report_num_entries; /**< Number of entries in the FTM Report, use esp_wifi_ftm_get_report to fetch it */ } wifi_event_ftm_report_t; #define WIFI_STATIS_BUFFER (1<<0) /**< Buffer status */ @@ -1369,7 +1363,7 @@ typedef struct { uint32_t reserved_2; /**< Reserved */ uint8_t ssi_version; /**< Indicates version of SSI in Publish instance, 0 if not available */ uint16_t ssi_len; /**< Length of service specific info */ - uint8_t ssi[]; /**< Service specific info of Publisher */ + uint8_t *ssi; /**< Service specific info of Publisher */ } wifi_event_nan_svc_match_t; /** @@ -1382,7 +1376,7 @@ typedef struct { uint32_t reserved_1; /**< Reserved */ uint32_t reserved_2; /**< Reserved */ uint16_t ssi_len; /**< Length of service specific info */ - uint8_t ssi[]; /**< Service specific info of Subscriber */ + uint8_t *ssi; /**< Service specific info of Subscriber */ } wifi_event_nan_replied_t; /** @@ -1392,11 +1386,10 @@ typedef struct { uint8_t inst_id; /**< Our Service Identifier */ uint8_t peer_inst_id; /**< Peer's Service Identifier */ uint8_t peer_if_mac[6]; /**< Peer's NAN Interface MAC */ - uint8_t peer_svc_info[ESP_WIFI_MAX_SVC_INFO_LEN];/**< To be deprecated in next major release, use ssi instead */ uint32_t reserved_1; /**< Reserved */ uint32_t reserved_2; /**< Reserved */ uint16_t ssi_len; /**< Length of service specific info */ - uint8_t ssi[]; /**< Service specific info from Follow-up */ + uint8_t *ssi; /**< Service specific info from Follow-up */ } wifi_event_nan_receive_t; /** @@ -1407,11 +1400,10 @@ typedef struct { uint8_t ndp_id; /**< NDP instance id */ uint8_t peer_nmi[6]; /**< Peer's NAN Management Interface MAC */ uint8_t peer_ndi[6]; /**< Peer's NAN Data Interface MAC */ - uint8_t svc_info[ESP_WIFI_MAX_SVC_INFO_LEN];/**< To be deprecated in next major release, use ssi instead */ uint32_t reserved_1; /**< Reserved */ uint32_t reserved_2; /**< Reserved */ uint16_t ssi_len; /**< Length of service specific info */ - uint8_t ssi[]; /**< Service specific info from NDP/NDPE Attribute */ + uint8_t *ssi; /**< Service specific info from NDP/NDPE Attribute */ } wifi_event_ndp_indication_t; /** @@ -1423,11 +1415,10 @@ typedef struct { uint8_t peer_nmi[6]; /**< Peer's NAN Management Interface MAC */ uint8_t peer_ndi[6]; /**< Peer's NAN Data Interface MAC */ uint8_t own_ndi[6]; /**< Own NAN Data Interface MAC */ - uint8_t svc_info[ESP_WIFI_MAX_SVC_INFO_LEN];/**< To be deprecated in next major release, use ssi instead */ uint32_t reserved_1; /**< Reserved */ uint32_t reserved_2; /**< Reserved */ uint16_t ssi_len; /**< Length of Service Specific Info */ - uint8_t ssi[]; /**< Service specific info from NDP/NDPE Attribute */ + uint8_t *ssi; /**< Service specific info from NDP/NDPE Attribute */ } wifi_event_ndp_confirm_t; /** diff --git a/components/esp_wifi/wifi_apps/nan_app/include/esp_nan.h b/components/esp_wifi/wifi_apps/nan_app/include/esp_nan.h index e0e9d90d81..c370b76ac5 100644 --- a/components/esp_wifi/wifi_apps/nan_app/include/esp_nan.h +++ b/components/esp_wifi/wifi_apps/nan_app/include/esp_nan.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -67,13 +67,12 @@ esp_err_t esp_wifi_nan_stop(void); * @attention This API should be called after esp_wifi_nan_start(). * * @param publish_cfg Configuration parameters for publishing a service. - * @param ndp_resp_needed Setting this true will require user response for every NDP Req using esp_wifi_nan_datapath_resp API. * * @return * - non-zero: Publish service identifier * - zero: failed */ -uint8_t esp_wifi_nan_publish_service(const wifi_nan_publish_cfg_t *publish_cfg, bool ndp_resp_needed); +uint8_t esp_wifi_nan_publish_service(const wifi_nan_publish_cfg_t *publish_cfg); /** * @brief Subscribe for a service within the NAN cluster @@ -128,7 +127,7 @@ uint8_t esp_wifi_nan_datapath_req(wifi_nan_datapath_req_t *req); /** * @brief Respond to a NAN Datapath request with Accept or Reject * - * @attention This API should be called if ndp_resp_needed is set True by the Publisher and + * @attention This API should be called if ndp_resp_needed is set 1 in wifi_nan_publish_cfg_t and * a WIFI_EVENT_NDP_INDICATION event is received due to an incoming NDP request. * * @param resp NAN Datapath Response parameters. diff --git a/docs/en/migration-guides/release-6.x/6.0/wifi.rst b/docs/en/migration-guides/release-6.x/6.0/wifi.rst index b6169eff48..d0e020ae9e 100644 --- a/docs/en/migration-guides/release-6.x/6.0/wifi.rst +++ b/docs/en/migration-guides/release-6.x/6.0/wifi.rst @@ -33,7 +33,6 @@ The following functions and types have been removed. - **DPP:** - The DPP event callback ``esp_supp_dpp_event_cb_t`` and event enum ``esp_supp_dpp_event_t`` have been removed. Please use Wi-Fi events directly (e.g. ``WIFI_EVENT_DPP_URI_READY``, ``WIFI_EVENT_DPP_CFG_RECVD``, ``WIFI_EVENT_DPP_FAILED``). - - The function ``esp_supp_dpp_init`` no longer accepts a callback and should be called as ``esp_supp_dpp_init(void)``. - **RRM:** The function ``esp_rrm_send_neighbor_rep_request`` has been removed. Use ``esp_rrm_send_neighbor_report_request`` instead. @@ -42,9 +41,7 @@ The following functions and types have been removed. - **ESP-NOW:** The function ``esp_wifi_config_espnow_rate`` has been removed. Use ``esp_now_set_peer_rate_config`` instead. -- **WPS:** The function ``esp_wifi_wps_start`` no longer accepts a ``timeout_ms`` argument. It should now be called as ``esp_wifi_wps_start(void)``. - -Removed Macros and Enum Values +Removed Variables, Macros and Enum Values ------------------------------- - **Authentication Modes:** The authentication modes ``WIFI_AUTH_WPA3_EXT_PSK`` and ``WIFI_AUTH_WPA3_EXT_PSK_MIXED_MODE`` have been removed. Use ``WIFI_AUTH_WPA3_PSK`` instead. @@ -52,3 +49,20 @@ Removed Macros and Enum Values - **Neighbor Report Event:** In the ``wifi_event_neighbor_report_t`` structure, the ``report`` field has been removed. Please use the ``n_report`` field instead, which is a flexible array member. - **Wi-Fi Interface:** The header file :project_file:`components/esp_wifi/include/esp_interface.h` has been removed. The ``wifi_interface_t`` enum is now defined in :project_file:`components/esp_wifi/include/esp_wifi_types_generic.h`. The enum values (e.g. ``WIFI_IF_STA``, ``WIFI_IF_AP``) are no longer defined based on ``ESP_IF_WIFI_STA``, ``ESP_IF_WIFI_AP``, etc. + +- **NAN:** + - Field ``svc_info`` from structures ``wifi_nan_publish_cfg_t``, ``wifi_nan_subscribe_cfg_t``, ``wifi_nan_followup_params_t``, ``wifi_event_ndp_indication_t``, ``wifi_event_ndp_confirm_t`` has been removed. Please use the equivalent fields ``ssi`` and ``ssi_len`` instead. + - Field ``peer_svc_info`` from structure ``wifi_event_nan_receive_t`` has been removed. Please use the equivalent fields ``ssi`` and ``ssi_len`` instead. + +- **FTM:** Field ``use_get_report_api`` from structure ``wifi_ftm_initiator_cfg_t`` and field ``ftm_report_data`` from structure ``wifi_event_ftm_report_t`` has been removed. Please use ``esp_wifi_ftm_get_report`` to fetch raw FTM report data instead. + +Modified Functions and Types +--------------------------- + +The following Wi-Fi functions have been modified. + +- **DPP:** The function ``esp_supp_dpp_init`` no longer accepts a callback and should be called as ``esp_supp_dpp_init(void)``. + +- **WPS:** The function ``esp_wifi_wps_start`` no longer accepts a ``timeout_ms`` argument. It should now be called as ``esp_wifi_wps_start(void)``. + +- **NAN:** The function argument ``ndp_resp_needed`` of ``esp_wifi_nan_publish_service`` has been moved to structure ``wifi_nan_publish_cfg_t``.