From 266ee73e92c8d76ea9d95f975dc17c251fe2bd58 Mon Sep 17 00:00:00 2001 From: xuxiao Date: Tue, 7 May 2024 19:07:24 +0800 Subject: [PATCH] feat(wifi): add itwt teardown status --- components/esp_wifi/include/esp_wifi_he_types.h | 9 +++++++++ components/esp_wifi/lib | 2 +- examples/wifi/itwt/main/itwt_main.c | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi_he_types.h b/components/esp_wifi/include/esp_wifi_he_types.h index 0baf7a66d1..a6ba90d591 100644 --- a/components/esp_wifi/include/esp_wifi_he_types.h +++ b/components/esp_wifi/include/esp_wifi_he_types.h @@ -302,9 +302,18 @@ typedef struct { uint64_t target_wake_time; /**< TWT SP start time */ } wifi_event_sta_itwt_setup_t; +/** + * @brief iTWT teardown status + */ +typedef enum { + ITWT_TEARDOWN_FAIL, /**< station sends teardown frame fail */ + ITWT_TEARDOWN_SUCCESS, /**< 1) station successfully sends teardown frame to AP; 2) station receives teardown frame from AP */ +} wifi_itwt_teardown_status_t; + /** Argument structure for WIFI_EVENT_TWT_TEARDOWN event */ typedef struct { uint8_t flow_id; /**< flow id */ + wifi_itwt_teardown_status_t status; /**< itwt teardown status */ } wifi_event_sta_itwt_teardown_t; /** diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 6aa93ec85d..321823002f 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 6aa93ec85df32b54dc91c44bb0ef2d5319f757cb +Subproject commit 321823002fd7aa2d76b9996b95336495011525db diff --git a/examples/wifi/itwt/main/itwt_main.c b/examples/wifi/itwt/main/itwt_main.c index 1e4e1af461..cdc87359b0 100644 --- a/examples/wifi/itwt/main/itwt_main.c +++ b/examples/wifi/itwt/main/itwt_main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -183,7 +183,11 @@ static void itwt_teardown_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) { wifi_event_sta_itwt_teardown_t *teardown = (wifi_event_sta_itwt_teardown_t *) event_data; - ESP_LOGI(TAG, "flow_id %d%s", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : ""); + if (teardown->status == ITWT_TEARDOWN_FAIL) { + ESP_LOGE(TAG, "flow_id %d%s, twt teardown frame tx failed", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : ""); + } else { + ESP_LOGI(TAG, "flow_id %d%s", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : ""); + } } static void itwt_suspend_handler(void *arg, esp_event_base_t event_base,