feat(wifi): Added tx callback function for 80211 tx

Closes https://github.com/espressif/esp-idf/issues/13319
This commit is contained in:
zhangyanjiao
2025-03-10 15:32:45 +08:00
parent 3e6c4dad7d
commit d19614738a
2 changed files with 44 additions and 0 deletions

View File

@@ -1198,6 +1198,27 @@ esp_err_t esp_wifi_get_event_mask(uint32_t *mask);
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);
/**
* @brief Callback function of 80211 tx data
*
* @param tx_info TX information of 80211 tx. The information can only be used in the callback context.
*/
typedef void (*esp_wifi_80211_tx_done_cb_t)(const esp_80211_tx_info_t *tx_info);
/**
* @brief Register the TX callback function of 80211 tx data.
*
* @attention This callback will be executed in WiFi task, so avoid doing any time consuming activity in the callback.
* Doing heavy work here can affect the WiFi performance.
*
* @param cb callback function. If the cb is NULL, then unregister the tx cb.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
*/
esp_err_t esp_wifi_register_80211_tx_cb(esp_wifi_80211_tx_done_cb_t cb);
/**
* @brief The RX callback function of Channel State Information(CSI) data.
*

View File

@@ -1486,6 +1486,29 @@ typedef struct {
uint8_t regulatory_type; /**< regulatory type of country */
} wifi_regdomain_t;
/**
* @brief Status of wifi sending data
*/
typedef enum {
WIFI_SEND_SUCCESS = 0, /**< Sending Wi-Fi data successfully */
WIFI_SEND_FAIL, /**< Sending Wi-Fi data fail */
} wifi_tx_status_t;
/**
* @brief Information of wifi sending data
*/
typedef struct {
uint8_t *des_addr; /**< The address of the receive device */
uint8_t *src_addr; /**< The address of the sending device */
wifi_interface_t ifidx; /**< Interface of sending 80211 tx data */
uint8_t *data; /**< The data for 80211 tx, start from the MAC header */
uint8_t data_len; /**< The frame body length for 80211 tx, excluding the MAC header */
wifi_phy_rate_t rate; /**< Data rate */
wifi_tx_status_t tx_status; /**< Status of sending 80211 tx data */
} wifi_tx_info_t;
typedef wifi_tx_info_t esp_80211_tx_info_t;
#ifdef __cplusplus
}
#endif