ESPHome  2022.12.8
mdns_esp32_arduino.cpp
Go to the documentation of this file.
1 #ifdef USE_ESP32_FRAMEWORK_ARDUINO
2 
3 #include "mdns_component.h"
4 #include "esphome/core/log.h"
5 #include <ESPmDNS.h>
6 
7 namespace esphome {
8 namespace mdns {
9 
11  this->compile_records_();
12 
13  MDNS.begin(this->hostname_.c_str());
14 
15  for (const auto &service : this->services_) {
16  MDNS.addService(service.service_type.c_str(), service.proto.c_str(), service.port);
17  for (const auto &record : service.txt_records) {
18  MDNS.addServiceTxt(service.service_type.c_str(), service.proto.c_str(), record.key.c_str(), record.value.c_str());
19  }
20  }
21 }
22 
23 } // namespace mdns
24 } // namespace esphome
25 
26 #endif // USE_ESP32_FRAMEWORK_ARDUINO
std::vector< MDNSService > services_
Definition: a4988.cpp:4