mirror of
https://github.com/esphome/esphome.git
synced 2024-12-11 16:04:54 +01:00
34606b0f1f
Co-authored-by: Maurice Makaay <account-github@makaay.nl> Co-authored-by: Otto winter <otto@otto-winter.com> Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
41 lines
942 B
C++
41 lines
942 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include "esphome/core/component.h"
|
|
|
|
namespace esphome {
|
|
namespace mdns {
|
|
|
|
struct MDNSTXTRecord {
|
|
std::string key;
|
|
std::string value;
|
|
};
|
|
|
|
struct MDNSService {
|
|
// service name _including_ underscore character prefix
|
|
// as defined in RFC6763 Section 7
|
|
std::string service_type;
|
|
// second label indicating protocol _including_ underscore character prefix
|
|
// as defined in RFC6763 Section 7, like "_tcp" or "_udp"
|
|
std::string proto;
|
|
uint16_t port;
|
|
std::vector<MDNSTXTRecord> txt_records;
|
|
};
|
|
|
|
class MDNSComponent : public Component {
|
|
public:
|
|
void setup() override;
|
|
|
|
#if defined(USE_ESP8266) && defined(USE_ARDUINO)
|
|
void loop() override;
|
|
#endif
|
|
float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
|
|
|
|
protected:
|
|
std::vector<MDNSService> compile_services_();
|
|
std::string compile_hostname_();
|
|
};
|
|
|
|
} // namespace mdns
|
|
} // namespace esphome
|