Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ repos:
- repo: local
hooks:
- id: commit message scopes
name: "commit message must be scoped with: mdns, dns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls, lws, modem_sim"
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)\)\:)'
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"
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)\)\:)'
language: pygrep
args: [--multiline]
stages: [commit-msg]
49 changes: 49 additions & 0 deletions components/net_connect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
# Header only library for linux

idf_component_register(INCLUDE_DIRS include)
return()
endif()

set(srcs "stdin_out.c"
"connect.c"
"wifi_connect.c")

if(CONFIG_NET_CONNECT_PROVIDE_WIFI_CONSOLE_CMD)
list(APPEND srcs "console_cmd.c")
endif()

if(CONFIG_NET_CONNECT_ETHERNET)
list(APPEND srcs "eth_connect.c")
endif()

if(CONFIG_NET_CONNECT_THREAD)
list(APPEND srcs "thread_connect.c")
endif()

if(CONFIG_NET_CONNECT_PPP)
list(APPEND srcs "ppp_connect.c")
endif()


idf_component_register(SRCS "${srcs}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all these dependencies necessary?

INCLUDE_DIRS "include"
PRIV_REQUIRES esp_netif esp_driver_gpio esp_driver_uart esp_wifi vfs openthread)

if(CONFIG_NET_CONNECT_PROVIDE_WIFI_CONSOLE_CMD)
idf_component_optional_requires(PRIVATE console)
endif()

if(CONFIG_NET_CONNECT_ETHERNET)
idf_component_optional_requires(PRIVATE esp_eth)
endif()

if(CONFIG_NET_CONNECT_THREAD)
idf_component_optional_requires(PRIVATE openthread)
endif()

if(CONFIG_NET_CONNECT_PPP)
idf_component_optional_requires(PRIVATE esp_tinyusb espressif__esp_tinyusb)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't component manager solve this?

endif()
316 changes: 316 additions & 0 deletions components/net_connect/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
menu "Net Connect Configuration"

orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why source from the example?


config NET_CONNECT_WIFI
bool "connect using WiFi interface"
depends on !IDF_TARGET_LINUX && (SOC_WIFI_SUPPORTED || ESP_WIFI_REMOTE_ENABLED || ESP_HOST_WIFI_ENABLED)
default y if SOC_WIFI_SUPPORTED
help
Protocol examples can use Wi-Fi, Ethernet and/or Thread to connect to the network.
Choose this option to connect with WiFi

if NET_CONNECT_WIFI
config NET_CONNECT_WIFI_SSID_PWD_FROM_STDIN
bool "Get ssid and password from stdin"
default n
help
Give the WiFi SSID and password from stdin.

config NET_CONNECT_PROVIDE_WIFI_CONSOLE_CMD
depends on !NET_CONNECT_WIFI_SSID_PWD_FROM_STDIN
bool "Provide wifi connect commands"
default y
help
Provide wifi connect commands for esp_console.
Please use `example_register_wifi_connect_commands` to register them.

config NET_CONNECT_WIFI_SSID
depends on !NET_CONNECT_WIFI_SSID_PWD_FROM_STDIN
string "WiFi SSID"
default "myssid"
help
SSID (network name) for the example to connect to.

config NET_CONNECT_WIFI_PASSWORD
depends on !NET_CONNECT_WIFI_SSID_PWD_FROM_STDIN
string "WiFi Password"
default "mypassword"
help
WiFi password (WPA or WPA2) for the example to use.
Can be left blank if the network has no security set.

config NET_CONNECT_WIFI_CONN_MAX_RETRY
int "Maximum retry"
default 6
help
Set the Maximum retry to avoid station reconnecting to the AP unlimited,
in case the AP is really inexistent.

choice NET_CONNECT_WIFI_SCAN_METHOD
prompt "WiFi Scan Method"
default NET_CONNECT_WIFI_SCAN_METHOD_ALL_CHANNEL
help
WiFi scan method:

If "Fast" is selected, scan will end after find SSID match AP.

If "All Channel" is selected, scan will end after scan all the channel.

config NET_CONNECT_WIFI_SCAN_METHOD_FAST
bool "Fast"
config NET_CONNECT_WIFI_SCAN_METHOD_ALL_CHANNEL
bool "All Channel"
endchoice

