From d866fe84a4e1c5a18f12ca4d5e28d7bb9b2691f0 Mon Sep 17 00:00:00 2001 From: qiyueixa Date: Tue, 13 Sep 2016 17:11:53 +0800 Subject: [PATCH 1/3] modify arguments for vendor ie APIs by using enum instead --- components/esp32/include/esp_wifi.h | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 19ba856dea..2c0a76bb95 100644 --- a/components/esp32/include/esp_wifi.h +++ b/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); +/** + * @brief Vendor IE type + * + */ +typedef enum { + VND_IE_TYPE_BEACON, + VND_IE_TYPE_PROBE_REQ, + VND_IE_TYPE_PROBE_RESP, + VND_IE_TYPE_ASSOC_REQ, + VND_IE_TYPE_ASSOC_RESP, +}vendor_ie_type_t; + +/** + * @brief Vendor IE index + * + */ +typedef enum { + VND_IE_ID_0, + VND_IE_ID_1, +}vendor_ie_id_t; + +/** + * @brief Set vendor specific element + * + * @param bool enable : enable or not + * @param vendor_ie_type_t type : 0 - VND_IE_TYPE_BEACON + * 1 - VND_IE_TYPE_PROBE_REQ + * 2 - VND_IE_TYPE_PROBE_RESP + * 3 - VND_IE_TYPE_ASSOC_REQ + * 4 - VND_IE_TYPE_ASSOC_RESP + * @param vendor_ie_id_t idx : 0 - VND_IE_ID_0 + 1 - 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, vendor_ie_type_t type, vendor_ie_id_t idx, uint8_t *vnd_ie); + +/** + * @brief Define function pointer for vendor specific element callback + * @param void *ctx : reserved + * @param vendor_ie_type_t type : 0 - VND_IE_TYPE_BEACON + * 1 - VND_IE_TYPE_PROBE_REQ + * 2 - VND_IE_TYPE_PROBE_RESP + * 3 - VND_IE_TYPE_ASSOC_REQ + * 4 - 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, 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 } #endif From f02e5cdec76545e0df617eb19ad8de3ec33baf42 Mon Sep 17 00:00:00 2001 From: qiyueixa Date: Wed, 14 Sep 2016 11:30:19 +0800 Subject: [PATCH 2/3] Rename vender_ie_type_t and vendor_ie_id_t to wifi_vendor_ie_type_t and wifi_vendor_ie_id_t respectively --- components/esp32/include/esp_wifi.h | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 2c0a76bb95..33b84a4345 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -694,53 +694,53 @@ esp_err_t esp_wifi_get_auto_connect(bool *en); * */ typedef enum { - VND_IE_TYPE_BEACON, - VND_IE_TYPE_PROBE_REQ, - VND_IE_TYPE_PROBE_RESP, - VND_IE_TYPE_ASSOC_REQ, - VND_IE_TYPE_ASSOC_RESP, -}vendor_ie_type_t; + 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 { - VND_IE_ID_0, - VND_IE_ID_1, -}vendor_ie_id_t; + 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 vendor_ie_type_t type : 0 - VND_IE_TYPE_BEACON - * 1 - VND_IE_TYPE_PROBE_REQ - * 2 - VND_IE_TYPE_PROBE_RESP - * 3 - VND_IE_TYPE_ASSOC_REQ - * 4 - VND_IE_TYPE_ASSOC_RESP - * @param vendor_ie_id_t idx : 0 - VND_IE_ID_0 - 1 - VND_IE_ID_1 + * @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, vendor_ie_type_t type, vendor_ie_id_t idx, uint8_t *vnd_ie); +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 vendor_ie_type_t type : 0 - VND_IE_TYPE_BEACON - * 1 - VND_IE_TYPE_PROBE_REQ - * 2 - VND_IE_TYPE_PROBE_RESP - * 3 - VND_IE_TYPE_ASSOC_REQ - * 4 - VND_IE_TYPE_ASSOC_RESP + * @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, vendor_ie_type_t type, const uint8_t sa[6], const uint8_t *vnd_ie, int rssi); +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 From 56586a10accaaedc74e981400a254c9df617fd25 Mon Sep 17 00:00:00 2001 From: qiyueixa Date: Wed, 14 Sep 2016 14:42:17 +0800 Subject: [PATCH 3/3] Format code by using 4 spaces instead --- components/esp32/include/esp_wifi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 33b84a4345..a5b9d089ae 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -706,8 +706,8 @@ typedef enum { * */ typedef enum { - WIFI_VND_IE_ID_0, - WIFI_VND_IE_ID_1, + WIFI_VND_IE_ID_0, + WIFI_VND_IE_ID_1, } wifi_vendor_ie_id_t; /**