Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0 Network Refactoring #8760

Merged
merged 59 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ca7ec90
Create ESP_NetworkInterface class and have Ethernet extending it
me-no-dev Oct 13, 2023
e42b99a
Update CMakeLists.txt
me-no-dev Oct 18, 2023
044da55
Merge branch 'master' into feature/network_refactoring
me-no-dev Oct 18, 2023
f2824bc
Merge branch 'master' into feature/network_refactoring
me-no-dev Oct 23, 2023
74a18b6
Merge branch 'master' into feature/network_refactoring
me-no-dev Oct 23, 2023
0e6d289
Merge branch 'master' into feature/network_refactoring
me-no-dev Oct 24, 2023
0c561bc
Split networking from WiFi (H2 can now use Ethernet)
me-no-dev Oct 27, 2023
0edaa59
Fix build errors
me-no-dev Oct 27, 2023
dfc59e7
Guard WiFi classes and fix RMII ETH examples
me-no-dev Oct 27, 2023
da4d198
Decouple network related libraries from WiFi
me-no-dev Oct 31, 2023
105c739
Fix examples and WiFiUpdate
me-no-dev Oct 31, 2023
44f899f
Guard WiFiProv lib to compile only on WiFi chips
me-no-dev Oct 31, 2023
f4d8cba
Merge branch 'master' into feature/network_refactoring
me-no-dev Nov 9, 2023
78cc5ec
Merge branch 'master' into feature/network_refactoring
me-no-dev Nov 10, 2023
61b8675
Merge branch 'master' into feature/network_refactoring
me-no-dev Nov 10, 2023
4f087ee
Merge branch 'master' into feature/network_refactoring
me-no-dev Nov 10, 2023
638abc3
Add periman string for network and "fix" mdns on the first ETH
me-no-dev Nov 10, 2023
7f4b1ec
Revert back location of Client/Server/Udp in order to accept some PRs
me-no-dev Nov 13, 2023
3a83cfa
Merge branch 'master' into feature/network_refactoring
me-no-dev Nov 27, 2023
c8a4d5a
Fix periman
me-no-dev Nov 27, 2023
8ace49a
Merge branch 'master' into feature/network_refactoring
me-no-dev Nov 29, 2023
102a776
Merge branch 'master' into feature/network_refactoring
me-no-dev Dec 15, 2023
864cec1
Merge branch 'master' into feature/network_refactoring
me-no-dev Jan 24, 2024
ae2a889
Some fixes from merging master
me-no-dev Jan 24, 2024
824d2a0
Fix web server missing fs.h
me-no-dev Jan 24, 2024
2085bbe
Move Client, Server and Udp out of WiFi
me-no-dev Jan 24, 2024
8c5ae3c
More fixes
me-no-dev Jan 24, 2024
ea1717b
more fixes
me-no-dev Jan 24, 2024
a8b19cd
Merge branch 'master' into feature/network_refactoring
me-no-dev Feb 1, 2024
09910c4
Fix CMakekLists and rework lib menu dependencies
me-no-dev Feb 1, 2024
2711182
Fix CMake issues
me-no-dev Feb 1, 2024
050a267
move back WiFiClient to rebase with master
me-no-dev Feb 22, 2024
43e0564
Merge branch 'master' into feature/network_refactoring
me-no-dev Feb 22, 2024
c44d255
Update ETH_TLK110.ino
me-no-dev Feb 22, 2024
1c580b8
Move back WiFiClient
me-no-dev Feb 22, 2024
f223ce0
Merge branch 'master' into feature/network_refactoring
me-no-dev Feb 28, 2024
6ce26e9
Merge branch 'master' into feature/network_refactoring
lucasssvaz Mar 1, 2024
6691cdb
Merge branch 'master' into feature/network_refactoring
me-no-dev Mar 1, 2024
9716d5d
Merge branch 'master' into feature/network_refactoring
me-no-dev Mar 18, 2024
bcc8e3d
Update progress
me-no-dev Mar 19, 2024
9bd5205
Update WiFiGeneric.cpp
me-no-dev Mar 19, 2024
1f5b81d
More fixes
me-no-dev Mar 19, 2024
1e6725a
Switch AP to the new interface
me-no-dev Mar 19, 2024
d8d2f09
Cleanup
me-no-dev Mar 19, 2024
4127270
Rename AP methods
me-no-dev Mar 19, 2024
bf97e36
Add extra interface info for Printable
me-no-dev Mar 19, 2024
7afd573
Rename IPv6 getters to clarify that they are returning LinkLocal address
me-no-dev Mar 20, 2024
cc5765f
Rename network classes
me-no-dev Mar 20, 2024
0ec3884
Update NetworkManager.h
me-no-dev Mar 20, 2024
a39dcfd
Rename WiFi Server and UDP
me-no-dev Mar 21, 2024
df90716
Rename WiFiClient and WiFiClientSecure
me-no-dev Mar 21, 2024
9db3df9
Update CMakeLists.txt
me-no-dev Mar 21, 2024
224e5eb
Update on-push.sh
me-no-dev Mar 21, 2024
c3efaa5
Rename Network library
me-no-dev Mar 21, 2024
29ab925
Remove unnecessary guard
me-no-dev Mar 25, 2024
d5d59d3
Merge branch 'master' into feature/network_refactoring
me-no-dev Mar 25, 2024
8f79cde
Get the correct interface MAC address for mDND Workstation service
me-no-dev Mar 25, 2024
7e893e9
Apply suggestions from code review
me-no-dev Mar 25, 2024
fb0041c
Merge branch 'master' into feature/network_refactoring
me-no-dev Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/scripts/on-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then
FQBN_ESP32H2="espressif:esp32:esp32h2:PartitionScheme=huge_app"

