• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <common/sys_config.h>
18 #include <stdint.h>
19 #include <common/bk_err.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /**
26  * @brief WiFi APIs Version 2 (New WiFi API)
27  * @addtogroup bk_api_wifi_v2 New WiFi API group
28  * @{
29  */
30 
31 /**
32  * @brief WiFi enum
33  * @defgroup bk_api_wifi_v2_enum enum
34  * @ingroup bk_api_wifi_v2
35  * @{
36  */
37 
38 #define BK_ERR_WIFI_NOT_INIT            (BK_ERR_WIFI_BASE - 1) /**< WiFi is not initialized, call bk_wifi_init() to init the WiFi */
39 #define BK_ERR_WIFI_STA_NOT_STARTED     (BK_ERR_WIFI_BASE - 2) /**< STA is not started, call bk_wifi_sta_start() to start the STA */
40 #define BK_ERR_WIFI_AP_NOT_STARTED      (BK_ERR_WIFI_BASE - 3) /**< AP is not initialized, call bk_wifi_ap_start() to start the AP */
41 #define BK_ERR_WIFI_CHAN_RANGE          (BK_ERR_WIFI_BASE - 4) /**< Invalid channel range */
42 #define BK_ERR_WIFI_COUNTRY_POLICY      (BK_ERR_WIFI_BASE - 5) /**< Invalid country policy */
43 #define BK_ERR_WIFI_RESERVED_FIELD      (BK_ERR_WIFI_BASE - 6) /**< Reserved fields not 0 */
44 #define BK_ERR_WIFI_MONITOR_IP          (BK_ERR_WIFI_BASE - 7) /**< Monitor is in progress */
45 #define BK_ERR_WIFI_STA_NOT_CONFIG      (BK_ERR_WIFI_BASE - 8) /**< STA is not configured, call bk_wifi_sta_config() to configure it */
46 #define BK_ERR_WIFI_AP_NOT_CONFIG       (BK_ERR_WIFI_BASE - 9) /**< AP is not configured, call bk_wifi_ap_config() to configure it */
47 #define BK_ERR_WIFI_DRIVER              (BK_ERR_WIFI_BASE - 10) /**< Internal WiFi driver error */
48 #define BK_ERR_WIFI_MONITOR_ENTER       (BK_ERR_WIFI_BASE - 11) /**< WiFi failed to enter monitor mode */
49 #define BK_ERR_WIFI_DRIVER_DEL_VIF      (BK_ERR_WIFI_BASE - 12) /**< WiFi driver failed to delete WiFi virtual interface */
50 #define BK_ERR_WIFI_DRIVER_AP_START     (BK_ERR_WIFI_BASE - 13) /**< WiFi driver failed to start BK AP */
51 #define BK_ERR_WIFI_CHAN_NUMBER         (BK_ERR_WIFI_BASE - 14) /**< Invalid channel number */
52 
53 #define WIFI_MIN_CHAN_NUM    1      /**< Minimum supported channel number */
54 #define WIFI_MAX_CHAN_NUM    14     /**< Maximum supported channel number */
55 
56 #define WIFI_SSID_STR_LEN    (32+1) /**< Maximum **NULL-terminated** WiFi SSID length */
57 #define WIFI_BSSID_LEN       6      /**< Length of BSSID */
58 #define WIFI_MAC_LEN         6      /**< Length of MAC */
59 
60 #define WIFI_PASSWORD_LEN    (64+1) /**< Maximum **NULL-terminated** WiFi password length */
61 
62 /**
63  * @brief default init configuration
64  * */
65 #define WIFI_DEFAULT_INIT_CONFIG() {\
66 	.features = 0,\
67 	}
68 
69 /**
70  * @brief default AP configuration
71  * */
72 #define WIFI_DEFAULT_AP_CONFIG() {\
73 	.ssid = "ap_default_ssid",\
74 	.password = "",\
75 	.channel = 0,\
76 	.security = WIFI_SECURITY_WPA2_MIXED,\
77 	.hidden = 0,\
78 	.max_con = 0,\
79 	.reserved = {0},\
80 	}
81 
82 /**
83  * @brief default Scan configuration
84  */
85 #define WIFI_DEFAULT_SCAN_CONFIG() {\
86 	.ssid = "scan_default_ssid",\
87 	.reserved = {0},\
88 }
89 
90 /**
91  * @brief default Filter configuration
92  */
93 #define WIFI_DEFAULT_FILTER_CONFIG() {\
94 	.rx_all_default_mgmt = 1,\
95 	.rx_probe_req = 0,\
96 	.rx_probe_rsp = 0,\
97 	.rx_all_beacon = 0,\
98 	.rx_action = 0,\
99 	.reserved = 0,\
100 }
101 
102 /**
103  * @brief WiFi public event type
104  */
105 typedef enum {
106 	EVENT_WIFI_SCAN_DONE = 0,      /**< WiFi scan done event */
107 
108 	EVENT_WIFI_STA_CONNECTED,      /**< The BK STA is connected */
109 	EVENT_WIFI_STA_DISCONNECTED,   /**< The BK STA is disconnected */
110 
111 	EVENT_WIFI_AP_CONNECTED,       /**< A STA is connected to the BK AP */
112 	EVENT_WIFI_AP_DISCONNECTED,    /**< A STA is disconnected from the BK AP */
113 	EVENT_WIFI_COUNT,              /**< WiFi event count */
114 } wifi_event_t;
115 
116 typedef enum {
117 	WIFI_REASON_UNSPECIFIED = 1,
118 	WIFI_REASON_PREV_AUTH_NOT_VALID = 2,
119 	WIFI_REASON_DEAUTH_LEAVING = 3,
120 	WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
121 	WIFI_REASON_DISASSOC_AP_BUSY = 5,
122 	WIFI_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
123 	WIFI_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
124 	WIFI_REASON_DISASSOC_STA_HAS_LEFT = 8,
125 	WIFI_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
126 	WIFI_REASON_PWR_CAPABILITY_NOT_VALID = 10,
127 	WIFI_REASON_SUPPORTED_CHANNEL_NOT_VALID = 11,
128 	WIFI_REASON_BSS_TRANSITION_DISASSOC = 12,
129 	WIFI_REASON_INVALID_IE = 13,
130 	WIFI_REASON_MICHAEL_MIC_FAILURE = 14,
131 	WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
132 	WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,
133 	WIFI_REASON_IE_IN_4WAY_DIFFERS = 17,
134 	WIFI_REASON_GROUP_CIPHER_NOT_VALID = 18,
135 	WIFI_REASON_PAIRWISE_CIPHER_NOT_VALID = 19,
136 	WIFI_REASON_AKMP_NOT_VALID = 20,
137 	WIFI_REASON_UNSUPPORTED_RSN_IE_VERSION = 21,
138 	WIFI_REASON_INVALID_RSN_IE_CAPAB = 22,
139 	WIFI_REASON_IEEE_802_1X_AUTH_FAILED = 23,
140 	WIFI_REASON_CIPHER_SUITE_REJECTED = 24,
141 	WIFI_REASON_TDLS_TEARDOWN_UNREACHABLE = 25,
142 	WIFI_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26,
143 	WIFI_REASON_SSP_REQUESTED_DISASSOC = 27,
144 	WIFI_REASON_NO_SSP_ROAMING_AGREEMENT = 28,
145 	WIFI_REASON_BAD_CIPHER_OR_AKM = 29,
146 	WIFI_REASON_NOT_AUTHORIZED_THIS_LOCATION = 30,
147 	WIFI_REASON_SERVICE_CHANGE_PRECLUDES_TS = 31,
148 	WIFI_REASON_UNSPECIFIED_QOS_REASON = 32,
149 	WIFI_REASON_NOT_ENOUGH_BANDWIDTH = 33,
150 	WIFI_REASON_DISASSOC_LOW_ACK = 34,
151 	WIFI_REASON_EXCEEDED_TXOP = 35,
152 	WIFI_REASON_STA_LEAVING = 36,
153 	WIFI_REASON_END_TS_BA_DLS = 37,
154 	WIFI_REASON_UNKNOWN_TS_BA = 38,
155 	WIFI_REASON_TIMEOUT = 39,
156 	WIFI_REASON_PEERKEY_MISMATCH = 45,
157 	WIFI_REASON_AUTHORIZED_ACCESS_LIMIT_REACHED = 46,
158 	WIFI_REASON_EXTERNAL_SERVICE_REQUIREMENTS = 47,
159 	WIFI_REASON_INVALID_FT_ACTION_FRAME_COUNT = 48,
160 	WIFI_REASON_INVALID_PMKID = 49,
161 	WIFI_REASON_INVALID_MDE = 50,
162 	WIFI_REASON_INVALID_FTE = 51,
163 	WIFI_REASON_MESH_PEERING_CANCELLED = 52,
164 	WIFI_REASON_MESH_MAX_PEERS = 53,
165 	WIFI_REASON_MESH_CONFIG_POLICY_VIOLATION = 54,
166 	WIFI_REASON_MESH_CLOSE_RCVD = 55,
167 	WIFI_REASON_MESH_MAX_RETRIES = 56,
168 	WIFI_REASON_MESH_CONFIRM_TIMEOUT = 57,
169 	WIFI_REASON_MESH_INVALID_GTK = 58,
170 	WIFI_REASON_MESH_INCONSISTENT_PARAMS = 59,
171 	WIFI_REASON_MESH_INVALID_SECURITY_CAP = 60,
172 	WIFI_REASON_MESH_PATH_ERROR_NO_PROXY_INFO = 61,
173 	WIFI_REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO = 62,
174 	WIFI_REASON_MESH_PATH_ERROR_DEST_UNREACHABLE = 63,
175 	WIFI_REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64,
176 	WIFI_REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65,
177 	WIFI_REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED = 66,
178 
179 	WIFI_REASON_BEACON_LOST = 256,       /**< The BK STA can't detect the beacon of the connected AP */
180 	WIFI_REASON_NO_AP_FOUND = 257,       /**< Can't find the target AP */
181 	WIFI_REASON_WRONG_PASSWORD = 258,    /**< The password is wrong */
182 	WIFI_REASON_DISCONNECT_BY_APP = 259, /**< The BK STA disconnected by application */
183 	WIFI_REASON_DHCP_TIMEOUT = 260,      /**<The BK STA dhcp timeout, 20s**/
184 	WIFI_REASON_MAX,                     /**<The BK STA connect success*/
185 } wifi_err_reason_t;
186 
187 typedef enum {
188 	WIFI_SECURITY_NONE,            /**< Open system. */
189 	WIFI_SECURITY_WEP,             /**< WEP security, **it's unsafe security, please don't use it** */
190 	WIFI_SECURITY_WPA_TKIP,        /**< WPA TKIP */
191 	WIFI_SECURITY_WPA_AES,         /**< WPA AES */
192 	WIFI_SECURITY_WPA2_TKIP,       /**< WPA2 TKIP */
193 	WIFI_SECURITY_WPA2_AES,        /**< WPA2 AES */
194 	WIFI_SECURITY_WPA2_MIXED,      /**< WPA2 AES or TKIP */
195 	WIFI_SECURITY_WPA3_SAE,        /**< WPA3 SAE */
196 	WIFI_SECURITY_WPA3_WPA2_MIXED, /**< WPA3 SAE or WPA2 AES */
197 	WIFI_SECURITY_EAP,             /**< EAP */
198 	WIFI_SECURITY_OWE,             /**< OWE */
199 	WIFI_SECURITY_AUTO,            /**< WiFi automatically detect the security type */
200 } wifi_security_t;
201 
202 typedef enum {
203 	/* for STA mode */
204 	WIFI_LINKSTATE_STA_IDLE = 0,      /**< sta mode is idle */
205 	WIFI_LINKSTATE_STA_CONNECTING,    /**< sta mode is connecting */
206 	WIFI_LINKSTATE_STA_DISCONNECTED,  /**< sta mode is disconnected */
207 	WIFI_LINKSTATE_STA_CONNECTED,     /**< sta mode is connected */
208 	WIFI_LINKSTATE_STA_GOT_IP,        /**< sta mode got ip */
209 
210 	/* for AP mode */
211 	WIFI_LINKSTATE_AP_CONNECTED,      /**< softap mode, a client association success */
212 	WIFI_LINKSTATE_AP_DISCONNECTED,   /**< softap mode, a client disconnect */
213 	WIFI_LINKSTATE_AP_CONNECT_FAILED, /**< softap mode, a client association failed */
214 	WIFI_LINKSTATE_MAX,               /**< reserved */
215 	//TODO maybe we can provide more precise link status
216 } wifi_link_state_t;
217 
218 typedef enum {
219 	WIFI_COUNTRY_POLICY_AUTO,   /**< Country policy is auto, use the country info of AP to which the station is connected */
220 	WIFI_COUNTRY_POLICY_MANUAL, /**< Country policy is manual, always use the configured country info */
221 } wifi_country_policy_t;            /**< WiFi country policy */
222 
223 typedef enum {
224 	WIFI_SECOND_CHANNEL_NONE = 0,/**< HT20 mode, no secondary channel */
225 	WIFI_SECOND_CHANNEL_ABOVE,   /**< Second channel is above the primary channel */
226 	WIFI_SECOND_CHANNEL_BELOW,   /**< Second channel is below the primary channel */
227 } wifi_second_channel_t;
228 
229 /**
230  * @}
231  */
232 
233 /**
234  * @brief WLAN struct  type
235  * @defgroup bk_api_wifi_v2_typedef struct
236  * @ingroup bk_api_wifi_v2 struct
237  * @{
238  */
239 
240 typedef struct {
241 	uint64_t features;          /**< WiFi feature bitmaps */
242 	uint8_t reserved[16];       /**< Reserved */
243 } wifi_init_config_t;
244 
245 typedef struct {
246 	uint8_t primary;                 /**< Primary channel */
247 	wifi_second_channel_t second;    /**< Secondary cahnnel */
248 } wifi_channel_t;
249 
250 /* wpa_vendor_elem_frame */
251 enum wifi_sta_vsie {
252 	WIFI_VENDOR_ELEM_ASSOC_REQ = 0,
253 	WIFI_VENDOR_ELEM_PROBE_REQ = 1,
254 	NUM_WIFI_VENDOR_ELEM_FRAMES
255 };
256 
257 typedef struct {
258 	char ssid[WIFI_SSID_STR_LEN];      /**< SSID of AP to be connected */
259 	uint8_t bssid[WIFI_BSSID_LEN];     /**< BSSID of AP to be connected, fast connect only */
260 	uint8_t channel;                   /**< Primary channel of AP to be connected, fast connect only */
261 	wifi_security_t security;          /**< Security of AP to be connected */
262 	char  password[WIFI_PASSWORD_LEN]; /**< Security key or PMK of the wlan. */
263 #if CONFIG_INCLUDE_STA_VSIE
264 	struct {
265 		uint8_t len;
266 		uint8_t buf[255];
267 	} vsies[NUM_WIFI_VENDOR_ELEM_FRAMES];
268 #endif
269 	uint8_t reserved[32];              /**< reserved, **must set to 0** */
270 
271 #if CONFIG_INCLUDE_WPA2_ENTERPRISE
272 	/* starts of WPA2-Enterprise/WPA3-Enterprise configuration */
273 	char eap[16];                      /**< phase1 authType: TLS/TTLS/SIM */
274 	char identity[32];                 /**< user identity */
275 	char ca[32];                       /**< CA certificate filename */
276 	char client_cert[32];              /**< client's Certification filename in PEM,DER format */
277 	char private_key[32];              /**< client's private key filename in PEM,DER format */
278 	char private_key_passwd[32];       /**< client's private key password */
279 	char phase1[32];                   /**< client's phase1 parameters */
280 #endif
281 
282 	/* auto reconnect configuration */
283 	int auto_reconnect_count;          /**< auto reconnect max count, 0 for always reconnect */
284 	int auto_reconnect_timeout;        /**< auto reconnect timeout in secs, 0 for no timeout */
285 	bool disable_auto_reconnect_after_disconnect;  /**< disable auto reconnect if deauth/disassoc by AP when in connected state */
286 } wifi_sta_config_t;
287 
288 typedef struct {
289 	wifi_link_state_t state;           /**<Wifi linkstate*/
290 	wifi_err_reason_t reason_code;     /**<Wifi disconnect reason code, success will be WIFI_REASON_MAX*/
291 } wifi_linkstate_reason_t;
292 
293 typedef struct {
294 	wifi_link_state_t state;           /**< The WiFi connection status */
295 	int aid;                           /**< STA AID */
296 	int rssi;                          /**< The RSSI of AP the BK STA is connected */
297 	char ssid[WIFI_SSID_STR_LEN];      /**< SSID of AP the BK STA is connected */
298 	uint8_t bssid[WIFI_BSSID_LEN];     /**< BSSID of AP the BK STA is connected */
299 	uint8_t channel;                   /**< Primary channel of AP the BK STA is connected */
300 	wifi_security_t security;          /**< Security of AP the BK STA is connected */
301 	char  password[WIFI_PASSWORD_LEN]; /**< Passord of AP the BK STA is connected */
302 } wifi_link_status_t;
303 
304 typedef struct {
305 	char ssid[WIFI_SSID_STR_LEN];     /**< SSID to be scaned */
306 	uint8_t reserved[16];             /**< Reserved fields, **must be zero** */
307 } wifi_scan_config_t;
308 
309 typedef struct {
310 	char ssid[WIFI_SSID_STR_LEN];      /**< SSID of AP found by scan */
311 	uint8_t bssid[WIFI_BSSID_LEN];     /**< BSSID of AP found by scan */
312 	int  rssi;                         /**< RSSI of AP found by scan */
313 	uint8_t channel;                   /**< The channel of the AP found by scan */
314 	wifi_security_t security;          /**< The security type of the AP found by scan */
315 	uint8_t reserved[16];              /**< Reserved, **must be zero** */
316 } wifi_scan_ap_info_t;
317 
318 typedef struct {
319 	int ap_num;                        /**< The number of AP found by scan */
320 	wifi_scan_ap_info_t *aps;          /**< The APs found by scan */
321 } wifi_scan_result_t;
322 
323 typedef struct {
324 	char ssid[WIFI_SSID_STR_LEN];      /**< The SSID of BK AP */
325 	char password[WIFI_PASSWORD_LEN];  /**< Password of BK AP, ignored in an open system.*/
326 	uint8_t channel;                   /**< The channel of BK AP, 0 indicates default TODO */
327 	wifi_security_t security;          /**< Security type of BK AP, default value TODO */
328 	uint8_t hidden: 1;                 /**< Whether the BK AP is hidden */
329 	uint8_t acs: 1;                    /**< Whether Auto Channel Selection is enabled */
330 	uint8_t vsie_len;                  /**< Beacon/ProbeResp Vendor Specific IE len */
331 	uint8_t vsie[255];                 /**< Beacon/ProbeResp Vendor Specific IE */
332 	uint8_t max_con;                   /**< Max number of stations allowed to connect to BK AP, TODO default value? */
333 	uint8_t reserved[32];              /**< Reserved, **must be zero** */
334 } wifi_ap_config_t;
335 
336 /**
337  * @brief Wlan station information definition
338  */
339 typedef struct wlan_ap_sta {
340 	uint8_t addr[6];
341 	uint32_t ipaddr;
342 	int8_t rssi;
343 } wlan_ap_sta_t;
344 
345 /**
346  * @brief Wlan connected stations information definition
347  */
348 typedef struct wlan_ap_stas {
349 	wlan_ap_sta_t *sta;
350 	int num;
351 } wlan_ap_stas_t;
352 
353 /**
354  * @brief softap beacon/probe response's vendor IEs
355  * Dynamic change softap's vendor specific IEs.
356  */
357 typedef struct wlan_ap_vsie {
358 	uint8_t len;
359 	uint8_t vsie[255];
360 } wlan_ap_vsie_t;
361 
362 /**
363  * @brief STA vendor IEs for (re)assoc, scan, p2p, p2p go, etc.
364  * Dynamic change STA's vendor specific IEs.
365  */
366 typedef struct wlan_sta_vsie {
367 	int frame;
368 	uint8_t len;
369 	uint8_t vsie[255];
370 } wlan_sta_vsie_t;
371 
372 typedef struct {
373 	uint32_t rx_mcast_frame: 1;        /**< Set this bit to enable callback to receive multicast/broadcast*/
374 	uint32_t rx_dup_frame: 1;          /**< Set this bit to enable callback to receive the duplicated*/
375 	uint32_t reserved: 30;             /**< Reserved bits, **must set to 0** */
376 } wifi_monitor_config_t;
377 
378 typedef struct {
379 	int rssi;                         /**< RSSI of the received frame in monitor mode */
380 } wifi_frame_info_t;
381 
382 /**
383  * @brief Monitor callback to receive frames relayed by WiFi driver.
384  *
385  * @attention 1. The memory of frame and frame_info will be freed immediately when the
386  *               callback is returned. If we want to use the frame or frame_info in other
387  *               task, make a copy of them and handle them accordingly.
388  * @attention 2. Don't do too much work in the callback because the callback is called in
389  *               context of WiFi core thread, too much work may impact the performance of
390  *               WiFi.
391  **/
392 typedef bk_err_t (*wifi_monitor_cb_t)(const uint8_t *frame, uint32_t len, const wifi_frame_info_t *frame_info);
393 
394 typedef struct {
395 	uint32_t rx_all_default_mgmt: 1;  /**< Set the bit to enable the callback to receive all management frame recived by WiFi driver */
396 	uint32_t rx_probe_req: 1;         /**< Set the bit to enable the callback to receive probe request */
397 	uint32_t rx_probe_rsp: 1;         /**< Set the bit to enable the callback to receive probe response */
398 	uint32_t rx_all_beacon: 1;        /**< Set the bit to enable the callback to receive all beacon */
399 	uint32_t rx_action: 1;            /**< Set the bit to enable the callback to receive action frame */
400 	uint32_t reserved: 27;            /**< Reserved bits, **must set to 0** */
401 } wifi_filter_config_t;
402 
403 /**
404  * @brief Filter callback to receive frames relayed by WiFi driver.
405  *
406  * @attention 1. The memory of frame and frame_info will be freed immediately when the
407  *               callback is returned. If we want to use the frame or frame_info in other
408  *               task, make a copy of them and handle them accordingly.
409  * @attention 2. Don't do too much work in the callback because the callback is called in
410  *               context of WiFi core thread, too much work may impact the performance of
411  *               WiFi.
412  **/
413 typedef bk_err_t (*wifi_filter_cb_t)(const uint8_t *frame, uint32_t len, const wifi_frame_info_t *frame_info);
414 
415 typedef struct {
416 	char                  cc[3];          /**< country code string */
417 	uint8_t               schan;          /**< start channel */
418 	uint8_t               nchan;          /**< total channel number */
419 	int8_t                max_tx_power;   /**< maximum tx power */
420 	wifi_country_policy_t policy;         /**< country policy */
421 } wifi_country_t;
422 
423 typedef struct {
424 	uint32_t scan_id; /**< Scan ID */
425 } wifi_event_scan_done_t;
426 
427 typedef struct {
428 	char    ssid[WIFI_SSID_STR_LEN];      /**< SSID of connected AP */
429 	uint8_t bssid[WIFI_BSSID_LEN];        /**< BSSID of connected AP*/
430 } wifi_event_sta_connected_t;
431 
432 typedef struct {
433 	int disconnect_reason;                /**< Disconnect reason of BK STA */
434 	bool local_generated;                 /**< if disconnect is request by local */
435 } wifi_event_sta_disconnected_t;
436 
437 typedef struct {
438 	uint8_t mac[WIFI_MAC_LEN];            /**< MAC of the STA connected to the BK AP */
439 } wifi_event_ap_connected_t;
440 
441 typedef struct {
442 	uint8_t mac[WIFI_MAC_LEN];            /**< MAC of the STA disconnected from the BK AP */
443 } wifi_event_ap_disconnected_t;
444 
445 /**
446  * @brief Wi-Fi Statistic info.
447  */
448 typedef struct {
449 	uint32_t tx_success_count;	/**< Number of TX successes, 0 if unavailable */
450 	uint32_t tx_retry_count;	/**< Number of TX retries, 0 if unavailable */
451 	uint32_t tx_fail_count; 	/**< Number of TX failures, 0 if unavailable */
452 	uint32_t rx_success_count;	/**< Number of RX successes, 0 if unavailable */
453 	uint32_t rx_crcerror_count; /**< Number of RX FCS errors, 0 if unavailable */
454 	uint32_t mic_error_count;	/**< Number of MIC errors, 0 if unavailable */
455 	int8_t noise;				/**< Average noise level in dBm, -128 if unavailable */
456 	uint16_t phyrate; 		/**< Maximum used PHY rate, 0 if unavailable */
457 	uint16_t txrate;			/**< Average used TX rate, 0 if unavailable */
458 	uint16_t rxrate;			/**< Average used RX rate, 0 if unavailable */
459 	int8_t rssi;				/**< Average beacon RSSI in dBm, -128 if unavailable */
460 	uint8_t bandwidth;		/**< Average used bandwidth, 0 if unavailable */
461 	uint8_t idle_time_per;		/**< Percent of idle time, 0 if unavailable */
462 } wifi_statistics_info_t;
463 
464 /**
465  * @}
466  */
467 
468 /**
469  * @}
470  */
471 
472 #ifdef __cplusplus
473 }
474 #endif
475