This document describes C API's provided for control interface. Please refer test.c to get an idea how to use these API's.
This is ESP32 station mode config. It has fields for AP credentials to connect to and current status if ESP32 is connected to AP.
Public Members
uint8_t ssid[SSID_LENGTH]
: SSID is name of AP to connect to. It should be string of length 0 to 32.uint8_t pwd[PASSWORD_LENGTH]
: Password or passphrase. It should be string of length to 63.uint8_t bssid[BSSID_LENGTH]
: BSSID or MAC address. It should be string of length to 17. ex.XX:XX:XX:XX:XX:XX
.bool is_wpa3_supported
: WPA3 support status of AP.- 0 : Unsupported
- 1 : Supported
int rssi
: RSSI signal strength.int channel
: WLAN Channel ID.int encryption_mode
: Encryption or authentication mode of AP.- 0 : OPEN
- 1 : WEP
- 2 : WPA_PSK
- 3 : WPA2_PSK
- 4 : WPA_WPA2_PSK
- 5 : WPA2_ENTERPRISE
- 6 : WPA3_PSK
- 7 : WPA2_WPA3_PSK
uint16_t listen_interval
: Listen Interval indicates how long the station will be sleeping without listening to any Beacon transmitted by the AP when the station enter in power save mode. This will be expressed in AP beacon intervals. This parameter will be in effect ifWIFI_PS_MAX_MODEM
is set. In case unknown, set this value to 0. This value defaults to 3 AP beacon interval if it is set to 0.char status[STATUS_LENGTH]
: Status of ESP32 station.- "Failure" : Failed to get ESP32 station status
- "Not connected" : ESP32 station is not connected to AP. Only in connected or successful case, AP configurations will be valid.
This is ESP32 softAP mode configuration. It has fields to set and get ESP32 softAP configuration.
Public Members
uint8_t ssid[SSID_LENGTH]
: SSID is of ESP32 softAP. It should be string of length 0 to 32.uint8_t pwd[PASSWORD_LENGTH]
: Password or passphrase. It should be string of length 8 to 63.int channel
: WLAN Channel ID of softAP. Supported channels for softAP are from 1 to 11.int encryption_mode
: Encryption or authentication mode of softAP. Currently ESP32 support only these encryption mode.- 0 : OPEN
- 2 : WPA_PSK
- 3 : WPA2_PSK
- 4 : WPA_WPA2_PSK
int max_connections
: Software limit of maximum number of stations which can connect to ESP32 softAP. This can have value from 1 to 10. Driver/Hardware current limit is 10.bool ssid_hidden
:- 0 : SSID broadcasted
- 1 : SSID not broadcasted
- wifi_bandwidth_t
bandwidth
: Bandwidth in 2.4 GHz microwave band.WIFI_BW_HT20
: 20MHz BandwidthWIFI_BW_HT40
: 40MHz Bandwidth
This is structure gives information of external neighbouring AP of ESP32
Public Members
uint8_t ssid[SSID_LENGTH]
: SSID is name of AP. It should be string of length 0 to 32.uint8_t bssid[BSSID_LENGTH]
: BSSID or MAC address of AP. It should be string of length to 17. ex.XX:XX:XX:XX:XX:XX
.int rssi
: RSSI signal strength.int channel
: WLAN Channel ID.int encryption_mode
: Encryption mode of AP.- 0 : OPEN
- 1 : WEP
- 2 : WPA_PSK
- 3 : WPA2_PSK
- 4 : WPA_WPA2_PSK
- 5 : WPA2_ENTERPRISE
- 6 : WPA3_PSK
- 7 : WPA2_WPA3_PSK
struct esp_hosted_wifi_connected_stations_list
:
This contains list of station(s) connected to ESP32 softAP.
Public Members
uint8_t bssid[BSSID_LENGTH]
: BSSID or MAC address of station of length 17. ex. "XX:XX:XX:XX:XX:XX".int rssi
: RSSI signal strength of station.
This is used to get the MAC address of station or softAP interface of ESP32
mode
:WIFI_MODE_STA
: stationWIFI_MODE_AP
: softAP
mac
: String in form of "XX:XX:XX:XX:XX:XX" in success case. It should be large enough to store string in form "XX:XX:XX:XX:XX:XX"
- 0 : SUCCESS
- -1 : FAILURE
This is used to set MAC address of ESP32 interface for given mode.
- First set wifi mode before setting MAC address for respective station and softAP Interface.
- ESP32 station and softAP have different MAC addresses, do not set them to be the same.
- The bit 0 of the first byte of ESP32 MAC address can not be 1. - For example, the MAC address can set to be "1a:XX:XX:XX:XX:XX", but can not be "15:XX:XX:XX:XX:XX".
- MAC address will get reset after esp restarts
mode
:WIFI_MODE_STA
: stationWIFI_MODE_AP
: softAP
mac
: Custom MAC Address for ESP32 Interface. String in form of "XX:XX:XX:XX:XX:XX".
- 0 : SUCCESS
- -1 : FAILURE
This is used to get Wi-Fi mode of ESP32
mode
:WIFI_MODE_NONE
: null Mode, Wi-Fi mode not setWIFI_MODE_STA
: station modeWIFI_MODE_AP
: softAP modeWIFI_MODE_APSTA
: station+softAP mode
- 0 : SUCCESS
- -1 : FAILURE
This is used to set the Wi-Fi mode of ESP32
mode
:WIFI_MODE_NONE
: null Mode, Wi-Fi mode not setWIFI_MODE_STA
: station modeWIFI_MODE_AP
: softAP modeWIFI_MODE_APSTA
: station+softAP mode
- 0 : SUCCESS
- -1 : FAILURE
This is used to set Wi-Fi power save mode of ESP32.
power_save_mode
:WIFI_PS_MIN_MODEM
: Minimum modem power saving. In this mode, station wakes up to receive beacon every DTIM period.WIFI_PS_MAX_MODEM
: Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wifi set ap config function.
- Power save mode is set to 'WIFI_PS_MIN_MODEM' in sdkconfig (boot config)
- In WiFi+BT/BLE mode in ESP-Hosted Firmware, 'WIFI_PS_NONE' i.e No power save mode is not supported.
- 0 : SUCCESS
- -1 : FAILURE
This is used to get the Wi-Fi power save mode of ESP32.
power_save_mode
:WIFI_PS_MIN_MODEM
: Minimum modem power saving. In this mode, station wakes up to receive beacon every DTIM period.WIFI_PS_MAX_MODEM
: Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wifi set ap config functionWIFI_PS_INVALID
: Invalid power save mode. In case of failure of command.
- 0 : SUCCESS
- -1 : FAILURE
This is used to set the AP config to which ESP32 station should connect to.
ap_config
: Configuration to be set on APssid
: SSID i.e. Name of AP. This should be a string upto 32 characters.pwd
: Password or passphrase. This should be string of 8 to 63 characters.bssid
: MAC address of AP in case of multiple AP has same SSID. In case of unknown scenario, "" should be passedis_wpa3_supported
: Status of WPA3 support present on AP. In case unknown, keep False.- 0 : Unsupported
- 1 : Supported
listen_interval
: Listen Interval indicates how long the station will be sleeping without listening to any Beacon transmitted by the AP when the station enter in power save mode. This will be expressed in AP beacon intervals. This parameter will be in effect ifWIFI_PS_MAX_MODEM
is set. In case unknown, set this value to 0. This value defaults to 3 AP beacon interval if it is set to 0.
- 0 : SUCCESS
- -1 : FAILURE
This is used to get the AP config to which ESP32 station is connected. If ESP32 station is not connected to AP, returns FAILURE with error print 'station is not connected to AP'.
ap_config
: Get configuration of connected AP.ssid
: SSID of connected APbssid
: MAC address of connected APchannel
: channel ID of connected APrssi
: RSSI signal strengthencryption_mode
: encryption/authentication mode of AP, a value from enumwifi_auth_mode_t
- 0 : SUCCESS
- -1 : FAILURE
This is used to disconnect ESP32 station from AP.
- 0 : SUCCESS
- -1 : FAILURE
This is used to set configuration of ESP32 softAP .
softap_config
: Set configuration of ESP32 softAPssid
: SSID i.e. Name of AP. This should be a string upto 32 characters.pwd
: Password or passphrase. This should be string of 8 to 63 characters.channel
: WLAN channel ID. Supported channels for softAP are from 1 to 11.encryption_mode
: Supported encryption i.e. authentication modes for softAP are:- 0 : OPEN
- 2 : WPA_PSK
- 3 : WPA2_PSK
- 4 : WPA_WPA2_PSK
max_connections
: Software limit of maximum number of stations which can connect to ESP32 softAP. This can have value from 1 to 10. Driver/Hardware current limit is 10.ssid_hidden
: If softAP should broadcast its SSID or not- 0 : SSID should be broadcasted
- 1 : SSID should not be broadcasted
bandwidth
: set bandwidth of ESP32 softAPWIFI_BW_HT20
: 20MHz BandwidthWIFI_BW_HT40
: 40MHz Bandwidth
- 0 : SUCCESS
- -1 : FAILURE
This is used to get configuration of ESP32 softAP .
softap_config
: Get configuration of ESP32 softAPssid
: SSID or name of softAPpwd
: password of softAPchannel
: channel ID of softAPencryption_mode
: encryption mode or authentication mode softAP is using- 0 : OPEN
- 2 : WPA_PSK
- 3 : WPA2_PSK
- 4 : WPA_WPA2_PSK
max_connections
: software value of maximum number of stations can connect to softAP currentlyssid_hidden
: softAP is broadcasting its SSID or not- 0 : SSID is broadcasted
- 1 : SSID is not broadcasted
bandwidth
: current bandwidth of softAPWIFI_BW_HT20
: 20MHz BandwidthWIFI_BW_HT40
: 40MHz Bandwidth
- 0 : SUCCESS
- -1 : FAILURE
This is used to stop ESP32 softAP.
- 0 : SUCCESS
- -1 : FAILURE
This is used to get list of available neighboring APs of ESP32.
count
: number of available neighboring APs.
esp_hosted_wifi_scanlist_t
handler :
Handler is pointer to list of scanned neighboring APs.
User should free esp_hosted_wifi_scanlist_t
handler after use.
This is used to get list of connected stations to ESP32 softAP.
num
: number of stations connected
esp_hosted_wifi_connected_stations_list
handler :
Handler is pointer to list of connected stations to ESP32 softAP.
User should free esp_hosted_wifi_connected_stations_list
handler after use.
Values:
WIFI_MODE_NULL
= 0 : Wi-Fi null or uininitialized modeWIFI_MODE_STA
: WiFi station modeWIFI_MODE_AP
: WiFi softAP modeWIFI_MODE_APSTA
: WiFi station + softAP modeWIFI_MODE_MAX
Supported authentication or encryption mode in station, softAP mode. Values:
WIFI_AUTH_OPEN
= 0 : Open modeWIFI_AUTH_WEP
: WEP modeWIFI_AUTH_WPA_PSK
: WPA_PSK modeWIFI_AUTH_WPA2_PSK
: WPA2_PSK modeWIFI_AUTH_WPA_WPA2_PSK
: WPA_WPA2_PSK modeWIFI_AUTH_WPA2_ENTERPRISE
: WPA2_ENTERPRISE modeWIFI_AUTH_WPA3_PSK
: WPA3_PSK modeWIFI_AUTH_WPA2_WPA3_PSK
: WPA2_WPA3_PSK mode
Bandwidth in 2.4 GHz band. Values :
WIFI_BW_HT20
= 1 : 20MHz BandwidthWIFI_BW_HT40
: 40MHz Bandwidth
Power save mode for ESP32 Values :
WIFI_PS_MIN_MODEM
= 1 : Minimum modem power saving. In this mode, station wakes up to receive beacon every DTIM period.WIFI_PS_MAX_MODEM
: Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wifi set ap config function.WIFI_PS_INVALID
: Invalid power save mode
This is ESP32 control configuration union. Its used for providing configurations to ESP32 station or softAP mode.
Public Members
- struct
esp_hosted_sta_config_t
: ESP32 station mode config - struct
esp_hosted_softap_config_t
: ESP32 softAP mode config