feat: add support for W5500 SPI Ethernet in gateway

- Introduced configuration options for wired Ethernet support in Kconfig and sdkconfig.
- Implemented Ethernet initialization and event handling in GatewayNetworkService.
- Enhanced app_main to manage Ethernet alongside Wi-Fi.
- Updated GatewayRuntime to store Ethernet information.
- Modified CMakeLists and include files to accommodate new Ethernet dependencies.
- Ensured backward compatibility by allowing Ethernet initialization failures to be ignored.

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-05-12 08:42:10 +08:00
parent 36d10702da
commit 626f86ec4e
10 changed files with 600 additions and 17 deletions
@@ -30,6 +30,11 @@ struct WirelessInfo {
std::string ip;
};
struct EthernetInfo {
std::string mac;
std::string ip;
};
struct GatewayRuntimeConfig {
std::string_view project_name;
std::string_view version;
@@ -47,6 +52,7 @@ struct GatewayDeviceInfo {
size_t dali_gateway_count{0};
bool ble_enabled{false};
std::optional<WirelessInfo> wlan;
std::optional<EthernetInfo> eth;
};
class GatewaySettingsStore {
@@ -119,6 +125,9 @@ class GatewayRuntime {
void setGatewayCount(size_t gateway_count);
void setWirelessInfo(WirelessInfo info);
bool clearWirelessInfo();
void setEthernetInfo(EthernetInfo info);
void clearEthernetInfo();
void clearEthernetIp();
void setCommandAddressResolver(std::function<uint8_t(uint8_t gw, uint8_t raw_addr)> resolver);
GatewayDeviceInfo deviceInfo() const;
@@ -159,6 +168,7 @@ class GatewayRuntime {
CommandDropReason last_enqueue_drop_reason_{CommandDropReason::kNone};
std::function<uint8_t(uint8_t gw, uint8_t raw_addr)> command_address_resolver_;
std::optional<WirelessInfo> wireless_info_;
std::optional<EthernetInfo> ethernet_info_;
SemaphoreHandle_t command_lock_{nullptr};
};