SKETCHES_ESP32="\
$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\
$ARDUINO_ESP32_PATH/libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\
$ARDUINO_ESP32_PATH/libraries/BLE/examples/Server/Server.ino\
$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino\
$ARDUINO_ESP32_PATH/libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics.ino\
Expand All @@ -90,7 +90,7 @@ else
BOARD="esp32dev"
OPTIONS="board_build.partitions = huge_app.csv"
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/Server/Server.ino" && \
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
Expand Down
22 changes: 15 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ set(ARDUINO_ALL_LIBRARIES
Insights
LittleFS
NetBIOS
Network
Preferences
RainMaker
SD_MMC
Expand All @@ -104,7 +105,7 @@ set(ARDUINO_ALL_LIBRARIES
Update
USB
WebServer
WiFiClientSecure
NetworkClientSecure
WiFi
WiFiProv
Wire
Expand Down Expand Up @@ -198,20 +199,27 @@ set(ARDUINO_LIBRARY_WebServer_SRCS
libraries/WebServer/src/Parsing.cpp
libraries/WebServer/src/detail/mimetable.cpp)

set(ARDUINO_LIBRARY_WiFiClientSecure_SRCS
libraries/WiFiClientSecure/src/ssl_client.cpp
libraries/WiFiClientSecure/src/WiFiClientSecure.cpp)
set(ARDUINO_LIBRARY_NetworkClientSecure_SRCS
libraries/NetworkClientSecure/src/ssl_client.cpp
libraries/NetworkClientSecure/src/NetworkClientSecure.cpp)

set(ARDUINO_LIBRARY_Network_SRCS
libraries/Network/src/NetworkInterface.cpp
libraries/Network/src/NetworkEvents.cpp
libraries/Network/src/NetworkManager.cpp
libraries/Network/src/NetworkClient.cpp
libraries/Network/src/NetworkServer.cpp
libraries/Network/src/NetworkUdp.cpp)

set(ARDUINO_LIBRARY_WiFi_SRCS
libraries/WiFi/src/WiFiAP.cpp
libraries/WiFi/src/WiFiClient.cpp
libraries/WiFi/src/WiFi.cpp
libraries/WiFi/src/WiFiGeneric.cpp
libraries/WiFi/src/WiFiMulti.cpp
libraries/WiFi/src/WiFiScan.cpp
libraries/WiFi/src/WiFiServer.cpp
libraries/WiFi/src/WiFiSTA.cpp
libraries/WiFi/src/WiFiUdp.cpp)
libraries/WiFi/src/STA.cpp
libraries/WiFi/src/AP.cpp)

set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp)

Expand Down
145 changes: 63 additions & 82 deletions Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -256,157 +256,138 @@ config ARDUINO_SELECTIVE_COMPILATION
bool "Include only specific Arduino libraries"
default n

config ARDUINO_SELECTIVE_ArduinoOTA
bool "Enable ArduinoOTA"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
select ARDUINO_SELECTIVE_ESPmDNS
default y

config ARDUINO_SELECTIVE_AsyncUDP
bool "Enable AsyncUDP"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

