From a4c130414a24f0a56f385d9794c18aab90ef636d Mon Sep 17 00:00:00 2001 From: Drzony Date: Mon, 1 Mar 2021 09:37:43 +0100 Subject: [PATCH] Added ESP32 compatible methods for setting/getting hostname --- 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 d2746745cc..b4a4807b9a 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 972a7c8008..d73c2d825a 100644 --- a/cores/esp8266/LwipIntf.h +++ b/cores/esp8266/LwipIntf.h @@ -34,6 +34,12 @@ class LwipIntf 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: