mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
WiFi: Modify the wifi_country struct in VNC to keep it consistent with IDF.
1. Modfy wifi_country struct 2. Add md5 check esp_wifi_types.h 3. Add md5 check esp_wifi.h
This commit is contained in:
parent
3badf6ebd9
commit
2dc98f3be8
@ -321,6 +321,15 @@ static const esp_err_msg_t esp_err_msg_table[] = {
|
||||
# endif
|
||||
# ifdef ESP_ERR_WIFI_NOT_CONNECT
|
||||
ERR_TBL_IT(ESP_ERR_WIFI_NOT_CONNECT), /* 12303 0x300f Station still in disconnect status */
|
||||
# endif
|
||||
# ifdef ESP_ERR_WIFI_POST
|
||||
ERR_TBL_IT(ESP_ERR_WIFI_POST), /* 12306 0x3012 Failed to post the event to WiFi task */
|
||||
# endif
|
||||
# ifdef ESP_ERR_WIFI_INIT_STATE
|
||||
ERR_TBL_IT(ESP_ERR_WIFI_INIT_STATE), /* 12307 0x3013 Invalod WiFi state when init/deinit is called */
|
||||
# endif
|
||||
# ifdef ESP_ERR_WIFI_STOP_STATE
|
||||
ERR_TBL_IT(ESP_ERR_WIFI_STOP_STATE), /* 12308 0x3014 Returned when WiFi is stopping */
|
||||
# endif
|
||||
// components/esp32/include/esp_wps.h
|
||||
# ifdef ESP_ERR_WIFI_REGISTRAR
|
||||
|
24
components/esp32/include/esp_private/esp_wifi_private.h
Normal file
24
components/esp32/include/esp_private/esp_wifi_private.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2015-2019 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_PRIVATE_H
|
||||
#define _ESP_WIFI_PRIVATE_H
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "rom/queue.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
#include "esp_wifi_os_adapter.h"
|
||||
|
||||
#endif /* _ESP_WIFI_PRIVATE_H */
|
@ -0,0 +1,21 @@
|
||||
// Copyright 2015-2019 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_PRIVATE_H
|
||||
#define _ESP_WIFI_TYPES_PRIVATE_H
|
||||
|
||||
#include "rom/queue.h"
|
||||
#include "esp_interface.h"
|
||||
|
||||
#endif
|
@ -59,15 +59,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "rom/queue.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_wifi_os_adapter.h"
|
||||
#include "esp_private/esp_wifi_private.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -89,6 +84,10 @@ extern "C" {
|
||||
#define ESP_ERR_WIFI_WOULD_BLOCK (ESP_ERR_WIFI_BASE + 14) /*!< The caller would block */
|
||||
#define ESP_ERR_WIFI_NOT_CONNECT (ESP_ERR_WIFI_BASE + 15) /*!< Station still in disconnect status */
|
||||
|
||||
#define ESP_ERR_WIFI_POST (ESP_ERR_WIFI_BASE + 18) /*!< Failed to post the event to WiFi task */
|
||||
#define ESP_ERR_WIFI_INIT_STATE (ESP_ERR_WIFI_BASE + 19) /*!< Invalod WiFi state when init/deinit is called */
|
||||
#define ESP_ERR_WIFI_STOP_STATE (ESP_ERR_WIFI_BASE + 20) /*!< Returned when WiFi is stopping */
|
||||
|
||||
/**
|
||||
* @brief WiFi stack configuration parameters passed to esp_wifi_init call.
|
||||
*/
|
||||
@ -581,7 +580,7 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
|
||||
* and the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14}
|
||||
* then the country info that will be used is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected
|
||||
* from the AP the country info is set back back to the country info of the station automatically,
|
||||
* {.cc="USA", .schan=1, .nchan=11} in the example.
|
||||
* {.cc="US", .schan=1, .nchan=11} in the example.
|
||||
* @attention 3. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, always use the configured country info.
|
||||
* @attention 4. When the country info is changed because of configuration or because the station connects to a different
|
||||
* external AP, the country IE in probe response/beacon of the soft-AP is changed also.
|
||||
@ -840,6 +839,16 @@ esp_err_t esp_wifi_set_auto_connect(bool en) __attribute__ ((deprecated));
|
||||
*/
|
||||
esp_err_t esp_wifi_get_auto_connect(bool *en) __attribute__ ((deprecated));
|
||||
|
||||
/**
|
||||
* @brief Function signature for received Vendor-Specific Information Element callback.
|
||||
* @param ctx Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.
|
||||
* @param type Information element type, based on frame type received.
|
||||
* @param sa Source 802.11 address.
|
||||
* @param vnd_ie Pointer to the vendor specific element data received.
|
||||
* @param rssi Received signal strength indication.
|
||||
*/
|
||||
typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const vendor_ie_data_t *vnd_ie, int rssi);
|
||||
|
||||
/**
|
||||
* @brief Set 802.11 Vendor-Specific Information Element
|
||||
*
|
||||
@ -858,16 +867,6 @@ esp_err_t esp_wifi_get_auto_connect(bool *en) __attribute__ ((deprecated));
|
||||
*/
|
||||
esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie);
|
||||
|
||||
/**
|
||||
* @brief Function signature for received Vendor-Specific Information Element callback.
|
||||
* @param ctx Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.
|
||||
* @param type Information element type, based on frame type received.
|
||||
* @param sa Source 802.11 address.
|
||||
* @param vnd_ie Pointer to the vendor specific element data received.
|
||||
* @param rssi Received signal strength indication.
|
||||
*/
|
||||
typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const vendor_ie_data_t *vnd_ie, int rssi);
|
||||
|
||||
/**
|
||||
* @brief Register Vendor-Specific Information Element monitoring callback.
|
||||
*
|
||||
@ -881,60 +880,22 @@ typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const
|
||||
esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
|
||||
|
||||
/**
|
||||
* @brief Set maximum WiFi transmiting power
|
||||
* @brief Set maximum WiFi transmitting power
|
||||
*
|
||||
* @attention WiFi transmiting power is divided to six levels in phy init data.
|
||||
* Level0 represents highest transmiting power and level5 represents lowest
|
||||
* transmiting power. Packets of different rates are transmitted in
|
||||
* different powers according to the configuration in phy init data.
|
||||
* This API only sets maximum WiFi transmiting power. If this API is called,
|
||||
* the transmiting power of every packet will be less than or equal to the
|
||||
* value set by this API. If this API is not called, the value of maximum
|
||||
* transmitting power set in phy_init_data.bin or menuconfig (depend on
|
||||
* whether to use phy init data in partition or not) will be used. Default
|
||||
* value is level0. Values passed in power are mapped to transmit power
|
||||
* levels as follows:
|
||||
* - [78, 127]: level0
|
||||
* - [76, 77]: level1
|
||||
* - [74, 75]: level2
|
||||
* - [68, 73]: level3
|
||||
* - [60, 67]: level4
|
||||
* - [52, 59]: level5
|
||||
* - [44, 51]: level5 - 2dBm
|
||||
* - [34, 43]: level5 - 4.5dBm
|
||||
* - [28, 33]: level5 - 6dBm
|
||||
* - [20, 27]: level5 - 8dBm
|
||||
* - [8, 19]: level5 - 11dBm
|
||||
* - [-128, 7]: level5 - 14dBm
|
||||
*
|
||||
* @param power Maximum WiFi transmiting power.
|
||||
* @param power Maximum WiFi transmitting power, unit is 0.25dBm, range is [40, 82] corresponding to 10dBm - 20.5dBm here.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
|
||||
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
|
||||
* - ESP_ERR_WIFI_NOT_ARG: invalid argument
|
||||
*/
|
||||
esp_err_t esp_wifi_set_max_tx_power(int8_t power);
|
||||
|
||||
/**
|
||||
* @brief Get maximum WiFi transmiting power
|
||||
*
|
||||
* @attention This API gets maximum WiFi transmiting power. Values got
|
||||
* from power are mapped to transmit power levels as follows:
|
||||
* - 78: 19.5dBm
|
||||
* - 76: 19dBm
|
||||
* - 74: 18.5dBm
|
||||
* - 68: 17dBm
|
||||
* - 60: 15dBm
|
||||
* - 52: 13dBm
|
||||
* - 44: 11dBm
|
||||
* - 34: 8.5dBm
|
||||
* - 28: 7dBm
|
||||
* - 20: 5dBm
|
||||
* - 8: 2dBm
|
||||
* - -4: -1dBm
|
||||
*
|
||||
* @param power Maximum WiFi transmiting power.
|
||||
* @param power Maximum WiFi transmitting power, unit is 0.25dBm.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
@ -1102,19 +1063,6 @@ esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config);
|
||||
*/
|
||||
esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief A general API to set/get WiFi internal configuration, it's for debug only
|
||||
*
|
||||
* @param cmd : ioctl command type
|
||||
* @param cfg : configuration for the command
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - others: failed
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_ioctl(int cmd, wifi_ioctl_config_t *cfg);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -203,6 +203,28 @@ esp_err_t esp_wifi_internal_osi_funcs_md5_check(const char *md5);
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_crypto_funcs_md5_check(const char *md5);
|
||||
|
||||
/**
|
||||
* @brief Check the MD5 values of the esp_wifi_types.h in IDF and WiFi library
|
||||
*
|
||||
* @attention 1. It is used for internal CI version check
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_WIFI_INVALID_ARG : MD5 check fail
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_wifi_type_md5_check(const char *md5);
|
||||
|
||||
/**
|
||||
* @brief Check the MD5 values of the esp_wifi.h in IDF and WiFi library
|
||||
*
|
||||
* @attention 1. It is used for internal CI version check
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_WIFI_INVALID_ARG : MD5 check fail
|
||||
*/
|
||||
esp_err_t esp_wifi_internal_esp_wifi_md5_check(const char *md5);
|
||||
|
||||
/**
|
||||
* @brief Check the git commit id of WiFi library
|
||||
*
|
||||
|
@ -18,9 +18,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "rom/queue.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_interface.h"
|
||||
#include "esp_private/esp_wifi_types_private.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -49,7 +48,7 @@ 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 */
|
||||
int8_t max_tx_power; /**< This field is used for getting WiFi maximum transmitting power, call esp_wifi_set_max_tx_power to set the maximum transmitting power. */
|
||||
wifi_country_policy_t policy; /**< country policy */
|
||||
} wifi_country_t;
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 3cc55570a8f03c9e7813df0de71a8d65ff7ed279
|
||||
Subproject commit 4f06a7de4f3be0d5a4dc191de086e905de6cbeca
|
@ -28,9 +28,23 @@ execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_coexist_
|
||||
OUTPUT_VARIABLE COEX_ADAPTER_MD5
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi_types.h
|
||||
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_types.h
|
||||
COMMAND cut -c 1-7
|
||||
OUTPUT_VARIABLE WIFI_TYPE_MD5
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi.h
|
||||
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi.h
|
||||
COMMAND cut -c 1-7
|
||||
OUTPUT_VARIABLE WIFI_ESP_WIFI_MD5
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\")
|
||||
add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\")
|
||||
add_definitions(-DCOEX_ADAPTER_MD5=\"${COEX_ADAPTER_MD5}\")
|
||||
add_definitions(-DWIFI_TYPE_MD5=\"${WIFI_TYPE_MD5}\")
|
||||
add_definitions(-DWIFI_ESP_WIFI_MD5=\"${WIFI_ESP_WIFI_MD5}\")
|
||||
|
||||
add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h")
|
||||
|
||||
|
@ -21,6 +21,16 @@ CFLAGS+=-DWIFI_CRYPTO_MD5=$(WIFI_CRYPTO_MD5_VAL)
|
||||
COEX_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_coexist_adapter.h | cut -c 1-7)\"
|
||||
CFLAGS+=-DCOEX_ADAPTER_MD5=$(COEX_ADAPTER_MD5_VAL)
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi_types.h
|
||||
WIFI_TYPE_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_types.h | cut -c 1-7)\"
|
||||
CFLAGS+=-DWIFI_TYPE_MD5=$(WIFI_TYPE_MD5_VAL)
|
||||
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi.h
|
||||
WIFI_ESP_WIFI_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi.h | cut -c 1-7)\"
|
||||
CFLAGS+=-DWIFI_ESP_WIFI_MD5=$(WIFI_ESP_WIFI_MD5_VAL)
|
||||
|
||||
|
||||
test_tjpgd.o: test_tjpgd_logo.h
|
||||
|
||||
test_tjpgd_logo.h: $(COMPONENT_PATH)/logo.jpg
|
||||
|
@ -12,7 +12,7 @@ TEST_CASE("wifi os adapter MD5","[wifi]")
|
||||
{
|
||||
const char *test_wifi_os_funcs_md5 = WIFI_OS_ADAPTER_MD5;
|
||||
|
||||
ESP_LOGI(TAG, "test wifi os adapter MD5...");
|
||||
ESP_LOGI(TAG, "test eps_wifi_os_adapter.h MD5...");
|
||||
TEST_ESP_OK(esp_wifi_internal_osi_funcs_md5_check(test_wifi_os_funcs_md5));
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
@ -22,13 +22,13 @@ TEST_CASE("wifi crypto types MD5","[wifi]")
|
||||
{
|
||||
const char *test_wifi_crypto_funcs_md5 = WIFI_CRYPTO_MD5;
|
||||
|
||||
ESP_LOGI(TAG, "test wifi crypto adapter MD5...");
|
||||
ESP_LOGI(TAG, "test esp_wifi_crypto_adapter.h MD5...");
|
||||
TEST_ESP_OK(esp_wifi_internal_crypto_funcs_md5_check(test_wifi_crypto_funcs_md5));
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
}
|
||||
|
||||
TEST_CASE("coexist adapter MD5","[coex]")
|
||||
TEST_CASE("coexist esp_coexist_adapter.h MD5","[coex]")
|
||||
{
|
||||
const char *test_coex_adapter_funcs_md5 = COEX_ADAPTER_MD5;
|
||||
|
||||
@ -37,3 +37,23 @@ TEST_CASE("coexist adapter MD5","[coex]")
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
}
|
||||
|
||||
TEST_CASE("wifi type MD5","[wifi]")
|
||||
{
|
||||
const char *test_wifi_type_md5 = WIFI_TYPE_MD5;
|
||||
|
||||
ESP_LOGI(TAG, "test esp_wifi_types.h MD5...");
|
||||
TEST_ESP_OK(esp_wifi_internal_wifi_type_md5_check(test_wifi_type_md5));
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
}
|
||||
|
||||
TEST_CASE("esp wifi MD5","[wifi]")
|
||||
{
|
||||
const char *test_esp_wifi_md5 = WIFI_ESP_WIFI_MD5;
|
||||
|
||||
ESP_LOGI(TAG, "test esp_wifi.h MD5...");
|
||||
TEST_ESP_OK(esp_wifi_internal_esp_wifi_md5_check(test_esp_wifi_md5));
|
||||
|
||||
ESP_LOGI(TAG, "test passed...");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user