Skip to content

Commit fd168d8

Browse files
committed
feat(wifi_remote): Add support for simple eppp based RPC
1 parent fbdb248 commit fd168d8

36 files changed

+1190
-124
lines changed
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
if(NOT CONFIG_ESP_WIFI_ENABLED)
2-
set(src_wifi_is_remote esp_wifi_remote.c esp_wifi_with_remote.c)
2+
set(src_wifi_is_remote esp_wifi_remote.c esp_wifi_with_remote.c esp_wifi_remote_net.c)
3+
endif()
4+
5+
if(CONFIG_ESP_WIFI_REMOTE_LIBRARY_EPPP)
6+
set(src_wifi_remote_eppp eppp/wifi_remote_rpc_client.cpp eppp/wifi_remote_rpc_server.cpp eppp/eppp_init.c)
7+
else()
8+
set(src_wifi_remote_weak esp_wifi_remote_weak.c)
39
endif()
410

511
idf_component_register(INCLUDE_DIRS include
6-
SRCS ${src_wifi_is_remote}
7-
esp_wifi_remote_net.c
8-
esp_wifi_remote_weak.c
12+
SRCS ${src_wifi_remote_weak}
13+
${src_wifi_remote_eppp}
14+
${src_wifi_is_remote}
15+
PRIV_INCLUDE_DIRS eppp
916
REQUIRES esp_event esp_netif
10-
PRIV_REQUIRES esp_wifi)
11-
12-
idf_component_optional_requires(PRIVATE esp_hosted)
17+
PRIV_REQUIRES esp_wifi esp-tls)
1318

1419
idf_component_get_property(wifi esp_wifi COMPONENT_LIB)
1520
target_link_libraries(${wifi} PUBLIC ${COMPONENT_LIB})

components/esp_wifi_remote/Kconfig

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ menu "Wi-Fi Remote"
55
default y
66

77
orsource "./Kconfig.soc_wifi_caps.in"
8+
orsource "./Kconfig.rpc.in"
89

910
config ESP_WIFI_STATIC_RX_BUFFER_NUM
1011
int "Max number of WiFi static RX buffers"
@@ -191,7 +192,7 @@ menu "Wi-Fi Remote"
191192
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
192193
compatibility but more memory. Most of time we should NOT change the default value unless special
193194
reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the
194-
recommended value is 9~12. If PSRAM is used and WiFi memory is prefered to allocat in PSRAM first,
195+
recommended value is 9~12. If PSRAM is used and WiFi memory is preferred to allocate in PSRAM first,
195196
the default and minimum value should be 16 to achieve better throughput and compatibility with both
196197
stations and APs.
197198

@@ -228,14 +229,14 @@ menu "Wi-Fi Remote"
228229
help
229230
ESP-MESH utilizes beacon frames to detect and resolve root node conflicts (see documentation). However
230231
the default length of a beacon frame can simultaneously hold only five root node identifier structures,
231-
meaning that a root node conflict of up to five nodes can be detected at one time. In the occurence of
232+
meaning that a root node conflict of up to five nodes can be detected at one time. In the occurrence of
232233
more root nodes conflict involving more than five root nodes, the conflict resolution process will
233234
detect five of the root nodes, resolve the conflict, and re-detect more root nodes. This process will
234235
repeat until all root node conflicts are resolved. However this process can generally take a very long
235236
time.
236237

237238
To counter this situation, the beacon frame length can be increased such that more root nodes can be
238-
detected simultaneously. Each additional root node will require 36 bytes and should be added ontop of
239+
detected simultaneously. Each additional root node will require 36 bytes and should be added on top of
239240
the default beacon frame length of
240241
752 bytes. For example, if you want to detect 10 root nodes simultaneously, you need to set the beacon
241242
frame length as
@@ -487,9 +488,9 @@ menu "Wi-Fi Remote"
487488
help
488489
Select this option to use MbedTLS TLS client for WPA2 enterprise connection.
489490
Please note that from MbedTLS-3.0 onwards, MbedTLS does not support SSL-3.0
490-
TLS-v1.0, TLS-v1.1 versions. Incase your server is using one of these version,
491+
TLS-v1.0, TLS-v1.1 versions. In case your server is using one of these version,
491492
it is advisable to update your server.
492-
Please disable this option for compatibilty with older TLS versions.
493+
Please disable this option for compatibility with older TLS versions.
493494

494495
config ESP_WIFI_EAP_TLS1_3
495496
bool "Enable EAP-TLS v1.3 Support for WiFi Enterprise connection"
@@ -556,6 +557,26 @@ menu "Wi-Fi Remote"
556557
help
557558
Select this option to enable WiFi Multiband operation certification support.
558559

560+
config ESP_WIFI_ENABLE_ROAMING_APP
561+
bool "Advanced support for Wi-Fi Roaming (Experimental)"
562+
depends on IDF_EXPERIMENTAL_FEATURES
563+
default n
564+
select ESP_WIFI_SCAN_CACHE
565+
help
566+
Enable Espressif's roaming app to allow for efficient Wi-Fi roaming.
567+
This includes configurable periodic environment scans, maintaining a cache of the
568+
best APs, handling low rssi events etc.
569+
570+
Risk Warning
571+
Please note that this feature is still experimental and enabling this potentially can
572+
lead to unpredictable scanning, connection and roaming attempts.
573+
We are still working on tuning and optimising this feature to ensure reliable and stable use.
574+
575+
menu "Configure roaming App"
576+
depends on ESP_WIFI_ENABLE_ROAMING_APP
577+
rsource "wifi_apps/roaming_app/src/Kconfig.roaming"
578+
endmenu
579+
559580
config ESP_WIFI_DPP_SUPPORT
560581
bool "Enable DPP support"
561582
default n
@@ -597,17 +618,17 @@ menu "Wi-Fi Remote"
597618
default n
598619
help
599620
Select this option to enable validate each WPS attribute
600-
rigorously. Disabling this add the workaorunds with various APs.
621+
rigorously. Disabling this add the workarounds with various APs.
601622
Enabling this may cause inter operability issues with some APs.
602623

