Skip to content

Commit 712046b

Browse files
committed
feat(net_connect): add net_connect component for unified network connectivity
Port the network connection functionality from esp-idf's protocol_examples_common component to esp-protocols as a standalone net_connect component. Changes: - Port all network connection code from esp-idf/examples/common_components/protocol_examples_common - Rename functions from example_* prefix to net_* prefix for consistency - Add unified API supporting WiFi, Ethernet, Thread, and PPP interfaces - Add comprehensive Kconfig options for all connection types - Add net_connect_example demonstrating component usage - Update component structure with proper CMakeLists.txt and idf_component.yml - Add README with usage instructions for all supported interfaces The component provides a unified interface for establishing network connectivity across multiple transport types, simplifying network setup in protocol examples and applications. Supported interfaces: - WiFi (Station mode with configurable scan methods) - Ethernet (EMAC and SPI-based) - Thread (IEEE802.15.4 native or RCP) - PPP (Point-to-Point Protocol over Serial/USB) All configuration is done via Kconfig menuconfig, making it easy to enable/disable specific interfaces and configure connection parameters.
1 parent 41f7157 commit 712046b

24 files changed

+2644
-2
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ repos:
5757
- repo: local
5858
hooks:
5959
- id: commit message scopes
60-
name: "commit message must be scoped with: mdns, dns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls, lws, modem_sim"
61-
entry: '\A(?!(feat|fix|ci|bump|test|docs|chore)\((mdns|dns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|tls_cxx|mosq|sockutls|lws|modem_sim)\)\:)'
60+
name: "commit message must be scoped with: mdns, dns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls, lws, modem_sim, net_connect"
61+
entry: '\A(?!(feat|fix|ci|bump|test|docs|chore)\((mdns|dns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|tls_cxx|mosq|sockutls|lws|modem_sim|net_connect)\)\:)'
6262
language: pygrep
6363
args: [--multiline]
6464
stages: [commit-msg]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
idf_build_get_property(target IDF_TARGET)
2+
3+
if(${target} STREQUAL "linux")
4+
# Header only library for linux
5+
6+
idf_component_register(INCLUDE_DIRS include
7+
SRCS protocol_examples_utils.c)
8+
return()
9+
endif()
10+
11+
set(srcs "stdin_out.c"
12+
"addr_from_stdin.c"
13+
"connect.c"
14+
"wifi_connect.c"
15+
"protocol_examples_utils.c")
16+
17+
if(CONFIG_NET_CONNECT_PROVIDE_WIFI_CONSOLE_CMD)
18+
list(APPEND srcs "console_cmd.c")
19+
endif()
20+
21+
if(CONFIG_NET_CONNECT_CONNECT_ETHERNET)
22+
list(APPEND srcs "eth_connect.c")
23+
endif()
24+
25+
if(CONFIG_NET_CONNECT_CONNECT_THREAD)
26+
list(APPEND srcs "thread_connect.c")
27+
endif()
28+
29+
if(CONFIG_NET_CONNECT_CONNECT_PPP)
30+
list(APPEND srcs "ppp_connect.c")
31+
endif()
32+
33+
34+
idf_component_register(SRCS "${srcs}"
35+
INCLUDE_DIRS "include"
36+
PRIV_REQUIRES esp_netif esp_driver_gpio esp_driver_uart esp_wifi vfs console esp_eth openthread)
37+
38+
if(CONFIG_NET_CONNECT_PROVIDE_WIFI_CONSOLE_CMD)
39+
idf_component_optional_requires(PRIVATE console)
40+
endif()
41+
42+
if(CONFIG_NET_CONNECT_CONNECT_ETHERNET)
43+
idf_component_optional_requires(PUBLIC esp_eth)
44+
endif()
45+
46+
if(CONFIG_NET_CONNECT_CONNECT_THREAD)
47+
idf_component_optional_requires(PRIVATE openthread)
48+
endif()
49+
50+
if(CONFIG_NET_CONNECT_CONNECT_PPP)
51+
idf_component_optional_requires(PRIVATE esp_tinyusb espressif__esp_tinyusb)
52+
endif()

0 commit comments

Comments
 (0)