ESPHome 2025.5.0
Loading...
Searching...
No Matches
util.cpp
Go to the documentation of this file.
1#include "util.h"
3#ifdef USE_NETWORK
4#ifdef USE_WIFI
6#endif
7
8#ifdef USE_ETHERNET
10#endif
11
12namespace esphome {
13namespace network {
14
16#ifdef USE_ETHERNET
18 return true;
19#endif
20
21#ifdef USE_WIFI
22 if (wifi::global_wifi_component != nullptr)
24#endif
25
26#ifdef USE_HOST
27 return true; // Assume its connected
28#endif
29 return false;
30}
31
33#ifdef USE_WIFI
34 if (wifi::global_wifi_component != nullptr)
36#endif
37 return false;
38}
39
41#ifdef USE_ETHERNET
42 if (ethernet::global_eth_component != nullptr)
44#endif
45#ifdef USE_WIFI
46 if (wifi::global_wifi_component != nullptr)
48#endif
49 return {};
50}
51
52std::string get_use_address() {
53#ifdef USE_ETHERNET
54 if (ethernet::global_eth_component != nullptr)
56#endif
57#ifdef USE_WIFI
58 if (wifi::global_wifi_component != nullptr)
60#endif
61 return "";
62}
63
64} // namespace network
65} // namespace esphome
66#endif
std::string get_use_address() const
network::IPAddresses get_ip_addresses()
EthernetComponent * global_eth_component
std::array< IPAddress, 5 > IPAddresses
Definition ip_address.h:143
std::string get_use_address()
Get the active network hostname.
Definition util.cpp:52
bool is_connected()
Return whether the node is connected to the network (through wifi, eth, ...)
Definition util.cpp:15
network::IPAddresses get_ip_addresses()
Definition util.cpp:40
bool is_disabled()
Return whether the network is disabled (only wifi for now)
Definition util.cpp:32
WiFiComponent * global_wifi_component
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7