menu "WiFi Scan threshold"
config NET_CONNECT_WIFI_SCAN_RSSI_THRESHOLD
int "WiFi minimum rssi"
range -127 0

default -127
help
The minimum rssi to accept in the scan mode.

choice NET_CONNECT_WIFI_SCAN_AUTH_MODE_THRESHOLD
prompt "WiFi Scan auth mode threshold"
default NET_CONNECT_WIFI_AUTH_OPEN
help
The weakest authmode to accept in the scan mode.

config NET_CONNECT_WIFI_AUTH_OPEN
bool "OPEN"
config NET_CONNECT_WIFI_AUTH_WEP
bool "WEP"
config NET_CONNECT_WIFI_AUTH_WPA_PSK
bool "WPA PSK"
config NET_CONNECT_WIFI_AUTH_WPA2_PSK
bool "WPA2 PSK"
config NET_CONNECT_WIFI_AUTH_WPA_WPA2_PSK
bool "WPA WPA2 PSK"
config NET_CONNECT_WIFI_AUTH_WPA2_ENTERPRISE
bool "WPA2 ENTERPRISE"
config NET_CONNECT_WIFI_AUTH_WPA3_PSK
bool "WPA3 PSK"
config NET_CONNECT_WIFI_AUTH_WPA2_WPA3_PSK
bool "WPA2 WPA3 PSK"
config NET_CONNECT_WIFI_AUTH_WAPI_PSK
bool "WAPI PSK"
endchoice
endmenu

choice NET_CONNECT_WIFI_CONNECT_AP_SORT_METHOD
prompt "WiFi Connect AP Sort Method"
default NET_CONNECT_WIFI_CONNECT_AP_BY_SIGNAL
help
WiFi connect AP sort method:

If "Signal" is selected, Sort matched APs in scan list by RSSI.

If "Security" is selected, Sort matched APs in scan list by security mode.

config NET_CONNECT_WIFI_CONNECT_AP_BY_SIGNAL
bool "Signal"
config NET_CONNECT_WIFI_CONNECT_AP_BY_SECURITY
bool "Security"
endchoice
endif

config NET_CONNECT_ETHERNET
bool "connect using Ethernet interface"
depends on !IDF_TARGET_LINUX
default y if !NET_CONNECT_WIFI && !NET_CONNECT_THREAD
help
Protocol examples can use Wi-Fi, Ethernet and/or Thread to connect to the network.
Choose this option to enable connection with Ethernet.
Go to `Top -> Ethernet Configuration` to configure the Ethernet interface.

config NET_CONNECT_DISABLE_ETHERNET_CONFIG
bool
select ETHERNET_INIT_OVERRIDE_DISABLE
default y if !NET_CONNECT_ETHERNET

config NET_CONNECT_PPP
bool "connect using Point to Point interface"
select LWIP_PPP_SUPPORT
help
Protocol examples can use PPP connection over serial line.
Choose this option to connect to the ppp server running
on your laptop over a serial line (either UART or USB ACM)

if NET_CONNECT_PPP
choice NET_CONNECT_PPP_DEVICE
prompt "Choose PPP device"
default NET_CONNECT_PPP_DEVICE_USB
help
Select which peripheral to use to connect to the PPP server.

config NET_CONNECT_PPP_DEVICE_USB
bool "USB"
depends on SOC_USB_OTG_SUPPORTED
select TINYUSB_CDC_ENABLED
help
Use USB ACM device.

config NET_CONNECT_PPP_DEVICE_UART
bool "UART"
help
Use UART.

endchoice

menu "UART Configuration"
depends on NET_CONNECT_PPP_DEVICE_UART
config NET_CONNECT_UART_TX_PIN
int "TXD Pin Number"
default 4
range 0 31
help
Pin number of UART TX.

config NET_CONNECT_UART_RX_PIN
int "RXD Pin Number"
default 5
range 0 31
help
Pin number of UART RX.

config NET_CONNECT_UART_BAUDRATE
int "UART Baudrate"
default 115200
range 9600 3000000
help
Baudrate of the UART device

endmenu

config NET_CONNECT_PPP_CONN_MAX_RETRY
int "Maximum retry"
default 6
help
Set the Maximum retry to avoid station reconnecting if the pppd
is not available

