Improve docs wrt to auto-connect vs connect, addresses #1273

This commit is contained in:
Marcel Stör 2016-04-29 19:21:25 +02:00
parent 583ea8514f
commit 8dbbe40fb8
1 changed files with 9 additions and 19 deletions

View File

@ -24,11 +24,6 @@ Gets the current WiFi channel.
#### Returns #### Returns
current WiFi channel current WiFi channel
#### Example
```lua
print(wifi.getchannel())
```
## wifi.getmode() ## wifi.getmode()
Gets WiFi operation mode. Gets WiFi operation mode.
@ -240,9 +235,9 @@ Sets the WiFi station configuration.
- `ssid` string which is less than 32 bytes. - `ssid` string which is less than 32 bytes.
- `password` string which is 8-64 or 0 bytes. Empty string indicates an open WiFi access point. - `password` string which is 8-64 or 0 bytes. Empty string indicates an open WiFi access point.
- `auto` value of 0 or 1 (default) - `auto` defaults to 1
- 0, Disable auto connect and remain disconnected from access point - 0 to disable auto connect and remain disconnected from access point
- 1, Enable auto connect and connect to access point - 1 to enable auto connect and connect to access point, hence with `auto=1` there's no need to call [`wifi.sta.connect()`](#wifistaconnect) later
- `bssid` string that contains the MAC address of the access point (optional) - `bssid` string that contains the MAC address of the access point (optional)
- You can set BSSID if you have multiple access points with the same SSID. - You can set BSSID if you have multiple access points with the same SSID.
- Note: if you set BSSID for a specific SSID and would like to configure station to connect to the same SSID only without the BSSID requirement, you MUST first configure to station to a different SSID first, then connect to the desired SSID - Note: if you set BSSID for a specific SSID and would like to configure station to connect to the same SSID only without the BSSID requirement, you MUST first configure to station to a different SSID first, then connect to the desired SSID
@ -257,22 +252,22 @@ Sets the WiFi station configuration.
#### Example #### Example
```lua ```lua
--Connect to access point automatically when in range -- Connect to access point automatically when in range, `auto` defaults to 1
wifi.sta.config("myssid", "password") wifi.sta.config("myssid", "password")
--Connect to Unsecured access point automatically when in range -- Connect to Unsecured access point automatically when in range, `auto` defaults to 1
wifi.sta.config("myssid", "") wifi.sta.config("myssid", "")
--Connect to access point, User decides when to connect/disconnect to/from AP -- Connect to access point, User decides when to connect/disconnect to/from AP due to `auto=0`
wifi.sta.config("myssid", "mypassword", 0) wifi.sta.config("myssid", "mypassword", 0)
wifi.sta.connect() wifi.sta.connect()
-- ... do some WiFi stuff -- ... do some WiFi stuff
wifi.sta.disconnect() wifi.sta.disconnect()
--Connect to specific access point automatically when in range -- Connect to specific access point automatically when in range, `auto` defaults to 1
wifi.sta.config("myssid", "mypassword", "12:34:56:78:90:12") wifi.sta.config("myssid", "mypassword", "12:34:56:78:90:12")
--Connect to specific access point, User decides when to connect/disconnect to/from AP -- Connect to specific access point, User decides when to connect/disconnect to/from AP due to `auto=0`
wifi.sta.config("myssid", "mypassword", 0, "12:34:56:78:90:12") wifi.sta.config("myssid", "mypassword", 0, "12:34:56:78:90:12")
wifi.sta.connect() wifi.sta.connect()
-- ... do some WiFi stuff -- ... do some WiFi stuff
@ -285,7 +280,7 @@ wifi.sta.disconnect()
## wifi.sta.connect() ## wifi.sta.connect()
Connects to AP in station mode. Connects to the configured AP in station mode. You only ever need to call this if auto-connect was disabled in [`wifi.sta.config()`](#wifistaconfig).
#### Syntax #### Syntax
`wifi.sta.connect()` `wifi.sta.connect()`
@ -296,11 +291,6 @@ none
#### Returns #### Returns
`nil` `nil`
#### Example
```lua
wifi.sta.connect()
```
#### See also #### See also
- [`wifi.sta.disconnect()`](#wifistadisconnect) - [`wifi.sta.disconnect()`](#wifistadisconnect)
- [`wifi.sta.config()`](#wifistaconfig) - [`wifi.sta.config()`](#wifistaconfig)