Skip to content

Commit

Permalink
allow setting the host name of AP interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Links2004 authored and igrr committed Jul 7, 2015
1 parent 811a373 commit 8efa1d4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,19 @@ class ESP8266WiFiClass
*/
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).
*
Expand Down

0 comments on commit 8efa1d4

Please sign in to comment.