diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index 4caa998dce..3bf4f760a9 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -1322,6 +1322,29 @@ esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t ra */ esp_err_t esp_wifi_disable_pmf_config(wifi_interface_t ifx); +/** + * @brief Get the Association id assigned to STA by AP + * + * @param[out] aid store the aid + * + * @attention aid = 0 if station is not connected to AP. + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_sta_get_aid(uint16_t *aid); + +/** + * @brief Get the negotiated phymode after connection. + * + * @param[out] phymode store the negotiated phymode. + * + * @attention Operation phy mode, BIT[5]: indicate whether LR enabled, BIT[0-4]: wifi_phy_mode_t + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index 88def44e4e..fb34bfe564 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -307,9 +307,7 @@ typedef struct { uint32_t ft_enabled:1; /**< Whether FT is enabled for the connection */ uint32_t owe_enabled:1; /**< Whether OWE is enabled for the connection */ uint32_t transition_disable:1; /**< Whether to enable transition disable feature */ - uint32_t aid:12; /**< Authentication id assigned by the connected AP. aid = 0 if the STA is not connected. */ - uint32_t phymode:6; /**< Operation phy mode, BIT[5]: indicate whether LR enabled, BIT[0-4]: wifi_phy_mode_t. */ - uint32_t reserved:8; /**< Reserved for future feature set */ + uint32_t reserved:26; /**< Reserved for future feature set */ wifi_sae_pwe_method_t sae_pwe_h2e; /**< Whether SAE hash to element is enabled */ wifi_sae_pk_mode_t sae_pk_mode; /**< SAE-PK mode */ uint8_t failure_retry_cnt; /**< Number of connection retries station will do before moving to next AP. scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config. diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 025a465101..7e1c6ef8bf 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 025a46510137c24ee8d15e766bfbb547b83462ac +Subproject commit 7e1c6ef8bff1d666b2a150110367abdf646ffafc diff --git a/examples/common_components/iperf/wifi_cmd.c b/examples/common_components/iperf/wifi_cmd.c index 1f1466c336..92617229e5 100644 --- a/examples/common_components/iperf/wifi_cmd.c +++ b/examples/common_components/iperf/wifi_cmd.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -592,7 +592,9 @@ static int wifi_cmd_query(int argc, char **argv) printf("\tbssid: "MACSTR, MAC2STR(cfg.sta.bssid)); printf("\n"); printf("\tchannel: %d\n", cfg.sta.channel); - printf("\taid: %d\n", cfg.sta.aid); + uint16_t aid; + esp_wifi_sta_get_aid(&aid); + printf("\taid: %d\n", aid); if (cfg.sta.pmf_cfg.capable) { if (cfg.sta.pmf_cfg.required) { printf("\tpmf: required\n"); diff --git a/examples/wifi/itwt/main/itwt.c b/examples/wifi/itwt/main/itwt.c index 23a60a3128..77c51b41c4 100644 --- a/examples/wifi/itwt/main/itwt.c +++ b/examples/wifi/itwt/main/itwt.c @@ -89,9 +89,11 @@ static void got_ip_handler(void *arg, esp_event_base_t event_base, /* setup a trigger-based announce individual TWT agreement. */ esp_err_t err = ESP_OK; int flow_id = 0; + wifi_phy_mode_t phymode; wifi_config_t sta_cfg = { 0, }; esp_wifi_get_config(WIFI_IF_STA, &sta_cfg); - if (sta_cfg.sta.phymode == WIFI_PHY_MODE_HE20) { + esp_wifi_sta_get_negotiated_phymode(&phymode); + if (phymode == WIFI_PHY_MODE_HE20) { err = esp_wifi_sta_itwt_setup(TWT_REQUEST, trigger_enabled, flow_type_announced ? 0 : 1, CONFIG_EXAMPLE_ITWT_MIN_WAKE_DURA, CONFIG_EXAMPLE_ITWT_WAKE_INVL_EXPN, CONFIG_EXAMPLE_ITWT_WAKE_INVL_MANT, &flow_id);