mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 18:27:31 +02:00
fix(wifi_remote): Make services restartable, code cleanup
This commit is contained in:
@ -4,40 +4,28 @@ This is a simple mqtt demo, that connects to WiFi AP first. This application has
|
||||
|
||||
## Overview
|
||||
|
||||
This is a simple example demonstrating connecting to an MQTT broker, subscribing and publishing some data.
|
||||
This example uses IDF build system and could be configured to be build and executed:
|
||||
* for any ESP32 family chip
|
||||
* for linux target
|
||||
When running this example on a target that doesn't natively support WiFi, please make sure that the remote target (slave application) is connected to your chipset via the configured transport interface.
|
||||
|
||||
## How to use example
|
||||
Connection to the slave device also depends on RPC library used. It is recommended to use [`esp_hosted`](https://github.com/espressif/esp-hosted). Alternatively you can use [`eppp_link`](https://components.espressif.com/components/espressif/eppp_link).
|
||||
|
||||
### Hardware Required
|
||||
Please note, that `esp_hosted` as a component is currently WIP, so the `wifi_remote` defaults to `eppp`, for now.
|
||||
|
||||
To run this example, you need any ESP32 development board or just PC/virtual machine/container running linux operating system.
|
||||
## HW connection
|
||||
|
||||
### Host build modes
|
||||
We currently support only `UART` transport, so the connection is very simple. You only need to connect Rx, Tx and GND with the remote target.
|
||||
You need to configure these fields according to your connection:
|
||||
* CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN
|
||||
* CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN
|
||||
|
||||
Linux build is supported in these two modes:
|
||||
* `WITH_LWIP=0`: Without lwIP component. The project uses linux BSD socket interface to interact with TCP/IP stack. There's no connection phase, we use the host network as users. This mode is often referred to as user-side networking.
|
||||
* `WITH_LWIP=1`: Including lwIP component, which is added to the list of required components and compiled on host. In this mode, we have to map the host network (linux TCP/IP stack) to the target network (lwip). We use IDF's [`tapif_io`](https://github.com/espressif/esp-idf/tree/master/examples/common_components/protocol_examples_tapif_io) component to create a network interface, which will be used to pass packets to and from the simulated target. Please refer to the [README](https://github.com/espressif/esp-idf/tree/master/examples/common_components/protocol_examples_tapif_io#readme) for more details about the host side networking.
|
||||
## SW configuration
|
||||
|
||||
### Building on linux
|
||||
The RPC mechanism between the host and the slave micro uses TLS with mutual authentication, so you would have to configure certificates and keys for both parties. This application -- host target -- is considered RPC client, so it needs client's certificate and key, as well as the CA certificate to validate the server (slave application).
|
||||
If self-signed certificates are acceptable, you can use [generate_test_certs](../test_certs/generate_test_certs.sh) script to generate both the CA and the keys itself and convert them to the PEM format that's accepted by the EPPP RPC engine.
|
||||
You will have to configure these options:
|
||||
* CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_CA
|
||||
* CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_CRT
|
||||
* CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_KEY
|
||||
|
||||
1) Configure linux target
|
||||
```bash
|
||||
idf.py --preview set-target linux
|
||||
```
|
||||
## Setting up slave device
|
||||
|
||||
2) Build the project with preferred components (with or without lwip)
|
||||
```bash
|
||||
idf.py -DWITH_LWIP=0 build # Building without lwip (user networking)
|
||||
idf.py -DWITH_LWIP=1 build # Building with lwip (TAP networking)
|
||||
```
|
||||
|
||||
3) Run the project
|
||||
|
||||
It is possible to run the project elf file directly, or using `idf.py` monitor target (no need to flash):
|
||||
```bash
|
||||
idf.py monitor
|
||||
```
|
||||
idf.py -DWITH_LWIP=0 build # Building without lwip (user networking)
|
||||
You need to set up the connection and configuration in a similar way on the slave part (connection pins + certificates and keys). Please refer to the [slave_application](../server/README.md) README for more information.
|
||||
|
Reference in New Issue
Block a user