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
This commit is contained in:
Angus Gratton 2019-12-18 13:12:36 +08:00
commit 30372f5a4f
72 changed files with 231 additions and 69 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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_

View file

@ -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_

View file

@ -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_

View file

@ -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
##

View file

@ -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

View file

@ -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

View file

@ -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.

View file

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

View file

@ -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` 目录下。

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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);

View file

@ -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 */

View file

@ -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 */

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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();

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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();

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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,

View file

@ -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());

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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));

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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());

View file

@ -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 */

View file

@ -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")

View file

@ -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();

View file

@ -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());

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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);

View file

@ -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) );

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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);

View file

@ -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);

View file

@ -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));

View file

@ -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();

View file

@ -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();

View file

@ -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);