endif # NET_CONNECT_PPP

config NET_CONNECT_THREAD
bool "Connect using Thread interface"
depends on !IDF_TARGET_LINUX && OPENTHREAD_ENABLED
default y if SOC_IEEE802154_SUPPORTED
select NET_CONNECT_IPV6
help
Protocol examples can use Wi-Fi, Ethernet and/or Thread to connect to the network.
Choose this option to connect with Thread.
The operational active dataset of the Thread network can be configured in openthread
component at '->Components->OpenThread->Thread Core Features->Thread Operational Dataset'

if NET_CONNECT_THREAD
config NET_CONNECT_THREAD_TASK_STACK_SIZE
int "Example Thread task stack size"
default 8192
help
Thread task stack size

menu "Radio Spinel Options"
depends on OPENTHREAD_RADIO_SPINEL_UART || OPENTHREAD_RADIO_SPINEL_SPI

config NET_CONNECT_THREAD_UART_RX_PIN
depends on OPENTHREAD_RADIO_SPINEL_UART
int "Uart Rx Pin"
default 17

config NET_CONNECT_THREAD_UART_TX_PIN
depends on OPENTHREAD_RADIO_SPINEL_UART
int "Uart Tx pin"
default 18

config NET_CONNECT_THREAD_UART_BAUD
depends on OPENTHREAD_RADIO_SPINEL_UART
int "Uart baud rate"
default 460800

config NET_CONNECT_THREAD_UART_PORT
depends on OPENTHREAD_RADIO_SPINEL_UART
int "Uart port"
default 1

config NET_CONNECT_THREAD_SPI_CS_PIN
depends on OPENTHREAD_RADIO_SPINEL_SPI
int "SPI CS Pin"
default 10

config NET_CONNECT_THREAD_SPI_SCLK_PIN
depends on OPENTHREAD_RADIO_SPINEL_SPI
int "SPI SCLK Pin"
default 12

config NET_CONNECT_THREAD_SPI_MISO_PIN
depends on OPENTHREAD_RADIO_SPINEL_SPI
int "SPI MISO Pin"
default 13

config NET_CONNECT_THREAD_SPI_MOSI_PIN
depends on OPENTHREAD_RADIO_SPINEL_SPI
int "SPI MOSI Pin"
default 11

config NET_CONNECT_THREAD_SPI_INTR_PIN
depends on OPENTHREAD_RADIO_SPINEL_SPI
int "SPI Interrupt Pin"
default 8
endmenu

endif

config NET_CONNECT_IPV4
bool
depends on LWIP_IPV4
default n if NET_CONNECT_THREAD
default y

config NET_CONNECT_IPV6
depends on NET_CONNECT_WIFI || NET_CONNECT_ETHERNET || NET_CONNECT_PPP || NET_CONNECT_THREAD
bool "Obtain IPv6 address"
default y
select LWIP_IPV6
select LWIP_PPP_ENABLE_IPV6 if NET_CONNECT_PPP
help
By default, examples will wait until IPv4 and IPv6 local link addresses are obtained.
Disable this option if the network does not support IPv6.
Choose the preferred IPv6 address type if the connection code should wait until other than
the local link address gets assigned.
Consider enabling IPv6 stateless address autoconfiguration (SLAAC) in the LWIP component.

if NET_CONNECT_IPV6
choice NET_CONNECT_PREFERRED_IPV6
prompt "Preferred IPv6 Type"
default NET_CONNECT_IPV6_PREF_LOCAL_LINK
help
Select which kind of IPv6 address the connect logic waits for.

config NET_CONNECT_IPV6_PREF_LOCAL_LINK
bool "Local Link Address"
help
Blocks until Local link address assigned.

config NET_CONNECT_IPV6_PREF_GLOBAL
bool "Global Address"
help
Blocks until Global address assigned.

config NET_CONNECT_IPV6_PREF_SITE_LOCAL
bool "Site Local Address"
help
Blocks until Site link address assigned.

config NET_CONNECT_IPV6_PREF_UNIQUE_LOCAL
bool "Unique Local Link Address"
help
Blocks until Unique local address assigned.

endchoice

endif


endmenu
Loading
Loading