Skip to content

Commit 6cc8f11

Browse files
committed
Add includes to male mDNS::enableWorkstation compile
1 parent 06ec7f1 commit 6cc8f11

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

libraries/ESPmDNS/src/ESPmDNS.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ License (MIT license):
4242
#include "WiFi.h"
4343
#include <functional>
4444
#include "esp_wifi.h"
45+
#include "esp_wifi_types.h"
4546

4647
// Add quotes around defined value
4748
#ifdef __IN_ECLIPSE__
@@ -111,18 +112,18 @@ void MDNSResponder::disableArduino(){
111112
}
112113
}
113114

114-
// void MDNSResponder::enableWorkstation(esp_interface_t interface){
115-
// char winstance[21+_hostname.length()];
116-
// uint8_t mac[6];
117-
// esp_wifi_get_mac((wifi_interface_t)interface, mac);
118-
// sprintf(winstance, "%s [%02x:%02x:%02x:%02x:%02x:%02x]", _hostname.c_str(), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
119-
120-
// if(mdns_service_add(NULL, "_workstation", "_tcp", 9, NULL, 0)) {
121-
// log_e("Failed adding Workstation service");
122-
// } else if(mdns_service_instance_name_set("_workstation", "_tcp", winstance)) {
123-
// log_e("Failed setting Workstation service instance name");
124-
// }
125-
// }
115+
void MDNSResponder::enableWorkstation(esp_interface_t interface){
116+
char winstance[21+_hostname.length()];
117+
uint8_t mac[6];
118+
esp_wifi_get_mac((wifi_interface_t)interface, mac);
119+
sprintf(winstance, "%s [%02x:%02x:%02x:%02x:%02x:%02x]", _hostname.c_str(), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
120+
121+
if(mdns_service_add(NULL, "_workstation", "_tcp", 9, NULL, 0)) {
122+
log_e("Failed adding Workstation service");
123+
} else if(mdns_service_instance_name_set("_workstation", "_tcp", winstance)) {
124+
log_e("Failed setting Workstation service instance name");
125+
}
126+
}
126127

127128
void MDNSResponder::disableWorkstation(){
128129
if(mdns_service_remove("_workstation", "_tcp")) {

libraries/ESPmDNS/src/ESPmDNS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ License (MIT license):
4444
#include "Arduino.h"
4545
#include "IPv6Address.h"
4646
#include "mdns.h"
47+
#include "esp_interface.h"
4748

4849
//this should be defined at build time
4950
#ifndef ARDUINO_VARIANT
@@ -84,8 +85,7 @@ class MDNSResponder {
8485
void enableArduino(uint16_t port=3232, bool auth=false);
8586
void disableArduino();
8687

87-
#warning This needs fixing for IDF 5.1
88-
//void enableWorkstation(esp_interface_t interface=ESP_IF_WIFI_STA);
88+
void enableWorkstation(esp_interface_t interface=ESP_IF_WIFI_STA);
8989
void disableWorkstation();
9090

9191
IPAddress queryHost(char *host, uint32_t timeout=2000);

0 commit comments

Comments
 (0)