Преглед изворни кода

Merge branch 'docs/esp_netif_programmer_manual' into 'master'

esp netif: formal fixes (docs and c++ sentinels again)

Closes IDFGH-2265

See merge request espressif/esp-idf!6819
Angus Gratton пре 6 година
родитељ
комит
30372f5a4f
72 измењених фајлова са 231 додато и 69 уклоњено
  1. 4 2
      components/esp_netif/include/esp_netif_net_stack.h
  2. 1 1
      components/esp_netif/lwip/esp_netif_lwip.c
  3. 8 0
      components/tcpip_adapter/include/tcpip_adapter.h
  4. 8 0
      components/tcpip_adapter/include/tcpip_adapter_compatible/tcpip_adapter_compat.h
  5. 9 0
      components/tcpip_adapter/include/tcpip_adapter_types.h
  6. 2 0
      docs/Doxyfile
  7. 34 5
      docs/en/api-reference/network/esp_netif.rst
  8. 97 0
      docs/en/api-reference/network/esp_netif_driver.rst
  9. 1 0
      docs/en/api-reference/network/index.rst
  10. 1 0
      docs/zh_CN/api-reference/network/esp_netif_driver.rst
  11. 5 0
      docs/zh_CN/api-reference/network/index.rst
  12. 1 1
      examples/bluetooth/bluedroid/ble/blufi/main/blufi_example_main.c
  13. 1 1
      examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/components/iperf/cmd_wifi.c
  14. 1 1
      examples/ethernet/basic/main/ethernet_example_main.c
  15. 1 1
      examples/ethernet/iperf/main/cmd_ethernet.c
  16. 1 1
      examples/mesh/internal_communication/main/mesh_main.c
  17. 1 1
      examples/mesh/manual_networking/main/mesh_main.c
  18. 1 1
      examples/protocols/coap_client/main/coap_client_example_main.c
  19. 1 1
      examples/protocols/coap_server/main/coap_server_example_main.c
  20. 1 1
      examples/protocols/esp_http_client/main/esp_http_client_example.c
  21. 1 1
      examples/protocols/esp_local_ctrl/main/app_main.c
  22. 1 1
      examples/protocols/http2_request/main/http2_request_example_main.c
  23. 1 1
      examples/protocols/http_request/main/http_request_example_main.c
  24. 1 1
      examples/protocols/http_server/advanced_tests/main/main.c
  25. 1 1
      examples/protocols/http_server/file_serving/main/main.c
  26. 1 1
      examples/protocols/http_server/persistent_sockets/main/main.c
  27. 1 1
      examples/protocols/http_server/restful_server/main/esp_rest_main.c
  28. 1 1
      examples/protocols/http_server/simple/main/main.c
  29. 1 1
      examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c
  30. 1 1
      examples/protocols/https_request/main/https_request_example_main.c
  31. 1 1
      examples/protocols/https_server/main/main.c
  32. 1 1
      examples/protocols/icmp_echo/main/echo_example_main.c
  33. 1 1
      examples/protocols/mqtt/publish_test/main/publish_test.c
  34. 1 1
      examples/protocols/mqtt/ssl/main/app_main.c
  35. 1 1
      examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c
  36. 1 1
      examples/protocols/mqtt/ssl_psk/main/app_main.c
  37. 1 1
      examples/protocols/mqtt/tcp/main/app_main.c
  38. 1 1
      examples/protocols/mqtt/ws/main/app_main.c
  39. 1 1
      examples/protocols/mqtt/wss/main/app_main.c
  40. 1 1
      examples/protocols/openssl_client/main/openssl_client_example_main.c
  41. 1 1
      examples/protocols/openssl_server/main/openssl_server_example_main.c
  42. 1 1
      examples/protocols/pppos_client/main/pppos_client_main.c
  43. 1 1
      examples/protocols/sntp/main/sntp_example_main.c
  44. 1 1
      examples/protocols/sockets/tcp_client/main/tcp_client.c
  45. 1 1
      examples/protocols/sockets/tcp_server/main/tcp_server.c
  46. 1 1
      examples/protocols/sockets/udp_client/main/udp_client.c
  47. 1 1
      examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c
  48. 1 1
      examples/protocols/sockets/udp_server/main/udp_server.c
  49. 1 1
      examples/protocols/websocket/main/websocket_example.c
  50. 1 1
      examples/provisioning/ble_prov/main/app_main.c
  51. 1 1
      examples/provisioning/console_prov/main/app_main.c
  52. 1 1
      examples/provisioning/custom_config/main/app_main.c
  53. 1 1
      examples/provisioning/manager/main/app_main.c
  54. 1 1
      examples/provisioning/softap_prov/main/app_main.c
  55. 1 1
      examples/provisioning/softap_prov/softap_prov_test.py
  56. 1 1
      examples/system/console/main/cmd_wifi.c
  57. 1 1
      examples/system/network_tests/main/net_suite.c
  58. 1 1
      examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c
  59. 1 1
      examples/system/ota/native_ota_example/main/native_ota_example.c
  60. 1 1
      examples/system/ota/simple_ota_example/main/simple_ota_example.c
  61. 1 1
      examples/system/select/main/select_example.c
  62. 1 1
      examples/wifi/espnow/main/espnow_example_main.c
  63. 1 1
      examples/wifi/fast_scan/main/fast_scan.c
  64. 1 1
      examples/wifi/getting_started/softAP/main/softap_example_main.c
  65. 1 1
      examples/wifi/getting_started/station/main/station_example_main.c
  66. 1 1
      examples/wifi/iperf/main/cmd_wifi.c
  67. 1 1
      examples/wifi/power_save/main/power_save.c
  68. 1 1
      examples/wifi/scan/main/scan.c
  69. 1 1
      examples/wifi/simple_sniffer/main/simple_sniffer_example_main.c
  70. 1 1
      examples/wifi/smart_config/main/smartconfig_main.c
  71. 1 1
      examples/wifi/wpa2_enterprise/main/wpa2_enterprise_main.c
  72. 1 1
      examples/wifi/wps/main/wps.c