config ARDUINO_SELECTIVE_AzureIoT
bool "Enable AzureIoT"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_HTTPClient
default y

config ARDUINO_SELECTIVE_BLE
bool "Enable BLE"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

config ARDUINO_SELECTIVE_BluetoothSerial
bool "Enable BluetoothSerial"
config ARDUINO_SELECTIVE_SPI
bool "Enable SPI"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

config ARDUINO_SELECTIVE_DNSServer
bool "Enable DNSServer"
config ARDUINO_SELECTIVE_Wire
bool "Enable Wire"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
default y

config ARDUINO_SELECTIVE_EEPROM
bool "Enable EEPROM"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

config ARDUINO_SELECTIVE_ESP32
bool "Enable ESP32"
config ARDUINO_SELECTIVE_Preferences
bool "Enable Preferences"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

config ARDUINO_SELECTIVE_ESPmDNS
bool "Enable ESPmDNS"
config ARDUINO_SELECTIVE_Ticker
bool "Enable Ticker"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
default y

config ARDUINO_SELECTIVE_FFat
bool "Enable FFat"
config ARDUINO_SELECTIVE_Update
bool "Enable Update"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
default y

config ARDUINO_SELECTIVE_FS
bool "Enable FS"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

config ARDUINO_SELECTIVE_HTTPClient
bool "Enable HTTPClient"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
select ARDUINO_SELECTIVE_WiFiClientSecure
config ARDUINO_SELECTIVE_SD
bool "Enable SD"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y

config ARDUINO_SELECTIVE_LITTLEFS
bool "Enable LITTLEFS"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
config ARDUINO_SELECTIVE_SD_MMC
bool "Enable SD_MMC"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y

config ARDUINO_SELECTIVE_NetBIOS
bool "Enable NetBIOS"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
config ARDUINO_SELECTIVE_SPIFFS
bool "Enable SPIFFS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y

config ARDUINO_SELECTIVE_Preferences
bool "Enable Preferences"
depends on ARDUINO_SELECTIVE_COMPILATION
config ARDUINO_SELECTIVE_FFat
bool "Enable FFat"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y

config ARDUINO_SELECTIVE_SD
bool "Enable SD"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
config ARDUINO_SELECTIVE_LITTLEFS
bool "Enable LITTLEFS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_FS
default y

config ARDUINO_SELECTIVE_SD_MMC
bool "Enable SD_MMC"
config ARDUINO_SELECTIVE_Networking
bool "Enable Networking"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
default y

config ARDUINO_SELECTIVE_SimpleBLE
bool "Enable SimpleBLE"
depends on ARDUINO_SELECTIVE_COMPILATION
config ARDUINO_SELECTIVE_ArduinoOTA
bool "Enable ArduinoOTA"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
select ARDUINO_SELECTIVE_ESPmDNS
default y

config ARDUINO_SELECTIVE_SPI
bool "Enable SPI"
depends on ARDUINO_SELECTIVE_COMPILATION
config ARDUINO_SELECTIVE_AsyncUDP
bool "Enable AsyncUDP"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
default y

config ARDUINO_SELECTIVE_SPIFFS
bool "Enable SPIFFS"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_FS
config ARDUINO_SELECTIVE_DNSServer
bool "Enable DNSServer"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
default y

config ARDUINO_SELECTIVE_Ticker
bool "Enable Ticker"
depends on ARDUINO_SELECTIVE_COMPILATION
config ARDUINO_SELECTIVE_ESPmDNS
bool "Enable ESPmDNS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
default y

config ARDUINO_SELECTIVE_Update
bool "Enable Update"
depends on ARDUINO_SELECTIVE_COMPILATION
config ARDUINO_SELECTIVE_HTTPClient
bool "Enable HTTPClient"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
select ARDUINO_SELECTIVE_WiFiClientSecure
default y

config ARDUINO_SELECTIVE_NetBIOS
bool "Enable NetBIOS"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
default y

config ARDUINO_SELECTIVE_WebServer
bool "Enable WebServer"
depends on ARDUINO_SELECTIVE_COMPILATION
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
default y
select ARDUINO_SELECTIVE_FS

config ARDUINO_SELECTIVE_WiFi
bool "Enable WiFi"
depends on ARDUINO_SELECTIVE_COMPILATION
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
default y

config ARDUINO_SELECTIVE_WiFiClientSecure
bool "Enable WiFiClientSecure"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking
default y

