59
59
60
60
#include <stdint.h>
61
61
#include <stdbool.h>
62
- #include "freertos/FreeRTOS.h"
63
- #include "freertos/queue.h"
64
- #include "rom/queue.h"
65
- #include "sdkconfig.h"
66
62
#include "esp_err.h"
67
63
#include "esp_wifi_types.h"
68
- #include "esp_wifi_crypto_types.h"
69
64
#include "esp_event.h"
70
- #include "esp_wifi_os_adapter .h"
65
+ #include "esp_private/esp_wifi_private .h"
71
66
72
67
#ifdef __cplusplus
73
68
extern "C" {
@@ -89,6 +84,10 @@ extern "C" {
89
84
#define ESP_ERR_WIFI_WOULD_BLOCK (ESP_ERR_WIFI_BASE + 14) /*!< The caller would block */
90
85
#define ESP_ERR_WIFI_NOT_CONNECT (ESP_ERR_WIFI_BASE + 15) /*!< Station still in disconnect status */
91
86
87
+ #define ESP_ERR_WIFI_POST (ESP_ERR_WIFI_BASE + 18) /*!< Failed to post the event to WiFi task */
88
+ #define ESP_ERR_WIFI_INIT_STATE (ESP_ERR_WIFI_BASE + 19) /*!< Invalod WiFi state when init/deinit is called */
89
+ #define ESP_ERR_WIFI_STOP_STATE (ESP_ERR_WIFI_BASE + 20) /*!< Returned when WiFi is stopping */
90
+
92
91
/**
93
92
* @brief WiFi stack configuration parameters passed to esp_wifi_init call.
94
93
*/
@@ -581,7 +580,7 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
581
580
* and the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14}
582
581
* then the country info that will be used is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected
583
582
* from the AP the country info is set back back to the country info of the station automatically,
584
- * {.cc="USA ", .schan=1, .nchan=11} in the example.
583
+ * {.cc="US ", .schan=1, .nchan=11} in the example.
585
584
* @attention 3. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, always use the configured country info.
586
585
* @attention 4. When the country info is changed because of configuration or because the station connects to a different
587
586
* 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));
840
839
*/
841
840
esp_err_t esp_wifi_get_auto_connect (bool * en ) __attribute__ ((deprecated ));
842
841
842
+ /**
843
+ * @brief Function signature for received Vendor-Specific Information Element callback.
844
+ * @param ctx Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.
845
+ * @param type Information element type, based on frame type received.
846
+ * @param sa Source 802.11 address.
847
+ * @param vnd_ie Pointer to the vendor specific element data received.
848
+ * @param rssi Received signal strength indication.
849
+ */
850
+ 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 );
851
+
843
852
/**
844
853
* @brief Set 802.11 Vendor-Specific Information Element
845
854
*
@@ -858,16 +867,6 @@ esp_err_t esp_wifi_get_auto_connect(bool *en) __attribute__ ((deprecated));
858
867
*/
859
868
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 );
860
869
861
- /**
862
- * @brief Function signature for received Vendor-Specific Information Element callback.
863
- * @param ctx Context argument, as passed to esp_wifi_set_vendor_ie_cb() when registering callback.
864
- * @param type Information element type, based on frame type received.
865
- * @param sa Source 802.11 address.
866
- * @param vnd_ie Pointer to the vendor specific element data received.
867
- * @param rssi Received signal strength indication.
868
- */
869
- 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 );
870
-
871
870
/**
872
871
* @brief Register Vendor-Specific Information Element monitoring callback.
873
872
*
@@ -881,60 +880,22 @@ typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const
881
880
esp_err_t esp_wifi_set_vendor_ie_cb (esp_vendor_ie_cb_t cb , void * ctx );
882
881
883
882
/**
884
- * @brief Set maximum WiFi transmiting power
885
- *
886
- * @attention WiFi transmiting power is divided to six levels in phy init data.
887
- * Level0 represents highest transmiting power and level5 represents lowest
888
- * transmiting power. Packets of different rates are transmitted in
889
- * different powers according to the configuration in phy init data.
890
- * This API only sets maximum WiFi transmiting power. If this API is called,
891
- * the transmiting power of every packet will be less than or equal to the
892
- * value set by this API. If this API is not called, the value of maximum
893
- * transmitting power set in phy_init_data.bin or menuconfig (depend on
894
- * whether to use phy init data in partition or not) will be used. Default
895
- * value is level0. Values passed in power are mapped to transmit power
896
- * levels as follows:
897
- * - [78, 127]: level0
898
- * - [76, 77]: level1
899
- * - [74, 75]: level2
900
- * - [68, 73]: level3
901
- * - [60, 67]: level4
902
- * - [52, 59]: level5
903
- * - [44, 51]: level5 - 2dBm
904
- * - [34, 43]: level5 - 4.5dBm
905
- * - [28, 33]: level5 - 6dBm
906
- * - [20, 27]: level5 - 8dBm
907
- * - [8, 19]: level5 - 11dBm
908
- * - [-128, 7]: level5 - 14dBm
909
- *
910
- * @param power Maximum WiFi transmiting power.
883
+ * @brief Set maximum WiFi transmitting power
884
+ *
885
+ * @param power Maximum WiFi transmitting power, unit is 0.25dBm, range is [40, 82] corresponding to 10dBm - 20.5dBm here.
911
886
*
912
887
* @return
913
888
* - ESP_OK: succeed
914
889
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
915
890
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
891
+ * - ESP_ERR_WIFI_NOT_ARG: invalid argument
916
892
*/
917
893
esp_err_t esp_wifi_set_max_tx_power (int8_t power );
918
894
919
895
/**
920
896
* @brief Get maximum WiFi transmiting power
921
897
*
922
- * @attention This API gets maximum WiFi transmiting power. Values got
923
- * from power are mapped to transmit power levels as follows:
924
- * - 78: 19.5dBm
925
- * - 76: 19dBm
926
- * - 74: 18.5dBm
927
- * - 68: 17dBm
928
- * - 60: 15dBm
929
- * - 52: 13dBm
930
- * - 44: 11dBm
931
- * - 34: 8.5dBm
932
- * - 28: 7dBm
933
- * - 20: 5dBm
934
- * - 8: 2dBm
935
- * - -4: -1dBm
936
- *
937
- * @param power Maximum WiFi transmiting power.
898
+ * @param power Maximum WiFi transmitting power, unit is 0.25dBm.
938
899
*
939
900
* @return
940
901
* - ESP_OK: succeed
@@ -1102,19 +1063,6 @@ esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config);
1102
1063
*/
1103
1064
esp_err_t esp_wifi_get_ant (wifi_ant_config_t * config );
1104
1065
1105
- /**
1106
- * @brief A general API to set/get WiFi internal configuration, it's for debug only
1107
- *
1108
- * @param cmd : ioctl command type
1109
- * @param cfg : configuration for the command
1110
- *
1111
- * @return
1112
- * - ESP_OK: succeed
1113
- * - others: failed
1114
- */
1115
- esp_err_t esp_wifi_internal_ioctl (int cmd , wifi_ioctl_config_t * cfg );
1116
-
1117
-
1118
1066
#ifdef __cplusplus
1119
1067
}
1120
1068
#endif
0 commit comments