kopia lustrzana https://github.com/espressif/esp-idf
provisioning: examples updated to use esp_netif instead of tcpip_adapter
rodzic
204492bd78
commit
c00123c77b
|
@ -112,7 +112,7 @@ static void start_ble_provisioning(void)
|
|||
void app_main(void)
|
||||
{
|
||||
/* Initialize networking stack */
|
||||
tcpip_adapter_init();
|
||||
esp_netif_init();
|
||||
|
||||
/* Create default event loop needed by the
|
||||
* main app and the provisioning service */
|
||||
|
@ -121,7 +121,8 @@ void app_main(void)
|
|||
/* Initialize NVS needed by Wi-Fi */
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize Wi-Fi with default config */
|
||||
/* Initialize Wi-Fi including netif with default config */
|
||||
esp_netif_create_default_wifi_sta();
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <esp_log.h>
|
||||
|
||||
#include <esp_wifi.h>
|
||||
#include <tcpip_adapter.h>
|
||||
#include <esp_netif.h>
|
||||
|
||||
#include <wifi_provisioning/wifi_config.h>
|
||||
|
||||
|
@ -60,10 +60,9 @@ static esp_err_t get_status_handler(wifi_prov_config_get_data_t *resp_data, wifi
|
|||
ESP_LOGI(TAG, "Connected state");
|
||||
|
||||
/* IP Addr assigned to STA */
|
||||
tcpip_adapter_ip_info_t ip_info;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
|
||||
char *ip_addr = ip4addr_ntoa(&ip_info.ip);
|
||||
strcpy(resp_data->conn_info.ip_addr, ip_addr);
|
||||
esp_netif_ip_info_t ip_info;
|
||||
esp_netif_get_ip_info(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"), &ip_info);
|
||||
esp_ip4addr_ntoa(&ip_info.ip, resp_data->conn_info.ip_addr, sizeof(resp_data->conn_info.ip_addr));
|
||||
|
||||
/* AP information to which STA is connected */
|
||||
wifi_ap_record_t ap_info;
|
||||
|
|
|
@ -83,7 +83,7 @@ static void start_console_provisioning(void)
|
|||
void app_main(void)
|
||||
{
|
||||
/* Initialize networking stack */
|
||||
tcpip_adapter_init();
|
||||
esp_netif_init();
|
||||
|
||||
/* Create default event loop needed by the
|
||||
* main app and the provisioning service */
|
||||
|
@ -92,7 +92,8 @@ void app_main(void)
|
|||
/* Initialize NVS needed by Wi-Fi */
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize Wi-Fi with default config */
|
||||
/* Initialize Wi-Fi including netif with default config */
|
||||
esp_netif_create_default_wifi_sta();
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <esp_log.h>
|
||||
|
||||
#include <esp_wifi.h>
|
||||
#include <tcpip_adapter.h>
|
||||
#include <esp_netif.h>
|
||||
|
||||
#include <wifi_provisioning/wifi_config.h>
|
||||
|
||||
|
@ -60,10 +60,9 @@ static esp_err_t get_status_handler(wifi_prov_config_get_data_t *resp_data, wifi
|
|||
ESP_LOGI(TAG, "Connected state");
|
||||
|
||||
/* IP Addr assigned to STA */
|
||||
tcpip_adapter_ip_info_t ip_info;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
|
||||
char *ip_addr = ip4addr_ntoa(&ip_info.ip);
|
||||
strcpy(resp_data->conn_info.ip_addr, ip_addr);
|
||||
esp_netif_ip_info_t ip_info;
|
||||
esp_netif_get_ip_info(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"), &ip_info);
|
||||
esp_ip4addr_ntoa(&ip_info.ip, resp_data->conn_info.ip_addr, sizeof(resp_data->conn_info.ip_addr));
|
||||
|
||||
/* AP information to which STA is connected */
|
||||
wifi_ap_record_t ap_info;
|
||||
|
|
|
@ -84,7 +84,7 @@ static void start_softap_provisioning(void)
|
|||
void app_main(void)
|
||||
{
|
||||
/* Initialize networking stack */
|
||||
tcpip_adapter_init();
|
||||
esp_netif_init();
|
||||
|
||||
/* Create default event loop needed by the
|
||||
* main app and the provisioning service */
|
||||
|
@ -93,7 +93,9 @@ void app_main(void)
|
|||
/* Initialize NVS needed by Wi-Fi */
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize Wi-Fi with default config */
|
||||
/* Initialize Wi-Fi including netif with default config */
|
||||
esp_netif_create_default_wifi_sta();
|
||||
esp_netif_create_default_wifi_ap();
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <esp_log.h>
|
||||
|
||||
#include <esp_wifi.h>
|
||||
#include <tcpip_adapter.h>
|
||||
#include <esp_netif.h>
|
||||
|
||||
#include <wifi_provisioning/wifi_config.h>
|
||||
#include <custom_provisioning/custom_config.h>
|
||||
|
@ -72,10 +72,9 @@ static esp_err_t get_status_handler(wifi_prov_config_get_data_t *resp_data, wifi
|
|||
ESP_LOGI(TAG, "Connected state");
|
||||
|
||||
/* IP Addr assigned to STA */
|
||||
tcpip_adapter_ip_info_t ip_info;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
|
||||
char *ip_addr = ip4addr_ntoa(&ip_info.ip);
|
||||
strcpy(resp_data->conn_info.ip_addr, ip_addr);
|
||||
esp_netif_ip_info_t ip_info;
|
||||
esp_netif_get_ip_info(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"), &ip_info);
|
||||
esp_ip4addr_ntoa(&ip_info.ip, resp_data->conn_info.ip_addr, sizeof(resp_data->conn_info.ip_addr));
|
||||
|
||||
/* AP information to which STA is connected */
|
||||
wifi_ap_record_t ap_info;
|
||||
|
|
|
@ -107,7 +107,7 @@ void app_main(void)
|
|||
}
|
||||
|
||||
/* Initialize TCP/IP */
|
||||
tcpip_adapter_init();
|
||||
esp_netif_init();
|
||||
|
||||
/* Initialize the event loop */
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
|
@ -118,7 +118,8 @@ void app_main(void)
|
|||
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
|
||||
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL));
|
||||
|
||||
/* Initialize Wi-Fi */
|
||||
/* Initialize Wi-Fi including netif with default config */
|
||||
esp_netif_create_default_wifi_sta();
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ static void start_softap_provisioning(void)
|
|||
void app_main(void)
|
||||
{
|
||||
/* Initialize networking stack */
|
||||
tcpip_adapter_init();
|
||||
esp_netif_init();
|
||||
|
||||
/* Create default event loop needed by the
|
||||
* main app and the provisioning service */
|
||||
|
@ -108,7 +108,9 @@ void app_main(void)
|
|||
/* Initialize NVS needed by Wi-Fi */
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize Wi-Fi with default config */
|
||||
/* Initialize Wi-Fi including netif with default config */
|
||||
esp_netif_create_default_wifi_sta();
|
||||
esp_netif_create_default_wifi_ap();
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <esp_log.h>
|
||||
|
||||
#include <esp_wifi.h>
|
||||
#include <tcpip_adapter.h>
|
||||
#include <esp_netif.h>
|
||||
|
||||
#include <wifi_provisioning/wifi_config.h>
|
||||
|
||||
|
@ -60,10 +60,9 @@ static esp_err_t get_status_handler(wifi_prov_config_get_data_t *resp_data, wifi
|
|||
ESP_LOGI(TAG, "Connected state");
|
||||
|
||||
/* IP Addr assigned to STA */
|
||||
tcpip_adapter_ip_info_t ip_info;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
|
||||
char *ip_addr = ip4addr_ntoa(&ip_info.ip);
|
||||
strcpy(resp_data->conn_info.ip_addr, ip_addr);
|
||||
esp_netif_ip_info_t ip_info;
|
||||
esp_netif_get_ip_info(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"), &ip_info);
|
||||
esp_ip4addr_ntoa(&ip_info.ip, resp_data->conn_info.ip_addr, sizeof(resp_data->conn_info.ip_addr));
|
||||
|
||||
/* AP information to which STA is connected */
|
||||
wifi_ap_record_t ap_info;
|
||||
|
|
Ładowanie…
Reference in New Issue