From b8a8fe3f5464366c9c52dd16c946585fde44ea35 Mon Sep 17 00:00:00 2001 From: xiehang Date: Tue, 19 Jan 2021 11:55:44 +0800 Subject: [PATCH 1/2] esp_wifi: Modify ESP_IF_WIFI_STA to WIFI_IF_STA --- components/driver/test/test_adc2_with_wifi.c | 4 ++-- components/esp_wifi/test/test_wifi.c | 4 ++-- components/wifi_provisioning/src/manager.c | 10 +++++----- .../src/esp_supplicant/esp_common.c | 18 +++++++++--------- .../src/esp_supplicant/esp_scan.c | 6 +++--- components/wpa_supplicant/src/rsn_supp/wpa.c | 6 +++--- .../components/case/wifi_connect.c | 2 +- .../components/iperf/cmd_wifi.c | 2 +- .../nimble/bleprph_wifi_coex/main/main.c | 2 +- .../protocol_examples_common/connect.c | 2 +- .../mesh/ip_internal_network/main/mesh_netif.c | 6 +++--- .../protocols/esp_local_ctrl/main/app_main.c | 2 +- .../legacy/ble_prov/main/app_prov.c | 4 ++-- .../legacy/console_prov/main/app_prov.c | 4 ++-- .../legacy/custom_config/main/app_prov.c | 4 ++-- .../legacy/softap_prov/main/app_prov.c | 4 ++-- examples/system/console/main/cmd_wifi.c | 2 +- examples/wifi/fast_scan/main/fast_scan.c | 2 +- .../station/main/station_example_main.c | 2 +- examples/wifi/iperf/main/cmd_wifi.c | 2 +- examples/wifi/power_save/main/power_save.c | 2 +- examples/wifi/roaming/main/roaming_example.c | 2 +- .../wifi/smart_config/main/smartconfig_main.c | 2 +- .../main/wpa2_enterprise_main.c | 2 +- examples/wifi/wps/main/wps.c | 4 ++-- 25 files changed, 50 insertions(+), 50 deletions(-) diff --git a/components/driver/test/test_adc2_with_wifi.c b/components/driver/test/test_adc2_with_wifi.c index 0aae193754..238dc03989 100644 --- a/components/driver/test/test_adc2_with_wifi.c +++ b/components/driver/test/test_adc2_with_wifi.c @@ -128,7 +128,7 @@ TEST_CASE("adc2 work with wifi","[adc]") }, }; TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); - TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); + TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); //test read value TEST_ESP_OK( adc2_get_raw( ADC_TEST_CH1, ADC_TEST_WIDTH, &read_raw )); @@ -260,7 +260,7 @@ TEST_CASE("adc1 and i2s work with wifi","[adc][ignore]") }, }; TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); - TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); + TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); i2s_adc_test(); //now start wifi printf("wifi start...\n"); diff --git a/components/esp_wifi/test/test_wifi.c b/components/esp_wifi/test/test_wifi.c index 766af9355e..e8627c637a 100644 --- a/components/esp_wifi/test/test_wifi.c +++ b/components/esp_wifi/test/test_wifi.c @@ -102,7 +102,7 @@ static void test_wifi_init_deinit(wifi_init_config_t *cfg, wifi_config_t* wifi_c ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_mode")); TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_config")); - TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_config)); + TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, wifi_config)); ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit...")); TEST_ESP_OK(esp_wifi_deinit()); } @@ -116,7 +116,7 @@ static void test_wifi_start_stop(wifi_init_config_t *cfg, wifi_config_t* wifi_co ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_mode")); TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_config")); - TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_config)); + TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, wifi_config)); //now start wifi ESP_LOGI(TAG, EMPH_STR("esp_wifi_start...")); TEST_ESP_OK(esp_wifi_start()); diff --git a/components/wifi_provisioning/src/manager.c b/components/wifi_provisioning/src/manager.c index 473bb5f82c..e3977cd6e7 100644 --- a/components/wifi_provisioning/src/manager.c +++ b/components/wifi_provisioning/src/manager.c @@ -1105,7 +1105,7 @@ esp_err_t wifi_prov_mgr_is_provisioned(bool *provisioned) /* Get Wi-Fi Station configuration */ wifi_config_t wifi_cfg; - if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { + if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) { return ESP_FAIL; } @@ -1164,7 +1164,7 @@ esp_err_t wifi_prov_mgr_configure_sta(wifi_config_t *wifi_cfg) } /* Configure Wi-Fi station with host credentials * provided during provisioning */ - if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { + if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) { ESP_LOGE(TAG, "Failed to set Wi-Fi configuration"); RELEASE_LOCK(prov_ctx_lock); return ESP_FAIL; @@ -1434,14 +1434,14 @@ esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const * to the AP whose credentials were present earlier */ wifi_config_t wifi_cfg_empty, wifi_cfg_old; memset(&wifi_cfg_empty, 0, sizeof(wifi_config_t)); - esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg_old); + esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg_old); err = esp_wifi_set_storage(WIFI_STORAGE_RAM); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to set Wi-Fi storage to RAM"); RELEASE_LOCK(prov_ctx_lock); return err; } - esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_cfg_empty); + esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg_empty); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to set empty Wi-Fi credentials"); RELEASE_LOCK(prov_ctx_lock); @@ -1527,7 +1527,7 @@ esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const err: prov_ctx->prov_state = WIFI_PROV_STATE_IDLE; esp_wifi_set_storage(WIFI_STORAGE_FLASH); - esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_cfg_old); + esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg_old); exit: RELEASE_LOCK(prov_ctx_lock); diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_common.c b/components/wpa_supplicant/src/esp_supplicant/esp_common.c index f491e69b7e..25dcb253e8 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_common.c +++ b/components/wpa_supplicant/src/esp_supplicant/esp_common.c @@ -158,7 +158,7 @@ static void esp_clear_bssid_flag(struct wpa_supplicant *wpa_s) wifi_config_t *config; /* Reset only if btm is enabled */ - if (esp_wifi_is_btm_enabled_internal(ESP_IF_WIFI_STA) == false) + if (esp_wifi_is_btm_enabled_internal(WIFI_IF_STA) == false) return; config = os_zalloc(sizeof(wifi_config_t)); @@ -168,9 +168,9 @@ static void esp_clear_bssid_flag(struct wpa_supplicant *wpa_s) return; } - esp_wifi_get_config(ESP_IF_WIFI_STA, config); + esp_wifi_get_config(WIFI_IF_STA, config); config->sta.bssid_set = 0; - esp_wifi_set_config(ESP_IF_WIFI_STA, config); + esp_wifi_set_config(WIFI_IF_STA, config); os_free(config); wpa_printf(MSG_DEBUG, "cleared bssid flag"); } @@ -182,9 +182,9 @@ static void esp_register_action_frame(struct wpa_supplicant *wpa_s) wpa_s->subtype = 0; /* current supported features in supplicant: rrm and btm */ - if (esp_wifi_is_rm_enabled_internal(ESP_IF_WIFI_STA)) + if (esp_wifi_is_rm_enabled_internal(WIFI_IF_STA)) wpa_s->subtype = 1 << WLAN_ACTION_RADIO_MEASUREMENT; - if (esp_wifi_is_btm_enabled_internal(ESP_IF_WIFI_STA)) + if (esp_wifi_is_btm_enabled_internal(WIFI_IF_STA)) wpa_s->subtype |= 1 << WLAN_ACTION_WNM; if (wpa_s->subtype) @@ -288,12 +288,12 @@ void wpa_supplicant_connect(struct wpa_supplicant *wpa_s, return; } - esp_wifi_get_config(ESP_IF_WIFI_STA, config); + esp_wifi_get_config(WIFI_IF_STA, config); /* We only support roaming in same ESS, therefore only bssid setting is needed */ os_memcpy(config->sta.bssid, bss->bssid, ETH_ALEN); config->sta.bssid_set = 1; esp_wifi_internal_issue_disconnect(WIFI_REASON_ROAMING); - esp_wifi_set_config(ESP_IF_WIFI_STA, config); + esp_wifi_set_config(WIFI_IF_STA, config); os_free(config); esp_wifi_connect(); } @@ -313,7 +313,7 @@ void esp_set_rm_enabled_ie(void) WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE; /* set rm enabled IE if enabled in driver */ - if (esp_wifi_is_rm_enabled_internal(ESP_IF_WIFI_STA)) { + if (esp_wifi_is_rm_enabled_internal(WIFI_IF_STA)) { esp_wifi_set_appie_internal(WIFI_APPIE_RM_ENABLED_CAPS, rmm_ie, rrm_ie_len, 0); } } @@ -350,7 +350,7 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s, goto cleanup; } - req->ifx = ESP_IF_WIFI_STA; + req->ifx = WIFI_IF_STA; req->subtype = WLAN_FC_STYPE_ACTION; req->data_len = data_len; os_memcpy(req->data, data, req->data_len); diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_scan.c b/components/wpa_supplicant/src/esp_supplicant/esp_scan.c index 70510e756d..286061d2d1 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_scan.c +++ b/components/wpa_supplicant/src/esp_supplicant/esp_scan.c @@ -38,7 +38,7 @@ static void esp_scan_done_event_handler(void* arg, esp_event_base_t event_base, struct wpa_supplicant *wpa_s = &g_wpa_supp; if (!wpa_s->scanning) { /* update last scan time */ - wpa_s->scan_start_tsf = esp_wifi_get_tsf_time(ESP_IF_WIFI_STA); + wpa_s->scan_start_tsf = esp_wifi_get_tsf_time(WIFI_IF_STA); wpa_printf(MSG_DEBUG, "scan not triggered by supplicant, ignore"); return; } @@ -174,7 +174,7 @@ static int esp_issue_scan(struct wpa_supplicant *wpa_s, { wifi_scan_config_t *params = NULL; int ret = 0; - u64 scan_start_tsf = esp_wifi_get_tsf_time(ESP_IF_WIFI_STA); + u64 scan_start_tsf = esp_wifi_get_tsf_time(WIFI_IF_STA); /* TODO: Directly try to connect if scan results are recent */ if ((scan_start_tsf - wpa_s->scan_start_tsf) > 100000) { @@ -183,7 +183,7 @@ static int esp_issue_scan(struct wpa_supplicant *wpa_s, wpa_bss_flush(wpa_s); } - esp_wifi_get_macaddr_internal(ESP_IF_WIFI_STA, wpa_s->tsf_bssid); + esp_wifi_get_macaddr_internal(WIFI_IF_STA, wpa_s->tsf_bssid); if (scan_params) { params = os_zalloc(sizeof(wifi_scan_config_t)); diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c index 2c467a4029..0da60abe9a 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa.c @@ -1023,7 +1023,7 @@ int ieee80211w_set_keys(struct wpa_sm *sm, if (keyidx > 4095) { return -1; } - return esp_wifi_set_igtk_internal(ESP_IF_WIFI_STA, igtk); + return esp_wifi_set_igtk_internal(WIFI_IF_STA, igtk); } return 0; #else @@ -2075,7 +2075,7 @@ bool wpa_sm_init(char * payload, WPA_SEND_FUNC snd_func, sm->key_entry_valid = 0; sm->key_install = false; - spp_attrubute = esp_wifi_get_spp_attrubute_internal(ESP_IF_WIFI_STA); + spp_attrubute = esp_wifi_get_spp_attrubute_internal(WIFI_IF_STA); sm->spp_sup.capable = ((spp_attrubute & WPA_CAPABILITY_SPP_CAPABLE) ? SPP_AMSDU_CAP_ENABLE : SPP_AMSDU_CAP_DISABLE); sm->spp_sup.require = ((spp_attrubute & WPA_CAPABILITY_SPP_REQUIRED) ? SPP_AMSDU_CAP_ENABLE : SPP_AMSDU_REQ_DISABLE); @@ -2169,7 +2169,7 @@ int wpa_set_bss(char *macddr, char * bssid, u8 pairwise_cipher, u8 group_cipher, if (esp_wifi_sta_pmf_enabled()) { wifi_config_t wifi_cfg; - esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg); + esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg); sm->pmf_cfg = wifi_cfg.sta.pmf_cfg; sm->mgmt_group_cipher = cipher_type_map_public_to_supp(esp_wifi_sta_get_mgmt_group_cipher()); } else { diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/wifi_connect.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/wifi_connect.c index 4b9c8fa611..57086d6921 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/wifi_connect.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/wifi_connect.c @@ -131,7 +131,7 @@ static void start(const char *ssid, const char *passwd) ESP_LOGI(TAG, "Connecting to %s...", wifi_config.sta.ssid); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start()); esp_wifi_connect(); s_connection_name = ssid; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c index 810b58b4a8..db7937e8d6 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c @@ -166,7 +166,7 @@ static bool wifi_cmd_sta_join(const char *ssid, const char *pass) reconnect = true; esp_wifi_disconnect(); //ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); //by snake - ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); esp_wifi_connect(); xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000 / portTICK_RATE_MS); diff --git a/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c b/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c index 90807fb820..fb93e64fee 100644 --- a/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c +++ b/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c @@ -131,7 +131,7 @@ void wifi_init_sta(void) }, }; ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); ESP_ERROR_CHECK(esp_wifi_start() ); ESP_LOGI(TAG, "wifi_init_sta finished."); diff --git a/examples/common_components/protocol_examples_common/connect.c b/examples/common_components/protocol_examples_common/connect.c index 25fa8e07c9..d6d2c0f2c2 100644 --- a/examples/common_components/protocol_examples_common/connect.c +++ b/examples/common_components/protocol_examples_common/connect.c @@ -269,7 +269,7 @@ static esp_netif_t *wifi_start(void) }; ESP_LOGI(TAG, "Connecting to %s...", wifi_config.sta.ssid); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start()); esp_wifi_connect(); return netif; diff --git a/examples/mesh/ip_internal_network/main/mesh_netif.c b/examples/mesh/ip_internal_network/main/mesh_netif.c index d94a8924be..d0a3aa2f27 100644 --- a/examples/mesh/ip_internal_network/main/mesh_netif.c +++ b/examples/mesh/ip_internal_network/main/mesh_netif.c @@ -251,7 +251,7 @@ mesh_netif_driver_t mesh_create_if_driver(bool is_ap, bool is_root) } // save station mac address to exclude it from routing-table on broadcast - esp_wifi_get_mac(ESP_IF_WIFI_STA, driver->sta_mac_addr); + esp_wifi_get_mac(WIFI_IF_STA, driver->sta_mac_addr); return driver; } @@ -301,7 +301,7 @@ static esp_err_t start_mesh_link_ap(void) static esp_err_t start_wifi_link_sta(void) { uint8_t mac[6]; - esp_wifi_get_mac(ESP_IF_WIFI_STA, mac); + esp_wifi_get_mac(WIFI_IF_STA, mac); esp_err_t ret; void *driver = esp_netif_get_io_driver(netif_sta); if ((ret = esp_wifi_register_if_rxcb(driver, esp_netif_receive, netif_sta)) != ESP_OK) { @@ -319,7 +319,7 @@ static esp_err_t start_wifi_link_sta(void) static esp_err_t start_mesh_link_sta(void) { uint8_t mac[MAC_ADDR_LEN]; - esp_wifi_get_mac(ESP_IF_WIFI_STA, mac); + esp_wifi_get_mac(WIFI_IF_STA, mac); esp_netif_set_mac(netif_sta, mac); esp_netif_action_start(netif_sta, NULL, 0, NULL); esp_netif_action_connected(netif_sta, NULL, 0, NULL); diff --git a/examples/protocols/esp_local_ctrl/main/app_main.c b/examples/protocols/esp_local_ctrl/main/app_main.c index 26cbf30bab..72c8f50920 100644 --- a/examples/protocols/esp_local_ctrl/main/app_main.c +++ b/examples/protocols/esp_local_ctrl/main/app_main.c @@ -89,7 +89,7 @@ esp_err_t wifi_init_sta(void) }, }; ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); ESP_ERROR_CHECK(esp_wifi_start() ); ESP_LOGI(TAG, "wifi_init_sta finished."); diff --git a/examples/provisioning/legacy/ble_prov/main/app_prov.c b/examples/provisioning/legacy/ble_prov/main/app_prov.c index ca12268d43..89c9533b90 100644 --- a/examples/provisioning/legacy/ble_prov/main/app_prov.c +++ b/examples/provisioning/legacy/ble_prov/main/app_prov.c @@ -288,7 +288,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned) /* Get WiFi Station configuration */ wifi_config_t wifi_cfg; - if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { + if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) { return ESP_FAIL; } @@ -309,7 +309,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg) } /* Configure WiFi station with host credentials * provided during provisioning */ - if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { + if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) { ESP_LOGE(TAG, "Failed to set WiFi configuration"); return ESP_FAIL; } diff --git a/examples/provisioning/legacy/console_prov/main/app_prov.c b/examples/provisioning/legacy/console_prov/main/app_prov.c index 6640467478..1e7a059e00 100644 --- a/examples/provisioning/legacy/console_prov/main/app_prov.c +++ b/examples/provisioning/legacy/console_prov/main/app_prov.c @@ -226,7 +226,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned) /* Get WiFi Station configuration */ wifi_config_t wifi_cfg; - if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { + if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) { return ESP_FAIL; } @@ -247,7 +247,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg) } /* Configure WiFi station with host credentials * provided during provisioning */ - if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { + if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) { ESP_LOGE(TAG, "Failed to set WiFi configuration"); return ESP_FAIL; } diff --git a/examples/provisioning/legacy/custom_config/main/app_prov.c b/examples/provisioning/legacy/custom_config/main/app_prov.c index f514a9c0e7..76b941fb96 100644 --- a/examples/provisioning/legacy/custom_config/main/app_prov.c +++ b/examples/provisioning/legacy/custom_config/main/app_prov.c @@ -251,7 +251,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned) /* Get WiFi Station configuration */ wifi_config_t wifi_cfg; - if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { + if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) { return ESP_FAIL; } @@ -272,7 +272,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg) } /* Configure WiFi station with host credentials * provided during provisioning */ - if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { + if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) { ESP_LOGE(TAG, "Failed to set WiFi configuration"); return ESP_FAIL; } diff --git a/examples/provisioning/legacy/softap_prov/main/app_prov.c b/examples/provisioning/legacy/softap_prov/main/app_prov.c index 1637ea0927..3560103f18 100644 --- a/examples/provisioning/legacy/softap_prov/main/app_prov.c +++ b/examples/provisioning/legacy/softap_prov/main/app_prov.c @@ -237,7 +237,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned) /* Get WiFi Station configuration */ wifi_config_t wifi_cfg; - if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { + if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) { return ESP_FAIL; } @@ -258,7 +258,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg) } /* Configure WiFi station with host credentials * provided during provisioning */ - if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { + if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) { ESP_LOGE(TAG, "Failed to set WiFi configuration"); return ESP_FAIL; } diff --git a/examples/system/console/main/cmd_wifi.c b/examples/system/console/main/cmd_wifi.c index 014d1918d7..0daf53677c 100644 --- a/examples/system/console/main/cmd_wifi.c +++ b/examples/system/console/main/cmd_wifi.c @@ -71,7 +71,7 @@ static bool wifi_join(const char *ssid, const char *pass, int timeout_ms) } ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); esp_wifi_connect(); int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, diff --git a/examples/wifi/fast_scan/main/fast_scan.c b/examples/wifi/fast_scan/main/fast_scan.c index 0fa7a5cbf9..90b943851c 100644 --- a/examples/wifi/fast_scan/main/fast_scan.c +++ b/examples/wifi/fast_scan/main/fast_scan.c @@ -110,7 +110,7 @@ static void fast_scan(void) }, }; ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start()); } diff --git a/examples/wifi/getting_started/station/main/station_example_main.c b/examples/wifi/getting_started/station/main/station_example_main.c index 171f6d4c4d..f8d91e26e1 100644 --- a/examples/wifi/getting_started/station/main/station_example_main.c +++ b/examples/wifi/getting_started/station/main/station_example_main.c @@ -104,7 +104,7 @@ void wifi_init_sta(void) }, }; ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); ESP_ERROR_CHECK(esp_wifi_start() ); ESP_LOGI(TAG, "wifi_init_sta finished."); diff --git a/examples/wifi/iperf/main/cmd_wifi.c b/examples/wifi/iperf/main/cmd_wifi.c index 94aaaf2c52..bfd70b4f1d 100644 --- a/examples/wifi/iperf/main/cmd_wifi.c +++ b/examples/wifi/iperf/main/cmd_wifi.c @@ -158,7 +158,7 @@ static bool wifi_cmd_sta_join(const char* ssid, const char* pass) reconnect = true; ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); esp_wifi_connect(); xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000/portTICK_RATE_MS); diff --git a/examples/wifi/power_save/main/power_save.c b/examples/wifi/power_save/main/power_save.c index 6e6203b9d6..5abe001337 100644 --- a/examples/wifi/power_save/main/power_save.c +++ b/examples/wifi/power_save/main/power_save.c @@ -74,7 +74,7 @@ static void wifi_power_save(void) }, }; ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start()); ESP_LOGI(TAG, "esp_wifi_set_ps()."); diff --git a/examples/wifi/roaming/main/roaming_example.c b/examples/wifi/roaming/main/roaming_example.c index 4d48453e1b..f136c2b49c 100644 --- a/examples/wifi/roaming/main/roaming_example.c +++ b/examples/wifi/roaming/main/roaming_example.c @@ -353,7 +353,7 @@ static void initialise_wifi(void) ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_start() ); } diff --git a/examples/wifi/smart_config/main/smartconfig_main.c b/examples/wifi/smart_config/main/smartconfig_main.c index 80ef2a4430..930127a7f4 100644 --- a/examples/wifi/smart_config/main/smartconfig_main.c +++ b/examples/wifi/smart_config/main/smartconfig_main.c @@ -78,7 +78,7 @@ static void event_handler(void* arg, esp_event_base_t event_base, } ESP_ERROR_CHECK( esp_wifi_disconnect() ); - ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); esp_wifi_connect(); } else if (event_base == SC_EVENT && event_id == SC_EVENT_SEND_ACK_DONE) { xEventGroupSetBits(s_wifi_event_group, ESPTOUCH_DONE_BIT); diff --git a/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c b/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c index 372b0cfd1f..87b114c444 100644 --- a/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c +++ b/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c @@ -126,7 +126,7 @@ static void initialise_wifi(void) }; ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); + ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EXAMPLE_EAP_ID, strlen(EXAMPLE_EAP_ID)) ); #ifdef CONFIG_EXAMPLE_VALIDATE_SERVER_CERT diff --git a/examples/wifi/wps/main/wps.c b/examples/wifi/wps/main/wps.c index 3e99570d63..8ba96a3c20 100644 --- a/examples/wifi/wps/main/wps.c +++ b/examples/wifi/wps/main/wps.c @@ -72,7 +72,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, if (ap_idx < s_ap_creds_num) { ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s", wps_ap_creds[ap_idx].sta.ssid, wps_ap_creds[ap_idx].sta.password); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wps_ap_creds[ap_idx++]) ); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wps_ap_creds[ap_idx++]) ); esp_wifi_connect(); } s_retry_num = 0; @@ -99,7 +99,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, /* If multiple AP credentials are received from WPS, connect with first one */ ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s", wps_ap_creds[0].sta.ssid, wps_ap_creds[0].sta.password); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wps_ap_creds[0]) ); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wps_ap_creds[0]) ); } /* * If only one AP credential is received from WPS, there will be no event data and From dffbce9813dd1980b247105bbb240ea206977d19 Mon Sep 17 00:00:00 2001 From: xiehang Date: Tue, 19 Jan 2021 11:58:04 +0800 Subject: [PATCH 2/2] esp_wifi: Modify ESP_IF_WIFI_AP to WIFI_IF_AP --- components/esp_wifi/test/test_wifi.c | 4 ++-- components/wifi_provisioning/src/scheme_softap.c | 2 +- .../ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c | 2 +- examples/ethernet/eth2ap/main/ethernet_example_main.c | 8 ++++---- examples/mesh/ip_internal_network/main/mesh_netif.c | 2 +- .../provisioning/legacy/custom_config/main/app_prov.c | 2 +- examples/provisioning/legacy/softap_prov/main/app_prov.c | 2 +- .../getting_started/softAP/main/softap_example_main.c | 2 +- examples/wifi/iperf/main/cmd_wifi.c | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/esp_wifi/test/test_wifi.c b/components/esp_wifi/test/test_wifi.c index e8627c637a..c33361f6ed 100644 --- a/components/esp_wifi/test/test_wifi.c +++ b/components/esp_wifi/test/test_wifi.c @@ -267,7 +267,7 @@ static void send_ds2ds_packet(void) // send packet 20 times to make sure receiver will get this packet for (uint16_t i = 0; i < 20; i++) { - esp_wifi_80211_tx(ESP_IF_WIFI_AP, ds2ds_pdu, sizeof(ds2ds_pdu), true); + esp_wifi_80211_tx(WIFI_IF_AP, ds2ds_pdu, sizeof(ds2ds_pdu), true); vTaskDelay(50 / portTICK_PERIOD_MS); } stop_wifi(); @@ -329,7 +329,7 @@ static void test_wifi_connection_softap(void) start_wifi_as_softap(); - TEST_ESP_OK(esp_wifi_get_mac(ESP_IF_WIFI_AP, mac)); + TEST_ESP_OK(esp_wifi_get_mac(WIFI_IF_AP, mac)); sprintf(mac_str, MACSTR, MAC2STR(mac)); unity_send_signal_param("SoftAP mac", mac_str); diff --git a/components/wifi_provisioning/src/scheme_softap.c b/components/wifi_provisioning/src/scheme_softap.c index fe25c1d613..289b1a4c62 100644 --- a/components/wifi_provisioning/src/scheme_softap.c +++ b/components/wifi_provisioning/src/scheme_softap.c @@ -63,7 +63,7 @@ static esp_err_t start_wifi_ap(const char *ssid, const char *pass) ESP_LOGE(TAG, "Failed to set Wi-Fi mode : %d", err); return err; } - err = esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config); + err = esp_wifi_set_config(WIFI_IF_AP, &wifi_config); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to set Wi-Fi config : %d", err); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c index db7937e8d6..40e67a3281 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c @@ -246,7 +246,7 @@ static bool wifi_cmd_ap_set(const char *ssid, const char *pass) } ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config)); return true; } diff --git a/examples/ethernet/eth2ap/main/ethernet_example_main.c b/examples/ethernet/eth2ap/main/ethernet_example_main.c index 246ec9754e..a61416e0fc 100644 --- a/examples/ethernet/eth2ap/main/ethernet_example_main.c +++ b/examples/ethernet/eth2ap/main/ethernet_example_main.c @@ -83,7 +83,7 @@ static void eth2wifi_flow_control_task(void *args) do { vTaskDelay(pdMS_TO_TICKS(timeout)); timeout += 2; - res = esp_wifi_internal_tx(ESP_IF_WIFI_AP, msg.packet, msg.length); + res = esp_wifi_internal_tx(WIFI_IF_AP, msg.packet, msg.length); } while (res && timeout < FLOW_CONTROL_WIFI_SEND_TIMEOUT_MS); if (res != ESP_OK) { ESP_LOGE(TAG, "WiFi send packet failed: %d", res); @@ -133,7 +133,7 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base, ESP_LOGI(TAG, "Wi-Fi AP got a station connected"); if (!s_con_cnt) { s_sta_is_connected = true; - esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, pkt_wifi2eth); + esp_wifi_internal_reg_rxcb(WIFI_IF_AP, pkt_wifi2eth); } s_con_cnt++; break; @@ -142,7 +142,7 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base, s_con_cnt--; if (!s_con_cnt) { s_sta_is_connected = false; - esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_AP, NULL); + esp_wifi_internal_reg_rxcb(WIFI_IF_AP, NULL); } break; default: @@ -250,7 +250,7 @@ static void initialize_wifi(void) wifi_config.ap.authmode = WIFI_AUTH_OPEN; } ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config)); } static esp_err_t initialize_flow_control(void) diff --git a/examples/mesh/ip_internal_network/main/mesh_netif.c b/examples/mesh/ip_internal_network/main/mesh_netif.c index d0a3aa2f27..1f5723693a 100644 --- a/examples/mesh/ip_internal_network/main/mesh_netif.c +++ b/examples/mesh/ip_internal_network/main/mesh_netif.c @@ -289,7 +289,7 @@ esp_err_t mesh_netifs_init(mesh_raw_recv_cb_t *cb) static esp_err_t start_mesh_link_ap(void) { uint8_t mac[MAC_ADDR_LEN]; - esp_wifi_get_mac(ESP_IF_WIFI_AP, mac); + esp_wifi_get_mac(WIFI_IF_AP, mac); esp_netif_set_mac(netif_ap, mac); esp_netif_action_start(netif_ap, NULL, 0, NULL); return ESP_OK; diff --git a/examples/provisioning/legacy/custom_config/main/app_prov.c b/examples/provisioning/legacy/custom_config/main/app_prov.c index 76b941fb96..c81ab21966 100644 --- a/examples/provisioning/legacy/custom_config/main/app_prov.c +++ b/examples/provisioning/legacy/custom_config/main/app_prov.c @@ -319,7 +319,7 @@ static esp_err_t start_wifi_ap(const char *ssid, const char *pass) ESP_LOGE(TAG, "Failed to set WiFi mode : %d", err); return err; } - err = esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config); + err = esp_wifi_set_config(WIFI_IF_AP, &wifi_config); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to set WiFi config : %d", err); return err; diff --git a/examples/provisioning/legacy/softap_prov/main/app_prov.c b/examples/provisioning/legacy/softap_prov/main/app_prov.c index 3560103f18..c57aa6ac18 100644 --- a/examples/provisioning/legacy/softap_prov/main/app_prov.c +++ b/examples/provisioning/legacy/softap_prov/main/app_prov.c @@ -305,7 +305,7 @@ static esp_err_t start_wifi_ap(const char *ssid, const char *pass) ESP_LOGE(TAG, "Failed to set WiFi mode : %d", err); return err; } - err = esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config); + err = esp_wifi_set_config(WIFI_IF_AP, &wifi_config); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to set WiFi config : %d", err); return err; diff --git a/examples/wifi/getting_started/softAP/main/softap_example_main.c b/examples/wifi/getting_started/softAP/main/softap_example_main.c index cf994be0bc..e252151486 100644 --- a/examples/wifi/getting_started/softAP/main/softap_example_main.c +++ b/examples/wifi/getting_started/softAP/main/softap_example_main.c @@ -74,7 +74,7 @@ void wifi_init_softap(void) } ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start()); ESP_LOGI(TAG, "wifi_init_softap finished. SSID:%s password:%s channel:%d", diff --git a/examples/wifi/iperf/main/cmd_wifi.c b/examples/wifi/iperf/main/cmd_wifi.c index bfd70b4f1d..ebfd0ea779 100644 --- a/examples/wifi/iperf/main/cmd_wifi.c +++ b/examples/wifi/iperf/main/cmd_wifi.c @@ -238,7 +238,7 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass) } ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); - ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config)); return true; }