Skip to content

Commit 68268e8

Browse files
committed
Add setHostname() method to WiFi
1 parent 66209a4 commit 68268e8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: libraries/WiFi/src/WiFi.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ int arduino::WiFiClass::begin(const char* ssid) {
9696
return begin(ssid, NULL, ENC_TYPE_NONE);
9797
}
9898

99+
int arduino::WiFiClass::setHostname(const char* hostname) {
100+
wifi_if->set_hostname(hostname);
101+
return 1;
102+
}
103+
99104
//Config Wifi to set Static IP && Disable DHCP
100105
void arduino::WiFiClass::config(const char* localip, const char* netmask, const char* gateway){
101106
SocketHelpers::config(IPAddress(localip), dnsIP(0), IPAddress(gateway), IPAddress(netmask));

Diff for: libraries/WiFi/src/WiFi.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ class WiFiClass : public MbedSocketClass {
7575
* must be between ASCII 32-126 (decimal).
7676
*/
7777
int begin(const char* ssid, const char* passphrase, wl_enc_type security = ENC_TYPE_UNKNOWN);
78-
78+
79+
// When using DHCP the hostname provided will be used.
80+
int setHostname(const char* hostname);
81+
7982
// Inherit config methods from the parent class
8083
using MbedSocketClass::config;
8184

0 commit comments

Comments
 (0)