10#if (defined(USE_ESP8266) || defined(USE_RP2040)) && \
11 ((defined(USE_WIFI) && defined(USE_WIFI_IP_STATE_LISTENERS)) || \
12 (defined(USE_ETHERNET) && defined(USE_ETHERNET_IP_STATE_LISTENERS)))
14#define USE_MDNS_EVENT_DRIVEN_POLLING
15#if defined(USE_WIFI) && defined(USE_WIFI_IP_STATE_LISTENERS)
17#define USE_MDNS_WIFI_LISTENER
19#if defined(USE_ETHERNET) && defined(USE_ETHERNET_IP_STATE_LISTENERS)
21#define USE_MDNS_ETHERNET_LISTENER
31#define MDNS_STR(name) (reinterpret_cast<const esphome::mdns::MDNSString *>(name))
35#define MDNS_STR_ARG(s) ((PGM_P) (s))
37#define MDNS_STR_ARG(s) (reinterpret_cast<const char *>(s))
44 const MDNSString *
key;
60#ifdef USE_MDNS_WIFI_LISTENER
64#ifdef USE_MDNS_ETHERNET_LISTENER
70 void setup()
override;
76#ifdef USE_MDNS_EVENT_DRIVEN_POLLING
98#ifdef USE_MDNS_EXTRA_SERVICES
102#ifdef USE_MDNS_STORE_SERVICES
108#ifdef USE_MDNS_DYNAMIC_TXT
116#ifdef USE_MDNS_EVENT_DRIVEN_POLLING
122#ifdef USE_MDNS_EVENT_DRIVEN_POLLING
132#ifdef USE_MDNS_DYNAMIC_TXT
139#if defined(USE_API) && defined(USE_MDNS_STORE_SERVICES)
145#ifdef USE_MDNS_STORE_SERVICES
148#if defined(USE_RP2040) && defined(USE_MDNS_EVENT_DRIVEN_POLLING)
153 char *config_hash_buf);
Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template...
Minimal static vector - saves memory by avoiding std::vector overhead.
void push_back(const T &value)
Function-pointer-only templatable storage (4 bytes on 32-bit).
Listener interface for Ethernet IP state changes.
void on_shutdown() override
StaticVector< std::string, MDNS_DYNAMIC_TXT_COUNT > dynamic_txt_values_
Storage for runtime-generated TXT values from user lambdas Pre-sized at compile time via MDNS_DYNAMIC...
static constexpr uint32_t MDNS_POLL_STOP_ID
void dump_config() override
void start_polling_window_()
Arm a fresh MDNS_POLL_WINDOW_MS polling window.
float get_setup_priority() const override
void on_ip_state(const network::IPAddresses &ips, const network::IPAddress &dns1, const network::IPAddress &dns2) override
const char * add_dynamic_txt_value(const std::string &value)
Add a dynamic TXT value and return pointer to it for use in MDNSTXTRecord.
char config_hash_str_[CONFIG_HASH_STR_SIZE]
Fixed buffer for config hash hex string (only needed when services are stored)
static constexpr size_t CONFIG_HASH_STR_SIZE
Size of buffer required for config hash hex string (8 hex chars + null terminator)
static constexpr uint32_t MDNS_POLL_WINDOW_MS
void setup_buffers_and_register_(PlatformRegisterFn platform_register)
void compile_records_(StaticVector< MDNSService, MDNS_SERVICE_COUNT > &services, char *mac_address_buf, char *config_hash_buf)
char mac_address_[MAC_ADDRESS_BUFFER_SIZE]
Fixed buffer for MAC address (only needed when services are stored)
void(*)(MDNSComponent *, StaticVector< MDNSService, MDNS_SERVICE_COUNT > &) PlatformRegisterFn
Helper to set up services and MAC buffers, then call platform-specific registration.
void add_extra_service(MDNSService service)
static constexpr uint32_t MDNS_POLL_ID
static constexpr uint32_t MDNS_UPDATE_INTERVAL_MS
const StaticVector< MDNSService, MDNS_SERVICE_COUNT > & get_services() const
StaticVector< MDNSService, MDNS_SERVICE_COUNT > services_
Listener interface for WiFi IP state changes.
std::array< IPAddress, 5 > IPAddresses
constexpr float AFTER_CONNECTION
For components that should be initialized after a data connection (API/MQTT) is connected.
constexpr size_t format_hex_size(size_t byte_count)
Calculate buffer size needed for format_hex_to: "XXXXXXXX...\0" = bytes * 2 + 1.
FixedVector< MDNSTXTRecord > txt_records
TemplatableFn< uint16_t > port
const MDNSString * service_type