Browse Source

Add documentation for new wifi functions

Marcel Stör 8 years ago
parent
commit
b03a669683
1 changed files with 41 additions and 1 deletions
  1. 41 1
      docs/en/modules/wifi.md

+ 41 - 1
docs/en/modules/wifi.md

@@ -275,7 +275,7 @@ wifi.sta.disconnect()
 - [`wifi.sta.disconnect()`](#wifistadisconnect)
 
 ## wifi.sta.connect()
-#### Description
+
 Connects to AP in station mode.
 
 #### Syntax
@@ -558,6 +558,24 @@ ssid, password, bssid_set, bssid=nil, nil, nil, nil
 - [`wifi.sta.connect()`](#wifistaconnect)
 - [`wifi.sta.disconnect()`](#wifistadisconnect)
 
+## wifi.sta.gethostname()
+
+Gets current station hostname.
+
+#### Syntax
+`wifi.sta.gethostname()`
+
+#### Parameters
+none
+
+#### Returns
+currently configured hostname
+
+#### Example
+```lua
+print("Current hostname is: \""..wifi.sta.gethostname().."\"")
+```
+
 ## wifi.sta.getip()
 
 Gets IP address, netmask, and gateway address in station mode.
@@ -603,6 +621,28 @@ MAC address as string e.g. "18-33-44-FE-55-BB"
 #### See also
 [`wifi.sta.getip()`](#wifistagetip)
 
+## wifi.sta.sethostname()
+
+Sets station hostname.
+
+#### Syntax
+`wifi.sta.sethostname(hostname)`
+
+#### Parameters
+`hostname` must only contain letters, numbers and hyphens('-') and be 32 characters or less with first and last character being alphanumeric
+
+#### Returns
+true if hostname was successfully set, false otherwise
+
+#### Example
+```lua
+if (wifi.sta.sethostname("NodeMCU") == true) then
+	print("hostname was successfully changed")
+else
+	print("hostname was not changed")
+end
+```
+
 ## wifi.sta.setip()
 Sets IP address, netmask, gateway address in station mode.