2 #if defined(USE_ESP32) && defined(USE_MDNS) 13 static const char *
const TAG =
"mdns";
18 esp_err_t err = mdns_init();
20 ESP_LOGW(TAG,
"mDNS init failed: %s", esp_err_to_name(err));
25 mdns_hostname_set(this->
hostname_.c_str());
26 mdns_instance_name_set(this->
hostname_.c_str());
28 for (
const auto &service : this->
services_) {
29 std::vector<mdns_txt_item_t> txt_records;
30 for (
const auto &record : service.txt_records) {
33 it.key = strdup(record.key.c_str());
34 it.value = strdup(record.value.c_str());
35 txt_records.push_back(it);
37 err = mdns_service_add(
nullptr, service.service_type.c_str(), service.proto.c_str(), service.port,
38 txt_records.data(), txt_records.size());
41 for (
const auto &it : txt_records) {
47 ESP_LOGW(TAG,
"Failed to register mDNS service %s: %s", service.service_type.c_str(), esp_err_to_name(err));
std::vector< MDNSService > services_
void on_shutdown() override
virtual void mark_failed()
Mark this component as failed.
Implementation of SPI Controller mode.
void IRAM_ATTR HOT delay(uint32_t ms)