Add support for Remain-on-Channel and Action Tx

1. Add API's and structures for Remain-onChannel & Action Tx
2. Handling of events and callbacks for the operations
3. Update WiFi lib with related API support
This commit is contained in:
Nachiket Kukade 2020-10-27 18:12:40 +05:30
parent 1a85d64da8
commit 1ca80b4221
5 changed files with 44 additions and 1 deletions

View File

@ -85,6 +85,12 @@ static system_event_id_t esp_event_legacy_wifi_event_id(int32_t event_id)
case WIFI_EVENT_AP_PROBEREQRECVED:
return SYSTEM_EVENT_AP_PROBEREQRECVED;
case WIFI_EVENT_ACTION_TX_STATUS:
return SYSTEM_EVENT_ACTION_TX_STATUS;
case WIFI_EVENT_ROC_DONE:
return SYSTEM_EVENT_ROC_DONE;
default:
ESP_LOGE(TAG, "invalid wifi event id %d", event_id);
return SYSTEM_EVENT_MAX;

View File

@ -48,6 +48,8 @@ typedef enum {
SYSTEM_EVENT_AP_STADISCONNECTED, /*!< a station disconnected from ESP32 soft-AP */
SYSTEM_EVENT_AP_STAIPASSIGNED, /*!< ESP32 soft-AP assign an IP to a connected station */
SYSTEM_EVENT_AP_PROBEREQRECVED, /*!< Receive probe request packet in soft-AP interface */
SYSTEM_EVENT_ACTION_TX_STATUS, /*!< Receive status of Action frame transmitted */
SYSTEM_EVENT_ROC_DONE, /*!< Indicates the completion of Remain-on-Channel operation status */
SYSTEM_EVENT_GOT_IP6, /*!< ESP32 station or ap or ethernet interface v6IP addr is preferred */
SYSTEM_EVENT_ETH_START, /*!< ESP32 ethernet start */
SYSTEM_EVENT_ETH_STOP, /*!< ESP32 ethernet stop */

View File

@ -483,6 +483,21 @@ typedef struct {
enabled_ant1: 4; /**< Index (in antenna GPIO configuration) of enabled WIFI_ANT_MODE_ANT1 */
} wifi_ant_config_t;
/**
* @brief Management Frame Tx Request
*
*
*/
typedef struct {
wifi_interface_t ifx; /**< WiFi interface to send request to */
uint8_t subtype; /**< Frame Subtype of Management frame */
uint8_t dest_mac[6]; /**< Destination MAC address */
bool no_ack; /**< Indicates no ack required for the frame */
uint32_t cookie; /**< Context to identify the request */
uint32_t data_len; /**< Length of the appended Data */
uint8_t data[0]; /**< Appended Data payload */
} mgmt_tx_req_t;
/**
* @brief WiFi PHY rate encodings
*
@ -551,6 +566,8 @@ typedef enum {
/* Add next events after this only */
WIFI_EVENT_STA_BSS_RSSI_LOW, /**< AP's RSSI crossed configured threshold */
WIFI_EVENT_ACTION_TX_STATUS, /**< Status indication of Action Tx operation */
WIFI_EVENT_ROC_DONE, /**< Remain-on-Channel operation complete */
WIFI_EVENT_MAX, /**< Invalid WiFi event ID */
} wifi_event_t;
@ -645,6 +662,19 @@ typedef struct {
#define WIFI_STATIS_PS (1<<4)
#define WIFI_STATIS_ALL (-1)
/** Argument structure for WIFI_EVENT_MGMT_TX_STATUS event */
typedef struct {
wifi_interface_t ifx; /**< WiFi interface to send request to */
uint32_t cookie; /**< Context to identify the request */
uint8_t da[6]; /**< Destination MAC address */
uint8_t status; /**< Status of the operation */
} wifi_event_mgmt_tx_status_t;
/** Argument structure for WIFI_EVENT_ROC_DONE event */
typedef struct {
uint32_t cookie; /**< Context to identify the request */
} wifi_event_roc_done_t;
#ifdef __cplusplus
}
#endif

@ -1 +1 @@
Subproject commit 21001cb8acd9f193aed4ec17e632ea861233e7e0
Subproject commit bad7d9df47543691d8be80b449f416bf5d581746

View File

@ -136,6 +136,7 @@ struct wpa_funcs {
uint8_t *(*wpa3_build_sae_msg)(uint8_t *bssid, uint32_t type, size_t *len);
int (*wpa3_parse_sae_msg)(uint8_t *buf, size_t len, uint32_t type, uint16_t status);
int (*wpa_sta_rx_mgmt)(u8 type, u8 *frame, size_t len, u8 *sender, u32 rssi, u8 channel, u64 current_tsf);
int (*offchan_rx_mgmt)(uint8_t *hdr, uint8_t *payload, size_t len, uint8_t channel);
};
struct wpa2_funcs {
@ -261,5 +262,9 @@ bool esp_wifi_is_btm_enabled_internal(uint8_t if_index);
esp_err_t esp_wifi_register_mgmt_frame_internal(uint32_t type, uint32_t subtype);
esp_err_t esp_wifi_send_mgmt_frm_internal(const wifi_mgmt_frm_req_t *req);
uint8_t esp_wifi_ap_get_prof_pairwise_cipher_internal(void);
esp_err_t esp_wifi_mgmt_tx_req(uint8_t action, uint8_t channel,
uint32_t wait_time_ms, const mgmt_tx_req_t *req);
esp_err_t esp_wifi_remain_on_channel(uint8_t ifx, uint8_t action, uint8_t channel,
uint32_t wait_time_ms, void *ctx);
#endif /* _ESP_WIFI_DRIVER_H_ */