From ac47c74ec4c6a5984ce2d191a895d6b8f7f993b1 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 25 Nov 2019 16:40:56 +0100 Subject: [PATCH 1/4] esp_netif, docs: Added programmer's manual section Also added guide for creating a custom network capable I/O driver And added notes about default wifi interfaces and implications of using default short-hand creation functions. --- .../esp_netif/include/esp_netif_net_stack.h | 6 +- docs/Doxyfile | 2 + docs/en/api-reference/network/esp_netif.rst | 39 +++++++- .../network/esp_netif_driver.rst | 97 +++++++++++++++++++ docs/en/api-reference/network/index.rst | 1 + .../network/esp_netif_driver.rst | 1 + docs/zh_CN/api-reference/network/index.rst | 5 + 7 files changed, 144 insertions(+), 7 deletions(-) create mode 100644 docs/en/api-reference/network/esp_netif_driver.rst create mode 100644 docs/zh_CN/api-reference/network/esp_netif_driver.rst diff --git a/components/esp_netif/include/esp_netif_net_stack.h b/components/esp_netif/include/esp_netif_net_stack.h index 334183a11..c38297a9f 100644 --- a/components/esp_netif/include/esp_netif_net_stack.h +++ b/components/esp_netif/include/esp_netif_net_stack.h @@ -62,8 +62,10 @@ void* esp_netif_get_netif_impl(esp_netif_t *esp_netif); * This function gets called from network stack to output packets to IO driver. * * @param[in] esp_netif Handle to esp-netif instance - * @param[in] data Data to be tranmitted + * @param[in] data Data to be transmitted * @param[in] len Length of the data frame + * + * @return ESP_OK on success, an error passed from the I/O driver otherwise */ esp_err_t esp_netif_transmit(esp_netif_t *esp_netif, void* data, size_t len); @@ -75,7 +77,7 @@ esp_err_t esp_netif_transmit(esp_netif_t *esp_netif, void* data, size_t len); * to avoid copying) * * @param[in] esp_netif Handle to esp-netif instance - * @param[in] void* buffer: rx buffer pointer + * @param[in] buffer Rx buffer pointer */ void esp_netif_free_rx_buffer(void *esp_netif, void* buffer); diff --git a/docs/Doxyfile b/docs/Doxyfile index a6f301cf5..c880f3b68 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -28,6 +28,7 @@ INPUT = \ ../../components/esp_wifi/include/esp_wifi_types.h \ ../../components/esp_wifi/include/esp_smartconfig.h \ ../../components/esp_wifi/include/esp_now.h \ + ../../components/esp_wifi/include/esp_wifi_default.h \ ## Mesh - API Reference ../../components/esp_wifi/include/esp_mesh.h \ ## Event loop - API Reference @@ -127,6 +128,7 @@ INPUT = \ ../../components/soc/esp32/include/soc/rtc_io_channel.h \ ## esp_netif - API Reference ../../components/esp_netif/include/esp_netif.h \ + ../../components/esp_netif/include/esp_netif_net_stack.h \ ## ## Protocols - API Reference ## diff --git a/docs/en/api-reference/network/esp_netif.rst b/docs/en/api-reference/network/esp_netif.rst index da44cbbd0..ea159c08c 100644 --- a/docs/en/api-reference/network/esp_netif.rst +++ b/docs/en/api-reference/network/esp_netif.rst @@ -90,10 +90,6 @@ B) Interaction with network interfaces using ESP-NETIF API * Receiving IP events (connect/disconnect) * Controlling application lifecycle (set interface up/down) -Please note that the initialization code as well as registering event handlers for default interfaces, -such as WiFi softAP and WiFi station, are provided as a separate APIs (for example ``esp_netif_create_default_wifi_ap()`` and -``esp_netif_create_default_wifi_sta()``) to facilitate simple startup code for most applications. - B) Communication driver, IO driver, media driver ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -105,7 +101,7 @@ Communication driver plays these two important roles in relation with ESP-NETIF: 2) Glue IO layer: Adapts the input/output functions to use ESP-NETIF transmit, receive and free receive buffer * Installs driver_transmit to appropriate ESP-NETIF object, so that outgoing packets from network stack are passed to the IO driver - * Calls ``esp_netif_receive()`` to pass incoming data to network stack + * Calls :cpp:func:`esp_netif_receive()` to pass incoming data to network stack C) ESP-NETIF, former tcpip_adapter @@ -140,9 +136,42 @@ Network stack has no public interaction with application code with regard to pub ESP-NETIF API. +ESP-NETIF programmer's manual +----------------------------- + +Please refer to the example section for basic initialization of default interfaces: + +- WiFi Station: :example:`examples/wifi/getting_started/station/main/station_example_main.c` +- WiFi Access Point: :example:`examples/wifi/getting_started/softAP/main/softap_example_main.c` +- Ethernet :example:`examples/ethernet/basic/main/ethernet_example_main.c` + +For more specific cases please consult this guide: :doc:`/api-reference/network/esp_netif_driver`. + + +WiFi default initialization +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The initialization code as well as registering event handlers for default interfaces, +such as softAP and station, are provided in two separate APIs to facilitate simple startup code for most applications: + +* :cpp:func:`esp_netif_create_default_wifi_ap()` +* :cpp:func:`esp_netif_create_default_wifi_sta()` + +Please note that these functions return the ``esp_netif`` handle, i.e. a pointer to a network interface object allocated and +configured with default settings, which as a consequence, means that: + +* The created object has to be destroyed if a network de-initialization is provided by an application. +* These *default* interfaces must not be created multiple times, unless the created handle is deleted using :cpp:func:`esp_netif_destroy()`. +* When using Wifi in ``AP+STA`` mode, both these interfaces has to be created. + API Reference ------------- .. include:: /_build/inc/esp_netif.inc + +WiFi default API reference +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. include:: /_build/inc/esp_wifi_default.inc diff --git a/docs/en/api-reference/network/esp_netif_driver.rst b/docs/en/api-reference/network/esp_netif_driver.rst new file mode 100644 index 000000000..4dd7f1c6a --- /dev/null +++ b/docs/en/api-reference/network/esp_netif_driver.rst @@ -0,0 +1,97 @@ +ESP-NETIF Custom I/O Driver +=========================== + +This section outlines implementing a new I/O driver with esp-netif connection capabilities. +By convention the I/O driver has to register itself as an esp-netif driver and thus holds a dependency on esp-netif component +and is responsible for providing data path functions, post-attach callback and in most cases also default event handlers to define network interface +actions based on driver's lifecycle transitions. + + +Packet input/output +^^^^^^^^^^^^^^^^^^^ + +As shown in the diagram, the following three API functions for the packet data path must be defined for connecting with esp-netif: + +* :cpp:func:`esp_netif_transmit()` +* :cpp:func:`esp_netif_free_rx_buffer()` +* :cpp:func:`esp_netif_receive()` + +The first two functions for transmitting and freeing the rx buffer are provided as callbacks, i.e. they get called from +esp-netif (and its underlying TCP/IP stack) and I/O driver provides their implementation. + +The receiving function on the other hand gets called from the I/O driver, so that the driver's code simply calls :cpp:func:`esp_netif_receive()` +on a new data received event. + + +Post attach callback +^^^^^^^^^^^^^^^^^^^^ + +A final part of the network interface initialization consists of attaching the esp-netif instance to the I/O driver, by means +of calling the following API: + +.. code:: c + + esp_err_t esp_netif_attach(esp_netif_t *esp_netif, esp_netif_iodriver_handle driver_handle); + +It is assumed that the ``esp_netif_iodriver_handle`` is a pointer to driver's object, a struct derived from ``struct esp_netif_driver_base_s``, +so that the first member of I/O driver structure must be this base structure with pointers to + +* post-attach function callback +* related esp-netif instance + +As a consequence the I/O driver has to create an instance of the struct per below: + +.. code:: c + + typedef struct my_netif_driver_s { + esp_netif_driver_base_t base; /*!< base structure reserved as esp-netif driver */ + driver_impl *h; /*!< handle of driver implementation */ + } my_netif_driver_t; + +with actual values of ``my_netif_driver_t::base.post_attach`` and the actual drivers handle ``my_netif_driver_t::h``. +So when the :cpp:func:`esp_netif_attach()` gets called from the initialization code, the post-attach callback from I/O driver's code +gets executed to mutually register callbacks between esp-netif and I/O driver instances. Typically the driver is started +as well in the post-attach callback. An example of a simple post-attach callback is outlined below: + +.. code:: c + + static esp_err_t my_post_attach_start(esp_netif_t * esp_netif, void * args) + { + my_netif_driver_t *driver = args; + const esp_netif_driver_ifconfig_t driver_ifconfig = { + .driver_free_rx_buffer = my_free_rx_buf, + .transmit = my_transmit, + .handle = driver->driver_impl + }; + driver->base.netif = esp_netif; + ESP_ERROR_CHECK(esp_netif_set_driver_config(esp_netif, &driver_ifconfig)); + my_driver_start(driver->driver_impl); + return ESP_OK; + } + + +Default handlers +^^^^^^^^^^^^^^^^ + +I/O drivers also typically provide default definitions of lifecycle behaviour of related network interfaces based +on state transitions of I/O drivers. For example *driver start* ``->`` *network start*, etc. +An example of such a default handler is provided below: + +.. code:: c + + esp_err_t my_driver_netif_set_default_handlers(my_netif_driver_t *driver, esp_netif_t * esp_netif) + { + driver_set_event_handler(driver->driver_impl, esp_netif_action_start, MY_DRV_EVENT_START, esp_netif); + driver_set_event_handler(driver->driver_impl, esp_netif_action_stop, MY_DRV_EVENT_STOP, esp_netif); + return ESP_OK; + } + + +Network stack connection +------------------------ + +The packet data path functions for transmitting and freeing the rx buffer (defined in the I/O driver) are called from +the esp-netif, specifically from its TCP/IP stack connecting layer. The following API reference outlines these network stack +interaction with the esp-netif. + +.. include:: /_build/inc/esp_netif_net_stack.inc diff --git a/docs/en/api-reference/network/index.rst b/docs/en/api-reference/network/index.rst index ab2bb3a73..82db052c2 100644 --- a/docs/en/api-reference/network/index.rst +++ b/docs/en/api-reference/network/index.rst @@ -42,6 +42,7 @@ IP Network Layer :hidden: TCP/IP Adapter Migration Guide + ESP-NETIF Custom I/O Driver Code examples for TCP/IP socket APIs are provided in the :example:`protocols/sockets` directory of ESP-IDF examples. diff --git a/docs/zh_CN/api-reference/network/esp_netif_driver.rst b/docs/zh_CN/api-reference/network/esp_netif_driver.rst new file mode 100644 index 000000000..127e5dcce --- /dev/null +++ b/docs/zh_CN/api-reference/network/esp_netif_driver.rst @@ -0,0 +1 @@ +.. include:: ../../../en/api-reference/network/esp_netif_driver.rst diff --git a/docs/zh_CN/api-reference/network/index.rst b/docs/zh_CN/api-reference/network/index.rst index 55c7ef168..57964dcca 100644 --- a/docs/zh_CN/api-reference/network/index.rst +++ b/docs/zh_CN/api-reference/network/index.rst @@ -37,7 +37,12 @@ IP 网络层协议 :maxdepth: 1 ESP-NETIF + +.. toctree:: + :hidden: + TCP/IP Adapter Migration Guide + ESP-NETIF Custom I/O Driver TCP/IP 套接字 API 的示例代码存放在 ESP-IDF 示例项目的 :example:`protocols/sockets` 目录下。 From f21107d12d48f195db49deef4cb1d29930ace3c5 Mon Sep 17 00:00:00 2001 From: Thomas Schaub Date: Wed, 27 Nov 2019 00:20:41 +0100 Subject: [PATCH 2/4] esp_netif/tcpip_adapter: declare functions extern "C" Merges https://github.com/espressif/esp-idf/pull/4408 --- components/tcpip_adapter/include/tcpip_adapter.h | 8 ++++++++ .../tcpip_adapter_compatible/tcpip_adapter_compat.h | 8 ++++++++ components/tcpip_adapter/include/tcpip_adapter_types.h | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/components/tcpip_adapter/include/tcpip_adapter.h b/components/tcpip_adapter/include/tcpip_adapter.h index 6c110b88a..db23a2ae6 100644 --- a/components/tcpip_adapter/include/tcpip_adapter.h +++ b/components/tcpip_adapter/include/tcpip_adapter.h @@ -23,6 +23,10 @@ #include "tcpip_adapter_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief tcpip adapter legacy init. It is used only to set the compatibility mode of esp-netif, which * will enable backward compatibility of esp-netif. @@ -245,4 +249,8 @@ esp_err_t tcpip_adapter_get_hostname(tcpip_adapter_if_t tcpip_if, const char **h */ esp_err_t tcpip_adapter_set_default_wifi_handlers(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif //_TCPIP_ADAPTER_H_ diff --git a/components/tcpip_adapter/include/tcpip_adapter_compatible/tcpip_adapter_compat.h b/components/tcpip_adapter/include/tcpip_adapter_compatible/tcpip_adapter_compat.h index bf32bd81d..2ccf4a483 100644 --- a/components/tcpip_adapter/include/tcpip_adapter_compatible/tcpip_adapter_compat.h +++ b/components/tcpip_adapter/include/tcpip_adapter_compatible/tcpip_adapter_compat.h @@ -15,6 +15,10 @@ #ifndef _TCPIP_ADAPTER_COMPAT_H_ #define _TCPIP_ADAPTER_COMPAT_H_ +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief This function is called from ethernet driver init code to facilitate * autostart fo the driver in backward compatible tcpip_adapter way @@ -54,4 +58,8 @@ esp_err_t tcpip_adapter_set_default_wifi_handlers(void); */ esp_err_t tcpip_adapter_clear_default_wifi_handlers(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif //_TCPIP_ADAPTER_COMPAT_H_ diff --git a/components/tcpip_adapter/include/tcpip_adapter_types.h b/components/tcpip_adapter/include/tcpip_adapter_types.h index 59f637fc7..37daf4675 100644 --- a/components/tcpip_adapter/include/tcpip_adapter_types.h +++ b/components/tcpip_adapter/include/tcpip_adapter_types.h @@ -18,6 +18,11 @@ #include "lwip/ip_addr.h" #include "dhcpserver/dhcpserver.h" #include "esp_netif_sta_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + // // Define compatible types if tcpip_adapter interface used // @@ -70,4 +75,8 @@ typedef esp_netif_dns_info_t tcpip_adapter_dns_info_t; typedef esp_netif_sta_list_t tcpip_adapter_sta_list_t; typedef esp_netif_sta_info_t tcpip_adapter_sta_info_t; +#ifdef __cplusplus +} // extern "C" +#endif + #endif // _TCPIP_ADAPTER_TYPES_H_ \ No newline at end of file From b61b9270083c39b252f2f3613130fe1444b29f6b Mon Sep 17 00:00:00 2001 From: David Cermak Date: Thu, 28 Nov 2019 16:28:38 +0100 Subject: [PATCH 3/4] esp_netif: minor log message fix in dhcps cb To make it more general, since the DHCP server does not necessarily runs only on softAP. --- components/esp_netif/lwip/esp_netif_lwip.c | 2 +- examples/provisioning/softap_prov/softap_prov_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index 91e7b13fd..1ed30fb0b 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -531,7 +531,7 @@ esp_err_t esp_netif_set_mac(esp_netif_t *esp_netif, uint8_t mac[]) static void esp_netif_dhcps_cb(u8_t client_ip[4]) { - ESP_LOGI(TAG, "softAP assign IP to station,IP is: %d.%d.%d.%d", + ESP_LOGI(TAG, "DHCP server assigned IP to a station, IP is: %d.%d.%d.%d", client_ip[0], client_ip[1], client_ip[2], client_ip[3]); ip_event_ap_staipassigned_t evt; diff --git a/examples/provisioning/softap_prov/softap_prov_test.py b/examples/provisioning/softap_prov/softap_prov_test.py index 9a6ee6858..5f7874d0c 100644 --- a/examples/provisioning/softap_prov/softap_prov_test.py +++ b/examples/provisioning/softap_prov/softap_prov_test.py @@ -55,7 +55,7 @@ def test_examples_provisioning_softap(env, extra_data): ctrl = wifi_tools.wpa_cli(iface, reset_on_exit=True) print("Connecting to DUT SoftAP...") ip = ctrl.connect(ssid, password) - got_ip = dut1.expect(re.compile(r"softAP assign IP to station,IP is: (\d+.\d+.\d+.\d+)"), timeout=30)[0] + got_ip = dut1.expect(re.compile(r"DHCP server assigned IP to a station, IP is: (\d+.\d+.\d+.\d+)"), timeout=30)[0] if ip != got_ip: raise RuntimeError("SoftAP connected to another host! " + ip + "!=" + got_ip) print("Connected to DUT SoftAP") From 31b270238789fa64fa4483dd2c7cbaca71b1f1b7 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 29 Nov 2019 10:54:02 +0100 Subject: [PATCH 4/4] esp_netif, examples: esp_netif_init() moved into ESP_ERROR_CHECK() esp_netif_init() returns standard esp_err_t error code (unlike tcpip_adapter init), so shall be checked for the return value Also to make the initialization code more consistent. --- .../bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c | 2 +- .../ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c | 2 +- examples/ethernet/basic/main/ethernet_example_main.c | 2 +- examples/ethernet/iperf/main/cmd_ethernet.c | 2 +- examples/mesh/internal_communication/main/mesh_main.c | 2 +- examples/mesh/manual_networking/main/mesh_main.c | 2 +- examples/protocols/coap_client/main/coap_client_example_main.c | 2 +- examples/protocols/coap_server/main/coap_server_example_main.c | 2 +- .../protocols/esp_http_client/main/esp_http_client_example.c | 2 +- examples/protocols/esp_local_ctrl/main/app_main.c | 2 +- .../protocols/http2_request/main/http2_request_example_main.c | 2 +- .../protocols/http_request/main/http_request_example_main.c | 2 +- examples/protocols/http_server/advanced_tests/main/main.c | 2 +- examples/protocols/http_server/file_serving/main/main.c | 2 +- examples/protocols/http_server/persistent_sockets/main/main.c | 2 +- .../protocols/http_server/restful_server/main/esp_rest_main.c | 2 +- examples/protocols/http_server/simple/main/main.c | 2 +- .../protocols/https_mbedtls/main/https_mbedtls_example_main.c | 2 +- .../protocols/https_request/main/https_request_example_main.c | 2 +- examples/protocols/https_server/main/main.c | 2 +- examples/protocols/icmp_echo/main/echo_example_main.c | 2 +- examples/protocols/mqtt/publish_test/main/publish_test.c | 2 +- examples/protocols/mqtt/ssl/main/app_main.c | 2 +- examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c | 2 +- examples/protocols/mqtt/ssl_psk/main/app_main.c | 2 +- examples/protocols/mqtt/tcp/main/app_main.c | 2 +- examples/protocols/mqtt/ws/main/app_main.c | 2 +- examples/protocols/mqtt/wss/main/app_main.c | 2 +- .../protocols/openssl_client/main/openssl_client_example_main.c | 2 +- .../protocols/openssl_server/main/openssl_server_example_main.c | 2 +- examples/protocols/pppos_client/main/pppos_client_main.c | 2 +- examples/protocols/sntp/main/sntp_example_main.c | 2 +- examples/protocols/sockets/tcp_client/main/tcp_client.c | 2 +- examples/protocols/sockets/tcp_server/main/tcp_server.c | 2 +- examples/protocols/sockets/udp_client/main/udp_client.c | 2 +- .../sockets/udp_multicast/main/udp_multicast_example_main.c | 2 +- examples/protocols/sockets/udp_server/main/udp_server.c | 2 +- examples/protocols/websocket/main/websocket_example.c | 2 +- examples/provisioning/ble_prov/main/app_main.c | 2 +- examples/provisioning/console_prov/main/app_main.c | 2 +- examples/provisioning/custom_config/main/app_main.c | 2 +- examples/provisioning/manager/main/app_main.c | 2 +- examples/provisioning/softap_prov/main/app_main.c | 2 +- examples/system/console/main/cmd_wifi.c | 2 +- examples/system/network_tests/main/net_suite.c | 2 +- .../ota/advanced_https_ota/main/advanced_https_ota_example.c | 2 +- .../system/ota/native_ota_example/main/native_ota_example.c | 2 +- .../system/ota/simple_ota_example/main/simple_ota_example.c | 2 +- examples/system/select/main/select_example.c | 2 +- examples/wifi/espnow/main/espnow_example_main.c | 2 +- examples/wifi/fast_scan/main/fast_scan.c | 2 +- examples/wifi/getting_started/softAP/main/softap_example_main.c | 2 +- .../wifi/getting_started/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/scan/main/scan.c | 2 +- examples/wifi/simple_sniffer/main/simple_sniffer_example_main.c | 2 +- examples/wifi/smart_config/main/smartconfig_main.c | 2 +- examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c | 2 +- examples/wifi/wps/main/wps.c | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c b/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c index 8bd8ac65e..c25e5c2fd 100644 --- a/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c +++ b/examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c @@ -212,7 +212,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, static void initialise_wifi(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); 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 87db1c785..28548c1ec 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 @@ -126,7 +126,7 @@ void initialise_wifi(void) return; } - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); diff --git a/examples/ethernet/basic/main/ethernet_example_main.c b/examples/ethernet/basic/main/ethernet_example_main.c index 0ed7c189f..59c81ef99 100644 --- a/examples/ethernet/basic/main/ethernet_example_main.c +++ b/examples/ethernet/basic/main/ethernet_example_main.c @@ -66,7 +66,7 @@ static void got_ip_event_handler(void *arg, esp_event_base_t event_base, void app_main(void) { // Initialize TCP/IP network interface (should be called only once in application) - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); // Create default event loop that running in background ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH(); diff --git a/examples/ethernet/iperf/main/cmd_ethernet.c b/examples/ethernet/iperf/main/cmd_ethernet.c index 63985c7d3..1303ac956 100644 --- a/examples/ethernet/iperf/main/cmd_ethernet.c +++ b/examples/ethernet/iperf/main/cmd_ethernet.c @@ -178,7 +178,7 @@ static void event_handler(void *arg, esp_event_base_t event_base, void register_ethernet(void) { eth_event_group = xEventGroupCreate(); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH(); eth_netif = esp_netif_new(&cfg); diff --git a/examples/mesh/internal_communication/main/mesh_main.c b/examples/mesh/internal_communication/main/mesh_main.c index 46fff40af..7d273b272 100644 --- a/examples/mesh/internal_communication/main/mesh_main.c +++ b/examples/mesh/internal_communication/main/mesh_main.c @@ -377,7 +377,7 @@ void app_main(void) ESP_ERROR_CHECK(mesh_light_init()); ESP_ERROR_CHECK(nvs_flash_init()); /* tcpip initialization */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); /* event initialization */ ESP_ERROR_CHECK(esp_event_loop_create_default()); /* crete network interfaces for mesh (only station instance saved for further manipulation, soft AP instance ignored */ diff --git a/examples/mesh/manual_networking/main/mesh_main.c b/examples/mesh/manual_networking/main/mesh_main.c index 9ffc971a3..7da60a50f 100644 --- a/examples/mesh/manual_networking/main/mesh_main.c +++ b/examples/mesh/manual_networking/main/mesh_main.c @@ -301,7 +301,7 @@ void app_main(void) ESP_ERROR_CHECK(mesh_light_init()); ESP_ERROR_CHECK(nvs_flash_init()); /* tcpip initialization */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); /* event initialization */ ESP_ERROR_CHECK(esp_event_loop_create_default()); /* crete network interfaces for mesh (only station instance saved for further manipulation, soft AP instance ignored */ diff --git a/examples/protocols/coap_client/main/coap_client_example_main.c b/examples/protocols/coap_client/main/coap_client_example_main.c index 423e9f7a1..f44112e91 100644 --- a/examples/protocols/coap_client/main/coap_client_example_main.c +++ b/examples/protocols/coap_client/main/coap_client_example_main.c @@ -440,7 +440,7 @@ clean_up: void app_main(void) { ESP_ERROR_CHECK( nvs_flash_init() ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/coap_server/main/coap_server_example_main.c b/examples/protocols/coap_server/main/coap_server_example_main.c index b8adb783d..58a698d8a 100644 --- a/examples/protocols/coap_server/main/coap_server_example_main.c +++ b/examples/protocols/coap_server/main/coap_server_example_main.c @@ -306,7 +306,7 @@ clean_up: void app_main(void) { ESP_ERROR_CHECK( nvs_flash_init() ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/esp_http_client/main/esp_http_client_example.c b/examples/protocols/esp_http_client/main/esp_http_client_example.c index 10d96034c..fc2485cce 100644 --- a/examples/protocols/esp_http_client/main/esp_http_client_example.c +++ b/examples/protocols/esp_http_client/main/esp_http_client_example.c @@ -541,7 +541,7 @@ void app_main(void) ret = nvs_flash_init(); } ESP_ERROR_CHECK(ret); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/esp_local_ctrl/main/app_main.c b/examples/protocols/esp_local_ctrl/main/app_main.c index a4dc11dc5..a4ed14a6a 100644 --- a/examples/protocols/esp_local_ctrl/main/app_main.c +++ b/examples/protocols/esp_local_ctrl/main/app_main.c @@ -65,7 +65,7 @@ void wifi_init_sta(void) { s_wifi_event_group = xEventGroupCreate(); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); diff --git a/examples/protocols/http2_request/main/http2_request_example_main.c b/examples/protocols/http2_request/main/http2_request_example_main.c index aaaa251a8..839c1474d 100644 --- a/examples/protocols/http2_request/main/http2_request_example_main.c +++ b/examples/protocols/http2_request/main/http2_request_example_main.c @@ -131,7 +131,7 @@ static void http2_task(void *args) void app_main(void) { ESP_ERROR_CHECK( nvs_flash_init() ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/http_request/main/http_request_example_main.c b/examples/protocols/http_request/main/http_request_example_main.c index e3a485bca..408bdc461 100644 --- a/examples/protocols/http_request/main/http_request_example_main.c +++ b/examples/protocols/http_request/main/http_request_example_main.c @@ -122,7 +122,7 @@ static void http_get_task(void *pvParameters) void app_main(void) { ESP_ERROR_CHECK( nvs_flash_init() ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/http_server/advanced_tests/main/main.c b/examples/protocols/http_server/advanced_tests/main/main.c index c30683ef0..702601513 100644 --- a/examples/protocols/http_server/advanced_tests/main/main.c +++ b/examples/protocols/http_server/advanced_tests/main/main.c @@ -46,7 +46,7 @@ void app_main(void) static httpd_handle_t server = NULL; ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/http_server/file_serving/main/main.c b/examples/protocols/http_server/file_serving/main/main.c index 463e6c643..7c2a2bbb8 100644 --- a/examples/protocols/http_server/file_serving/main/main.c +++ b/examples/protocols/http_server/file_serving/main/main.c @@ -67,7 +67,7 @@ esp_err_t start_file_server(const char *base_path); void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/http_server/persistent_sockets/main/main.c b/examples/protocols/http_server/persistent_sockets/main/main.c index 3905c4450..1b8044d3d 100644 --- a/examples/protocols/http_server/persistent_sockets/main/main.c +++ b/examples/protocols/http_server/persistent_sockets/main/main.c @@ -216,7 +216,7 @@ void app_main(void) static httpd_handle_t server = NULL; ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/http_server/restful_server/main/esp_rest_main.c b/examples/protocols/http_server/restful_server/main/esp_rest_main.c index 15580769b..f0d52ca57 100644 --- a/examples/protocols/http_server/restful_server/main/esp_rest_main.c +++ b/examples/protocols/http_server/restful_server/main/esp_rest_main.c @@ -126,7 +126,7 @@ esp_err_t init_fs(void) void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); initialise_mdns(); netbiosns_init(); diff --git a/examples/protocols/http_server/simple/main/main.c b/examples/protocols/http_server/simple/main/main.c index 93e624170..a17495124 100644 --- a/examples/protocols/http_server/simple/main/main.c +++ b/examples/protocols/http_server/simple/main/main.c @@ -272,7 +272,7 @@ void app_main(void) static httpd_handle_t server = NULL; ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c b/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c index 482133bf8..1bceffc82 100644 --- a/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c +++ b/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c @@ -274,7 +274,7 @@ static void https_get_task(void *pvParameters) void app_main(void) { ESP_ERROR_CHECK( nvs_flash_init() ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/https_request/main/https_request_example_main.c b/examples/protocols/https_request/main/https_request_example_main.c index b41fadb59..a5ade1e4f 100644 --- a/examples/protocols/https_request/main/https_request_example_main.c +++ b/examples/protocols/https_request/main/https_request_example_main.c @@ -151,7 +151,7 @@ static void https_get_task(void *pvParameters) void app_main(void) { ESP_ERROR_CHECK( nvs_flash_init() ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/https_server/main/main.c b/examples/protocols/https_server/main/main.c index 5f68eab0a..2cf9369b5 100644 --- a/examples/protocols/https_server/main/main.c +++ b/examples/protocols/https_server/main/main.c @@ -103,7 +103,7 @@ void app_main(void) static httpd_handle_t server = NULL; ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* Register event handlers to start server when Wi-Fi or Ethernet is connected, diff --git a/examples/protocols/icmp_echo/main/echo_example_main.c b/examples/protocols/icmp_echo/main/echo_example_main.c index 573378fe6..8ffd87b37 100644 --- a/examples/protocols/icmp_echo/main/echo_example_main.c +++ b/examples/protocols/icmp_echo/main/echo_example_main.c @@ -79,7 +79,7 @@ void app_main(void) initialize_console(); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* wait for active network connection */ ESP_ERROR_CHECK(example_connect()); diff --git a/examples/protocols/mqtt/publish_test/main/publish_test.c b/examples/protocols/mqtt/publish_test/main/publish_test.c index 2a20d1a41..b6b7e53a6 100644 --- a/examples/protocols/mqtt/publish_test/main/publish_test.c +++ b/examples/protocols/mqtt/publish_test/main/publish_test.c @@ -169,7 +169,7 @@ void app_main(void) esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/ssl/main/app_main.c b/examples/protocols/mqtt/ssl/main/app_main.c index f8e857351..1afb9c0b7 100644 --- a/examples/protocols/mqtt/ssl/main/app_main.c +++ b/examples/protocols/mqtt/ssl/main/app_main.c @@ -139,7 +139,7 @@ void app_main(void) esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c b/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c index 858f58aa7..6c620afd8 100644 --- a/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c +++ b/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c @@ -111,7 +111,7 @@ void app_main(void) esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/ssl_psk/main/app_main.c b/examples/protocols/mqtt/ssl_psk/main/app_main.c index 48e73f8c0..3ca754c25 100644 --- a/examples/protocols/mqtt/ssl_psk/main/app_main.c +++ b/examples/protocols/mqtt/ssl_psk/main/app_main.c @@ -128,7 +128,7 @@ void app_main(void) esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/tcp/main/app_main.c b/examples/protocols/mqtt/tcp/main/app_main.c index d4b631e1a..2c2abbe6f 100644 --- a/examples/protocols/mqtt/tcp/main/app_main.c +++ b/examples/protocols/mqtt/tcp/main/app_main.c @@ -138,7 +138,7 @@ void app_main(void) esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/ws/main/app_main.c b/examples/protocols/mqtt/ws/main/app_main.c index 5af121fee..96b29e33f 100644 --- a/examples/protocols/mqtt/ws/main/app_main.c +++ b/examples/protocols/mqtt/ws/main/app_main.c @@ -111,7 +111,7 @@ void app_main(void) esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/wss/main/app_main.c b/examples/protocols/mqtt/wss/main/app_main.c index 29b5de16a..61b7b446d 100644 --- a/examples/protocols/mqtt/wss/main/app_main.c +++ b/examples/protocols/mqtt/wss/main/app_main.c @@ -120,7 +120,7 @@ void app_main(void) esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/openssl_client/main/openssl_client_example_main.c b/examples/protocols/openssl_client/main/openssl_client_example_main.c index 09f508c9f..8e917e66d 100644 --- a/examples/protocols/openssl_client/main/openssl_client_example_main.c +++ b/examples/protocols/openssl_client/main/openssl_client_example_main.c @@ -174,7 +174,7 @@ void app_main(void) { ESP_ERROR_CHECK( nvs_flash_init() ); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/openssl_server/main/openssl_server_example_main.c b/examples/protocols/openssl_server/main/openssl_server_example_main.c index 2c94dd36d..1a79722e6 100644 --- a/examples/protocols/openssl_server/main/openssl_server_example_main.c +++ b/examples/protocols/openssl_server/main/openssl_server_example_main.c @@ -208,7 +208,7 @@ static void openssl_server_init(void) void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/pppos_client/main/pppos_client_main.c b/examples/protocols/pppos_client/main/pppos_client_main.c index 655809856..05e6e6cc0 100644 --- a/examples/protocols/pppos_client/main/pppos_client_main.c +++ b/examples/protocols/pppos_client/main/pppos_client_main.c @@ -215,7 +215,7 @@ void app_main(void) #else #error "Unsupported AUTH Negotiation" #endif - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &on_ip_event, NULL)); ESP_ERROR_CHECK(esp_event_handler_register(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, &on_ppp_changed, NULL)); diff --git a/examples/protocols/sntp/main/sntp_example_main.c b/examples/protocols/sntp/main/sntp_example_main.c index 94e842153..56625f9a0 100644 --- a/examples/protocols/sntp/main/sntp_example_main.c +++ b/examples/protocols/sntp/main/sntp_example_main.c @@ -119,7 +119,7 @@ void app_main(void) static void obtain_time(void) { ESP_ERROR_CHECK( nvs_flash_init() ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK( esp_event_loop_create_default() ); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/sockets/tcp_client/main/tcp_client.c b/examples/protocols/sockets/tcp_client/main/tcp_client.c index f8a93eaa7..2d2e515a0 100644 --- a/examples/protocols/sockets/tcp_client/main/tcp_client.c +++ b/examples/protocols/sockets/tcp_client/main/tcp_client.c @@ -112,7 +112,7 @@ static void tcp_client_task(void *pvParameters) void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/sockets/tcp_server/main/tcp_server.c b/examples/protocols/sockets/tcp_server/main/tcp_server.c index 6f3de3f04..7b5a1d1ae 100644 --- a/examples/protocols/sockets/tcp_server/main/tcp_server.c +++ b/examples/protocols/sockets/tcp_server/main/tcp_server.c @@ -137,7 +137,7 @@ CLEAN_UP: void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/sockets/udp_client/main/udp_client.c b/examples/protocols/sockets/udp_client/main/udp_client.c index 36de61fde..402d27274 100644 --- a/examples/protocols/sockets/udp_client/main/udp_client.c +++ b/examples/protocols/sockets/udp_client/main/udp_client.c @@ -111,7 +111,7 @@ static void udp_client_task(void *pvParameters) void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c b/examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c index fa0d41533..6215e7327 100644 --- a/examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c +++ b/examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c @@ -484,7 +484,7 @@ static void mcast_example_task(void *pvParameters) void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/sockets/udp_server/main/udp_server.c b/examples/protocols/sockets/udp_server/main/udp_server.c index 812126afe..5936c7671 100644 --- a/examples/protocols/sockets/udp_server/main/udp_server.c +++ b/examples/protocols/sockets/udp_server/main/udp_server.c @@ -112,7 +112,7 @@ static void udp_server_task(void *pvParameters) void app_main(void) { ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/websocket/main/websocket_example.c b/examples/protocols/websocket/main/websocket_example.c index 82e7ba385..5e99b4389 100644 --- a/examples/protocols/websocket/main/websocket_example.c +++ b/examples/protocols/websocket/main/websocket_example.c @@ -90,7 +90,7 @@ void app_main(void) esp_log_level_set("TRANS_TCP", ESP_LOG_DEBUG); ESP_ERROR_CHECK(nvs_flash_init()); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/provisioning/ble_prov/main/app_main.c b/examples/provisioning/ble_prov/main/app_main.c index 67f296826..e4ad35dec 100644 --- a/examples/provisioning/ble_prov/main/app_main.c +++ b/examples/provisioning/ble_prov/main/app_main.c @@ -112,7 +112,7 @@ static void start_ble_provisioning(void) void app_main(void) { /* Initialize networking stack */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); /* Create default event loop needed by the * main app and the provisioning service */ diff --git a/examples/provisioning/console_prov/main/app_main.c b/examples/provisioning/console_prov/main/app_main.c index f735078bc..25806de8a 100644 --- a/examples/provisioning/console_prov/main/app_main.c +++ b/examples/provisioning/console_prov/main/app_main.c @@ -83,7 +83,7 @@ static void start_console_provisioning(void) void app_main(void) { /* Initialize networking stack */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); /* Create default event loop needed by the * main app and the provisioning service */ diff --git a/examples/provisioning/custom_config/main/app_main.c b/examples/provisioning/custom_config/main/app_main.c index 7c39f69eb..773789a3b 100644 --- a/examples/provisioning/custom_config/main/app_main.c +++ b/examples/provisioning/custom_config/main/app_main.c @@ -84,7 +84,7 @@ static void start_softap_provisioning(void) void app_main(void) { /* Initialize networking stack */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); /* Create default event loop needed by the * main app and the provisioning service */ diff --git a/examples/provisioning/manager/main/app_main.c b/examples/provisioning/manager/main/app_main.c index 2b859702b..53ea813ea 100644 --- a/examples/provisioning/manager/main/app_main.c +++ b/examples/provisioning/manager/main/app_main.c @@ -107,7 +107,7 @@ void app_main(void) } /* Initialize TCP/IP */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); /* Initialize the event loop */ ESP_ERROR_CHECK(esp_event_loop_create_default()); diff --git a/examples/provisioning/softap_prov/main/app_main.c b/examples/provisioning/softap_prov/main/app_main.c index 8eb9225cd..6f6730087 100644 --- a/examples/provisioning/softap_prov/main/app_main.c +++ b/examples/provisioning/softap_prov/main/app_main.c @@ -99,7 +99,7 @@ static void start_softap_provisioning(void) void app_main(void) { /* Initialize networking stack */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); /* Create default event loop needed by the * main app and the provisioning service */ diff --git a/examples/system/console/main/cmd_wifi.c b/examples/system/console/main/cmd_wifi.c index 87555b656..e0751e476 100644 --- a/examples/system/console/main/cmd_wifi.c +++ b/examples/system/console/main/cmd_wifi.c @@ -44,7 +44,7 @@ static void initialise_wifi(void) if (initialized) { return; } - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *ap_netif = esp_netif_create_default_wifi_ap(); diff --git a/examples/system/network_tests/main/net_suite.c b/examples/system/network_tests/main/net_suite.c index 09bb03723..226ae2037 100644 --- a/examples/system/network_tests/main/net_suite.c +++ b/examples/system/network_tests/main/net_suite.c @@ -156,7 +156,7 @@ void app_main(void) // Netif creation and configure // - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); esp_netif_t* netif = esp_netif_new(&config); assert(netif); diff --git a/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c b/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c index 6728e63b2..f9407582c 100644 --- a/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c +++ b/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c @@ -125,7 +125,7 @@ void app_main(void) } ESP_ERROR_CHECK( err ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/system/ota/native_ota_example/main/native_ota_example.c b/examples/system/ota/native_ota_example/main/native_ota_example.c index 0e8b32d5e..69e216019 100644 --- a/examples/system/ota/native_ota_example/main/native_ota_example.c +++ b/examples/system/ota/native_ota_example/main/native_ota_example.c @@ -278,7 +278,7 @@ void app_main(void) } ESP_ERROR_CHECK( err ); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/system/ota/simple_ota_example/main/simple_ota_example.c b/examples/system/ota/simple_ota_example/main/simple_ota_example.c index 086b0f83a..8cb18d0a1 100644 --- a/examples/system/ota/simple_ota_example/main/simple_ota_example.c +++ b/examples/system/ota/simple_ota_example/main/simple_ota_example.c @@ -112,7 +112,7 @@ void app_main(void) } ESP_ERROR_CHECK(err); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/system/select/main/select_example.c b/examples/system/select/main/select_example.c index ccfcf28a7..464b3782e 100644 --- a/examples/system/select/main/select_example.c +++ b/examples/system/select/main/select_example.c @@ -43,7 +43,7 @@ static void socket_init(void) int err; struct sockaddr_in saddr = { 0 }; - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); err = getaddrinfo("localhost", "80", &hints, &res); diff --git a/examples/wifi/espnow/main/espnow_example_main.c b/examples/wifi/espnow/main/espnow_example_main.c index def33c4bf..c5311a17f 100644 --- a/examples/wifi/espnow/main/espnow_example_main.c +++ b/examples/wifi/espnow/main/espnow_example_main.c @@ -41,7 +41,7 @@ static void example_espnow_deinit(example_espnow_send_param_t *send_param); /* WiFi should start before using ESPNOW */ static void example_wifi_init(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); diff --git a/examples/wifi/fast_scan/main/fast_scan.c b/examples/wifi/fast_scan/main/fast_scan.c index 185cacc0c..4818dea5a 100644 --- a/examples/wifi/fast_scan/main/fast_scan.c +++ b/examples/wifi/fast_scan/main/fast_scan.c @@ -85,7 +85,7 @@ static void event_handler(void* arg, esp_event_base_t event_base, /* Initialize Wi-Fi as sta and set scan method */ static void fast_scan(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); 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 ca1883e04..8e7b747d0 100644 --- a/examples/wifi/getting_started/softAP/main/softap_example_main.c +++ b/examples/wifi/getting_started/softAP/main/softap_example_main.c @@ -45,7 +45,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, void wifi_init_softap(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_create_default_wifi_ap(); 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 9a5a94ac6..5c6b350b2 100644 --- a/examples/wifi/getting_started/station/main/station_example_main.c +++ b/examples/wifi/getting_started/station/main/station_example_main.c @@ -64,7 +64,7 @@ void wifi_init_sta(void) { s_wifi_event_group = xEventGroupCreate(); - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_create_default_wifi_sta(); diff --git a/examples/wifi/iperf/main/cmd_wifi.c b/examples/wifi/iperf/main/cmd_wifi.c index 380d7a968..128fe4703 100644 --- a/examples/wifi/iperf/main/cmd_wifi.c +++ b/examples/wifi/iperf/main/cmd_wifi.c @@ -108,7 +108,7 @@ void initialise_wifi(void) return; } - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK( esp_event_loop_create_default() ); netif_ap = esp_netif_create_default_wifi_ap(); diff --git a/examples/wifi/power_save/main/power_save.c b/examples/wifi/power_save/main/power_save.c index fd7bbbf96..ac8f8bbfa 100644 --- a/examples/wifi/power_save/main/power_save.c +++ b/examples/wifi/power_save/main/power_save.c @@ -55,7 +55,7 @@ static void event_handler(void* arg, esp_event_base_t event_base, /*init wifi as sta and set power save mode*/ static void wifi_power_save(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); assert(sta_netif); diff --git a/examples/wifi/scan/main/scan.c b/examples/wifi/scan/main/scan.c index b96fc4e81..65aad5bd7 100644 --- a/examples/wifi/scan/main/scan.c +++ b/examples/wifi/scan/main/scan.c @@ -103,7 +103,7 @@ static void print_cipher_type(int pairwise_cipher, int group_cipher) /* Initialize Wi-Fi as sta and set scan method */ static void wifi_scan(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); assert(sta_netif); diff --git a/examples/wifi/simple_sniffer/main/simple_sniffer_example_main.c b/examples/wifi/simple_sniffer/main/simple_sniffer_example_main.c index 3a60fc0ba..059aa5abc 100644 --- a/examples/wifi/simple_sniffer/main/simple_sniffer_example_main.c +++ b/examples/wifi/simple_sniffer/main/simple_sniffer_example_main.c @@ -64,7 +64,7 @@ static void initialize_nvs(void) /* Initialize wifi with tcp/ip adapter */ static void initialize_wifi(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_wifi_init(&cfg)); diff --git a/examples/wifi/smart_config/main/smartconfig_main.c b/examples/wifi/smart_config/main/smartconfig_main.c index b6498ca54..b8a668c3f 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, static void initialise_wifi(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); s_wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); diff --git a/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c b/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c index 841f68393..a3d453b6e 100644 --- a/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c +++ b/examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c @@ -104,7 +104,7 @@ static void initialise_wifi(void) unsigned int client_key_bytes = client_key_end - client_key_start; #endif /* CONFIG_EXAMPLE_EAP_METHOD_TLS */ - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); wifi_event_group = xEventGroupCreate(); ESP_ERROR_CHECK(esp_event_loop_create_default()); sta_netif = esp_netif_create_default_wifi_sta(); diff --git a/examples/wifi/wps/main/wps.c b/examples/wifi/wps/main/wps.c index 14d9a2859..a3f7237a7 100644 --- a/examples/wifi/wps/main/wps.c +++ b/examples/wifi/wps/main/wps.c @@ -97,7 +97,7 @@ static void got_ip_event_handler(void* arg, esp_event_base_t event_base, /*init wifi as sta and start wps*/ static void start_wps(void) { - esp_netif_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta(); assert(sta_netif);