typedef struct {
uint8_t ssid[32]; /**< wifi的名称,最大32个字节*/
uint8_t password[64]; /**< wifi的密码,最大64个字节,最小8位,需要程序上做限制*/
uint8_t ssid_len; /**< wifi名称的长度 */
uint8_t channel; /**< Channel of ESP32 soft-AP */
wifi_auth_mode_t authmode; /**< 安全类型,加密方法,. Do not support AUTH_WEP in soft-AP mode */
uint8_t ssid_hidden; /**< 是否广播SSID,也即是说是否隐藏WiFi名字,这样就需要用户自己去主动连接,并配置wifi信息 */
uint8_t max_connection; /**< AP模式下可以连接的数量,结合硬件有一个最大限定值 default 4, max 4 */
uint16_t beacon_interval; /**< 信标间隔,100 ~ 60000 ms,默认为100ms,SSID广播包发送的间距 */
} wifi_ap_config_t;
STA模式
确保wifi不在连接状态
设置为AP模式
配置信息
typedef struct {
uint8_t ssid[32]; /**< SSID of target AP*/
uint8_t password[64]; /**< password of target AP*/
wifi_scan_method_t scan_method; /**< do all channel scan or fast scan */
bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8_t bssid[6]; /**< MAC address of target AP*/
uint8_t channel; /**< channel of target AP. Set to 1~13 to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.*/
uint16_t listen_interval; /**< Listen interval for ESP32 station to receive beacon when WIFI_PS_MAX_MODEM is set. Units: AP beacon intervals. Defaults to 3 if set to 0. */
wifi_sort_method_t sort_method; /**< sort the connect AP in the list by rssi or security mode */
wifi_scan_threshold_t threshold; /**< When scan_method is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used. */
} wifi_sta_config_t;
typedef enum {
WIFI_FAST_SCAN = 0, /**< Do fast scan, scan will end after find SSID match AP 快速扫描*/
WIFI_ALL_CHANNEL_SCAN, /**< All channel scan, scan will end after scan all the channel 全部信道扫描*/
}wifi_scan_method_t;
typedef enum {
WIFI_CONNECT_AP_BY_SIGNAL = 0, /**< Sort match AP in scan list by RSSI 通过RSSI信号强度排序*/
WIFI_CONNECT_AP_BY_SECURITY, /**< Sort match AP in scan list by security mode 通过安全模式排序*/
}wifi_sort_method_t;