mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_wifi: Modify ESP_IF_WIFI_STA to WIFI_IF_STA
This commit is contained in:
parent
8e8e54737d
commit
4c68212c8f
@ -82,7 +82,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( ADC2_CHANNEL_8, ADC_WIDTH_12Bit, &read_raw ));
|
||||
@ -205,7 +205,7 @@ TEST_CASE("adc1 and i2s 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));
|
||||
i2s_adc_test();
|
||||
//now start wifi
|
||||
printf("wifi start...\n");
|
||||
|
@ -74,7 +74,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());
|
||||
}
|
||||
@ -88,7 +88,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());
|
||||
|
@ -143,7 +143,7 @@ static void handle_sta_start(void *arg, esp_event_base_t base, int32_t event_id,
|
||||
uint8_t sta_mac[6];
|
||||
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_netstack_buf_cb",esp_wifi_internal_reg_netstack_buf_cb(esp_netif_netstack_buf_ref, esp_netif_netstack_buf_free), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_mac_get", esp_wifi_get_mac(ESP_IF_WIFI_STA, sta_mac), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_mac_get", esp_wifi_get_mac(WIFI_IF_STA, sta_mac), ESP_OK);
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &sta_ip);
|
||||
tcpip_adapter_sta_start(sta_mac, &sta_ip);
|
||||
}
|
||||
@ -157,7 +157,7 @@ static void handle_sta_connected(void *arg, esp_event_base_t base, int32_t event
|
||||
{
|
||||
tcpip_adapter_dhcp_status_t status;
|
||||
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_STA, (wifi_rxcb_t)tcpip_adapter_sta_input), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(WIFI_IF_STA, (wifi_rxcb_t)tcpip_adapter_sta_input), ESP_OK);
|
||||
|
||||
tcpip_adapter_up(TCPIP_ADAPTER_IF_STA);
|
||||
|
||||
@ -196,7 +196,7 @@ static void handle_sta_connected(void *arg, esp_event_base_t base, int32_t event
|
||||
static void handle_sta_disconnected(void *arg, esp_event_base_t base, int32_t event_id, void *data)
|
||||
{
|
||||
tcpip_adapter_down(TCPIP_ADAPTER_IF_STA);
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_STA, NULL), ESP_OK);
|
||||
API_CALL_CHECK("esp_wifi_internal_reg_rxcb", esp_wifi_internal_reg_rxcb(WIFI_IF_STA, NULL), ESP_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1104,7 +1104,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;
|
||||
}
|
||||
|
||||
@ -1163,7 +1163,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;
|
||||
@ -1433,14 +1433,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);
|
||||
@ -1526,7 +1526,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);
|
||||
|
@ -1021,7 +1021,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
|
||||
@ -2151,7 +2151,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 {
|
||||
|
@ -160,7 +160,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);
|
||||
|
@ -136,7 +136,7 @@ static void start()
|
||||
};
|
||||
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 = CONFIG_EXAMPLE_WIFI_SSID;
|
||||
|
@ -87,7 +87,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.");
|
||||
|
@ -287,7 +287,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;
|
||||
}
|
||||
|
||||
@ -308,7 +308,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;
|
||||
}
|
||||
|
@ -225,7 +225,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;
|
||||
}
|
||||
|
||||
@ -246,7 +246,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;
|
||||
}
|
||||
|
@ -250,7 +250,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;
|
||||
}
|
||||
|
||||
@ -271,7 +271,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;
|
||||
}
|
||||
|
@ -236,7 +236,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;
|
||||
}
|
||||
|
||||
@ -257,7 +257,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;
|
||||
}
|
||||
|
@ -67,7 +67,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,
|
||||
|
@ -105,7 +105,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());
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void wifi_init_sta()
|
||||
},
|
||||
};
|
||||
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.");
|
||||
|
@ -140,7 +140,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);
|
||||
|
@ -72,7 +72,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().");
|
||||
|
@ -69,7 +69,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "PASSWORD:%s", password);
|
||||
|
||||
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);
|
||||
|
@ -110,7 +110,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_ca_cert(ca_pem_start, ca_pem_bytes) );
|
||||
ESP_ERROR_CHECK( esp_wifi_sta_wpa2_ent_set_cert_key(client_crt_start, client_crt_bytes,\
|
||||
client_key_start, client_key_bytes, NULL, 0) );
|
||||
@ -133,7 +133,7 @@ static void wpa2_enterprise_example_task(void *pvParameters)
|
||||
while (1) {
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
|
||||
if (tcpip_adapter_get_ip_info(ESP_IF_WIFI_STA, &ip) == 0) {
|
||||
if (tcpip_adapter_get_ip_info(WIFI_IF_STA, &ip) == 0) {
|
||||
ESP_LOGI(TAG, "~~~~~~~~~~~");
|
||||
ESP_LOGI(TAG, "IP:"IPSTR, IP2STR(&ip.ip));
|
||||
ESP_LOGI(TAG, "MASK:"IPSTR, IP2STR(&ip.netmask));
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user