From 473db9c14b0bc90d5fe0aef06887290f5c7b3c6c Mon Sep 17 00:00:00 2001 From: liu zhifu Date: Fri, 3 Apr 2020 16:29:05 +0800 Subject: [PATCH] esp32: add esp_wifi_set_mgmt() --- components/esp32/include/esp_wifi.h | 11 +++++++++++ components/esp32/include/esp_wifi_types.h | 18 ++++++++++++++++++ components/esp32/lib | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index e642808dde..32c25558c5 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -1074,6 +1074,17 @@ esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config); */ esp_err_t esp_wifi_improve_contention_ability(bool enable); +/** + * @brief Set the management frame receiving + * + * @param filter the management frame need to be received by the callback + * @param cb the management frame receiving callback + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_set_rx_mgmt(wifi_rx_mgmt_filter_t filter, wifi_rx_mgmt_cb_t cb); + #ifdef __cplusplus } #endif diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp32/include/esp_wifi_types.h index 3f6eccde0b..fc65d53a39 100644 --- a/components/esp32/include/esp_wifi_types.h +++ b/components/esp32/include/esp_wifi_types.h @@ -519,6 +519,24 @@ typedef struct { } data; /**< Configuration of ioctl command */ } wifi_ioctl_config_t; +/** + * @brief Manangement frame receiving callback function + * + */ +typedef void (*wifi_rx_mgmt_cb_t)(const uint8_t *frame, int len, int rssi); + +/** + * @brief Management frame receiving filter + * + */ +typedef enum { + WIFI_RX_MGMT_FILTER_PROBE = 1, /**< Probe */ + WIFI_RX_MGMT_FILTER_BEACON = (1<<1), /**< Beacon */ + WIFI_RX_MGMT_FILTER_AUTH = (1<<2), /**< Auth/Deauth */ + WIFI_RX_MGMT_FILTER_ASSOC = (1<<3), /**< Assoc/Disassoc */ + WIFI_RX_MGMT_FILTER_ACTION = (1<<4), /**< Action */ +} wifi_rx_mgmt_filter_t; + #ifdef __cplusplus } #endif diff --git a/components/esp32/lib b/components/esp32/lib index 6914cc06a5..5d77b0329f 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit 6914cc06a5dae577309f9346d610171b8e5493af +Subproject commit 5d77b0329f75a9b30e9ccd30698515f30bce1978