603624
config ESP_WIFI_WPS_PASSPHRASE
604625
bool "Get WPA2 passphrase in WPS config"
605626
default n
606627
help
607628
Select this option to get passphrase during WPS configuration.
608-
This option fakes the virtual display capabilites to get the
629+
This option fakes the virtual display capabilities to get the
609630
configuration in passphrase mode.
610-
Not recommanded to be used since WPS credentials should not
631+
Not recommended to be used since WPS credentials should not
611632
be shared to other devices, making it in readable format increases
612633
that risk, also passphrase requires pbkdf2 to convert in psk.
613634

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
choice ESP_WIFI_REMOTE_LIBRARY
2+
prompt "Choose WiFi-remote implementation"
3+
default ESP_WIFI_REMOTE_LIBRARY_EPPP
4+
help
5+
Select type of WiFi Remote implementation
6+
7+
ESP-HOSTED is the default and most versatile option.
8+
It's also possible to use EPPP, which uses PPPoS link between micros and NAPT, so it's slower
9+
and less universal.
10+
11+
config ESP_WIFI_REMOTE_LIBRARY_HOSTED
12+
bool "ESP-HOSTED"
13+
config ESP_WIFI_REMOTE_LIBRARY_EPPP
14+
bool "EPPP"
15+
endchoice
16+
17+
if ESP_WIFI_REMOTE_LIBRARY_EPPP
18+
menu "WiFi remote by EPPP"
19+
20+
choice ESP_WIFI_REMOTE_EPPP_TRANSPORT
21+
prompt "Choose EPPP transport"
22+
default ESP_WIFI_REMOTE_EPPP_TRANSPORT_UART
23+
help
24+
Select type of EPPP transport
25+
26+
config ESP_WIFI_REMOTE_EPPP_TRANSPORT_UART
27+
bool "UART"
28+
config ESP_WIFI_REMOTE_EPPP_TRANSPORT_SPI
29+
bool "SPI"
30+
endchoice
31+
32+
if ESP_WIFI_REMOTE_EPPP_TRANSPORT_UART
33+
config ESP_WIFI_REMOTE_EPPP_UART_TX_PIN
34+
int "TXD Pin Number"
35+
default 10
36+
range 0 31
37+
help
38+
Pin number of UART TX.
39+
40+
config ESP_WIFI_REMOTE_EPPP_UART_RX_PIN
41+
int "RXD Pin Number"
42+
default 11
43+
range 0 31
44+
help
45+
Pin number of UART RX.
46+
endif
47+
48+
config ESP_WIFI_REMOTE_EPPP_SERVER_CA
49+
string "Servers CA certificate"
50+
default "--- Please copy content of the CA certificate ---"
51+
52+
config ESP_WIFI_REMOTE_EPPP_CLIENT_CRT
53+
string "Client certificate"
54+
default "--- Please copy content of the Client certificate ---"
55+
56+
config ESP_WIFI_REMOTE_EPPP_CLIENT_KEY
57+
string "Client key"
58+
default "--- Please copy content of the Client key ---"
59+
60+
config ESP_WIFI_REMOTE_EPPP_CLIENT_CA
61+
string "Clients CA certificate"
62+
default "--- Please copy content of the CA certificate ---"
63+
64+
config ESP_WIFI_REMOTE_EPPP_SERVER_CRT
65+
string "Server certificate"
66+
default "--- Please copy content of the Client certificate ---"
67+
68+
config ESP_WIFI_REMOTE_EPPP_SERVER_KEY
69+
string "Server key"
70+
default "--- Please copy content of the Client key ---"
71+
endmenu
72+
73+
endif

components/esp_wifi_remote/Kconfig.soc_wifi_caps.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,11 @@ endif # ESP32C6
227227
if SLAVE_IDF_TARGET_ESP32H2
228228

229229
endif # ESP32H2
230+
231+
if SLAVE_IDF_TARGET_ESP32P4
232+
233+
config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH
234+
int
235+
default 12
236+
237+
endif # ESP32P4
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#include "esp_log.h"
7+
#include "esp_wifi.h"
8+
#include "eppp_link.h"
9+
10+
esp_netif_t *wifi_remote_eppp_init(eppp_type_t role)
11+
{
12+
uint32_t our_ip = role == EPPP_SERVER ? EPPP_DEFAULT_SERVER_IP() : EPPP_DEFAULT_CLIENT_IP();
13+
uint32_t their_ip = role == EPPP_SERVER ? EPPP_DEFAULT_CLIENT_IP() : EPPP_DEFAULT_SERVER_IP();
14+
eppp_config_t config = EPPP_DEFAULT_CONFIG(our_ip, their_ip);
15+
#if CONFIG_ESP_WIFI_REMOTE_EPPP_TRANSPORT_UART
16+
config.transport = EPPP_TRANSPORT_UART;
17+
config.uart.tx_io = CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN;
18+
config.uart.rx_io = CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN;
19+
#else
20+
#error ESP_WIFI_REMOTE supports only UART transport
21+
#endif
22+
return eppp_open(role, &config, portMAX_DELAY);
23+
}

0 commit comments

Comments
 (0)