From 22442f08731730ee645aedaf877e8a2e8687c84b Mon Sep 17 00:00:00 2001 From: Drzony Date: Wed, 3 Mar 2021 02:32:34 +0100 Subject: [PATCH] Added ESP32 compatible methods for setting/getting hostname (#7900) --- cores/esp8266/LwipIntf.cpp | 9 +++++++++ cores/esp8266/LwipIntf.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/cores/esp8266/LwipIntf.cpp b/cores/esp8266/LwipIntf.cpp index d2746745c..b4a4807b9 100644 --- a/cores/esp8266/LwipIntf.cpp +++ b/cores/esp8266/LwipIntf.cpp @@ -64,6 +64,15 @@ String LwipIntf::hostname(void) return wifi_station_get_hostname(); } +/** + Get ESP8266 station DHCP hostname + @return hostname +*/ +const char* LwipIntf::getHostname(void) +{ + return wifi_station_get_hostname(); +} + /** Set ESP8266 station DHCP hostname @param aHostname max length:24 diff --git a/cores/esp8266/LwipIntf.h b/cores/esp8266/LwipIntf.h index 972a7c800..d73c2d825 100644 --- a/cores/esp8266/LwipIntf.h +++ b/cores/esp8266/LwipIntf.h @@ -34,6 +34,12 @@ public: return hostname(aHostname.c_str()); } bool hostname(const char* aHostname); + // ESP32 API compatibility + bool setHostname(const char* aHostName) + { + return hostname(aHostName); + } + const char* getHostname(); protected: