2016-08-17 11:08:22 -04:00
|
|
|
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2016-09-07 08:33:13 -04:00
|
|
|
|
|
|
|
/* Notes about WiFi Programming
|
|
|
|
*
|
2016-09-12 04:43:32 -04:00
|
|
|
* The esp32 WiFi programming model can be depicted as following picture:
|
2016-09-07 08:33:13 -04:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* default handler user handler
|
2016-09-12 04:43:32 -04:00
|
|
|
* ------------- --------------- ---------------
|
|
|
|
* | | event | | callback or | |
|
|
|
|
* | tcpip | ---------> | event | ----------> | application |
|
2016-09-07 08:33:13 -04:00
|
|
|
* | stack | | task | event | task |
|
|
|
|
* |-----------| |-------------| |-------------|
|
|
|
|
* /|\ |
|
|
|
|
* | |
|
|
|
|
* event | |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* --------------- |
|
|
|
|
* | | |
|
|
|
|
* | WiFi Driver |/__________________|
|
|
|
|
* | |\ API call
|
|
|
|
* | |
|
|
|
|
* |-------------|
|
2016-09-12 04:43:32 -04:00
|
|
|
*
|
|
|
|
* The WiFi driver can be consider as black box, it knows nothing about the high layer code, such as
|
|
|
|
* TCPIP stack, application task, event task etc, all it can do is to receive API call from high layer
|
|
|
|
* or post event queue to a specified Queue, which is initialized by API esp_wifi_init().
|
2016-09-07 08:33:13 -04:00
|
|
|
*
|
|
|
|
* The event task is a daemon task, which receives events from WiFi driver or from other subsystem, such
|
|
|
|
* as TCPIP stack, event task will call the default callback function on receiving the event. For example,
|
|
|
|
* on receiving event SYSTEM_EVENT_STA_CONNECTED, it will call tcpip_adapter_start() to start the DHCP
|
2016-09-12 04:43:32 -04:00
|
|
|
* client in it's default handler.
|
|
|
|
*
|
|
|
|
* Application can register it's own event callback function by API esp_event_init, then the application callback
|
|
|
|
* function will be called after the default callback. Also, if application doesn't want to execute the callback
|
|
|
|
* in the event task, what it needs to do is to post the related event to application task in the application callback function.
|
2016-09-07 08:33:13 -04:00
|
|
|
*
|
2016-09-12 04:43:32 -04:00
|
|
|
* The application task (code) generally mixes all these thing together, it calls APIs to init the system/WiFi and
|
2016-09-07 08:33:13 -04:00
|
|
|
* handle the events when necessary.
|
2016-09-12 04:43:32 -04:00
|
|
|
*
|
2016-09-07 08:33:13 -04:00
|
|
|
*/
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
#ifndef __ESP_WIFI_H__
|
|
|
|
#define __ESP_WIFI_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2016-09-25 13:35:31 -04:00
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/queue.h"
|
2016-08-22 23:22:58 -04:00
|
|
|
#include "rom/queue.h"
|
2016-09-26 23:33:19 -04:00
|
|
|
#include "esp_err.h"
|
2016-09-26 23:47:47 -04:00
|
|
|
#include "esp_wifi_types.h"
|
2016-09-26 23:33:19 -04:00
|
|
|
#include "esp_event.h"
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-11-08 04:34:46 -05:00
|
|
|
#define ESP_ERR_WIFI_OK ESP_OK /*!< No error */
|
|
|
|
#define ESP_ERR_WIFI_FAIL ESP_FAIL /*!< General fail code */
|
|
|
|
#define ESP_ERR_WIFI_NO_MEM ESP_ERR_NO_MEM /*!< Out of memory */
|
|
|
|
#define ESP_ERR_WIFI_ARG ESP_ERR_INVALID_ARG /*!< Invalid argument */
|
2016-11-08 06:19:28 -05:00
|
|
|
#define ESP_ERR_WIFI_NOT_SUPPORT ESP_ERR_NOT_SUPPORTED /*!< Indicates that API is not supported yet */
|
|
|
|
|
2016-11-08 04:34:46 -05:00
|
|
|
#define ESP_ERR_WIFI_NOT_INIT (ESP_ERR_WIFI_BASE + 1) /*!< WiFi driver is not installed by esp_wifi_init */
|
|
|
|
#define ESP_ERR_WIFI_NOT_START (ESP_ERR_WIFI_BASE + 2) /*!< WiFi driver is not started by esp_wifi_start */
|
2016-11-08 06:19:28 -05:00
|
|
|
#define ESP_ERR_WIFI_IF (ESP_ERR_WIFI_BASE + 3) /*!< WiFi interface error */
|
|
|
|
#define ESP_ERR_WIFI_MODE (ESP_ERR_WIFI_BASE + 4) /*!< WiFi mode error */
|
|
|
|
#define ESP_ERR_WIFI_STATE (ESP_ERR_WIFI_BASE + 5) /*!< WiFi internal state error */
|
|
|
|
#define ESP_ERR_WIFI_CONN (ESP_ERR_WIFI_BASE + 6) /*!< WiFi internal control block of station or soft-AP error */
|
|
|
|
#define ESP_ERR_WIFI_NVS (ESP_ERR_WIFI_BASE + 7) /*!< WiFi internal NVS module error */
|
|
|
|
#define ESP_ERR_WIFI_MAC (ESP_ERR_WIFI_BASE + 8) /*!< MAC address is invalid */
|
|
|
|
#define ESP_ERR_WIFI_SSID (ESP_ERR_WIFI_BASE + 9) /*!< SSID is invalid */
|
|
|
|
#define ESP_ERR_WIFI_PASSWORD (ESP_ERR_WIFI_BASE + 10) /*!< Passord is invalid */
|
|
|
|
#define ESP_ERR_WIFI_TIMEOUT (ESP_ERR_WIFI_BASE + 11) /*!< Timeout error */
|
2016-11-30 23:08:11 -05:00
|
|
|
#define ESP_ERR_WIFI_WAKE_FAIL (ESP_ERR_WIFI_BASE + 12) /*!< WiFi is in sleep state(RF closed) and wakeup fail */
|
2016-11-08 04:34:46 -05:00
|
|
|
|
2016-11-15 12:35:09 -05:00
|
|
|
/**
|
|
|
|
* @brief WiFi stack configuration parameters passed to esp_wifi_init call.
|
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
typedef struct {
|
2016-09-26 23:47:47 -04:00
|
|
|
system_event_handler_t event_handler; /**< WiFi event handler */
|
2016-08-17 11:08:22 -04:00
|
|
|
} wifi_init_config_t;
|
|
|
|
|
2016-09-26 08:15:16 -04:00
|
|
|
|
2016-09-26 23:33:19 -04:00
|
|
|
#define WIFI_INIT_CONFIG_DEFAULT() { \
|
|
|
|
.event_handler = &esp_event_send, \
|
2016-09-26 08:15:16 -04:00
|
|
|
};
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Init WiFi
|
|
|
|
* Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer,
|
|
|
|
* WiFi NVS structure etc, this WiFi also start WiFi task
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-09-12 04:43:32 -04:00
|
|
|
* @attention 1. This API must be called before all other WiFi API can be called
|
|
|
|
* @attention 2. Generally we should init event_q in *config, WiFi driver will post the event
|
|
|
|
* to this queue when event happens, such as, when station connects to WiFi, WiFi driver
|
|
|
|
* will post station connected event to this queue. If the queue is not initialized, WiFi
|
2016-09-07 05:29:08 -04:00
|
|
|
* will not post any events
|
2016-09-12 04:43:32 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param config provide WiFi init configuration
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NO_MEM: out of memory
|
|
|
|
* - others: refer to error code esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_init(wifi_init_config_t *config);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Deinit WiFi
|
|
|
|
* Free all resource allocated in esp_wifi_init and stop WiFi task
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-09-12 04:43:32 -04:00
|
|
|
* @attention 1. This API should be called if you want to remove WiFi driver from the system
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @return ESP_OK: succeed
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_deinit(void);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Set the WiFi operating mode
|
|
|
|
*
|
|
|
|
* Set the WiFi operating mode as station, soft-AP or station+soft-AP,
|
|
|
|
* The default mode is soft-AP mode.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param mode WiFi operating mode
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - others: refer to error code in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_set_mode(wifi_mode_t mode);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get current operating mode of WiFi
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param[out] mode store current WiFi mode
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Start WiFi according to current configuration
|
|
|
|
* If mode is WIFI_MODE_STA, it create station control block and start station
|
|
|
|
* If mode is WIFI_MODE_AP, it create soft-AP control block and start soft-AP
|
|
|
|
* If mode is WIFI_MODE_APSTA, it create soft-AP and station control block and start soft-AP and station
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_NO_MEM: out of memory
|
|
|
|
* - ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
|
|
|
|
* - ESP_ERR_WIFI_FAIL: other WiFi internal errors
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_start(void);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Stop WiFi
|
2016-11-15 12:35:09 -05:00
|
|
|
* If mode is WIFI_MODE_STA, it stop station and free station control block
|
2016-09-12 04:43:32 -04:00
|
|
|
* If mode is WIFI_MODE_AP, it stop soft-AP and free soft-AP control block
|
|
|
|
* If mode is WIFI_MODE_APSTA, it stop station/soft-AP and free station/soft-AP control block
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_stop(void);
|
|
|
|
|
2016-11-21 04:15:37 -05:00
|
|
|
/**
|
|
|
|
* @brief Restore WiFi stack persistent settings to default values
|
|
|
|
*
|
|
|
|
* This function will reset settings made using the following APIs:
|
|
|
|
* - esp_wifi_get_auto_connect,
|
|
|
|
* - esp_wifi_set_protocol,
|
|
|
|
* - esp_wifi_set_config related
|
|
|
|
* - esp_wifi_set_mode
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
*/
|
|
|
|
esp_err_t esp_wifi_restore(void);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Connect the ESP32 WiFi station to the AP.
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
|
|
|
* @attention 1. This API only impact WIFI_MODE_STA or WIFI_MODE_APSTA mode
|
|
|
|
* @attention 2. If the ESP32 is connected to an AP, call esp_wifi_disconnect to disconnect.
|
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
|
|
|
* - ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
|
|
|
|
* - ESP_ERR_WIFI_SSID: SSID of AP which station connects is invalid
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_connect(void);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Disconnect the ESP32 WiFi station from the AP.
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
|
|
|
* - ESP_ERR_WIFI_FAIL: other WiFi internal errors
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_disconnect(void);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Currently this API is just an stub API
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - others: fail
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-30 06:09:48 -04:00
|
|
|
esp_err_t esp_wifi_clear_fast_connect(void);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-10-26 09:50:15 -04:00
|
|
|
* @brief deauthenticate all stations or associated id equals to aid
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param aid when aid is 0, deauthenticate all stations, otherwise deauthenticate station whose associated id is aid
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-10-26 09:50:15 -04:00
|
|
|
esp_err_t esp_wifi_deauth_sta(uint16_t aid);
|
2016-08-30 06:09:48 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Scan all available APs.
|
|
|
|
*
|
2016-09-12 04:43:32 -04:00
|
|
|
* @attention If this API is called, the found APs are stored in WiFi driver dynamic allocated memory and the
|
2016-09-07 05:29:08 -04:00
|
|
|
* will be freed in esp_wifi_get_ap_list, so generally, call esp_wifi_get_ap_list to cause
|
|
|
|
* the memory to be freed once the scan is done
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param config configuration of scanning
|
|
|
|
* @param block if block is true, this API will block the caller until the scan is done, otherwise
|
2016-09-12 04:43:32 -04:00
|
|
|
* it will return immediately
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
|
|
|
* - ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout
|
|
|
|
* - others: refer to error code in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-11-15 12:35:09 -05:00
|
|
|
esp_err_t esp_wifi_scan_start(wifi_scan_config_t *config, bool block);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Stop the scan in process
|
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_scan_stop(void);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get number of APs found in last scan
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param[out] number store number of APIs found in last scan
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @attention This API can only be called when the scan is completed, otherwise it may get wrong value.
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-10-26 08:02:39 -04:00
|
|
|
esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get AP list found in last scan
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param[inout] number As input param, it stores max AP number ap_records can hold.
|
|
|
|
* As output param, it receives the actual AP number this API returns.
|
|
|
|
* @param ap_records wifi_ap_record_t array to hold the found APs
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_NO_MEM: out of memory
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-10-26 08:02:39 -04:00
|
|
|
esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-10-26 22:42:01 -04:00
|
|
|
|
|
|
|
/**
|
2016-11-15 12:35:09 -05:00
|
|
|
* @brief Get information of AP which the ESP32 station is associated with
|
2016-10-26 22:42:01 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ap_info the wifi_ap_record_t to hold AP information
|
2016-10-26 22:42:01 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - others: fail
|
2016-10-26 22:42:01 -04:00
|
|
|
*/
|
|
|
|
esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Set current power save type
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-30 23:08:11 -05:00
|
|
|
* @attention Default power save type is WIFI_PS_NONE.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param type power save type
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @return ESP_ERR_WIFI_NOT_SUPPORT: not supported yet
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_set_ps(wifi_ps_type_t type);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get current power save type
|
|
|
|
*
|
2016-11-30 23:08:11 -05:00
|
|
|
* @attention Default power save type is WIFI_PS_NONE.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param[out] type: store current power save type
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @return ESP_ERR_WIFI_NOT_SUPPORT: not supported yet
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Set protocol type of specified interface
|
|
|
|
* The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N)
|
|
|
|
*
|
|
|
|
* @attention Currently we only support 802.11b or 802.11bg or 802.11bgn mode
|
2016-09-12 04:43:32 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interfaces
|
|
|
|
* @param protocol_bitmap WiFi protocol bitmap
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
|
|
|
* - others: refer to error codes in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
|
|
|
esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
|
|
|
|
|
|
|
|
/**
|
2016-11-15 12:35:09 -05:00
|
|
|
* @brief Get the current protocol bitmap of the specified interface
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interface
|
|
|
|
* @param[out] protocol_bitmap store current WiFi protocol bitmap of interface ifx
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - others: refer to error codes in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
|
|
|
esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Set the bandwidth of ESP32 specified interface
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @attention 1. API return false if try to configure an interface that is not enabled
|
2016-09-07 05:29:08 -04:00
|
|
|
* @attention 2. WIFI_BW_HT40 is supported only when the interface support 11N
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interface to be configured
|
|
|
|
* @param bw bandwidth
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - others: refer to error codes in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get the bandwidth of ESP32 specified interface
|
|
|
|
*
|
|
|
|
* @attention 1. API return false if try to get a interface that is not enable
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interface to be configured
|
|
|
|
* @param[out] bw store bandwidth of interface ifx
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-11-15 12:35:09 -05:00
|
|
|
* @brief Set primary/secondary channel of ESP32
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
|
|
|
* @attention 1. This is a special API for sniffer
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param primary for HT20, primary is the channel number, for HT40, primary is the primary channel
|
|
|
|
* @param second for HT20, second is ignored, for HT40, second is the second channel
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-11-15 12:35:09 -05:00
|
|
|
* @brief Get the primary/secondary channel of ESP32
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
|
|
|
* @attention 1. API return false if try to get a interface that is not enable
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param primary store current primary channel
|
|
|
|
* @param[out] second store current second channel
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Set country code
|
|
|
|
* The default value is WIFI_COUNTRY_CN
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param country country type
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - others: refer to error code in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_set_country(wifi_country_t country);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get country code
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param country store current country
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_get_country(wifi_country_t *country);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Set MAC address of the ESP32 WiFi station or the soft-AP interface.
|
|
|
|
*
|
|
|
|
* @attention 1. This API can only be called when the interface is disabled
|
|
|
|
* @attention 2. ESP32 soft-AP and station have different MAC addresses, do not set them to be the same.
|
2016-11-15 12:35:09 -05:00
|
|
|
* @attention 3. The bit 0 of the first byte of ESP32 MAC address can not be 1. For example, the MAC address
|
2016-09-07 05:29:08 -04:00
|
|
|
* can set to be "1a:XX:XX:XX:XX:XX", but can not be "15:XX:XX:XX:XX:XX".
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interface
|
|
|
|
* @param mac the MAC address
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
|
|
|
* - ESP_ERR_WIFI_MAC: invalid mac address
|
|
|
|
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
|
|
|
|
* - others: refer to error codes in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, uint8_t mac[6]);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get mac of specified interface
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interface
|
|
|
|
* @param[out] mac store mac of the interface ifx
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief The RX callback function in the promiscuous mode.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* Each time a packet is received, the callback function will be called.
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param buf the data received
|
|
|
|
* @param len data length
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return none
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
typedef void (* wifi_promiscuous_cb_t)(void *buf, uint16_t len);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Register the RX callback function in the promiscuous mode.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* Each time a packet is received, the registered callback function will be called.
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param cb callback
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-27 06:10:01 -04:00
|
|
|
esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Enable the promiscuous mode.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param en false - disable, true - enable
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-09-26 08:15:16 -04:00
|
|
|
esp_err_t esp_wifi_set_promiscuous(bool en);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get the promiscuous mode.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param[out] en store the current status of promiscuous mode
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-09-26 08:15:16 -04:00
|
|
|
esp_err_t esp_wifi_get_promiscuous(bool *en);
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Set the configuration of the ESP32 STA or AP
|
|
|
|
*
|
2016-09-12 04:43:32 -04:00
|
|
|
* @attention 1. This API can be called only when specified interface is enabled, otherwise, API fail
|
|
|
|
* @attention 2. For station configuration, bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.
|
2016-09-07 05:29:08 -04:00
|
|
|
* @attention 3. ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as
|
|
|
|
* the channel of the ESP32 station.
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interface
|
|
|
|
* @param conf station or soft-AP configuration
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
|
|
|
* - ESP_ERR_WIFI_MODE: invalid mode
|
|
|
|
* - ESP_ERR_WIFI_PASSWORD: invalid password
|
|
|
|
* - ESP_ERR_WIFI_NVS: WiFi internal NVS error
|
|
|
|
* - others: refer to the erro code in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get configuration of specified interface
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ifx interface
|
|
|
|
* @param[out] conf station or soft-AP configuration
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_IF: invalid interface
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-17 11:08:22 -04:00
|
|
|
esp_err_t esp_wifi_get_config(wifi_interface_t ifx, wifi_config_t *conf);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Get STAs associated with soft-AP
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
|
|
|
* @attention SSC only API
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param[out] sta station list
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
|
|
|
|
* - ESP_ERR_WIFI_CONN: WiFi internal error, the station/soft-AP control block is invalid
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-10-26 06:16:40 -04:00
|
|
|
esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
|
2016-08-22 23:22:58 -04:00
|
|
|
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Set the WiFi API configuration storage type
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
|
|
|
* @attention 1. The default value is WIFI_STORAGE_FLASH
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param storage : storage type
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-09-01 03:09:00 -04:00
|
|
|
esp_err_t esp_wifi_set_storage(wifi_storage_t storage);
|
2016-08-30 06:09:48 -04:00
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
2016-09-12 04:43:32 -04:00
|
|
|
* @brief Set auto connect
|
2016-09-07 05:29:08 -04:00
|
|
|
* The default value is true
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param en : true - enable auto connect / false - disable auto connect
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_MODE: WiFi internal error, the station/soft-AP control block is invalid
|
|
|
|
* - others: refer to error code in esp_err.h
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-30 06:04:22 -04:00
|
|
|
esp_err_t esp_wifi_set_auto_connect(bool en);
|
|
|
|
|
2016-09-07 05:29:08 -04:00
|
|
|
/**
|
|
|
|
* @brief Get the auto connect flag
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param[out] en store current auto connect configuration
|
2016-09-07 05:29:08 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
2016-09-07 05:29:08 -04:00
|
|
|
*/
|
2016-08-30 06:04:22 -04:00
|
|
|
esp_err_t esp_wifi_get_auto_connect(bool *en);
|
|
|
|
|
2016-09-13 05:11:53 -04:00
|
|
|
/**
|
|
|
|
* @brief Set vendor specific element
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param enable enable or not
|
|
|
|
* @param type information element type
|
|
|
|
* @param idx information element index
|
|
|
|
* @param vnd_ie pointer to a vendor specific element
|
2016-09-13 05:11:53 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
|
|
|
* - ESP_ERR_WIFI_ARG: invalid argument
|
|
|
|
* - ESP_ERR_WIFI_NO_MEM: out of memory
|
2016-09-13 05:11:53 -04:00
|
|
|
*/
|
2016-09-13 23:30:19 -04:00
|
|
|
esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, uint8_t *vnd_ie);
|
2016-09-13 05:11:53 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define function pointer for vendor specific element callback
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param ctx reserved
|
|
|
|
* @param type information element type
|
|
|
|
* @param sa source address
|
|
|
|
* @param vnd_ie pointer to a vendor specific element
|
|
|
|
* @param rssi received signal strength indication
|
2016-09-13 05:11:53 -04:00
|
|
|
*/
|
2016-09-13 23:30:19 -04:00
|
|
|
typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const uint8_t *vnd_ie, int rssi);
|
2016-09-13 05:11:53 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set vendor specific element callback
|
|
|
|
*
|
2016-11-15 12:35:09 -05:00
|
|
|
* @param cb callback function
|
|
|
|
* @param ctx reserved
|
2016-09-13 05:11:53 -04:00
|
|
|
*
|
2016-11-08 04:34:46 -05:00
|
|
|
* @return
|
2016-11-15 12:35:09 -05:00
|
|
|
* - ESP_OK: succeed
|
|
|
|
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init
|
2016-09-13 05:11:53 -04:00
|
|
|
*/
|
|
|
|
esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ESP_WIFI_H__ */
|