ESPHome
2026.5.0-dev
Loading...
Searching...
No Matches
esphome
components
ethernet
ethernet_component.cpp
Go to the documentation of this file.
1
#include "
ethernet_component.h
"
2
3
#ifdef USE_ETHERNET
4
5
#include "
esphome/core/log.h
"
6
7
namespace
esphome::ethernet
{
8
9
EthernetComponent
*
global_eth_component
;
// NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
10
11
EthernetComponent::EthernetComponent
() {
global_eth_component
=
this
; }
12
13
float
EthernetComponent::get_setup_priority
()
const
{
return
setup_priority::WIFI
; }
14
15
void
EthernetComponent::set_type
(
EthernetType
type
) { this->
type_
=
type
; }
16
17
#ifdef USE_ETHERNET_MANUAL_IP
18
void
EthernetComponent::set_manual_ip
(
const
ManualIP
&manual_ip) { this->
manual_ip_
= manual_ip; }
19
#endif
20
21
#ifdef USE_ETHERNET_IP_STATE_LISTENERS
22
void
EthernetComponent::notify_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
esphome::ethernet::EthernetComponent
Definition
ethernet_component.h:117
esphome::ethernet::EthernetComponent::type_
EthernetType type_
Definition
ethernet_component.h:285
esphome::ethernet::EthernetComponent::get_setup_priority
float get_setup_priority() const override
Definition
ethernet_component.cpp:13
esphome::ethernet::EthernetComponent::notify_ip_state_listeners_
void notify_ip_state_listeners_()
Definition
ethernet_component.cpp:22
esphome::ethernet::EthernetComponent::set_manual_ip
void set_manual_ip(const ManualIP &manual_ip)
Definition
ethernet_component.cpp:18
esphome::ethernet::EthernetComponent::get_ip_addresses
network::IPAddresses get_ip_addresses()
Definition
ethernet_component_esp32.cpp:487
esphome::ethernet::EthernetComponent::get_dns_address
network::IPAddress get_dns_address(uint8_t num)
Definition
ethernet_component_esp32.cpp:512
esphome::ethernet::EthernetComponent::set_type
void set_type(EthernetType type)
Definition
ethernet_component.cpp:15
esphome::ethernet::EthernetComponent::manual_ip_
optional< ManualIP > manual_ip_
Definition
ethernet_component.h:280
esphome::ethernet::EthernetComponent::ip_state_listeners_
StaticVector< EthernetIPStateListener *, ESPHOME_ETHERNET_IP_STATE_LISTENERS > ip_state_listeners_
Definition
ethernet_component.h:298
esphome::ethernet::EthernetComponent::EthernetComponent
EthernetComponent()
Definition
ethernet_component.cpp:11
type
uint16_t type
Definition
dns_server_esp32_idf.cpp:0
ethernet_component.h
log.h
esphome::ethernet
Definition
ethernet_component.cpp:7
esphome::ethernet::global_eth_component
EthernetComponent * global_eth_component
Definition
ethernet_component.cpp:9
esphome::ethernet::EthernetType
EthernetType
Definition
ethernet_component.h:72
esphome::setup_priority::WIFI
constexpr float WIFI
Definition
component.h:47
esphome::ethernet::ManualIP
Definition
ethernet_component.h:91
Generated by
1.12.0