Răsfoiți Sursa

Merge branch 'feature/support_vendor_ie_api' into 'master'

esp32: add vendor ie API

1. add esp_wifi_set_vnd_ie
2. add esp_wifi_set_vnd_ie_cb

See merge request !75

Wu Jian Gang 9 ani în urmă
părinte
comite
6104370ac9
1 a modificat fișierele cu 64 adăugiri și 0 ștergeri
  1. 64 0
      components/esp32/include/esp_wifi.h

+ 64 - 0
components/esp32/include/esp_wifi.h

@@ -689,6 +689,70 @@ esp_err_t esp_wifi_set_auto_connect(bool en);
   */
   */
 esp_err_t esp_wifi_get_auto_connect(bool *en);
 esp_err_t esp_wifi_get_auto_connect(bool *en);
 
 
+/**
+  * @brief     Vendor IE type
+  *
+  */
+typedef enum {
+    WIFI_VND_IE_TYPE_BEACON,
+    WIFI_VND_IE_TYPE_PROBE_REQ,
+    WIFI_VND_IE_TYPE_PROBE_RESP,
+    WIFI_VND_IE_TYPE_ASSOC_REQ,
+    WIFI_VND_IE_TYPE_ASSOC_RESP,
+} wifi_vendor_ie_type_t;
+
+/**
+  * @brief     Vendor IE index
+  *
+  */
+typedef enum {
+    WIFI_VND_IE_ID_0,
+    WIFI_VND_IE_ID_1,
+} wifi_vendor_ie_id_t;
+
+/**
+  * @brief     Set vendor specific element
+  *
+  * @param     bool enable : enable or not
+  * @param     wifi_vendor_ie_type_t type : 0 - WIFI_VND_IE_TYPE_BEACON
+  *                           1 - WIFI_VND_IE_TYPE_PROBE_REQ
+  *                           2 - WIFI_VND_IE_TYPE_PROBE_RESP
+  *                           3 - WIFI_VND_IE_TYPE_ASSOC_REQ
+  *                           4 - WIFI_VND_IE_TYPE_ASSOC_RESP
+  * @param     wifi_vendor_ie_id_t idx : 0 - WIFI_VND_IE_ID_0
+                                    1 - WIFI_VND_IE_ID_1
+  * @param     uint8_t *vnd_ie : pointer to a vendor specific element
+  *
+  * @return    ESP_OK : succeed
+  * @return    others : fail
+  */
+esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, uint8_t *vnd_ie);
+
+/**
+  * @brief     Define function pointer for vendor specific element callback
+  * @param     void *ctx : reserved
+  * @param     wifi_vendor_ie_type_t type : 0 - WIFI_VND_IE_TYPE_BEACON
+  *                           1 - WIFI_VND_IE_TYPE_PROBE_REQ
+  *                           2 - WIFI_VND_IE_TYPE_PROBE_RESP
+  *                           3 - WIFI_VND_IE_TYPE_ASSOC_REQ
+  *                           4 - WIFI_VND_IE_TYPE_ASSOC_RESP
+  * @param     const uint8_t sa[6] : source address
+  * @param     const uint8_t *vnd_ie : pointer to a vendor specific element
+  * @param     int rssi : received signal strength indication
+  */
+typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const uint8_t *vnd_ie, int rssi);
+
+/**
+  * @brief     Set vendor specific element callback
+  *
+  * @param     esp_vendor_ie_cb_t cb : callback function
+  * @param     void *ctx : reserved
+  *
+  * @return    ESP_OK : succeed
+  * @return    others : fail
+  */
+esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
+
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif