Skip to content

Commit e11f030

Browse files
xuxiao111jack0c
authored andcommitted
feat(wifi): add itwt teardown status
1 parent beebbad commit e11f030

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

components/esp_wifi/include/esp_wifi_he_types.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,18 @@ typedef struct {
302302
uint64_t target_wake_time; /**< TWT SP start time */
303303
} wifi_event_sta_itwt_setup_t;
304304

305+
/**
306+
* @brief iTWT teardown status
307+
*/
308+
typedef enum {
309+
ITWT_TEARDOWN_FAIL, /**< station sends teardown frame fail */
310+
ITWT_TEARDOWN_SUCCESS, /**< 1) station successfully sends teardown frame to AP; 2) station receives teardown frame from AP */
311+
} wifi_itwt_teardown_status_t;
312+
305313
/** Argument structure for WIFI_EVENT_TWT_TEARDOWN event */
306314
typedef struct {
307315
uint8_t flow_id; /**< flow id */
316+
wifi_itwt_teardown_status_t status; /**< itwt teardown status */
308317
} wifi_event_sta_itwt_teardown_t;
309318

310319
/**

examples/wifi/itwt/main/itwt_main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -183,7 +183,11 @@ static void itwt_teardown_handler(void *arg, esp_event_base_t event_base,
183183
int32_t event_id, void *event_data)
184184
{
185185
wifi_event_sta_itwt_teardown_t *teardown = (wifi_event_sta_itwt_teardown_t *) event_data;
186-
ESP_LOGI(TAG, "<WIFI_EVENT_ITWT_TEARDOWN>flow_id %d%s", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : "");
186+
if (teardown->status == ITWT_TEARDOWN_FAIL) {
187+
ESP_LOGE(TAG, "<WIFI_EVENT_ITWT_TEARDOWN>flow_id %d%s, twt teardown frame tx failed", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : "");
188+
} else {
189+
ESP_LOGI(TAG, "<WIFI_EVENT_ITWT_TEARDOWN>flow_id %d%s", teardown->flow_id, (teardown->flow_id == 8) ? "(all twt)" : "");
190+
}
187191
}
188192

189193
static void itwt_suspend_handler(void *arg, esp_event_base_t event_base,

0 commit comments

Comments
 (0)