1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

allow setting the host name of AP interface

This commit is contained in:
Markus Sattler 2015-07-04 10:00:27 +02:00 committed by Ivan Grokhotkov
parent 63590a9526
commit 505ba22e05
2 changed files with 32 additions and 0 deletions

View File

@ -582,6 +582,25 @@ int ESP8266WiFiClass::hostByName(const char* aHostname, IPAddress& aResult)
return (aResult != 0) ? 1 : 0;
}
String ESP8266WiFiClass::hostname(void) {
return String(wifi_station_get_hostname());
}
bool ESP8266WiFiClass::hostname(char* aHostname) {
if(strlen(aHostname) > 32) {
return false;
}
return wifi_station_set_hostname(aHostname);
}
bool ESP8266WiFiClass::hostname(const char* aHostname) {
return hostname((char*) aHostname);
}
bool ESP8266WiFiClass::hostname(String aHostname) {
return hostname((char*) aHostname.c_str());
}
void ESP8266WiFiClass::beginSmartConfig()
{
if (_smartConfigStarted)

View File

@ -300,6 +300,19 @@ public:
*/
int hostByName(const char* aHostname, IPAddress& aResult);
/*
* Get ESP8266 station DHCP hostname
*/
String hostname(void);
/*
* Set ESP8266 station DHCP hostname
* hostname, max length:32
*/
bool hostname(char* aHostname);
bool hostname(const char* aHostname);
bool hostname(String aHostname);
/*
* Output WiFi settings to an object derived from Print interface (like Serial).
*