SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
discovery.cpp
Go to the documentation of this file.
1#include "discovery.h"
2
3#include "sensesp.h"
4#include "sensesp_app.h"
5
6#include <ESPmDNS.h>
7
8namespace sensesp {
9
12
13 // MDNS.begin(hostname) will crash if hostname is blank
14 if ((hostname == "")) {
15 debugE("hostname has not been set - mDNS can't start");
16 return;
17 }
18 if (!MDNS.begin(hostname.c_str())) { // Start the mDNS responder for hostname.local
19 debugW("Error setting up mDNS responder");
20 } else {
21 debugI("mDNS responder started for hostname '%s'", hostname.c_str());
22 }
23 mdns_instance_name_set(hostname.c_str()); // mDNS hostname for ESP32
24}
25
26} // namespace sensesp
Construct a new transform based on a single function.
virtual void start() override
Definition discovery.cpp:10
static String get_hostname()
Get the current hostname.
#define debugI(fmt,...)
Definition local_debug.h:48
#define debugE(fmt,...)
Definition local_debug.h:50
#define debugW(fmt,...)
Definition local_debug.h:49