Skip to content

Commit

Permalink
Fix mDNS on Ethernet port.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstegeman committed Jan 7, 2020
1 parent e0f43af commit 6aa4cbb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions EthernetWebThingAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ class WebThingAdapter {
void begin() {
name.toLowerCase();
#ifdef CONFIG_MDNS
String serviceName = name + "._webthing";
mdns.begin(Ethernet.localIP(), name.c_str());

mdns.addServiceRecord("_webthing", port, MDNSServiceTCP, "\x06path=/");
// \x06 is the length of the record
mdns.addServiceRecord(serviceName.c_str(), port, MDNSServiceTCP,
"\x06path=/");
#endif
server.begin();
}
Expand Down
7 changes: 5 additions & 2 deletions WiFi101WebThingAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <WiFiUdp.h>
#include <ArduinoMDNS.h>

#include <ArduinoJson.h>

#define WITHOUT_WS 1
Expand Down Expand Up @@ -81,9 +82,11 @@ class WebThingAdapter {
void begin() {
name.toLowerCase();

String serviceName = name + "._webthing";
mdns.begin(WiFi.localIP(), name.c_str());

mdns.addServiceRecord("_webthing", port, MDNSServiceTCP, "\x06path=/");
// \x06 is the length of the record
mdns.addServiceRecord(serviceName.c_str(), port, MDNSServiceTCP,
"\x06path=/");

server.begin();
}
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webthing-arduino",
"description": "A library for creating Web Things using the Web of Things API. Runs on ESP8266, ESP32, Ethernet, and WiFi101-compatible boards. Compatible with the Mozilla WebThings Gateway.",
"keywords": "Communication",
"version": "0.11.0",
"version": "0.11.1",
"authors": {
"name": "Mozilla IoT <[email protected]>"
},
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=webthing-arduino
version=0.11.0
version=0.11.1
author=Mozilla IoT <[email protected]>
maintainer=James Hobin <[email protected]>
sentence=A library for creating Web Things using the Web of Things API
Expand Down

0 comments on commit 6aa4cbb

Please sign in to comment.