SmartConfig APIs.
More...
SmartConfig APIs.
SmartConfig can only be enabled in station only mode. Please make sure the target AP is enabled before enable SmartConfig.
typedef void(* sc_callback_t) (sc_status status, void *pdata) |
The callback of SmartConfig, executed when smart-config status changed.
- Parameters
-
sc_status | status : status of SmartConfig:
- if status == SC_STATUS_GETTING_SSID_PSWD, parameter void *pdata is a pointer of sc_type, means SmartConfig type: AirKiss or ESP-TOUCH.
- if status == SC_STATUS_LINK, parameter void *pdata is a pointer of struct station_config;
- if status == SC_STATUS_LINK_OVER, parameter void *pdata is a pointer of mobile phone's IP address, 4 bytes. This is only available in ESPTOUCH, otherwise, it is NULL.
- otherwise, parameter void *pdata is NULL.
|
void | *pdata : data of SmartConfig |
- Returns
- null
Enumerator |
---|
SC_STATUS_WAIT |
waiting, do not start connection in this phase
|
SC_STATUS_FIND_CHANNEL |
find target channel, start connection by APP in this phase
|
SC_STATUS_GETTING_SSID_PSWD |
getting SSID and password of target AP
|
SC_STATUS_LINK |
connecting to target AP
|
SC_STATUS_LINK_OVER |
got IP, connect to AP successfully
|
Enumerator |
---|
SC_TYPE_ESPTOUCH |
protocol: ESPTouch
|
SC_TYPE_AIRKISS |
protocol: AirKiss
|
SC_TYPE_ESPTOUCH_AIRKISS |
protocol: ESPTouch and AirKiss
|
bool esptouch_set_timeout |
( |
uint8 |
time_s | ) |
|
Set timeout of SmartConfig.
- Attention
- SmartConfig timeout start at SC_STATUS_FIND_CHANNEL, SmartConfig will restart if timeout.
- Parameters
-
uint8 | time_s : range 15s~255s, offset:45s. |
- Returns
- true : succeed
-
false : fail
const char* smartconfig_get_version |
( |
void |
| ) |
|
Get the version of SmartConfig.
- Parameters
-
- Returns
- SmartConfig version
bool smartconfig_set_type |
( |
sc_type |
type | ) |
|
Set protocol type of SmartConfig.
- Attention
- If users need to set the SmartConfig type, please set it before calling smartconfig_start.
- Parameters
-
sc_type | type : AirKiss, ESP-TOUCH or both. |
- Returns
- true : succeed
-
false : fail
Start SmartConfig mode.
Start SmartConfig mode, to connect ESP8266 station to AP, by sniffing for special packets from the air, containing SSID and password of desired AP. You need to broadcast the SSID and password (e.g. from mobile device or computer) with the SSID and password encoded.
- Attention
- 1. This api can only be called in station mode.
-
2. During SmartConfig, ESP8266 station and soft-AP are disabled.
-
3. Can not call smartconfig_start twice before it finish, please call smartconfig_stop first.
-
4. Don't call any other APIs during SmartConfig, please call smartconfig_stop first.
- Parameters
-
sc_callback_t | cb : SmartConfig callback; executed when SmartConfig status changed; |
uint8 | log : 1, UART output logs; otherwise, UART only outputs the result. |
- Returns
- true : succeed
-
false : fail
bool smartconfig_stop |
( |
void |
| ) |
|
Stop SmartConfig, free the buffer taken by smartconfig_start.
- Attention
- Whether connect to AP succeed or not, this API should be called to free memory taken by smartconfig_start.
- Parameters
-
- Returns
- true : succeed
-
false : fail