config ARDUINO_SELECTIVE_WiFiProv
bool "Enable WiFiProv"
depends on ARDUINO_SELECTIVE_COMPILATION && ARDUINO_SELECTIVE_Networking && ARDUINO_SELECTIVE_WiFi
default y

config ARDUINO_SELECTIVE_BLE
bool "Enable BLE"
depends on ARDUINO_SELECTIVE_COMPILATION
select ARDUINO_SELECTIVE_WiFi
default y

config ARDUINO_SELECTIVE_Wire
bool "Enable Wire"
config ARDUINO_SELECTIVE_BluetoothSerial
bool "Enable BluetoothSerial"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

config ARDUINO_SELECTIVE_SimpleBLE
bool "Enable SimpleBLE"
depends on ARDUINO_SELECTIVE_COMPILATION
default y

endmenu

2 changes: 1 addition & 1 deletion docs/en/api/wifi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ Function to get the IPv6 address.

.. code-block:: arduino

IPAddress softAPIPv6();
IPAddress softAPlinkLocalIPv6();

The function will return the AP IPv6 address in ``IPAddress`` format.

Expand Down
2 changes: 1 addition & 1 deletion libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <NetworkUdp.h>
#include <ArduinoOTA.h>

const char* ssid = "..........";
Expand Down
6 changes: 3 additions & 3 deletions libraries/ArduinoOTA/src/ArduinoOTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define LWIP_OPEN_SRC
#endif
#include <functional>
#include <WiFiUdp.h>
#include "ArduinoOTA.h"
#include "NetworkClient.h"
#include "ESPmDNS.h"
#include "MD5Builder.h"
#include "Update.h"
Expand Down Expand Up @@ -128,7 +128,7 @@ void ArduinoOTAClass::begin() {
if (!_hostname.length()) {
char tmp[20];
uint8_t mac[6];
WiFi.macAddress(mac);
Network.macAddress(mac);
sprintf(tmp, "esp32-%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
_hostname = tmp;
}
Expand Down Expand Up @@ -266,7 +266,7 @@ void ArduinoOTAClass::_runUpdate() {
_progress_callback(0, _size);
}

WiFiClient client;
NetworkClient client;
if (!client.connect(_ota_ip, _ota_port)) {
if (_error_callback) {
_error_callback(OTA_CONNECT_ERROR);
Expand Down
6 changes: 3 additions & 3 deletions libraries/ArduinoOTA/src/ArduinoOTA.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef __ARDUINO_OTA_H
#define __ARDUINO_OTA_H

#include <WiFi.h>
#include <functional>
#include "Network.h"
#include "Update.h"
#include <functional>

#define INT_BUFFER_SIZE 16

Expand Down Expand Up @@ -86,7 +86,7 @@ class ArduinoOTAClass
String _hostname;
String _partition_label;
String _nonce;
WiFiUDP _udp_ota;
NetworkUDP _udp_ota;
bool _initialized;
bool _rebootOnSuccess;
bool _mdnsEnabled;
Expand Down
6 changes: 5 additions & 1 deletion libraries/DNSServer/src/DNSServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ DNSServer::DNSServer(const String &domainName) : _port(DNS_DEFAULT_PORT), _ttl(h

bool DNSServer::start(){
if (_resolvedIP.operator uint32_t() == 0){ // no address is set, try to obtain AP interface's IP
#if SOC_WIFI_SUPPORTED
if (WiFi.getMode() & WIFI_AP){
_resolvedIP = WiFi.softAPIP();
} else return false; // won't run if WiFi is not in AP mode
return true;
}
#endif
return false; // won't run if WiFi is not in AP mode
}

_udp.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@

// Face Detection will not work on boards without (or with disabled) PSRAM
#ifdef BOARD_HAS_PSRAM
#define CONFIG_ESP_FACE_DETECT_ENABLED 1
// Face Recognition takes upward from 15 seconds per frame on chips other than ESP32S3
// Makes no sense to have it enabled for them
#if CONFIG_IDF_TARGET_ESP32S3
#define CONFIG_ESP_FACE_RECOGNITION_ENABLED 1
#define CONFIG_ESP_FACE_DETECT_ENABLED 1
#else
#define CONFIG_ESP_FACE_RECOGNITION_ENABLED 0
#define CONFIG_ESP_FACE_DETECT_ENABLED 0
#endif
#else
#define CONFIG_ESP_FACE_DETECT_ENABLED 0
Expand Down
Loading
Loading