+ 4 - 2
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);
 

+ 1 - 1
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;
 

+ 8 - 0
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_

+ 8 - 0
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_

+ 9 - 0
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_

+ 2 - 0
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
     ##

+ 34 - 5
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

+ 97 - 0
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

+ 1 - 0
docs/en/api-reference/network/index.rst

@@ -42,6 +42,7 @@ IP Network Layer
     :hidden:
 
     TCP/IP Adapter Migration Guide <tcpip_adapter_migration.rst>
+    ESP-NETIF Custom I/O Driver <esp_netif_driver.rst>
 
 Code examples for TCP/IP socket APIs are provided in the :example:`protocols/sockets` directory of ESP-IDF examples.
 

+ 1 - 0
docs/zh_CN/api-reference/network/esp_netif_driver.rst

@@ -0,0 +1 @@
+.. include:: ../../../en/api-reference/network/esp_netif_driver.rst

+ 5 - 0
docs/zh_CN/api-reference/network/index.rst

@@ -37,7 +37,12 @@ IP 网络层协议
    :maxdepth: 1
 
    ESP-NETIF <esp_netif.rst>
+
+.. toctree::
+   :hidden:
+
    TCP/IP Adapter Migration Guide <tcpip_adapter_migration.rst>
+   ESP-NETIF Custom I/O Driver <esp_netif_driver.rst>
 
 TCP/IP 套接字 API 的示例代码存放在 ESP-IDF 示例项目的 :example:`protocols/sockets` 目录下。
 

+ 1 - 1
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();

+ 1 - 1
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();

+ 1 - 1
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();

+ 1 - 1
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);

+ 1 - 1
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 */

+ 1 - 1
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 */

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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();

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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();

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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,

+ 1 - 1
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());

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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));

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
examples/protocols/websocket/main/websocket_example.c

@@ -117,7 +117,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.

+ 1 - 1
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 */

+ 1 - 1
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 */

+ 1 - 1
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 */

+ 1 - 1
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());

+ 1 - 1
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 */

+ 1 - 1
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")

+ 1 - 1
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();

+ 1 - 1
examples/system/network_tests/main/net_suite.c

@@ -106,7 +106,7 @@ void app_main(void)
 
     // Netif creation and configuration
     //
-    esp_netif_init();
+    ESP_ERROR_CHECK(esp_netif_init());
     esp_netif_t* netif = esp_netif_new(&config);
     assert(netif);
     esp_netif_attach(netif, netsuite_io_new());

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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);
 

+ 1 - 1
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) );

+ 1 - 1
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();

+ 1 - 1
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();
 

+ 1 - 1
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();

+ 1 - 1
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();

+ 1 - 1
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);

+ 1 - 1
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);

+ 1 - 1
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));

+ 1 - 1
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();

+ 1 - 1
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();

+ 1 - 1
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);