SmartConfig¶
API Reference¶
Header File¶
Functions¶
-
const char *
esp_smartconfig_get_version
(void)¶ Get the version of SmartConfig.
- Return
SmartConfig version const char.
-
esp_err_t
esp_smartconfig_start
(const smartconfig_start_config_t *config)¶ Start SmartConfig, config ESP device to connect AP. You need to broadcast information by phone APP. Device sniffer special packets from the air that containing SSID and password of target AP.
- Attention
1. This API can be called in station or softAP-station mode.
- Attention
2. Can not call esp_smartconfig_start twice before it finish, please call esp_smartconfig_stop first.
- Return
ESP_OK: succeed
others: fail
- Parameters
config
: pointer to smartconfig start configure structure
-
esp_err_t
esp_smartconfig_stop
(void)¶ Stop SmartConfig, free the buffer taken by esp_smartconfig_start.
- Attention
Whether connect to AP succeed or not, this API should be called to free memory taken by smartconfig_start.
- Return
ESP_OK: succeed
others: fail
-
esp_err_t
esp_esptouch_set_timeout
(uint8_t time_s)¶ Set timeout of SmartConfig process.
- Attention
Timing starts from SC_STATUS_FIND_CHANNEL status. SmartConfig will restart if timeout.
- Return
ESP_OK: succeed
others: fail
- Parameters
time_s
: range 15s~255s, offset:45s.
-
esp_err_t
esp_smartconfig_set_type
(smartconfig_type_t type)¶ Set protocol type of SmartConfig.
- Attention
If users need to set the SmartConfig type, please set it before calling esp_smartconfig_start.
- Return
ESP_OK: succeed
others: fail
- Parameters
type
: Choose from the smartconfig_type_t.
-
esp_err_t
esp_smartconfig_fast_mode
(bool enable)¶ Set mode of SmartConfig. default normal mode.
- Attention
1. Please call it before API esp_smartconfig_start.
- Attention
2. Fast mode have corresponding APP(phone).
- Attention
3. Two mode is compatible.
- Return
ESP_OK: succeed
others: fail
- Parameters
enable
: false-disable(default); true-enable;
Structures¶
-
struct
smartconfig_event_got_ssid_pswd_t
¶ Argument structure for SC_EVENT_GOT_SSID_PSWD event
Public Members
-
uint8_t
ssid
[32]¶ SSID of the AP. Null terminated string.
-
uint8_t
password
[64]¶ Password of the AP. Null terminated string.
-
bool
bssid_set
¶ whether set MAC address of target AP or not.
-
uint8_t
bssid
[6]¶ MAC address of target AP.
-
smartconfig_type_t
type
¶ Type of smartconfig(ESPTouch or AirKiss).
-
uint8_t
token
¶ Token from cellphone which is used to send ACK to cellphone.
-
uint8_t
cellphone_ip
[4]¶ IP address of cellphone.
-
uint8_t
Enumerations¶
-
enum
smartconfig_type_t
¶ Values:
-
SC_TYPE_ESPTOUCH
= 0¶ protocol: ESPTouch
-
SC_TYPE_AIRKISS
¶ protocol: AirKiss
-
SC_TYPE_ESPTOUCH_AIRKISS
¶ protocol: ESPTouch and AirKiss
-
-
enum
smartconfig_event_t
¶ Smartconfig event declarations
Values:
-
SC_EVENT_SCAN_DONE
¶ ESP32 station smartconfig has finished to scan for APs
-
SC_EVENT_FOUND_CHANNEL
¶ ESP32 station smartconfig has found the channel of the target AP
-
SC_EVENT_GOT_SSID_PSWD
¶ ESP32 station smartconfig got the SSID and password
-
SC_EVENT_SEND_ACK_DONE
¶ ESP32 station smartconfig has sent ACK to cellphone
-