feat(wifi): Add wifi APIs according to IDF

This commit is contained in:
Zhang Jun Hao
2018-06-23 18:23:34 +08:00
parent 5d31b02f9b
commit ffe1e5c9cd
8 changed files with 1247 additions and 1734 deletions

View File

@ -0,0 +1,36 @@
// Copyright 2018 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.
#ifndef __ESP_INTERFACE_H__
#define __ESP_INTERFACE_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
ESP_IF_WIFI_STA = 0, /**< ESP8266 station interface */
ESP_IF_WIFI_AP, /**< ESP8266 soft-AP interface */
ESP_IF_MAX
} esp_interface_t;
#ifdef __cplusplus
}
#endif
#endif /* __ESP_INTERFACE_TYPES_H__ */

View File

@ -1,294 +0,0 @@
/*
* ESPRSSIF MIT License
*
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
* it is free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __ESP_SOFTAP_H__
#define __ESP_SOFTAP_H__
#include <stdint.h>
#include <stdbool.h>
#include <sys/queue.h>
#include "esp_wifi.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup WiFi_APIs WiFi Related APIs
* @brief WiFi APIs
*/
/** @addtogroup WiFi_APIs
* @{
*/
/** \defgroup SoftAP_APIs SoftAP APIs
* @brief ESP8266 Soft-AP APIs
* @attention To call APIs related to ESP8266 soft-AP has to enable soft-AP mode first (wifi_set_opmode)
*/
/** @addtogroup SoftAP_APIs
* @{
*/
struct softap_config {
uint8_t ssid[32]; /**< SSID of ESP8266 soft-AP */
uint8_t password[64]; /**< Password of ESP8266 soft-AP */
uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
uint8_t channel; /**< Channel of ESP8266 soft-AP */
AUTH_MODE authmode; /**< Auth mode of ESP8266 soft-AP. Do not support AUTH_WEP in soft-AP mode */
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */
uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 */
};
struct station_info {
STAILQ_ENTRY(station_info) next; /**< Information of next AP */
uint8_t bssid[6]; /**< BSSID of AP */
struct ip4_addr ip; /**< IP address of AP */
};
/**
* @brief Get the current configuration of the ESP8266 WiFi soft-AP
*
* @param struct softap_config *config : ESP8266 soft-AP configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_get_config(struct softap_config *config);
/**
* @brief Get the configuration of the ESP8266 WiFi soft-AP saved in the flash
*
* @param struct softap_config *config : ESP8266 soft-AP configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_get_config_default(struct softap_config *config);
/**
* @brief Set the configuration of the WiFi soft-AP and save it to the Flash.
*
* @attention 1. This configuration will be saved in flash system parameter area if changed
* @attention 2. The ESP8266 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 ESP8266 station.
*
* @param struct softap_config *config : ESP8266 soft-AP configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_config(struct softap_config *config);
/**
* @brief Set the configuration of the WiFi soft-AP; the configuration will
* not be saved to the Flash.
*
* @attention The ESP8266 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 ESP8266 station.
*
* @param struct softap_config *config : ESP8266 soft-AP configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_config_current(struct softap_config *config);
/**
* @brief Get the number of stations connected to the ESP8266 soft-AP.
*
* @attention The ESP8266 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 ESP8266 station.
*
* @param null
*
* @return the number of stations connected to the ESP8266 soft-AP
*/
uint8_t wifi_softap_get_station_num(void);
/**
* @brief Get the information of stations connected to the ESP8266 soft-AP,
* including MAC and IP.
*
* @attention wifi_softap_get_station_info depends on DHCP, it can only
* be used when DHCP is enabled, so it can not get the static IP.
*
* @param null
*
* @return struct station_info* : station information structure
*/
struct station_info *wifi_softap_get_station_info(void);
/**
* @brief Free the space occupied by station_info when wifi_softap_get_station_info is called.
*
* @attention The ESP8266 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 ESP8266 station.
*
* @param null
*
* @return null
*/
void wifi_softap_free_station_info(void);
/**
* @brief Enable the ESP8266 soft-AP DHCP server.
*
* @attention 1. The DHCP is enabled by default.
* @attention 2. The DHCP and the static IP related API (wifi_set_ip_info) influence
* each other, if the DHCP is enabled, the static IP will be disabled;
* if the static IP is enabled, the DHCP will be disabled.
* It depends on the latest configuration.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_dhcps_start(void);
/**
* @brief Disable the ESP8266 soft-AP DHCP server. The DHCP is enabled by default.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_dhcps_stop(void);
/**
* @brief Get the ESP8266 soft-AP DHCP server status.
*
* @param null
*
* @return enum dhcp_status
*/
enum dhcp_status wifi_softap_dhcps_status(void);
/**
* @brief Query the IP range that can be got from the ESP8266 soft-AP DHCP server.
*
* @attention This API can only be called during ESP8266 soft-AP DHCP server enabled.
*
* @param struct dhcps_lease *please : IP range of the ESP8266 soft-AP DHCP server.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_get_dhcps_lease(struct dhcps_lease *please);
/**
* @brief Set the IP range of the ESP8266 soft-AP DHCP server.
*
* @attention 1. The IP range should be in the same sub-net with the ESP8266
* soft-AP IP address.
* @attention 2. This API should only be called when the DHCP server is disabled
* (wifi_softap_dhcps_stop).
* @attention 3. This configuration will only take effect the next time when the
* DHCP server is enabled (wifi_softap_dhcps_start).
* - If the DHCP server is disabled again, this API should be called to set the IP range.
* - Otherwise, when the DHCP server is enabled later, the default IP range will be used.
*
* @param struct dhcps_lease *please : IP range of the ESP8266 soft-AP DHCP server.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please);
/**
* @brief Get ESP8266 soft-AP DHCP server lease time.
*
* @attention This API can only be called during ESP8266 soft-AP DHCP server enabled.
*
* @param null
*
* @return lease time, uint: minute.
*/
uint32_t wifi_softap_get_dhcps_lease_time(void);
/**
* @brief Set ESP8266 soft-AP DHCP server lease time, default is 120 minutes.
*
* @attention This API can only be called during ESP8266 soft-AP DHCP server enabled.
*
* @param uint32 minute : lease time, uint: minute, range:[1, 2880].
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_dhcps_lease_time(uint32_t minute);
/**
* @brief Reset ESP8266 soft-AP DHCP server lease time which is 120 minutes by default.
*
* @attention This API can only be called during ESP8266 soft-AP DHCP server enabled.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_reset_dhcps_lease_time(void);
/**
* @brief Set the ESP8266 soft-AP DHCP server option.
*
* Example:
* <pre>
* uint8 mode = 0;
* wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode);
* </pre>
*
* @param uint8 level : OFFER_ROUTER, set the router option.
* @param void* optarg :
* - bit0, 0 disable the router information;
* - bit0, 1 enable the router information.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_dhcps_offer_option(uint8_t level, void *optarg);
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,443 +0,0 @@
/*
* ESPRSSIF MIT License
*
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
* it is free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __ESP_STA_H__
#define __ESP_STA_H__
#include <stdbool.h>
#include <stdint.h>
#include <sys/queue.h>
#include "esp_wifi.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup WiFi_APIs WiFi Related APIs
* @brief WiFi APIs
*/
/** @addtogroup WiFi_APIs
* @{
*/
/** \defgroup Station_APIs Station APIs
* @brief ESP8266 station APIs
* @attention To call APIs related to ESP8266 station has to enable station mode
* first (wifi_set_opmode)
*/
/** @addtogroup Station_APIs
* @{
*/
struct station_config {
uint8_t ssid[32]; /**< SSID of target AP*/
uint8_t password[64]; /**< password of target AP*/
uint8_t 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*/
};
/**
* @brief Get the current configuration of the ESP8266 WiFi station.
*
* @param struct station_config *config : ESP8266 station configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_get_config(struct station_config *config);
/**
* @brief Get the configuration parameters saved in the Flash of the ESP8266 WiFi station.
*
* @param struct station_config *config : ESP8266 station configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_get_config_default(struct station_config *config);
/**
* @brief Set the configuration of the ESP8266 station and save it to the Flash.
*
* @attention 1. This API can be called only when the ESP8266 station is enabled.
* @attention 2. If wifi_station_set_config is called in user_init , there is no
* need to call wifi_station_connect.
* The ESP8266 station will automatically connect to the AP (router)
* after the system initialization. Otherwise, wifi_station_connect should be called.
* @attention 3. 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.
* @attention 4. This configuration will be saved in the Flash system parameter area if changed.
*
* @param struct station_config *config : ESP8266 station configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_set_config(struct station_config *config);
/**
* @brief Set the configuration of the ESP8266 station. And the configuration
* will not be saved to the Flash.
*
* @attention 1. This API can be called only when the ESP8266 station is enabled.
* @attention 2. If wifi_station_set_config_current is called in user_init , there
* is no need to call wifi_station_connect.
* The ESP8266 station will automatically connect to the AP (router)
* after the system initialization. Otherwise, wifi_station_connect
* should be called.
* @attention 3. 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.
*
* @param struct station_config *config : ESP8266 station configuration
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_set_config_current(struct station_config *config);
/**
* @brief Connect the ESP8266 WiFi station to the AP.
*
* @attention 1. This API should be called when the ESP8266 station is enabled,
* and the system initialization is completed. Do not call this API in user_init.
* @attention 2. If the ESP8266 is connected to an AP, call wifi_station_disconnect to disconnect.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_connect(void);
/**
* @brief Disconnect the ESP8266 WiFi station from the AP.
*
* @attention This API should be called when the ESP8266 station is enabled,
* and the system initialization is completed. Do not call this API in user_init.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_disconnect(void);
typedef enum {
WIFI_SCAN_TYPE_ACTIVE = 0, /**< active scan */
WIFI_SCAN_TYPE_PASSIVE, /**< passive scan */
} wifi_scan_type_t;
/** @brief Range of active scan times per channel */
typedef struct {
uint32_t min; /**< minimum active scan time per channel, units: millisecond */
uint32_t max; /**< maximum active scan time per channel, units: millisecond, values above 1500ms may
cause station to disconnect from AP and are not recommended. */
} wifi_active_scan_time_t;
/** @brief Aggregate of active & passive scan time per channel */
typedef union {
wifi_active_scan_time_t active; /**< active scan time per channel, units: millisecond. */
uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may
cause station to disconnect from AP and are not recommended. */
} wifi_scan_time_t;
struct scan_config {
uint8_t *ssid; /**< SSID of AP */
uint8_t *bssid; /**< MAC address of AP */
uint8_t channel; /**< channel, scan the specific channel */
uint8_t show_hidden; /**< enable to scan AP whose SSID is hidden */
wifi_scan_type_t scan_type; /**< scan type, active or passive */
wifi_scan_time_t scan_time; /**< scan time per channel */
};
typedef enum {
CIPHER_NONE = 0, /**< the cipher type is none */
CIPHER_WEP40, /**< the cipher type is WEP40 */
CIPHER_WEP104, /**< the cipher type is WEP104 */
CIPHER_TKIP, /**< the cipher type is TKIP */
CIPHER_CCMP, /**< the cipher type is CCMP */
CIPHER_TKIP_CCMP, /**< the cipher type is TKIP and CCMP */
CIPHER_UNKNOWN, /**< the cipher type is unknown */
} CIPHER_TYPE;
struct bss_info {
STAILQ_ENTRY(bss_info) next; /**< information of next AP */
uint8_t bssid[6]; /**< MAC address of AP */
uint8_t ssid[32]; /**< SSID of AP */
uint8_t ssid_len; /**< SSID length */
uint8_t channel; /**< channel of AP */
int8_t rssi; /**< single strength of AP */
AUTH_MODE authmode; /**< authmode of AP */
uint8_t is_hidden; /**< SSID of current AP is hidden or not. */
int16_t freq_offset; /**< frequency offset */
int16_t freqcal_val;
uint8_t *esp_mesh_ie;
CIPHER_TYPE pairwise_cipher; /**< pairwise cipher of AP */
CIPHER_TYPE group_cipher; /**< group cipher of AP */
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
uint32_t wps:1; /**< bit: 3 flag to identify if WPS is supported or not */
uint32_t reserved:28; /**< bit: 4..31 reserved */
};
typedef enum {
OK = 0,
FAIL,
PENDING,
BUSY,
CANCEL,
} STATUS;
/**
* @brief Callback function for wifi_station_scan.
*
* @param void *arg : information of APs that are found; save them as linked list;
* refer to struct bss_info
* @param STATUS status : status of scanning
*
* @return null
*/
typedef void (* scan_done_cb_t)(void *arg, STATUS status);
/**
* @brief Scan all available APs.
*
* @attention This API should be called when the ESP8266 station is enabled, and
* the system initialization is completed. Do not call this API in user_init.
*
* @param struct scan_config *config : configuration of scanning
* @param struct scan_done_cb_t cb : callback of scanning
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb);
/**
* @brief Check if the ESP8266 station will connect to the recorded AP automatically
* when the power is on.
*
* @param null
*
* @return true : connect to the AP automatically
* @return false : not connect to the AP automatically
*/
bool wifi_station_get_auto_connect(void);
/**
* @brief Set whether the ESP8266 station will connect to the recorded AP
* automatically when the power is on. It will do so by default.
*
* @attention 1. If this API is called in user_init, it is effective immediately
* after the power is on. If it is called in other places, it will
* be effective the next time when the power is on.
* @attention 2. This configuration will be saved in Flash system parameter area if changed.
*
* @param bool set : If it will automatically connect to the AP when the power is on
* - true : it will connect automatically
* - false: it will not connect automatically
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_set_auto_connect(bool set);
/**
* @brief Check whether the ESP8266 station will reconnect to the AP after disconnection.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_get_reconnect_policy(void);
/**
* @brief Set whether the ESP8266 station will reconnect to the AP after disconnection.
* It will do so by default.
*
* @attention If users want to call this API, it is suggested that users call this API in user_init.
*
* @param bool set : if it's true, it will enable reconnection; if it's false,
* it will disable reconnection.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_set_reconnect_policy(bool set);
typedef enum {
STATION_IDLE = 0, /**< ESP8266 station idle */
STATION_CONNECTING, /**< ESP8266 station is connecting to AP*/
STATION_WRONG_PASSWORD, /**< the password is wrong*/
STATION_NO_AP_FOUND, /**< ESP8266 station can not find the target AP*/
STATION_CONNECT_FAIL, /**< ESP8266 station fail to connect to AP*/
STATION_GOT_IP /**< ESP8266 station got IP address from AP*/
} STATION_STATUS;
/**
* @brief Get the connection status of the ESP8266 WiFi station.
*
* @param null
*
* @return the status of connection
*/
STATION_STATUS wifi_station_get_connect_status(void);
/**
* @brief Get the information of APs (5 at most) recorded by ESP8266 station.
*
* @param struct station_config config[] : information of the APs, the array size should be 5.
*
* @return The number of APs recorded.
*/
uint8_t wifi_station_get_current_ap_id(void);
/**
* @brief Switch the ESP8266 station connection to a recorded AP.
*
* @param uint8_t new_ap_id : AP's record id, start counting from 0.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_ap_change(uint8_t current_ap_id);
/**
* @brief Set the number of APs that can be recorded in the ESP8266 station.
* When the ESP8266 station is connected to an AP, the SSID and password
* of the AP will be recorded.
*
* @attention This configuration will be saved in the Flash system parameter area if changed.
*
* @param uint8_t ap_number : the number of APs that can be recorded (MAX: 5)
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_ap_number_set(uint8_t ap_number);
/**
* @brief Get the information of APs (5 at most) recorded by ESP8266 station.
*
* Example:
* <pre>
* struct station_config config[5];
* nt i = wifi_station_get_ap_info(config);
* </pre>
*
* @param struct station_config config[] : information of the APs, the array size should be 5.
*
* @return The number of APs recorded.
*/
uint8_t wifi_station_get_ap_info(struct station_config config[]);
/**
* @brief Get rssi of the AP which ESP8266 station connected to.
*
* @param null
*
* @return 31 : fail, invalid value.
* @return others : succeed, value of rssi. In general, rssi value < 10
*/
int8_t wifi_station_get_rssi(void);
/**
* @brief Enable the ESP8266 station DHCP client.
*
* @attention 1. The DHCP is enabled by default.
* @attention 2. The DHCP and the static IP API ((wifi_set_ip_info)) influence each other,
* and if the DHCP is enabled, the static IP will be disabled;
* if the static IP is enabled, the DHCP will be disabled.
* It depends on the latest configuration.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_dhcpc_start(void);
/**
* @brief Disable the ESP8266 station DHCP client.
*
* @attention 1. The DHCP is enabled by default.
* @attention 2. The DHCP and the static IP API ((wifi_set_ip_info)) influence each other,
* and if the DHCP is enabled, the static IP will be disabled;
* if the static IP is enabled, the DHCP will be disabled.
* It depends on the latest configuration.
*
* @param null
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_dhcpc_stop(void);
/**
* @brief Get the ESP8266 station DHCP client status.
*
* @param null
*
* @return enum dhcp_status
*/
enum dhcp_status wifi_station_dhcpc_status(void);
/**
* @brief Set ESP8266 station DHCP hostname.
*
* @param char *name : hostname of ESP8266 station
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_set_hostname(char *name);
/**
* @brief Get ESP8266 station DHCP hostname.
*
* @param null
*
* @return the hostname of ESP8266 station
*/
char* wifi_station_get_hostname(void);
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,9 @@
extern "C" { extern "C" {
#endif #endif
#define ESP_WIFI_OS_ADAPTER_VERSION 0x00000001
#define ESP_WIFI_OS_ADAPTER_MAGIC 0xDEADBEAF
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff #define OSI_FUNCS_TIME_BLOCKING 0xffffffff
#define OSI_QUEUE_SEND_FRONT 0 #define OSI_QUEUE_SEND_FRONT 0
@ -33,6 +36,7 @@ extern "C" {
#define OSI_MALLOC_CAP_DMA (1 << 3) #define OSI_MALLOC_CAP_DMA (1 << 3)
typedef struct { typedef struct {
int32_t version;
uint32_t (*enter_critical)(void); uint32_t (*enter_critical)(void);
void (*exit_critical)(uint32_t tmp); void (*exit_critical)(uint32_t tmp);
@ -87,6 +91,21 @@ typedef struct {
void (*srand)(uint32_t seed); void (*srand)(uint32_t seed);
int32_t (*rand)(void); int32_t (*rand)(void);
int32_t (* nvs_set_i8)(uint32_t handle, const char* key, int8_t value);
int32_t (* nvs_get_i8)(uint32_t handle, const char* key, int8_t* out_value);
int32_t (* nvs_set_u8)(uint32_t handle, const char* key, uint8_t value);
int32_t (* nvs_get_u8)(uint32_t handle, const char* key, uint8_t* out_value);
int32_t (* nvs_set_u16)(uint32_t handle, const char* key, uint16_t value);
int32_t (* nvs_get_u16)(uint32_t handle, const char* key, uint16_t* out_value);
int32_t (* nvs_open)(const char* name, uint32_t open_mode, uint32_t *out_handle);
void (* nvs_close)(uint32_t handle);
int32_t (* nvs_commit)(uint32_t handle);
int32_t (* nvs_set_blob)(uint32_t handle, const char* key, const void* value, size_t length);
int32_t (* nvs_get_blob)(uint32_t handle, const char* key, void* out_value, size_t* length);
int32_t (* nvs_erase_key)(uint32_t handle, const char* key);
int32_t magic;
} wifi_osi_funcs_t; } wifi_osi_funcs_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -0,0 +1,369 @@
// Copyright 2018 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.
#ifndef __ESP_WIFI_TYPES_H__
#define __ESP_WIFI_TYPES_H__
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "esp_interface.h"
#include "queue.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
WIFI_MODE_NULL = 0, /**< null mode */
WIFI_MODE_STA, /**< WiFi station mode */
WIFI_MODE_AP, /**< WiFi soft-AP mode */
WIFI_MODE_APSTA, /**< WiFi station + soft-AP mode */
WIFI_MODE_MAX
} wifi_mode_t;
typedef esp_interface_t wifi_interface_t;
#define WIFI_IF_STA ESP_IF_WIFI_STA
#define WIFI_IF_AP ESP_IF_WIFI_AP
typedef enum {
WIFI_COUNTRY_POLICY_AUTO, /**< Country policy is auto, use the country info of AP to which the station is connected */
WIFI_COUNTRY_POLICY_MANUAL, /**< Country policy is manual, always use the configured country info */
} wifi_country_policy_t;
/** @brief Structure describing WiFi country-based regional restrictions. */
typedef struct {
char cc[3]; /**< country code string */
uint8_t schan; /**< start channel */
uint8_t nchan; /**< total channel number */
int8_t max_tx_power; /**< maximum tx power */
wifi_country_policy_t policy; /**< country policy */
} wifi_country_t;
typedef enum {
WIFI_AUTH_OPEN = 0, /**< authenticate mode : open */
WIFI_AUTH_WEP, /**< authenticate mode : WEP */
WIFI_AUTH_WPA_PSK, /**< authenticate mode : WPA_PSK */
WIFI_AUTH_WPA2_PSK, /**< authenticate mode : WPA2_PSK */
WIFI_AUTH_WPA_WPA2_PSK, /**< authenticate mode : WPA_WPA2_PSK */
WIFI_AUTH_WPA2_ENTERPRISE, /**< authenticate mode : WPA2_ENTERPRISE */
WIFI_AUTH_MAX
} wifi_auth_mode_t;
typedef enum {
WIFI_REASON_UNSPECIFIED = 1,
WIFI_REASON_AUTH_EXPIRE = 2,
WIFI_REASON_AUTH_LEAVE = 3,
WIFI_REASON_ASSOC_EXPIRE = 4,
WIFI_REASON_ASSOC_TOOMANY = 5,
WIFI_REASON_NOT_AUTHED = 6,
WIFI_REASON_NOT_ASSOCED = 7,
WIFI_REASON_ASSOC_LEAVE = 8,
WIFI_REASON_ASSOC_NOT_AUTHED = 9,
WIFI_REASON_DISASSOC_PWRCAP_BAD = 10,
WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11,
WIFI_REASON_IE_INVALID = 13,
WIFI_REASON_MIC_FAILURE = 14,
WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,
WIFI_REASON_IE_IN_4WAY_DIFFERS = 17,
WIFI_REASON_GROUP_CIPHER_INVALID = 18,
WIFI_REASON_PAIRWISE_CIPHER_INVALID = 19,
WIFI_REASON_AKMP_INVALID = 20,
WIFI_REASON_UNSUPP_RSN_IE_VERSION = 21,
WIFI_REASON_INVALID_RSN_IE_CAP = 22,
WIFI_REASON_802_1X_AUTH_FAILED = 23,
WIFI_REASON_CIPHER_SUITE_REJECTED = 24,
WIFI_REASON_BEACON_TIMEOUT = 200,
WIFI_REASON_NO_AP_FOUND = 201,
WIFI_REASON_AUTH_FAIL = 202,
WIFI_REASON_ASSOC_FAIL = 203,
WIFI_REASON_HANDSHAKE_TIMEOUT = 204,
} wifi_err_reason_t;
typedef enum {
WIFI_SECOND_CHAN_NONE = 0, /**< the channel width is HT20 */
WIFI_SECOND_CHAN_ABOVE, /**< the channel width is HT40 and the second channel is above the primary channel */
WIFI_SECOND_CHAN_BELOW, /**< the channel width is HT40 and the second channel is below the primary channel */
} wifi_second_chan_t;
typedef enum {
WIFI_SCAN_TYPE_ACTIVE = 0, /**< active scan */
WIFI_SCAN_TYPE_PASSIVE, /**< passive scan */
} wifi_scan_type_t;
/** @brief Range of active scan times per channel */
typedef struct {
uint32_t min; /**< minimum active scan time per channel, units: millisecond */
uint32_t max; /**< maximum active scan time per channel, units: millisecond, values above 1500ms may
cause station to disconnect from AP and are not recommended. */
} wifi_active_scan_time_t;
/** @brief Aggregate of active & passive scan time per channel */
typedef union {
wifi_active_scan_time_t active; /**< active scan time per channel, units: millisecond. */
uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may
cause station to disconnect from AP and are not recommended. */
} wifi_scan_time_t;
/** @brief Parameters for an SSID scan. */
typedef struct {
uint8_t *ssid; /**< SSID of AP */
uint8_t *bssid; /**< MAC address of AP */
uint8_t channel; /**< channel, scan the specific channel */
bool show_hidden; /**< enable to scan AP whose SSID is hidden */
wifi_scan_type_t scan_type; /**< scan type, active or passive */
wifi_scan_time_t scan_time; /**< scan time per channel */
} wifi_scan_config_t;
typedef enum {
WIFI_CIPHER_TYPE_NONE = 0, /**< the cipher type is none */
WIFI_CIPHER_TYPE_WEP40, /**< the cipher type is WEP40 */
WIFI_CIPHER_TYPE_WEP104, /**< the cipher type is WEP104 */
WIFI_CIPHER_TYPE_TKIP, /**< the cipher type is TKIP */
WIFI_CIPHER_TYPE_CCMP, /**< the cipher type is CCMP */
WIFI_CIPHER_TYPE_TKIP_CCMP, /**< the cipher type is TKIP and CCMP */
WIFI_CIPHER_TYPE_UNKNOWN, /**< the cipher type is unknown */
} wifi_cipher_type_t;
typedef enum {
WIFI_ANT_ANT0, /**< WiFi antenna 0 */
WIFI_ANT_ANT1, /**< WiFi antenna 1 */
WIFI_ANT_MAX, /**< Invalid WiFi antenna */
} wifi_ant_t;
/** @brief Description of an WiFi AP */
typedef struct {
uint8_t bssid[6]; /**< MAC address of AP */
uint8_t ssid[33]; /**< SSID of AP */
uint8_t primary; /**< channel of AP */
wifi_second_chan_t second; /**< secondary channel of AP */
int8_t rssi; /**< signal strength of AP */
wifi_auth_mode_t authmode; /**< authmode of AP */
wifi_cipher_type_t pairwise_cipher; /**< pairwise cipher of AP */
wifi_cipher_type_t group_cipher; /**< group cipher of AP */
wifi_ant_t ant; /**< antenna used to receive beacon from AP */
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */
uint32_t wps:1; /**< bit: 4 flag to identify if WPS is supported or not */
uint32_t reserved:27; /**< bit: 5..31 reserved */
wifi_country_t country; /**< country information of AP */
} wifi_ap_record_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 */
WIFI_CONNECT_AP_BY_SECURITY, /**< Sort match AP in scan list by security mode */
}wifi_sort_method_t;
/** @brief Structure describing parameters for a WiFi fast scan */
typedef struct {
int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode */
}wifi_fast_scan_threshold_t;
typedef enum {
WIFI_PS_NONE, /**< No power save */
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_sta_config_t */
} wifi_ps_type_t;
#define WIFI_PS_MODEM WIFI_PS_MIN_MODEM /**< @deprecated Use WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM instead */
#define WIFI_PROTOCOL_11B 1
#define WIFI_PROTOCOL_11G 2
#define WIFI_PROTOCOL_11N 4
#define WIFI_PROTOCOL_LR 8
typedef enum {
WIFI_BW_HT20 = 1, /* Bandwidth is HT20 */
WIFI_BW_HT40, /* Bandwidth is HT40 */
} wifi_bandwidth_t;
/** @brief Soft-AP configuration settings for the ESP8266 */
typedef struct {
uint8_t ssid[32]; /**< SSID of ESP8266 soft-AP */
uint8_t password[64]; /**< Password of ESP8266 soft-AP */
uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
uint8_t channel; /**< Channel of ESP8266 soft-AP */
wifi_auth_mode_t authmode; /**< Auth mode of ESP8266 soft-AP. Do not support AUTH_WEP in soft-AP mode */
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */
uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */
} wifi_ap_config_t;
/** @brief STA configuration settings for the ESP8266 */
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 ESP8266 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_fast_scan_threshold_t threshold; /**< When scan_method is set to WIFI_FAST_SCAN, 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;
/** @brief Configuration data for ESP8266 AP or STA.
*
* The usage of this union (for ap or sta configuration) is determined by the accompanying
* interface argument passed to esp_wifi_set_config() or esp_wifi_get_config()
*
*/
typedef union {
wifi_ap_config_t ap; /**< configuration of AP */
wifi_sta_config_t sta; /**< configuration of STA */
} wifi_config_t;
/** @brief Description of STA associated with AP */
typedef struct {
uint8_t mac[6]; /**< mac address */
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */
uint32_t reserved:28; /**< bit: 4..31 reserved */
} wifi_sta_info_t;
#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP8266 soft-AP */
/** @brief List of stations associated with the ESP8266 Soft-AP */
typedef struct {
wifi_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< station list */
int num; /**< number of stations in the list (other entries are invalid) */
} wifi_sta_list_t;
typedef enum {
WIFI_STORAGE_FLASH, /**< all configuration will strore in both memory and flash */
WIFI_STORAGE_RAM, /**< all configuration will only store in the memory */
} wifi_storage_t;
/**
* @brief Vendor Information Element type
*
* Determines the frame type that the IE will be associated with.
*/
typedef enum {
WIFI_VND_IE_TYPE_BEACON,
WIFI_VND_IE_TYPE_PROBE_REQ,
WIFI_VND_IE_TYPE_PROBE_RESP,
WIFI_VND_IE_TYPE_ASSOC_REQ,
WIFI_VND_IE_TYPE_ASSOC_RESP,
} wifi_vendor_ie_type_t;
/**
* @brief Vendor Information Element index
*
* Each IE type can have up to two associated vendor ID elements.
*/
typedef enum {
WIFI_VND_IE_ID_0,
WIFI_VND_IE_ID_1,
} wifi_vendor_ie_id_t;
#define WIFI_VENDOR_IE_ELEMENT_ID 0xDD
/**
* @brief Vendor Information Element header
*
* The first bytes of the Information Element will match this header. Payload follows.
*/
typedef struct {
uint8_t element_id; /**< Should be set to WIFI_VENDOR_IE_ELEMENT_ID (0xDD) */
uint8_t length; /**< Length of all bytes in the element data following this field. Minimum 4. */
uint8_t vendor_oui[3]; /**< Vendor identifier (OUI). */
uint8_t vendor_oui_type; /**< Vendor-specific OUI type. */
uint8_t payload[0]; /**< Payload. Length is equal to value in 'length' field, minus 4. */
} vendor_ie_data_t;
/** @brief Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers */
typedef struct {
signed rssi:8; /**< signal intensity of packet */
unsigned rate:5; /**< data rate */
unsigned :1; /**< reserve */
unsigned sig_mode:2; /**< 0:is not 11n packet; 1:is 11n packet */
unsigned :16; /**< reserve */
unsigned mcs:7; /**< if is 11n packet, shows the modulation(range from 0 to 76) */
unsigned cwb:1; /**< if is 11n packet, shows if is HT40 packet or not */
unsigned :16; /**< reserve */
unsigned smoothing:1; /**< reserve */
unsigned not_sounding:1; /**< reserve */
unsigned :1; /**< reserve */
unsigned aggregation:1; /**< Aggregation */
unsigned stbc:2; /**< STBC */
unsigned fec_coding:1; /**< Flag is set for 11n packets which are LDPC */
unsigned sgi:1; /**< SGI */
unsigned noise_floor:8; /**< noise floor */
unsigned ampdu_cnt:8; /**< ampdu cnt */
unsigned channel:4; /**< which channel this packet in */
unsigned :12; /**< reserve */
unsigned timestamp:32; /**< timestamp */
unsigned :32; /**< reserve */
unsigned :32; /**< reserve */
unsigned sig_len:12; /**< length of packet */
unsigned :12; /**< reserve */
unsigned rx_state:8; /**< rx state */
} wifi_pkt_rx_ctrl_t;
/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback.
*/
typedef struct {
wifi_pkt_rx_ctrl_t rx_ctrl; /**< metadata header */
uint8_t payload[0]; /**< Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback. */
} wifi_promiscuous_pkt_t;
/**
* @brief Promiscuous frame type
*
* Passed to promiscuous mode RX callback to indicate the type of parameter in the buffer.
*
*/
typedef enum {
WIFI_PKT_MGMT, /**< Management frame, indicates 'buf' argument is wifi_promiscuous_pkt_t */
WIFI_PKT_DATA, /**< Data frame, indiciates 'buf' argument is wifi_promiscuous_pkt_t */
WIFI_PKT_MISC, /**< Other type, such as MIMO etc. 'buf' argument is wifi_promiscuous_pkt_t but the payload is zero length. */
} wifi_promiscuous_pkt_type_t;
#define WIFI_PROMIS_FILTER_MASK_ALL (0xFFFFFFFF) /**< filter all packets */
#define WIFI_PROMIS_FILTER_MASK_MGMT (1) /**< filter the packets with type of WIFI_PKT_MGMT */
#define WIFI_PROMIS_FILTER_MASK_DATA (1<<1) /**< filter the packets with type of WIFI_PKT_DATA */
#define WIFI_PROMIS_FILTER_MASK_MISC (1<<2) /**< filter the packets with type of WIFI_PKT_MISC */
#define WIFI_PROMIS_FILTER_MASK_DATA_MPDU (1<<3) /**< filter the MPDU which is a kind of WIFI_PKT_DATA */
#define WIFI_PROMIS_FILTER_MASK_DATA_AMPDU (1<<4) /**< filter the AMPDU which is a kind of WIFI_PKT_DATA */
/** @brief Mask for filtering different packet types in promiscuous mode. */
typedef struct {
uint32_t filter_mask; /**< OR of one or more filter values WIFI_PROMIS_FILTER_* */
} wifi_promiscuous_filter_t;
#define WIFI_EVENT_MASK_ALL (0xFFFFFFFF) /**< mask all WiFi events */
#define WIFI_EVENT_MASK_NONE (0) /**< mask none of the WiFi events */
#define WIFI_EVENT_MASK_AP_PROBEREQRECVED (BIT(0)) /**< mask SYSTEM_EVENT_AP_PROBEREQRECVED event */
#ifdef __cplusplus
}
#endif
#endif /* __ESP_WIFI_TYPES_H__ */

View File

@ -0,0 +1,44 @@
// Copyright 2018 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.
#include "esp_libc.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_socket.h"
#include "net/sockio.h"
/**
* @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
*
* @attention 1. This API must be called before all other WiFi API can be called
* @attention 2. Always use WIFI_INIT_CONFIG_DEFAULT macro to init the config to default values, this can
* guarantee all the fields got correct value when more fields are added into wifi_init_config_t
* in future release. If you want to set your owner initial values, overwrite the default values
* which are set by WIFI_INIT_CONFIG_DEFAULT, please be notified that the field 'magic' of
* wifi_init_config_t should always be WIFI_INIT_CONFIG_MAGIC!
*
* @param config pointer to WiFi init configuration structure; can point to a temporary variable.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_NO_MEM: out of memory
* - others: refer to error code esp_err.h
*/
esp_err_t esp_wifi_init(const wifi_init_config_t *config)
{
esp_event_set_default_wifi_handlers();
return esp_wifi_init_internal(config);
}

View File

@ -22,6 +22,8 @@
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "freertos/timers.h" #include "freertos/timers.h"
#include "nvs.h"
#if defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL) || defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO) #if defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL) || defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
#include "esp_newlib.h" #include "esp_newlib.h"
#endif #endif
@ -42,7 +44,6 @@ static void *task_create_wrapper(void *task_func, const char *name, uint32_t sta
{ {
portBASE_TYPE ret; portBASE_TYPE ret;
xTaskHandle handle; xTaskHandle handle;
ret = xTaskCreate(task_func, name, stack_depth, param, prio, &handle); ret = xTaskCreate(task_func, name, stack_depth, param, prio, &handle);
return ret == pdPASS ? handle : NULL; return ret == pdPASS ? handle : NULL;
@ -311,6 +312,8 @@ static int32_t rand_wrapper(void)
} }
wifi_osi_funcs_t s_wifi_osi_funcs = { wifi_osi_funcs_t s_wifi_osi_funcs = {
.version = ESP_WIFI_OS_ADAPTER_VERSION,
.enter_critical = enter_critical_wrapper, .enter_critical = enter_critical_wrapper,
.exit_critical = exit_critical_wrapper, .exit_critical = exit_critical_wrapper,
@ -365,4 +368,19 @@ wifi_osi_funcs_t s_wifi_osi_funcs = {
.srand = srand_wrapper, .srand = srand_wrapper,
.rand = rand_wrapper, .rand = rand_wrapper,
.nvs_set_i8 = nvs_set_i8,
.nvs_get_i8 = nvs_get_i8,
.nvs_set_u8 = nvs_set_u8,
.nvs_get_u8 = nvs_get_u8,
.nvs_set_u16 = nvs_set_u16,
.nvs_get_u16 = nvs_get_u16,
.nvs_open = nvs_open,
.nvs_close = nvs_close,
.nvs_commit = nvs_commit,
.nvs_set_blob = nvs_set_blob,
.nvs_get_blob = nvs_get_blob,
.nvs_erase_key = nvs_erase_key,
.magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };