]> granicus.if.org Git - esp-idf/commitdiff
add WiFi event mask API
authorXiaXiaotian <xiaxiaotian@espressif.com>
Fri, 16 Mar 2018 03:43:21 +0000 (11:43 +0800)
committerXiaXiaotian <xiaxiaotian@espressif.com>
Wed, 25 Apr 2018 11:25:43 +0000 (19:25 +0800)
components/esp32/include/esp_wifi.h
components/esp32/include/esp_wifi_types.h

index beb36e270901f929ee08c468061d14a3d8bf3ee5..5326b12008550f7d010422c19b4fa61a4712f974 100755 (executable)
@@ -869,6 +869,36 @@ esp_err_t esp_wifi_set_max_tx_power(int8_t power);
   */
 esp_err_t esp_wifi_get_max_tx_power(int8_t *power);
 
+/**
+  * @brief     Set mask to enable or disable some WiFi events
+  *
+  * @attention 1. Mask can be created by logical OR of various WIFI_EVENT_MASK_ constants.
+  *               Events which have corresponding bit set in the mask will not be delivered to the system event handler.
+  * @attention 2. Default WiFi event mask is WIFI_EVENT_MASK_AP_PROBEREQRECVED.
+  * @attention 3. There may be lots of stations sending probe request data around.
+  *               Don't unmask this event unless you need to receive probe request data.
+  *
+  * @param     mask  WiFi event mask.
+  *
+  * @return
+  *    - ESP_OK: succeed
+  *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
+  */
+esp_err_t esp_wifi_set_event_mask(uint32_t mask);
+
+/**
+  * @brief     Get mask of WiFi events
+  *
+  * @param     mask  WiFi event mask.
+  *
+  * @return
+  *    - ESP_OK: succeed
+  *    - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
+  *    - ESP_ERR_WIFI_ARG: invalid argument
+  */
+esp_err_t esp_wifi_get_event_mask(uint32_t *mask);
+
+
 #ifdef __cplusplus
 }
 #endif
index 455238baf1b2c20c48cfd9afe7e3f657f2704462..65181c570ab7fd20a93ba15931589e8a4c3e610f 100755 (executable)
@@ -344,6 +344,10 @@ typedef struct {
     uint32_t filter_mask; /**< OR of one or more filter values WIFI_PROMIS_FILTER_* */
 } wifi_promiscuous_filter_t;
 
+#define WIFI_EVENT_MASK_ALL                 (0xFFFFFFFF)  /**< mask all WiFi events */
+#define WIFI_EVENT_MASK_NONE                (0)           /**< mask none of the WiFi events */
+#define WIFI_EVENT_MASK_AP_PROBEREQRECVED   (BIT(0))      /**< mask SYSTEM_EVENT_AP_PROBEREQRECVED event */
+
 #ifdef __cplusplus
 }
 #endif