ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
ethernet_component.cpp
Go to the documentation of this file.
2
3#ifdef USE_ETHERNET
4
5#include "esphome/core/log.h"
6
8
9EthernetComponent *global_eth_component; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
10
12
14
16
17#ifdef USE_ETHERNET_MANUAL_IP
18void EthernetComponent::set_manual_ip(const ManualIP &manual_ip) { this->manual_ip_ = manual_ip; }
19#endif
20
21#ifdef USE_ETHERNET_IP_STATE_LISTENERS
23 auto ips = this->get_ip_addresses();
24 auto dns1 = this->get_dns_address(0);
25 auto dns2 = this->get_dns_address(1);
26 for (auto *listener : this->ip_state_listeners_) {
27 listener->on_ip_state(ips, dns1, dns2);
28 }
29}
30#endif // USE_ETHERNET_IP_STATE_LISTENERS
31
32} // namespace esphome::ethernet
33
34#endif // USE_ETHERNET
void set_manual_ip(const ManualIP &manual_ip)
network::IPAddress get_dns_address(uint8_t num)
StaticVector< EthernetIPStateListener *, ESPHOME_ETHERNET_IP_STATE_LISTENERS > ip_state_listeners_
uint16_t type
EthernetComponent * global_eth_component
constexpr float WIFI
Definition component.h:47