-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmDNS.cpp
More file actions
50 lines (38 loc) · 698 Bytes
/
mDNS.cpp
File metadata and controls
50 lines (38 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* mDNS.cpp
*
* Created on: Jul 2, 2016
* Author: lieven
*/
#include "mDNS.h"
//MDNSResponder responder;
mDNS::mDNS(const char* name) :
Actor(name)
{
}
mDNS::~mDNS()
{
}
void mDNS::setWifi(uid_t wifi) {
_wifi = wifi;
}
void mDNS::setup()
{
eb.onEvent(_wifi,H("connected")).call(this,(MethodHandler)&mDNS::onWifiConnected);
}
void mDNS::onEvent(Cbor& cbor)
{
ERROR(" no events expected");
}
void mDNS::onWifiConnected()
{
if (!MDNS.begin(Sys::hostname(),WiFi.localIP())) {
WARN("Error setting up MDNS responder!");
}
INFO(" MDNS publish %s ",WiFi.hostname().c_str());
}
void mDNS::loop()
{
MDNS.update();
// responder.update();
}