1 /* * 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 /* * 20 * @file hi_wifi_api.h 21 * @defgroup hi_wifi_basic WiFi Basic Settings 22 * @ingroup hi_wifi 23 */ 24 25 #ifndef __HI_WIFI_API_H__ 26 #define __HI_WIFI_API_H__ 27 28 #include "hdf_ibus_intf.h" 29 #include "wifi_inc.h" 30 #ifdef __cplusplus 31 #if __cplusplus 32 extern "C" { 33 #endif 34 #endif 35 36 /* * 37 * mac transform string.CNcomment:地址转为字符串.CNend 38 */ 39 #ifndef MACSTR 40 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" 41 #endif 42 43 #ifndef MAC2STR 44 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] 45 #endif 46 47 /* * 48 * @ingroup hi_wifi_basic 49 * 50 * TKIP of cipher mode.CNcomment:加密方式为TKIP.CNend 51 */ 52 #define WIFI_CIPHER_TKIP BIT(3) 53 54 /* * 55 * @ingroup hi_wifi_basic 56 * 57 * CCMP of cipher mode.CNcomment:加密方式为CCMP.CNend 58 */ 59 #define WIFI_CIPHER_CCMP BIT(4) 60 61 /* * 62 * @ingroup hi_wifi_basic 63 * 64 * Channel numbers of 2.4G frequency.CNcomment:2.4G频段的信道数量.CNend 65 */ 66 #define WIFI_24G_CHANNEL_NUMS 14 67 68 /* * 69 * @ingroup hi_wifi_basic 70 * 71 * max interiface name length.CNcomment:网络接口名最大长度.CNend 72 */ 73 #define WIFI_IFNAME_MAX_SIZE 16 74 75 /* * 76 * @ingroup hi_wifi_basic 77 * 78 * The minimum timeout of a single reconnection.CNcomment:最小单次重连超时时间.CNend 79 */ 80 #define WIFI_MIN_RECONNECT_TIMEOUT 2 81 82 /* * 83 * @ingroup hi_wifi_basic 84 * 85 * The maximum timeout of a single reconnection, representing an infinite number of loop reconnections. 86 * CNcomment:最大单次重连超时时间,表示无限次循环重连.CNend 87 */ 88 #define WIFI_MAX_RECONNECT_TIMEOUT 65535 89 90 /* * 91 * @ingroup hi_wifi_basic 92 * 93 * The minimum auto reconnect interval.CNcomment:最小自动重连间隔时间.CNend 94 */ 95 #define WIFI_MIN_RECONNECT_PERIOD 1 96 97 /* * 98 * @ingroup hi_wifi_basic 99 * 100 * The maximum auto reconnect interval.CNcomment:最大自动重连间隔时间.CNend 101 */ 102 #define WIFI_MAX_RECONNECT_PERIOD 65535 103 104 /* * 105 * @ingroup hi_wifi_basic 106 * 107 * The minmum times of auto reconnect.CNcomment:最小自动重连连接次数.CNend 108 */ 109 #define WIFI_MIN_RECONNECT_TIMES 1 110 111 /* * 112 * @ingroup hi_wifi_basic 113 * 114 * The maximum times of auto reconnect.CNcomment:最大自动重连连接次数.CNend 115 */ 116 #define WIFI_MAX_RECONNECT_TIMES 65535 117 118 /* * 119 * @ingroup hi_wifi_basic 120 * 121 * max scan number of ap.CNcomment:支持扫描ap的最多数目.CNend 122 */ 123 #define WIFI_SCAN_AP_LIMIT 32 124 125 /* * 126 * @ingroup hi_wifi_basic 127 * 128 * length of status buff.CNcomment:获取连接状态字符串的长度.CNend 129 */ 130 #define WIFI_STATUS_BUF_LEN_LIMIT 512 131 132 /* * 133 * @ingroup hi_wifi_basic 134 * 135 * Decimal only WPS pin code length.CNcomment:WPS中十进制pin码长度.CNend 136 */ 137 #define WIFI_WPS_PIN_LEN 8 138 139 /* * 140 * @ingroup hi_wifi_basic 141 * 142 * default max num of vap.CNcomment:默认支持的设备最大个数.CNend 143 */ 144 #define WIFI_MAX_NUM_VAP 3 145 146 /* * 147 * @ingroup hi_wifi_basic 148 * 149 * default max num of user.CNcomment:默认支持的用户最大个数.CNend 150 */ 151 #define WIFI_MAX_NUM_USER 4 152 153 /* * 154 * @ingroup hi_wifi_basic 155 * 156 * default max num of station.CNcomment:默认支持的station最大个数.CNend 157 */ 158 #define WIFI_DEFAULT_MAX_NUM_STA WIFI_MAX_NUM_USER 159 160 /* * 161 * @ingroup hi_wifi_basic 162 * 163 * return success value.CNcomment:返回成功标识.CNend 164 */ 165 #define HISI_OK 0 166 167 /* * 168 * @ingroup hi_wifi_basic 169 * 170 * return failed value.CNcomment:返回值错误标识.CNend 171 */ 172 #define HISI_FAIL (-1) 173 174 /* * 175 * @ingroup hi_wifi_basic 176 * 177 * Max length of SSID.CNcomment:SSID最大长度定义.CNend 178 */ 179 #define HI_WIFI_MAX_SSID_LEN 32 180 181 /* * 182 * @ingroup hi_wifi_basic 183 * 184 * Length of MAC address.CNcomment:MAC地址长度定义.CNend 185 */ 186 #define HI_WIFI_MAC_LEN 6 187 188 /* * 189 * @ingroup hi_wifi_basic 190 * 191 * String length of bssid, eg. 00:00:00:00:00:00.CNcomment:bssid字符串长度定义(00:00:00:00:00:00).CNend 192 */ 193 #define HI_WIFI_TXT_ADDR_LEN 17 194 195 /* * 196 * @ingroup hi_wifi_basic 197 * 198 * Length of Key.CNcomment:KEY 密码长度定义.CNend 199 */ 200 #define HI_WIFI_AP_KEY_LEN 64 201 202 /* * 203 * @ingroup hi_wifi_basic 204 * 205 * Maximum length of Key.CNcomment:KEY 最大密码长度.CNend 206 */ 207 #define HI_WIFI_MAX_KEY_LEN 64 208 209 /* * 210 * @ingroup hi_wifi_basic 211 * 212 * Return value of invalid channel.CNcomment:无效信道返回值.CNend 213 */ 214 #define HI_WIFI_INVALID_CHANNEL 0xFF 215 216 /* * 217 * @ingroup hi_wifi_basic 218 * 219 * Index of Vendor IE.CNcomment:Vendor IE 最大索引.CNend 220 */ 221 #define HI_WIFI_VENDOR_IE_MAX_IDX 1 222 223 /* * 224 * @ingroup hi_wifi_basic 225 * 226 * Max length of Vendor IE.CNcomment:Vendor IE 最大长度.CNend 227 */ 228 #define HI_WIFI_VENDOR_IE_MAX_LEN 255 229 230 /* * 231 * @ingroup hi_wifi_basic 232 * 233 * Minimum length of custom's frame.CNcomment:用户定制报文最小长度值.CNend 234 */ 235 #define HI_WIFI_CUSTOM_PKT_MIN_LEN 24 236 237 /* * 238 * @ingroup hi_wifi_basic 239 * 240 * Max length of custom's frame.CNcomment:用户定制报文最大长度值.CNend 241 */ 242 #define HI_WIFI_CUSTOM_PKT_MAX_LEN 1400 243 244 /* * 245 * @ingroup hi_wifi_basic 246 * 247 * Max num of retry.CNcomment:软件重传的最大次数.CNend 248 */ 249 #define HI_WIFI_RETRY_MAX_NUM 15 250 251 /* * 252 * @ingroup hi_wifi_basic 253 * 254 * Max time of retry.CNcomment:软件重传的最大时间.CNend 255 */ 256 #define HI_WIFI_RETRY_MAX_TIME 200 257 258 /* * 259 * @ingroup hi_wifi_basic 260 * 261 * Freq compensation param count.CNcomment:(高温)频偏补偿参数个数.CNend 262 */ 263 #define HI_WIFI_FREQ_COMP_PARAM_CNT 3 264 265 /* * 266 * @ingroup hi_wifi_basic 267 * 268 * country code bits .CNcomment:国家码字节数.CNend 269 */ 270 #define HI_WIFI_COUNTRY_CODE_BITS_CNT 3 271 272 /* * 273 * @ingroup hi_wifi_basic 274 * 275 * DBB scale param count.CNcomment:dbb scale相关参数个数.CNend 276 */ 277 #define HI_WIFI_DBB_PARAM_CNT 7 278 279 /* * 280 * @ingroup hi_wifi_basic 281 * 282 * Ch depend tx power offset count.CNcomment:信道相关发送功率参数个数.CNend 283 */ 284 #define HI_WIFI_CH_TX_PWR_PARAM_CNT 13 285 286 /* * 287 * @ingroup hi_wifi_basic 288 * 289 * Reporting data type of monitor mode.CNcomment:混杂模式上报的数据类型.CNend 290 */ 291 typedef enum { 292 HI_WIFI_MONITOR_OFF, /**< close monitor mode. CNcomment: 关闭混杂模式.CNend */ 293 HI_WIFI_MONITOR_MCAST_DATA, /**< report multi-cast data frame. CNcomment: 上报组播(广播)数据包.CNend */ 294 HI_WIFI_MONITOR_UCAST_DATA, /**< report single-cast data frame. CNcomment: 上报单播数据包.CNend */ 295 HI_WIFI_MONITOR_MCAST_MANAGEMENT, /**< report multi-cast mgmt frame. CNcomment: 上报组播(广播)管理包.CNend */ 296 HI_WIFI_MONITOR_UCAST_MANAGEMENT, /**< report sigle-cast mgmt frame. CNcomment: 上报单播管理包.CNend */ 297 298 HI_WIFI_MONITOR_BUTT 299 } hi_wifi_monitor_mode; 300 301 /* * 302 * @ingroup hi_wifi_basic 303 * 304 * Definition of protocol frame type.CNcomment:协议报文类型定义.CNend 305 */ 306 typedef enum { 307 HI_WIFI_PKT_TYPE_BEACON, /**< Beacon packet. CNcomment: Beacon包.CNend */ 308 HI_WIFI_PKT_TYPE_PROBE_REQ, /**< Probe Request packet. CNcomment: Probe Request包.CNend */ 309 HI_WIFI_PKT_TYPE_PROBE_RESP, /**< Probe Response packet. CNcomment: Probe Response包.CNend */ 310 HI_WIFI_PKT_TYPE_ASSOC_REQ, /**< Assoc Request packet. CNcomment: Assoc Request包.CNend */ 311 HI_WIFI_PKT_TYPE_ASSOC_RESP, /**< Assoc Response packet. CNcomment: Assoc Response包.CNend */ 312 313 HI_WIFI_PKT_TYPE_BUTT 314 } hi_wifi_pkt_type; 315 316 /* * 317 * @ingroup hi_wifi_basic 318 * 319 * Interface type of wifi.CNcomment:wifi 接口类型.CNend 320 */ 321 typedef enum { 322 HI_WIFI_IFTYPE_UNSPECIFIED, 323 HI_WIFI_IFTYPE_ADHOC, 324 HI_WIFI_IFTYPE_STATION = 2, /* *< Station. CNcomment: STA类型.CNend */ 325 HI_WIFI_IFTYPE_AP = 3, /* *< SoftAp. CNcomment: SoftAp类型.CNend */ 326 HI_WIFI_IFTYPE_AP_VLAN, 327 HI_WIFI_IFTYPE_WDS, 328 HI_WIFI_IFTYPE_MONITOR, 329 HI_WIFI_IFTYPE_MESH_POINT = 7, /* *< Mesh. CNcomment: Mesh类型.CNend */ 330 HI_WIFI_IFTYPE_P2P_CLIENT, 331 HI_WIFI_IFTYPE_P2P_GO, 332 HI_WIFI_IFTYPE_P2P_DEVICE, 333 334 HI_WIFI_IFTYPES_BUTT 335 } hi_wifi_iftype; 336 337 /* * 338 * @ingroup hi_wifi_basic 339 * 340 * Definition of bandwidth type.CNcomment:接口带宽定义.CNend 341 */ 342 typedef enum { 343 HI_WIFI_BW_HIEX_5M, /* *< 5M bandwidth. CNcomment: 窄带5M带宽.CNend */ 344 HI_WIFI_BW_HIEX_10M, /* *< 10M bandwidth. CNcomment: 窄带10M带宽.CNend */ 345 HI_WIFI_BW_LEGACY_20M, /* *< 20M bandwidth. CNcomment: 20M带宽.CNend */ 346 HI_WIFI_BW_BUTT 347 } hi_wifi_bw; 348 349 /* * 350 * @ingroup hi_wifi_basic 351 * 352 * The protocol mode of softap and station interfaces.CNcomment:softap和station接口的protocol模式.CNend 353 */ 354 typedef enum { 355 HI_WIFI_PHY_MODE_11BGN, /* *< 802.11BGN mode. CNcomment: 802.11BGN 模式.CNend */ 356 HI_WIFI_PHY_MODE_11BG, /* *< 802.11BG mode. CNcomment: 802.11BG 模式.CNend */ 357 HI_WIFI_PHY_MODE_11B, /* *< 802.11B mode. CNcomment: 802.11B 模式.CNend */ 358 HI_WIFI_PHY_MODE_BUTT 359 } hi_wifi_protocol_mode; 360 361 /* * 362 * @ingroup hi_wifi_basic 363 * 364 * Authentication type enum.CNcomment:认证类型(连接网络不支持HI_WIFI_SECURITY_WPAPSK).CNend 365 */ 366 typedef enum { 367 HI_WIFI_SECURITY_OPEN, /* *< OPEN. CNcomment: 认证类型:开放.CNend */ 368 HI_WIFI_SECURITY_WEP, /* *< WEP. CNcomment: 认证类型:WEP.CNend */ 369 HI_WIFI_SECURITY_WPA2PSK, /* *< WPA-PSK. CNcomment: 认证类型:WPA2-PSK.CNend */ 370 HI_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, /* *< WPA/WPA2-PSK MIX. CNcomment: 认证类型:WPA-PSK/WPA2-PSK混合.CNend */ 371 HI_WIFI_SECURITY_WPAPSK, /* *< WPA-PSK. CNcomment: 认证类型:WPA-PSK.CNend */ 372 HI_WIFI_SECURITY_WPA, /* *< WPA. CNcomment: 认证类型:WPA.CNend */ 373 HI_WIFI_SECURITY_WPA2, /* *< WPA2. CNcomment: 认证类型:WPA2.CNend */ 374 HI_WIFI_SECURITY_SAE, /* *< SAE. CNcomment: 认证类型:SAE.CNend */ 375 HI_WIFI_SECURITY_UNKNOWN /* *< UNKNOWN. CNcomment: 其他认证类型:UNKNOWN.CNend */ 376 } hi_wifi_auth_mode; 377 378 /* * 379 * @ingroup hi_wifi_basic 380 * 381 * Encryption type enum.CNcoment:加密类型.CNend 382 * 383 */ 384 typedef enum { 385 HI_WIFI_PARIWISE_UNKNOWN, /* *< UNKNOWN. CNcomment: 加密类型:UNKNOWN.CNend */ 386 HI_WIFI_PAIRWISE_AES, /* *< AES. CNcomment: 加密类型:AES.CNend */ 387 HI_WIFI_PAIRWISE_TKIP, /* *< TKIP. CNcomment: 加密类型:TKIP.CNend */ 388 HI_WIFI_PAIRWISE_TKIP_AES_MIX /* *< TKIP/AES MIX. CNcomment: 加密类型:TKIP AES混合.CNend */ 389 } hi_wifi_pairwise; 390 391 /* * 392 * @ingroup hi_wifi_basic 393 * 394 * PMF type enum.CNcomment:PMF管理帧保护模式类型.CNend 395 */ 396 typedef enum { 397 HI_WIFI_MGMT_FRAME_PROTECTION_CLOSE, /* *< Disable. CNcomment: 管理帧保护模式:关闭.CNend */ 398 HI_WIFI_MGMT_FRAME_PROTECTION_OPTIONAL, /* *< Optional. CNcomment: 管理帧保护模式:可选.CNend */ 399 HI_WIFI_MGMT_FRAME_PROTECTION_REQUIRED /* *< Required. CNcomment: 管理帧保护模式:必须.CNend */ 400 } hi_wifi_pmf_options; 401 402 /* * 403 * @ingroup hi_wifi_basic 404 * 405 * Type of connect's status.CNcomment:连接状态.CNend 406 */ 407 typedef enum { 408 HI_WIFI_DISCONNECTED, /* *< Disconnected. CNcomment: 连接状态:未连接.CNend */ 409 HI_WIFI_CONNECTED, /* *< Connected. CNcomment: 连接状态:已连接.CNend */ 410 } hi_wifi_conn_status; 411 412 /* * 413 * @ingroup hi_wifi_basic 414 * 415 * wifi's operation mode.CNcomment:wifi的工作模式.CNend 416 */ 417 typedef enum { 418 HI_WIFI_MODE_INFRA = 0, /* *< STA模式 */ 419 HI_WIFI_MODE_AP = 2, /* *< AP 模式 */ 420 HI_WIFI_MODE_MESH = 5 /* *< MESH 模式 */ 421 } hi_wifi_mode; 422 423 /* * 424 * @ingroup hi_wifi_basic 425 * 426 * Event type of WiFi event.CNcomment:WiFi的事件类型.CNend 427 */ 428 typedef enum { 429 HI_WIFI_EVT_UNKNOWN, /* *< UNKNWON. CNcomment: UNKNOWN.CNend */ 430 HI_WIFI_EVT_SCAN_DONE, /* *< Scan finish. CNcomment: STA扫描完成.CNend */ 431 HI_WIFI_EVT_CONNECTED, /* *< Connected. CNcomment: 已连接.CNend */ 432 HI_WIFI_EVT_DISCONNECTED, /* *< Disconnected. CNcomment: 断开连接.CNend */ 433 HI_WIFI_EVT_WPS_TIMEOUT, /* *< WPS timeout. CNcomment: WPS事件超时.CNend */ 434 HI_WIFI_EVT_MESH_CONNECTED, /* *< MESH connected. CNcomment: MESH已连接.CNend */ 435 HI_WIFI_EVT_MESH_DISCONNECTED, /* *< MESH disconnected. CNcomment: MESH断开连接.CNend */ 436 HI_WIFI_EVT_AP_START, /* *< AP start. CNcomment: AP开启.CNend */ 437 HI_WIFI_EVT_STA_CONNECTED, /* *< STA connected with ap. CNcomment: AP和STA已连接.CNend */ 438 HI_WIFI_EVT_STA_DISCONNECTED, /* *< STA disconnected from ap. CNcomment: AP和STA断开连接.CNend */ 439 HI_WIFI_EVT_STA_FCON_NO_NETWORK, /* *< STA connect, but can't find network. CNcomment: STA连接时扫描不到网络.CNend */ 440 HI_WIFI_EVT_MESH_CANNOT_FOUND, /* *< MESH can't find network. CNcomment: MESH关联扫不到对端.CNend */ 441 HI_WIFI_EVT_MESH_SCAN_DONE, /* *< MESH AP scan finish. CNcomment: MESH AP扫描完成.CNend */ 442 HI_WIFI_EVT_MESH_STA_SCAN_DONE, /* *< MESH STA scan finish. CNcomment: MESH STA扫描完成.CNend */ 443 HI_WIFI_EVT_AP_SCAN_DONE, /* *< AP scan finish. CNcomment: AP扫描完成.CNend */ 444 HI_WIFI_EVT_BUTT 445 } hi_wifi_event_type; 446 447 /* * 448 * @ingroup hi_wifi_basic 449 * 450 * Scan type enum.CNcomment:扫描类型.CNend 451 */ 452 typedef enum { 453 HI_WIFI_BASIC_SCAN, /* *< Common and all channel scan. CNcomment: 普通扫描.CNend */ 454 HI_WIFI_CHANNEL_SCAN, /* *< Specified channel scan. CNcomment: 指定信道扫描.CNend */ 455 HI_WIFI_SSID_SCAN, /* *< Specified SSID scan. CNcomment: 指定SSID扫描.CNend */ 456 HI_WIFI_SSID_PREFIX_SCAN, /* *< Prefix SSID scan. CNcomment: SSID前缀扫描.CNend */ 457 HI_WIFI_BSSID_SCAN, /* *< Specified BSSID scan. CNcomment: 指定BSSID扫描.CNend */ 458 } hi_wifi_scan_type; 459 460 /* * 461 * @ingroup iot_lp 462 * Sleep level enumeration. 463 */ 464 typedef enum { 465 HI_NO_SLEEP, /* *< no sleep type.CNcomment:不睡模式 CNend */ 466 HI_LIGHT_SLEEP, /* *< light sleep type.CNcomment:浅睡模式 CNend */ 467 HI_DEEP_SLEEP, /* *< deep sleep type.CNcomment:深睡模式 CNend */ 468 } hi_plat_type; 469 470 /* * 471 * @ingroup hi_wifi_basic 472 * wow pattern type 473 */ 474 typedef enum { 475 HI_WOW_PATTERN_ADD, 476 HI_WOW_PATTERN_DEL, 477 HI_WOW_PATTERN_CLR, 478 } hi_wifi_wow_pattern_type; 479 480 /* * 481 * @ingroup hi_wifi_basic 482 * 483 * parameters of scan.CNcomment:station接口scan参数.CNend 484 */ 485 typedef struct { 486 char ssid[HI_WIFI_MAX_SSID_LEN + 1]; /* *< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 487 unsigned char bssid[HI_WIFI_MAC_LEN]; /* *< BSSID. CNcomment: BSSID.CNend */ 488 unsigned char ssid_len; /* *< SSID length. CNcomment: SSID长度.CNend */ 489 unsigned char channel; /* *< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 490 hi_wifi_scan_type scan_type; /* *< Scan type. CNcomment: 扫描类型.CNend */ 491 } hi_wifi_scan_params; 492 493 /* * 494 * @ingroup hi_wifi_basic 495 * 496 * Struct of scan result.CNcomment:扫描结果结构体.CNend 497 */ 498 typedef struct { 499 char ssid[HI_WIFI_MAX_SSID_LEN + 1]; /* *< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 500 unsigned char bssid[HI_WIFI_MAC_LEN]; /* *< BSSID. CNcomment: BSSID.CNend */ 501 unsigned int channel; /* *< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 502 hi_wifi_auth_mode auth; /* *< Authentication type. CNcomment: 认证类型.CNend */ 503 int rssi; /* *< Signal Strength. CNcomment: 信号强度.CNend */ 504 unsigned char wps_flag : 1; /* *< WPS flag. CNcomment: WPS标识.CNend */ 505 unsigned char wps_session : 1; /* *< WPS session:PBC-0/PIN-1. CNcomment: WPS会话类型,PBC-0/PIN-1.CNend */ 506 unsigned char wmm : 1; /* *< WMM flag. CNcomment: WMM标识.CNend */ 507 unsigned char resv : 1; /* *< Reserved. CNcomment: 预留.CNend */ 508 unsigned char hisi_mesh_flag : 1; /* *< MESH flag. CNcomment: MESH标识.CNend */ 509 } hi_wifi_ap_info; 510 511 /* * 512 * @ingroup hi_wifi_basic 513 * 514 * Struct of connect parameters.CNcomment:station连接结构体.CNend 515 */ 516 typedef struct { 517 char ssid[HI_WIFI_MAX_SSID_LEN + 1]; /* *< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 518 hi_wifi_auth_mode auth; /* *< Authentication mode. CNcomment: 认证类型.CNend */ 519 char key[HI_WIFI_MAX_KEY_LEN + 1]; /* *< Secret key. CNcomment: 秘钥.CNend */ 520 unsigned char bssid[HI_WIFI_MAC_LEN]; /* *< BSSID. CNcomment: BSSID.CNend */ 521 hi_wifi_pairwise pairwise; /* *< Encryption type. CNcomment: 加密方式,不需指定时置0.CNend */ 522 } hi_wifi_assoc_request; 523 524 /* * 525 * @ingroup hi_wifi_basic 526 * 527 * Struct of fast connect parameters.CNcomment:station快速连接结构体.CNend 528 */ 529 typedef struct { 530 hi_wifi_assoc_request req; /* *< Association request. CNcomment: 关联请求.CNend */ 531 unsigned char channel; /* *< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 532 } hi_wifi_fast_assoc_request; 533 534 /* * 535 * @ingroup hi_wifi_basic 536 * 537 * Status of sta's connection.CNcomment:获取station连接状态.CNend 538 */ 539 typedef struct { 540 char ssid[HI_WIFI_MAX_SSID_LEN + 1]; /* *< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 541 unsigned char bssid[HI_WIFI_MAC_LEN]; /* *< BSSID. CNcomment: BSSID.CNend */ 542 unsigned int channel; /* *< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 543 hi_wifi_conn_status status; /* *< Connect status. CNcomment: 连接状态.CNend */ 544 } hi_wifi_status; 545 546 /* * 547 * @ingroup hi_wifi_basic 548 * 549 * Event type of wifi scan done.CNcomment:扫描完成事件.CNend 550 */ 551 typedef struct { 552 unsigned short bss_num; /* *< numbers of scan result. CNcomment: 扫描到的ap数目.CNend */ 553 } event_wifi_scan_done; 554 555 /* * 556 * @ingroup hi_wifi_basic 557 * 558 * Event type of wifi connected CNcomment:wifi的connect事件信息.CNend 559 */ 560 typedef struct { 561 char ssid[HI_WIFI_MAX_SSID_LEN + 1]; /* *< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 562 unsigned char bssid[HI_WIFI_MAC_LEN]; /* *< BSSID. CNcomment: BSSID.CNend */ 563 unsigned char ssid_len; /* *< SSID length. CNcomment: SSID长度.CNend */ 564 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /* *< Iftype name. CNcomment: 接口名称.CNend */ 565 } event_wifi_connected; 566 567 /* * 568 * @ingroup hi_wifi_basic 569 * 570 * Event type of wifi disconnected.CNcomment:wifi的断开事件信息.CNend 571 */ 572 typedef struct { 573 unsigned char bssid[HI_WIFI_MAC_LEN]; /* *< BSSID. CNcomment: BSSID.CNend */ 574 unsigned short reason_code; /* *< reason code. CNcomment: 断开原因.CNend */ 575 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /* *< Iftype name. CNcomment: 接口名称.CNend */ 576 } event_wifi_disconnected; 577 578 /* * 579 * @ingroup hi_wifi_basic 580 * 581 * Event type of ap connected sta.CNcomment:ap连接sta事件信息.CNend 582 */ 583 typedef struct { 584 char addr[HI_WIFI_MAC_LEN]; /* *< user's mac address of SoftAp. CNcomment: 连接AP的sta地址.CNend */ 585 } event_ap_sta_connected; 586 587 /* * 588 * @ingroup hi_wifi_basic 589 * 590 * Event type of ap disconnected sta.CNcomment:ap断开sta事件信息.CNend 591 */ 592 typedef struct { 593 unsigned char addr[HI_WIFI_MAC_LEN]; /* *< User's mac address of SoftAp. CNcomment: AP断开STA的MAC地址.CNend */ 594 unsigned short reason_code; /* *< Reason code. CNcomment: AP断开连接的原因值.CNend */ 595 } event_ap_sta_disconnected; 596 597 /* * 598 * @ingroup hi_wifi_basic 599 * 600 * Event type of ap start.CNcomment:ap启动事件信息.CNend 601 */ 602 typedef struct { 603 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /* *< Iftype name. CNcomment: 接口名称.CNend */ 604 } event_ap_start; 605 606 /* * 607 * @ingroup hi_wifi_basic 608 * 609 * Event type of mesh connected.CNcomment:mesh的connect事件信息.CNend 610 */ 611 typedef struct { 612 unsigned char addr[HI_WIFI_MAC_LEN]; /* *< User's mac address of MESH. CNcomment: MESH连接的peer MAC地址.CNend */ 613 } event_mesh_connected; 614 615 /* * 616 * @ingroup hi_wifi_basic 617 * 618 * Event type of mesh disconnected.CNcomment:mesh的disconnect事件信息.CNend 619 */ 620 typedef struct { 621 unsigned char addr[HI_WIFI_MAC_LEN]; /* *< User's mac address of MESH. CNcomment: 断开连接的peer MAC地址.CNend */ 622 unsigned short reason_code; /* *< Reason code. CNcomment: MESH断开连接的原因.CNend */ 623 } event_mesh_disconnected; 624 625 /* * 626 * @ingroup hi_wifi_basic 627 * 628 * Event type wifi information.CNcomment:wifi的事件信息体.CNend 629 */ 630 typedef union { 631 event_wifi_scan_done wifi_scan_done; /* *< Scan finish event. CNcomment: WIFI扫描完成事件信息.CNend */ 632 event_wifi_connected wifi_connected; /* *< STA's connected event. CNcomment: STA的连接事件信息.CNend */ 633 event_wifi_disconnected wifi_disconnected; /* *< STA's dsiconnected event. CNcomment: STA的断连事件信息.CNend */ 634 event_ap_sta_connected ap_sta_connected; /* *< AP's connected event . CNcomment: AP的连接事件信息.CNend */ 635 event_ap_sta_disconnected ap_sta_disconnected; /* *< AP's disconnected event. CNcomment: AP的断连事件信息.CNend */ 636 event_ap_start ap_start; /* *< AP's start success event. CNcomment: AP启动成功信息.CNend */ 637 event_mesh_connected mesh_connected; /* *< MESH's connected event. CNcomment: MESH连接事件信息.CNend */ 638 event_mesh_disconnected mesh_disconnected; /* *< MESH's disconnected event. CNcomment: MESH断连事件信息.CNend */ 639 } hi_wifi_event_info; 640 641 /* * 642 * @ingroup hi_wifi_basic 643 * 644 * Struct of WiFi event.CNcomment:WiFi事件结构体.CNend 645 * 646 */ 647 typedef struct { 648 hi_wifi_event_type event; /* *< Event type. CNcomment: 事件类型.CNend */ 649 hi_wifi_event_info info; /* *< Event information. CNcomment: 事件信息.CNend */ 650 } hi_wifi_event; 651 652 /* * 653 * @ingroup hi_wifi_basic 654 * 655 * Struct of softap's basic config.CNcomment:softap基本配置.CNend 656 * 657 */ 658 typedef struct { 659 char ssid[HI_WIFI_MAX_SSID_LEN + 1]; /* *< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 660 char key[HI_WIFI_AP_KEY_LEN + 1]; /* *< Secret key. CNcomment: 秘钥.CNend */ 661 unsigned char channel_num; /* *< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 662 int ssid_hidden; /* *< Hidden ssid. CNcomment: 是否隐藏SSID.CNend */ 663 hi_wifi_auth_mode authmode; /* *< Authentication mode. CNcomment: 认证方式.CNend */ 664 hi_wifi_pairwise pairwise; /* *< Encryption type. CNcomment: 加密方式,不需指定时置0.CNend */ 665 } hi_wifi_softap_config; 666 667 /* * 668 * @ingroup hi_wifi_basic 669 * 670 * mac address of softap's user.CNcomment:与softap相连的station mac地址.CNend 671 * 672 */ 673 typedef struct { 674 unsigned char mac[HI_WIFI_MAC_LEN]; /* *< MAC address.CNcomment:与softap相连的station mac地址.CNend */ 675 } hi_wifi_ap_sta_info; 676 677 /* * 678 * @ingroup hi_wifi_basic 679 * 680 * Struct of frame filter config in monitor mode.CNcomment:混杂模式报文接收过滤设置.CNend 681 */ 682 typedef struct { 683 char mdata_en : 1; /* *< get multi-cast data frame flag. CNcomment: 使能接收组播(广播)数据包.CNend */ 684 char udata_en : 1; /* *< get single-cast data frame flag. CNcomment: 使能接收单播数据包.CNend */ 685 char mmngt_en : 1; /* *< get multi-cast mgmt frame flag. CNcomment: 使能接收组播(广播)管理包.CNend */ 686 char umngt_en : 1; /* *< get single-cast mgmt frame flag. CNcomment: 使能接收单播管理包.CNend */ 687 char resvd : 4; /* *< reserved bits. CNcomment: 保留字段.CNend */ 688 } hi_wifi_ptype_filter; 689 690 /* * 691 * @ingroup hi_wifi_basic 692 * 693 * Struct of customize params.CNcomment:配置定制化参数.CNend 694 */ 695 typedef struct { 696 char country_code[HI_WIFI_COUNTRY_CODE_BITS_CNT]; 697 int rssi_offset; 698 unsigned int freq_comp[HI_WIFI_FREQ_COMP_PARAM_CNT]; 699 unsigned int dbb_params[HI_WIFI_DBB_PARAM_CNT]; 700 unsigned int ch_txpwr_offset[HI_WIFI_CH_TX_PWR_PARAM_CNT]; 701 } hi_wifi_customize_params; 702 703 /* * 704 * @ingroup hi_wifi_basic 705 * 706 * Struct of report goodput.CNcomment:吞吐量数据.CNend 707 */ 708 typedef struct { 709 unsigned int be_datarate; 710 unsigned int be_avg_retry; 711 unsigned int bk_datarate; 712 unsigned int bk_avg_retry; 713 unsigned int vi_datarate; 714 unsigned int vi_avg_retry; 715 unsigned int vo_datarate; 716 unsigned int vo_avg_retry; 717 } hi_wifi_report_tx_params; 718 719 typedef enum { 720 DEV_PANIC = 1, 721 DRIVER_HUNG, 722 UNKNOWN, 723 } hi_wifi_driver_event; 724 725 /* * 726 * @ingroup hi_wifi_driver_event_cb 727 * 728 * report driving events to application layer.CNcommment:向应用层上报驱动事件.CNend 729 */ 730 typedef int (*hi_wifi_driver_event_cb)(hi_wifi_driver_event event); 731 732 /* * 733 * @ingroup hi_wifi_basic 734 * 735 * callback function definition of monitor mode.CNcommment:混杂模式收包回调接口定义.CNend 736 */ 737 typedef int (*hi_wifi_promis_cb)(void *recv_buf, int frame_len, signed char rssi); 738 739 /* * 740 * @ingroup hi_wifi_basic 741 * 742 * callback function definition of wifi event.CNcommment:wifi事件回调接口定义.CNend 743 */ 744 typedef void (*hi_wifi_event_cb)(const hi_wifi_event *event); 745 746 /* * 747 * @ingroup hi_wifi_basic 748 * 749 * callback function definition of wifi event to get goodput and average send times. 750 * CNcommment:wifi获取吞吐量、平均发送次数事件回调接口定义.CNend 751 */ 752 typedef unsigned int (*hi_wifi_report_tx_params_callback)(hi_wifi_report_tx_params *); 753 754 /* * 755 * @ingroup hi_wifi_basic 756 * @brief Wifi initialize.CNcomment:wifi初始化.CNend 757 * 758 * @par Description: 759 Wifi driver initialize.CNcomment:wifi驱动初始化,不创建wifi设备.CNend 760 * 761 * @attention NULL 762 * @param max_port_count [IN] Type #uint8_t, max port num 763 * 764 * @retval #HISI_OK Excute successfully 765 * @retval #Other Error code 766 * @par Dependency: 767 * @li hi_wifi_api.h: WiFi API 768 * @see NULL 769 * @since Hi3881_V100R001C00 770 */ 771 int hi_wifi_init(uint8_t max_port_count, struct BusDev *bus); 772 773 774 /* * 775 * @ingroup hi_wifi_basic 776 * @brief Wifi de-initialize.CNcomment:wifi去初始化.CNend 777 * 778 * @par Description: 779 * Wifi driver de-initialize.CNcomment:wifi驱动去初始化.CNend 780 * 781 * @attention NULL 782 * @param NULL 783 * 784 * @retval #HISI_OK Excute successfully 785 * @retval #Other Error code 786 * @par Dependency: 787 * @li hi_wifi_api.h: WiFi API 788 * @see NULL 789 * @since Hi3861_V100R001C00 790 */ 791 int hi_wifi_deinit(void); 792 793 /* * 794 * @ingroup hi_wifi_basic 795 * @brief Set protocol mode of sta.CNcomment:设置station接口的protocol模式.CNend 796 * 797 * @par Description: 798 * Set protocol mode of sta, set before calling hi_wifi_sta_start().\n 799 * CNcomment:配置station接口的protocol模式, 在sta start之前调用.CNend 800 * 801 * @attention Default mode 802.11BGN CNcomment:默认模式 802.11BGN.CNend 802 * @param mode [IN] Type #hi_wifi_protocol_mode, protocol mode. 803 * 804 * @retval #HISI_OK Execute successfully. 805 * @retval #HISI_FAIL Execute failed. 806 * @par Dependency: 807 * @li hi_wifi_api.h: WiFi API 808 * @see NULL 809 * @since Hi3881_V100R001C00 810 */ 811 int hi_wifi_sta_set_protocol_mode(hi_wifi_protocol_mode mode); 812 813 /* * 814 * @ingroup hi_wifi_basic 815 * @brief Get protocol mode of.CNcomment:获取station接口的protocol模式.CNend 816 * 817 * @par Description: 818 * Get protocol mode of station.CNcomment:获取station接口的protocol模式.CNend 819 * 820 * @attention NULL 821 * @param NULL 822 * 823 * @retval #hi_wifi_protocol_mode protocol mode. 824 * @par Dependency: 825 * @li hi_wifi_api.h: WiFi API 826 * @see NULL 827 * @since Hi3881_V100R001C00 828 */ 829 hi_wifi_protocol_mode hi_wifi_sta_get_protocol_mode(void); 830 831 /* * 832 * @ingroup hi_wifi_basic 833 * @brief Config pmf settings of sta.CNcomment:配置station的pmf.CNend 834 * 835 * @par Description: 836 * Config pmf settings of sta, set before sta start.CNcomment:配置station的pmf, 在sta start之前调用.CNend 837 * 838 * @attention Default pmf enum value 1. CNcomment:默认pmf枚举值1.CNend 839 * @param pmf [IN] Type #hi_wifi_pmf_options, pmf enum value.CNcoment:pmf枚举值.CNend 840 * 841 * @retval #HISI_OK Execute successfully. 842 * @retval #HISI_FAIL Execute failed. 843 * @par Dependency: 844 * @li hi_wifi_api.h: WiFi API 845 * @see NULL 846 * @since Hi3881_V100R001C00 847 */ 848 int hi_wifi_set_pmf(hi_wifi_pmf_options pmf); 849 850 /* * 851 * @ingroup hi_wifi_basic 852 * @brief Get pmf settings of sta.CNcomment:获取station的pmf设置.CNend 853 * 854 * @par Description: 855 * Get pmf settings of sta.CNcomment:获取station的pmf设置.CNend 856 * 857 * @attention NULL 858 * @param NULL 859 * 860 * @retval #hi_wifi_pmf_options pmf enum value. 861 * @par Dependency: 862 * @li hi_wifi_api.h: WiFi API 863 * @see NULL 864 * @since Hi3881_V100R001C00 865 */ 866 hi_wifi_pmf_options hi_wifi_get_pmf(void); 867 868 /* * 869 * @ingroup hi_wifi_basic 870 * @brief Start wifi station.CNcomment:开启STA.CNend 871 * 872 * @par Description: 873 * Start wifi station.CNcomment:开启STA.CNend 874 * 875 * @attention 1. Multiple interfaces of the same type are not supported.CNcomment:1. 不支持使用多个同类型接口.CNend\n 876 * 2. Dual interface coexistence support: STA + AP or STA + MESH. 877 * CNcomment:2. 双接口共存支持:STA + AP or STA + MESH.CNend\n 878 * 3. Start timeout 5s.CNcomment:3. 启动超时时间5s.CNend\n 879 * 4. The memories of <ifname> and <len> should be requested by the caller, 880 * the input value of len must be the same as the length of ifname(the recommended length is 17Bytes).\n 881 * CNcomment:4. <ifname>和<len>由调用者申请内存,用户写入len的值必须与ifname长度一致(建议长度为17Bytes).CNend 882 * @param ifname [IN/OUT] Type #char *, device name.CNcomment:接口名.CNend 883 * @param len [IN/OUT] Type #int *, length of device name.CNcomment:接口名长度.CNend 884 * 885 * @retval #HISI_OK Execute successfully. 886 * @retval #HISI_FAIL Execute failed. 887 * @par Dependency: 888 * @li hi_wifi_api.h: WiFi API 889 * @see NULL 890 * @since Hi3881_V100R001C00 891 */ 892 int hi_wifi_sta_start(char *ifname, int *len); 893 894 /* * 895 * @ingroup hi_wifi_basic 896 * @brief Close wifi station.CNcomment:关闭STA.CNend 897 * 898 * @par Description: 899 * Close wifi station.CNcomment:关闭STA.CNend 900 * 901 * @attention NULL 902 * @param NULL 903 * 904 * @retval #HISI_OK Execute successfully. 905 * @retval #HISI_FAIL Execute failed. 906 * @par Dependency: 907 * @li hi_wifi_api.h: WiFi API 908 * @see NULL 909 * @since Hi3881_V100R001C00 910 */ 911 int hi_wifi_sta_stop(void); 912 913 /* * 914 * @ingroup hi_wifi_basic 915 * @brief Start sta basic scanning in all channels.CNcomment:station进行全信道基础扫描.CNend 916 * 917 * @par Description: 918 * Start sta basic scanning in all channels.CNcomment:启动station全信道基础扫描.CNend 919 * 920 * @attention NULL 921 * @param NULL 922 * 923 * @retval #HISI_OK Execute successfully. 924 * @retval #HISI_FAIL Execute failed. 925 * @par Dependency: 926 * @li hi_wifi_api.h: WiFi API 927 * @see NULL 928 * @since Hi3881_V100R001C00 929 */ 930 int hi_wifi_sta_scan(void); 931 932 /* * 933 * @ingroup hi_wifi_basic 934 * @brief Start station scanning with specified parameter.CNcomment:station执行带特定参数的扫描.CNend 935 * 936 * @par Description: 937 * Start station scanning with specified parameter.CNcomment:station执行带特定参数的扫描.CNend 938 * 939 * @attention 1. advance scan can scan with ssid only,channel only,bssid only,prefix_ssid only, 940 * and the combination parameters scanning does not support.\n 941 * CNcomment:1. 高级扫描分别单独支持 ssid扫描,信道扫描,bssid扫描,ssid前缀扫描, 不支持组合参数扫描方式.CNend\n 942 * 2. Scanning mode, subject to the type set by scan_type. 943 * CNcomment:2 .扫描方式,以scan_type传入的类型为准。CNend\n 944 * 3. SSID only supports ASCII characters. 945 * CNcomment:3. SSID 只支持ASCII字符.CNend 946 * @param sp [IN] Type #hi_wifi_scan_params * parameters of scan.CNcomment:扫描网络参数设置.CNend 947 * 948 * @retval #HISI_OK Execute successfully. 949 * @retval #HISI_FAIL Execute failed. 950 * @par Dependency: 951 * @li hi_wifi_api.h: WiFi API 952 * @see NULL 953 * @since Hi3881_V100R001C00 954 */ 955 int hi_wifi_sta_advance_scan(hi_wifi_scan_params *sp); 956 957 /* * 958 * @ingroup hi_wifi_basic 959 * @brief sta start scan.CNcomment:station进行扫描.CNend 960 * 961 * @par Description: 962 * Get station scan result.CNcomment:获取station扫描结果.CNend 963 * @attention 1. The memories of <ap_list> and <ap_num> memories are requested by the caller. \n 964 * The <ap_list> size up to : sizeof(hi_wifi_ap_info ap_list) * 32. \n 965 * CNcomment:1. <ap_list>和<ap_num>由调用者申请内存, 966 * <ap_list>size最大为:sizeof(hi_wifi_ap_info ap_list) * 32.CNend \n 967 * 2. ap_num: parameters can be passed in to specify the number of scanned results.The maximum is 32. \n 968 * CNcomment:2. ap_num: 可以传入参数,指定获取扫描到的结果数量,最大为32。CNend \n 969 * 3. If the user callback function is used, ap num refers to bss_num in event_wifi_scan_done. \n 970 * CNcomment:3. 如果使用上报用户的回调函数,ap_num参考event_wifi_scan_done中的bss_num。CNend \n 971 * 4. ap_num should be same with number of hi_wifi_ap_info structures applied, 972 * Otherwise, it will cause memory overflow. \n 973 * CNcomment:4. ap_num和申请的hi_wifi_ap_info结构体数量一致,否则可能造成内存溢出。CNend \n 974 * 5. SSID only supports ASCII characters. \n 975 * CNcomment:5. SSID 只支持ASCII字符.CNend \n 976 * 6. The rssi in the scan results needs to be divided by 100 to get the actual rssi.\n 977 * CNcomment:6. 扫描结果中的rssi需要除以100才能获得实际的rssi.CNend 978 * @param ap_list [IN/OUT] Type #hi_wifi_ap_info * scan result.CNcomment:扫描的结果.CNend 979 * @param ap_num [IN/OUT] Type #unsigned int *, number of scan result.CNcomment:扫描到的网络数目.CNend 980 * 981 * @retval #HISI_OK Execute successfully. 982 * @retval #HISI_FAIL Execute failed. 983 * @par Dependency: 984 * @li hi_wifi_api.h: WiFi API 985 * @see NULL 986 * @since Hi3881_V100R001C00 987 */ 988 int hi_wifi_sta_scan_results(hi_wifi_ap_info *ap_list, unsigned int *ap_num); 989 990 /* * 991 * @ingroup hi_wifi_basic 992 * @brief sta start connect.CNcomment:station进行连接网络.CNend 993 * 994 * @par Description: 995 * sta start connect.CNcomment:station进行连接网络.CNend 996 * 997 * @attention 1.<ssid> and <bssid> cannot be empty at the same time. CNcomment:1. <ssid>与<bssid>不能同时为空.CNend\n 998 * 2. When <auth_type> is set to OPEN, the <passwd> parameter is not required. 999 * CNcomment:2. <auth_type>设置为OPEN时,无需<passwd>参数.CNend\n 1000 * 3. This function is non-blocking.CNcomment:3. 此函数为非阻塞式.CNend\n 1001 * 4. Pairwise can be set, default is 0.CNcomment:4. pairwise 可设置, 默认为0.CNend\n 1002 * 5. If the station is already connected to a network, disconnect the existing connection and 1003 * then connect to the new network.\n 1004 * CNcomment:5. 若station已接入某个网络,则先断开已有连接,然后连接新网络.CNend\n 1005 * 6. If the wrong SSID, BSSID or key is passed in, the HISI_OK will be returned, 1006 * but sta cannot connect the ap. 1007 * CNcomment:6. 如果传入错误的ssid,bssid或者不正确的密码,返回成功,但连接ap失败。CNend\n 1008 * 7. SSID only supports ASCII characters. 1009 * CNcomment:7. SSID 只支持ASCII字符.CNend \n 1010 * 8. Only support auth mode as bellow: 1011 * HI_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, 1012 * HI_WIFI_SECURITY_WPA2PSK, 1013 * HI_WIFI_SECURITY_WEP, 1014 * HI_WIFI_SECURITY_OPEN 1015 * CNcomment:8. 只支持以下认证模式: 1016 * HI_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, 1017 * HI_WIFI_SECURITY_WPA2PSK, 1018 * HI_WIFI_SECURITY_WEP, 1019 * HI_WIFI_SECURITY_OPEN \n 1020 * 9. WEP supports 64 bit and 128 bit encryption. 1021 * for 64 bit encryption, the encryption key is 10 hexadecimal characters or 5 ASCII characters; 1022 * for 128 bit encryption, the encryption key is 26 hexadecimal characters or 13 ASCII characters。\n 1023 * CNcomment:9. WEP支持64位和128位加密,对于64位加密,加密密钥为10个十六进制字符或5个ASCII字符; 1024 * 对于128位加密,加密密钥为26个十六进制字符或13个ASCII字符。CNend\n 1025 * 10. When the key of WEP is in the form of ASCII character, 1026 * the key in the input struct needs to be added with double quotation marks; 1027 * when the key of WEP is in the form of hexadecimal character, 1028 * the key in the input struct does not need to add double quotation marks.\n 1029 * CNcomment:10. WEP的秘钥为ASCIl字符形式时,入参结构体中的key需要添加双引号; 1030 * WEP的秘钥为为十六进制字符时,入参结构体中的key不需要添加双引号。CNend\n 1031 * 1032 * @param req [IN] Type #hi_wifi_assoc_request * connect parameters of network.CNcomment:连接网络参数设置.CNend 1033 * @retval #HISI_OK Execute successfully. 1034 * @retval #HISI_FAIL Execute failed. 1035 * @par Dependency: 1036 * @li hi_wifi_api.h: WiFi API 1037 * @see NULL 1038 * @since Hi3881_V100R001C00 1039 */ 1040 int hi_wifi_sta_connect(hi_wifi_assoc_request *req); 1041 1042 /* * 1043 * @ingroup hi_wifi_basic 1044 * @brief Start fast connect.CNcomment:station进行快速连接网络.CNend 1045 * 1046 * @par Description: 1047 * Start fast connect.CNcomment:station进行快速连接网络.CNend 1048 * 1049 * @attention 1. <ssid> and <bssid> cannot be empty at the same time. CNcomment:1.<ssid>与<bssid>不能同时为空.CNend\n 1050 * 2. When <auth_type> is set to OPEN, the <passwd> parameter is not required. 1051 * CNcomment:2.<auth_type>设置为OPEN时,无需<passwd>参数.CNend\n 1052 * 3. <chn> There are differences in the range of values, and China is 1-13. 1053 * CNcomment:3.<chn>取值范围不同区域有差异,中国为1-13.CNend\n 1054 * 4. This function is non-blocking.CNcomment:4.此函数为非阻塞式.CNend\n 1055 * 5. Pairwise can be set, set to zero by default.CNcomment:5. pairwise 可设置,默认置零.CNend\n 1056 * 6. If the wrong SSID, BSSID or key is passed in, the HISI_FAIL will be returned, 1057 * and sta cannot connect the ap. 1058 * CNcomment:7. 如果传入错误的ssid,bssid或者不正确的密码,返回失败并且连接ap失败。CNend\n 1059 * 7. SSID only supports ASCII characters. 1060 * CNcomment:8. SSID 只支持ASCII字符.CNend \n 1061 * @param fast_request [IN] Type #hi_wifi_fast_assoc_request *,fast connect parameters. CNcomment:快速连接网络参数.CNend 1062 1063 * @retval #HISI_OK Execute successfully. 1064 * @retval #HISI_FAIL Execute failed. 1065 * @par Dependency: 1066 * @li hi_wifi_api.h: WiFi API 1067 * @see NULL 1068 * @since Hi3881_V100R001C00 1069 */ 1070 int hi_wifi_sta_fast_connect(hi_wifi_fast_assoc_request *fast_request); 1071 1072 /* * 1073 * @ingroup hi_wifi_basic 1074 * @brief Disconnect from network.CNcomment:station断开相连的网络.CNend 1075 * 1076 * @par Description: 1077 * Disconnect from network.CNcomment:station断开相连的网络.CNend 1078 * 1079 * @attention NULL 1080 * @param NULL 1081 * 1082 * @retval #HISI_OK Execute successfully. 1083 * @retval #HISI_FAIL Execute failed. 1084 * @par Dependency: 1085 * @li hi_wifi_api.h: WiFi API 1086 * @see NULL 1087 * @since Hi3881_V100R001C00 1088 */ 1089 int hi_wifi_sta_disconnect(void); 1090 1091 /* * 1092 * @ingroup hi_wifi_basic 1093 * @brief Set reconnect policy.CNcomment:station设置重新连接网络机制.CNend 1094 * 1095 * @par Description: 1096 * Set reconnect policy.CNcomment:station设置重新连接网络机制.CNend 1097 * 1098 * @attention 1. It is recommended called after STA start or connected successfully. 1099 * CNcomment:1. 在STA启动后或者关联成功后调用该接口.CNend\n 1100 * 2. The reconnection policy will be triggered when the station is disconnected from ap.\n 1101 * CNcomment:2. 重连机制将于station下一次去关联时生效,当前已经去关联设置无效.CNend\n 1102 * 3. The Settings will take effect on the next reconnect timer.\n 1103 * CNcomment:3. 重关联过程中更新重关联配置将于下一次重连计时生效.CNend\n 1104 * 4. After calling station connect/disconnect or station stop, stop reconnecting. 1105 * CNcomment:4. 调用station connect/disconnect或station stop,停止重连.CNend\n 1106 * 5. If the target network cannot be found by scanning, 1107 the reconnection policy cannot trigger to take effect.\n 1108 * CNcomment:5. 若扫描不到目标网络,重连机制无法触发生效.CNend\n 1109 * 6. When the <seconds> value is 65535, it means infinite loop reconnection. 1110 * CNcomment:6. <seconds>取值为65535时,表示无限次循环重连.CNend\n 1111 * 7.Enable reconnect, user and lwip will not receive disconnect event when disconnected from ap until 15 1112 * seconds later and still don't reconnect to ap successfully. 1113 * CNcomment:7. 使能自动重连,wifi将在15s内尝试自动重连并在此期间不上报去关联事件到用户和lwip协议栈, 1114 * 做到15秒内重连成功用户和上层网络不感知.CNend\n 1115 * 8.Must call again if add/down/delete SoftAp or MESH's interface status after last call. 1116 * CNcomment:8. 调用后如果添加/禁用/删除了SoftAp,MESH接口的状态,需要再次调用该接口.CNend\n 1117 1118 * @param enable [IN] Type #int enable reconnect.0-disable/1-enable.CNcomment:使能重连网络参数.CNend 1119 * @param seconds [IN] Type #unsigned int reconnect timeout in seconds for once, range:[2-65535]. 1120 * CNcomment:单次重连超时时间,取值[2-65535].CNend 1121 * @param period [IN] Type #unsigned int reconnect period in seconds, range:[1-65535]. 1122 CNcomment:重连间隔周期,取值[1-65535].CNend 1123 * @param max_try_count [IN] Type #unsigned int max reconnect try count number,range:[1-65535]. 1124 CNcomment:最大重连次数,取值[1-65535].CNend 1125 * 1126 * @retval #HISI_OK Execute successfully. 1127 * @retval #HISI_FAIL Execute failed. 1128 * @par Dependency: 1129 * @li hi_wifi_api.h: WiFi API 1130 * @see NULL 1131 * @since Hi3881_V100R001C00 1132 */ 1133 int hi_wifi_sta_set_reconnect_policy(int enable, unsigned int seconds, unsigned int period, unsigned int max_try_count); 1134 1135 /* * 1136 * @ingroup hi_wifi_basic 1137 * @brief Get status of sta.CNcomment:获取station连接的网络状态.CNend 1138 * 1139 * @par Description: 1140 * Get status of sta.CNcomment:获取station连接的网络状态.CNend 1141 * 1142 * @attention NULL 1143 * @param connect_status [IN/OUT] Type #hi_wifi_status *, connect status, memory is requested by the caller. 1144 * CNcomment:连接状态, 由调用者申请内存.CNend 1145 * 1146 * @retval #HISI_OK Execute successfully. 1147 * @retval #HISI_FAIL Execute failed. 1148 * @par Dependency: 1149 * @li hi_wifi_api.h: WiFi API 1150 * @see NULL 1151 * @since Hi3881_V100R001C00 1152 */ 1153 int hi_wifi_sta_get_connect_info(hi_wifi_status *connect_status); 1154 1155 /* * 1156 * @ingroup hi_wifi_basic 1157 * @brief Start pbc connect in WPS.CNcomment:设置WPS进行pbc连接.CNend 1158 * 1159 * @par Description: 1160 * Start pbc connect in WPS.CNcomment:设置WPS进行pbc连接.CNend 1161 * 1162 * @attention 1. bssid can be NULL or MAC. CNcomment:1. bssid 可以指定mac或者填NULL.CNend 1163 * @param bssid [IN] Type #unsigned char * mac address 1164 * 1165 * @retval #HISI_OK Execute successfully. 1166 * @retval #HISI_FAIL Execute failed. 1167 * @par Dependency: 1168 * @li hi_wifi_api.h: WiFi API 1169 * @see NULL 1170 * @since Hi3881_V100R001C00 1171 */ 1172 int hi_wifi_sta_wps_pbc(unsigned char *bssid); 1173 1174 /* * 1175 * @ingroup hi_wifi_basic 1176 * @brief Start pin connect in WPS.CNcomment:WPS通过pin码连接网络.CNend 1177 * 1178 * @par Description: 1179 * Start pin connect in WPS.CNcomment:WPS通过pin码连接网络.CNend 1180 * 1181 * @attention 1. Bssid can be NULL or MAC. CNcomment:1. bssid 可以指定mac或者填NULL.CNend \n 1182 * 2. Decimal only WPS pin code length is 8 Bytes.CNcomment:2. WPS中pin码仅限十进制,长度为8 Bytes.CNend 1183 * @param pin [IN] Type #char * pin code 1184 * @param bssid [IN] Type #unsigned char * mac address 1185 * 1186 * @retval #HISI_OK Execute successfully. 1187 * @retval #HISI_FAIL Execute failed. 1188 * @par Dependency: 1189 * @li hi_wifi_api.h: WiFi API 1190 * @see NULL 1191 * @since Hi3881_V100R001C00 1192 */ 1193 int hi_wifi_sta_wps_pin(char *pin, unsigned char *bssid); 1194 1195 /* * 1196 * @ingroup hi_wifi_basic 1197 * @brief Get pin code.CNcomment:WPS获取pin码.CNend 1198 * 1199 * @par Description: 1200 * Get pin code.CNcomment:WPS获取pin码.CNend 1201 * 1202 * @attention Decimal only WPS pin code length is 8 Bytes.CNcomment:WPS中pin码仅限十进制,长度为8 Bytes.CNend 1203 * @param pin [IN/OUT] Type #char *, pin code buffer, should be obtained, length is 9 Bytes. 1204 * The memory is requested by the caller.\n 1205 * CNcomment:待获取pin码,长度为9 Bytes。由调用者申请内存.CNend 1206 * @param len [IN] Type #unsigned int, length of pin code.CNcomment:pin码的长度.CNend 1207 * 1208 * @retval #HISI_OK Execute successfully. 1209 * @retval #HISI_FAIL Execute failed. 1210 * @par Dependency: 1211 * @li hi_wifi_api.h: WiFi API 1212 * @see NULL 1213 * @since Hi3881_V100R001C00 1214 */ 1215 int hi_wifi_sta_wps_pin_get(char *pin, unsigned int len); 1216 1217 /* * 1218 * @ingroup hi_wifi_basic 1219 * @brief register user callback interface.CNcomment:注册回调函数接口.CNend 1220 * 1221 * @par Description: 1222 * register user callback interface.CNcomment:注册回调函数接口.CNend 1223 * 1224 * @attention NULL 1225 * @param event_cb [OUT] Type #hi_wifi_event_cb, event callback .CNcomment:回调函数.CNend 1226 * 1227 * @retval #HISI_OK Execute successfully. 1228 * @retval #HISI_FAIL Execute failed. 1229 * @par Dependency: 1230 * @li hi_wifi_api.h: WiFi API 1231 * @see NULL 1232 * @since Hi3881_V100R001C00 1233 */ 1234 int hi_wifi_register_event_callback(hi_wifi_event_cb event_cb); 1235 1236 /* * 1237 * @ingroup hi_wifi_basic 1238 * @brief Set protocol mode of softap.CNcomment:设置softap接口的protocol模式.CNend 1239 * 1240 * @par Description: 1241 * Set protocol mode of softap.CNcomment:设置softap接口的protocol模式.CNend\n 1242 * Initiallize config, set before softap start.CNcomment:初始配置,在softap start之前调用.CNend 1243 * 1244 * @attention Default mode(802.11BGN) CNcomment:默认模式(802.11BGN).CNend 1245 * @param mode [IN] Type #hi_wifi_protocol_mode protocol mode. 1246 * 1247 * @retval #HISI_OK Execute successfully. 1248 * @retval #HISI_FAIL Execute failed. 1249 * @par Dependency: 1250 * @li hi_wifi_api.h: WiFi API 1251 * @see NULL 1252 * @since Hi3881_V100R001C00 1253 */ 1254 int hi_wifi_softap_set_protocol_mode(hi_wifi_protocol_mode mode); 1255 1256 /* * 1257 * @ingroup hi_wifi_basic 1258 * @brief Get protocol mode of softap.CNcomment:获取softap接口的protocol模式.CNend 1259 * 1260 * @par Description: 1261 * Get protocol mode of softap.CNcomment:获取softap接口的protocol模式.CNend 1262 * 1263 * @attention NULL 1264 * @param NULL 1265 * 1266 * @retval #hi_wifi_protocol_mode protocol mode. 1267 * @par Dependency: 1268 * @li hi_wifi_api.h: WiFi API 1269 * @see NULL 1270 * @since Hi3881_V100R001C00 1271 */ 1272 hi_wifi_protocol_mode hi_wifi_softap_get_protocol_mode(void); 1273 1274 /* * 1275 * @ingroup hi_wifi_basic 1276 * @brief Set softap's beacon interval.CNcomment:设置softap的beacon周期.CNend 1277 * 1278 * @par Description: 1279 * Set softap's beacon interval.CNcomment:设置softap的beacon周期.CNend. \n 1280 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend 1281 * 1282 * @attention NULL 1283 * @param beacon_period [IN] Type #int beacon period in milliseconds, range(33ms~1000ms), default(100ms) 1284 * 1285 * @retval #HISI_OK Execute successfully. 1286 * @retval #HISI_FAIL Execute failed. 1287 * @par Dependency: 1288 * @li hi_wifi_api.h: WiFi API 1289 * @see NULL 1290 * @since Hi3881_V100R001C00 1291 */ 1292 int hi_wifi_softap_set_beacon_period(int beacon_period); 1293 1294 /* * 1295 * @ingroup hi_wifi_basic 1296 * @brief Set softap's dtim count.CNcomment:设置softap的dtim周期.CNend 1297 * 1298 * @par Description: 1299 * Set softap's dtim count.CNcomment:设置softap的dtim周期.CNend \n 1300 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend 1301 * 1302 * @attention NULL 1303 * @param dtim_period [IN] Type #int, dtim period , range(1~30), default(2) 1304 * 1305 * @retval #HISI_OK Execute successfully. 1306 * @retval #HISI_FAIL Execute failed. 1307 * @par Dependency: 1308 * @li hi_wifi_api.h: WiFi API 1309 * @see NULL 1310 * @since Hi3881_V100R001C00 1311 */ 1312 int hi_wifi_softap_set_dtim_period(int dtim_period); 1313 1314 /* * 1315 * @ingroup hi_wifi_basic 1316 * @brief Set update time of softap's group key.CNcomment:配置softap组播秘钥更新时间.CNend 1317 * 1318 * @par Description: 1319 * Set update time of softap's group key.CNcomment:配置softap组播秘钥更新时间.CNend\n 1320 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend\n 1321 * If you need to use the rekey function, it is recommended to use WPA+WPA2-PSK + CCMP encryption. 1322 * CNcomment:若需要使用rekey功能,推荐使用WPA+WPA2-PSK + CCMP加密方式.CNend 1323 * 1324 * @attention When using wpa2psk-only + CCMP encryption, rekey is forced to 86400s by default. 1325 * CNcomment:当使用wpa2psk-only + CCMP加密方式时 ,rekey默认强制改为 86400.CNend 1326 * @param wpa_group_rekey [IN] Type #int, update time in seconds, range(30s-86400s), default(86400s) 1327 * CNcomment:更新时间以秒为单位,范围(30s-86400s),默认(86400s).CNend 1328 * 1329 * @retval #HISI_OK Execute successfully. 1330 * @retval #HISI_FAIL Execute failed. 1331 * @par Dependency: 1332 * @li hi_wifi_api.h: WiFi API 1333 * @see NULL 1334 * @since Hi3881_V100R001C00 1335 */ 1336 int hi_wifi_softap_set_group_rekey(int wifi_group_rekey); 1337 1338 /* * 1339 * @ingroup hi_wifi_basic 1340 * @brief Set short-gi of softap.CNcomment:设置softap的SHORT-GI功能.CNend 1341 * 1342 * @par Description: 1343 * Enable or disable short-gi of softap.CNcomment:开启或则关闭softap的SHORT-GI功能.CNend\n 1344 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend 1345 * @attention NULL 1346 * @param flag [IN] Type #int, enable(1) or disable(0). default enable(1). 1347 CNcomment:使能标志,默认使能(1).CNend 1348 * 1349 * @retval #HISI_OK Execute successfully. 1350 * @retval #HISI_FAIL Execute failed. 1351 * @par Dependency: 1352 * @li hi_wifi_api.h: WiFi API 1353 * @see NULL 1354 * @since Hi3881_V100R001C00 1355 */ 1356 int hi_wifi_softap_set_shortgi(int flag); 1357 1358 /* * 1359 * @ingroup hi_wifi_basic 1360 * @brief Start softap interface.CNcomment:开启SoftAP.CNend 1361 * 1362 * @par Description: 1363 * Start softap interface.CNcomment:开启SoftAP.CNend 1364 * 1365 * @attention 1. Multiple interfaces of the same type are not supported.CNcomment:不支持使用多个同类型接口.CNend\n 1366 * 2. Dual interface coexistence support: STA + AP. CNcomment:双接口共存支持:STA + AP.CNend \n 1367 * 3. Start timeout 5s.CNcomment:启动超时时间5s。CNend \n 1368 * 4. Softap key length range(8 Bytes - 64 Bytes).CNcomment:softap key长度范围(8 Bytes - 64 Bytes).CNend \n 1369 * 5. Only support auth mode as bellow: \n 1370 * HI_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, \n 1371 * HI_WIFI_SECURITY_WPA2PSK, \n 1372 * HI_WIFI_SECURITY_OPEN \n 1373 * CNcomment:5. 只支持以下认证模式:\n 1374 * HI_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, \n 1375 * HI_WIFI_SECURITY_WPA2PSK, \n 1376 * HI_WIFI_SECURITY_OPEN.CNend \n 1377 * 6. The memories of <ifname> and <len> should be requested by the caller, 1378 * the input value of len must be the same as the length of ifname(the recommended length is 17Bytes).\n 1379 * CNcomment:6. <ifname>和<len>由调用者申请内存,用户写入len的值必须与ifname长度一致(建议长度为17Bytes).CNend \n 1380 * 7. SSID only supports ASCII characters. \n 1381 * CNcomment:7. SSID 只支持ASCII字符.CNend 1382 * @param conf [IN] Type #hi_wifi_softap_config *, softap's configuration.CNcomment:SoftAP配置.CNend 1383 * @param ifname [IN/OUT] Type #char *, interface name.CNcomment:接口名字.CNend 1384 * @param len [IN/OUT] Type #int *, interface name length.CNcomment:接口名字长度.CNend 1385 * 1386 * @retval #HISI_OK Execute successfully. 1387 * @retval #HISI_FAIL Execute failed. 1388 * @par Dependency: 1389 * @li hi_wifi_api.h: WiFi API 1390 * @see NULL 1391 * @since Hi3881_V100R001C00 1392 */ 1393 int hi_wifi_softap_start(hi_wifi_softap_config *conf, char *ifname, int *len); 1394 1395 /* * 1396 * @ingroup hi_wifi_basic 1397 * @brief Close softap interface.CNcomment:关闭SoftAP.CNend 1398 * 1399 * @par Description: 1400 * Close softap interface.CNcomment:关闭SoftAP.CNend 1401 * 1402 * @attention NULL 1403 * @param NULL 1404 * 1405 * @retval #HISI_OK Execute successfully. 1406 * @retval #HISI_FAIL Execute failed. 1407 * @par Dependency: 1408 * @li hi_wifi_api.h: WiFi API 1409 * @see NULL 1410 * @since Hi3881_V100R001C00 1411 */ 1412 int hi_wifi_softap_stop(void); 1413 1414 /* * 1415 * @ingroup hi_wifi_basic 1416 * @brief Get all user's information of softap.CNcomment:softap获取已连接的station的信息.CNend 1417 * 1418 * @par Description: 1419 * Get all user's information of softap.CNcomment:softap获取已连接的station的信息.CNend 1420 * 1421 * @attention 1.sta_list: malloc by user.CNcomment:1.扫描结果参数。由用户动态申请。CNend \n 1422 * 2.sta_list: max size is hi_wifi_ap_sta_info * 6. 1423 * CNcomment:2.sta_list 足够的结构体大小,最大为hi_wifi_ap_sta_info * 6。CNend \n 1424 * 3.sta_num:parameters can be passed in to specify the number of connected sta.The maximum is 6. 1425 * CNcomment:3.可以传入参数,指定获取已接入的sta个数,最大为6。CNend \n 1426 * 4.sta_num should be the same with number of hi_wifi_ap_sta_info structures applied, Otherwise, 1427 * it will cause memory overflow.\n 1428 * CNcomment:4.sta_num和申请的hi_wifi_ap_sta_info结构体数量一致,否则可能造成内存溢出。CNend 1429 * @param sta_list [IN/OUT] Type #hi_wifi_ap_sta_info *, station information.CNcomment:STA信息.CNend 1430 * @param sta_num [IN/OUT] Type #unsigned int *, station number.CNcomment:STA个数.CNend 1431 * 1432 * @retval #HISI_OK Execute successfully. 1433 * @retval #HISI_FAIL Execute failed. 1434 * @par Dependency: 1435 * @li hi_wifi_api.h: WiFi API 1436 * @see NULL 1437 * @since Hi3881_V100R001C00 1438 */ 1439 int hi_wifi_softap_get_connected_sta(hi_wifi_ap_sta_info *sta_list, unsigned int *sta_num); 1440 1441 /* * 1442 * @ingroup hi_wifi_basic 1443 * @brief Softap deauth user by mac address.CNcomment:softap指定断开连接的station网络.CNend 1444 * 1445 * @par Description: 1446 * Softap deauth user by mac address.CNcomment:softap指定断开连接的station网络.CNend 1447 * 1448 * @attention NULL 1449 * @param addr [IN] Type #const unsigned char *, station mac address.CNcomment:MAC地址.CNend 1450 * @param addr_len [IN] Type #unsigned char, station mac address length, must be 6. 1451 * CNcomment:MAC地址长度,必须为6.CNend 1452 * 1453 * @retval #HISI_OK Execute successfully. 1454 * @retval #HISI_FAIL Execute failed. 1455 * @par Dependency: 1456 * @li hi_wifi_api.h: WiFi API 1457 * @see NULL 1458 * @since Hi3881_V100R001C00 1459 */ 1460 int hi_wifi_softap_deauth_sta(const unsigned char *addr, unsigned char addr_len); 1461 1462 /* * 1463 * @ingroup hi_wifi_basic 1464 * @brief set mac address.CNcomment:设置MAC地址.CNend 1465 * 1466 * @par Description: 1467 * Set original mac address.CNcomment:设置起始mac地址.CNend\n 1468 * mac address will increase or recycle when adding or deleting device. 1469 * CNcomment:添加设备mac地址递增,删除设备回收对应的mac地址.CNend 1470 * 1471 * @attention NULL 1472 * @param mac_addr [IN] Type #char *, mac address.CNcomment:MAC地址.CNend 1473 * @param mac_len [IN] Type #unsigned char, mac address length.CNcomment:MAC地址长度.CNend 1474 * 1475 * @retval #HISI_OK Excute successfully 1476 * @retval #Other Error code 1477 * @par Dependency: 1478 * @li hi_wifi_api.h: WiFi API 1479 * @see NULL 1480 * @since Hi3881_V100R001C00 1481 */ 1482 int hi_wifi_set_macaddr(const char *mac_addr, unsigned char mac_len); 1483 1484 /* * 1485 * @ingroup hi_wifi_basic 1486 * @brief get mac address.CNcomment:获取MAC地址.CNend 1487 * 1488 * @par Description: 1489 * Get original mac address.CNcomment:获取mac地址.CNend\n 1490 * mac address will increase or recycle when adding device or deleting device. 1491 * CNcomment:添加设备mac地址递增,删除设备回收对应的mac地址.CNend 1492 * 1493 * @attention NULL 1494 * @param mac_addr [OUT] Type #char *, mac address. 1495 * @param mac_len [IN] Type #unsigned char, mac address length. 1496 * 1497 * @retval #HISI_OK Excute successfully 1498 * @retval #Other Error code 1499 * @par Dependency: 1500 * @li hi_wifi_api.h: WiFi API 1501 * @see NULL 1502 * @since Hi3881_V100R001C00 1503 */ 1504 int hi_wifi_get_macaddr(char *mac_addr, unsigned char mac_len); 1505 1506 /* * 1507 * @ingroup hi_wifi_basic 1508 * @brief Set country code.CNcomment:设置国家码.CNend 1509 * 1510 * @par Description: 1511 * Set country code(two uppercases).CNcomment:设置国家码,由两个大写字符组成.CNend 1512 * 1513 * @attention 1.Before setting the country code, you must call hi_wifi_init to complete the initialization. 1514 * CNcomment:设置国家码之前,必须调用hi_wifi_init初始化完成.CNend\n 1515 * 2.cc_len should be greater than or equal to 3.CNcomment:cc_len应大于等于3.CNend 1516 * @param cc [IN] Type #char *, country code.CNcomment:国家码.CNend 1517 * @param cc_len [IN] Type #unsigned char, country code length.CNcomment:国家码长度.CNend 1518 * 1519 * @retval #HISI_OK Excute successfully 1520 * @retval #Other Error code 1521 * @par Dependency: 1522 * @li hi_wifi_api.h: WiFi API 1523 * @see NULL 1524 * @since Hi3881_V100R001C00 1525 */ 1526 int hi_wifi_set_country(const char *cc, unsigned char cc_len); 1527 1528 /* * 1529 * @ingroup hi_wifi_basic 1530 * @brief Get country code.CNcomment:获取国家码.CNend 1531 * 1532 * @par Description: 1533 * Get country code.CNcomment:获取国家码,由两个大写字符组成.CNend 1534 * 1535 * @attention 1.Before getting the country code, you must call hi_wifi_init to complete the initialization. 1536 * CNcomment:获取国家码之前,必须调用hi_wifi_init初始化完成.CNend 1537 * @param cc [OUT] Type #char *, country code.CNcomment:国家码.CNend 1538 * @param len [IN/OUT] Type #int *, country code length.CNcomment:国家码长度.CNend 1539 * 1540 * @retval #HISI_OK Excute successfully 1541 * @retval #Other Error code 1542 * @par Dependency: 1543 * @li hi_wifi_api.h: WiFi API 1544 * @see NULL 1545 * @since Hi3881_V100R001C00 1546 */ 1547 int hi_wifi_get_country(char *cc, int *len); 1548 1549 /* * 1550 * @ingroup hi_wifi_basic 1551 * @brief Set bandwidth.CNcomment:设置带宽.CNend 1552 * 1553 * @par Description: 1554 * Set bandwidth, support 5M/10M/20M.CNcomment:设置接口的工作带宽,支持5M 10M 20M带宽的设置.CNend 1555 * 1556 * @attention NULL 1557 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 1558 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 1559 * @param bw [IN] Type #hi_wifi_bw, bandwidth enum.CNcomment:带宽.CNend 1560 * 1561 * @retval #HISI_OK Excute successfully 1562 * @retval #Other Error code 1563 * @par Dependency: 1564 * @li hi_wifi_api.h: WiFi API 1565 * @see NULL 1566 * @since Hi3881_V100R001C00 1567 */ 1568 int hi_wifi_set_bandwidth(const char *ifname, unsigned char ifname_len, hi_wifi_bw bw); 1569 1570 /* * 1571 * @ingroup hi_wifi_basic 1572 * @brief Get bandwidth.CNcomment:获取带宽.CNend 1573 * 1574 * @par Description: 1575 * Get bandwidth.CNcomment:获取带宽.CNend 1576 * 1577 * @attention NULL 1578 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 1579 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 1580 * 1581 * @retval #bandwidth enum.CNcomment:带宽的枚举值.CNend 1582 * @par Dependency: 1583 * @li hi_wifi_api.h: WiFi API 1584 * @see NULL 1585 * @since Hi3881_V100R001C00 1586 */ 1587 hi_wifi_bw hi_wifi_get_bandwidth(const char *ifname, unsigned char ifname_len); 1588 1589 /* * 1590 * @ingroup hi_wifi_basic 1591 * @brief Set channel.CNcomment:设置信道.CNend 1592 * 1593 * @par Description: 1594 * Set channel.CNcomment:设置信道.CNend 1595 * 1596 * @attention NULL 1597 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 1598 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 1599 * @param channel [IN] Type #int , listen channel.CNcomment:信道号.CNend 1600 * 1601 * @retval #HISI_OK Excute successfully 1602 * @retval #Other Error code 1603 * @par Dependency: 1604 * @li hi_wifi_api.h: WiFi API 1605 * @see NULL 1606 * @since Hi3881_V100R001C00 1607 */ 1608 int hi_wifi_set_channel(const char *ifname, unsigned char ifname_len, int channel); 1609 1610 /* * 1611 * @ingroup hi_wifi_basic 1612 * @brief Get channel.CNcomment:获取信道.CNend 1613 * 1614 * @par Description: 1615 * Get channel.CNcomment:获取信道.CNend 1616 * 1617 * @attention NULL 1618 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 1619 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 1620 * 1621 * @retval #HI_WIFI_INVALID_CHANNEL 1622 * @retval #Other chanel value. 1623 * @par Dependency: 1624 * @li hi_wifi_api.h: WiFi API 1625 * @see NULL 1626 * @since Hi3881_V100R001C00 1627 */ 1628 int hi_wifi_get_channel(const char *ifname, unsigned char ifname_len); 1629 1630 /* * 1631 * @ingroup hi_wifi_basic 1632 * @brief Set monitor mode.CNcomment:设置混杂模式.CNend 1633 * 1634 * @par Description: 1635 * Enable/disable monitor mode of interface.CNcomment:设置指定接口的混杂模式使能.CNend 1636 * 1637 * @attention NULL 1638 * @param ifname [IN] Type #const char * interface name.CNcomment:接口名.CNend 1639 * @param enable [IN] Type #int enable(1) or disable(0).CNcomment:开启/关闭.CNend 1640 * @param filter [IN] Type #hi_wifi_ptype_filter * filtered frame type enum.CNcomment:过滤列表.CNend 1641 * 1642 * @retval #HI_ERR_SUCCESS Excute successfully 1643 * @retval #Other Error code 1644 * @par Dependency: 1645 * @li hi_wifi_api.h: WiFi API 1646 * @see NULL 1647 * @since Hi3881_V100R001C00 1648 */ 1649 int hi_wifi_promis_enable(const char *ifname, int enable, const hi_wifi_ptype_filter *filter); 1650 1651 /* * 1652 * @ingroup hi_wifi_basic 1653 * @brief Register receive callback in monitor mode.CNcomment:注册混杂模式的收包回调函数.CNend 1654 * 1655 * @par Description: 1656 * 1.Register receive callback in monitor mode.CNcomment:1.注册混杂模式的收包回调函数.CNend\n 1657 * 2.Wifi driver will put the receive frames to this callback. 1658 * CNcomment:2.驱动将混杂模式的收到的报文递交到注册的回调函数处理.CNend 1659 * 1660 * @attention NULL 1661 * @param data_cb [IN] Type #hi_wifi_promis_cb callback function pointer.CNcomment:混杂模式回调函数.CNend 1662 * 1663 * @retval #HI_ERR_SUCCESS Excute successfully 1664 * @retval #Other Error code 1665 * @par Dependency: 1666 * @li hi_wifi_api.h: WiFi API 1667 * @see NULL 1668 * @since Hi3881_V100R001C00 1669 */ 1670 int hi_wifi_promis_set_rx_callback(hi_wifi_promis_cb data_cb); 1671 1672 /* * 1673 * @ingroup hi_wifi_basic 1674 * @brief Open/close system power save.CNcomment:开启/关闭WiFi低功耗模式.CNend 1675 * 1676 * @par Description: 1677 * Open/close system power save.CNcomment:开启/关闭WiFi低功耗模式.CNend 1678 * 1679 * @attention NULL 1680 * @param enable [IN] Type #unsigned char, enable(1) or disable(0).CNcomment:开启/关闭WiFi低功耗.CNend 1681 * 1682 * @retval #HI_ERR_SUCCESS Excute successfully 1683 * @retval #Other Error code 1684 * @par Dependency: 1685 * @li hi_wifi_api.h: WiFi API 1686 * @see NULL 1687 * @since Hi3881_V100R001C00 1688 */ 1689 int hi_wifi_set_pm_switch(unsigned char enable); 1690 1691 /* * 1692 * @ingroup hi_wifi_basic 1693 * @brief Set wow wakeup pattern .CNcomment:设置wow wakeup 模式.CNend 1694 * 1695 * @attention: set specific pattern of TCP/UPD for wow wakeup host 1696 CNcomment: 设置wow 唤醒 host侧 的TCP/UDP包类型, 最大支持设置4种唤醒包. CNend 1697 * @param ifname [IN] Type #const char *, device name. 1698 * @param type [IN] Type #hi_wifi_wow_pattern_type, operation_type. 1699 * @param index [IN] Type #unsigned char, patter_index. invalid value: 0, 1, 2, 3 1700 * @param pattern [IN] Type #char *, hex payload of TCP/UDP. 1701 1702 * @retval #HISI_OK Excute successfully 1703 * @retval #Other Error code 1704 * @par Dependency: 1705 * @li hi_wifi_api.h: WiFi API 1706 * @see NULL 1707 * @since Hi3881_V100R001C00 1708 */ 1709 unsigned char hi_wifi_wow_set_pattern(const char *ifname, hi_wifi_wow_pattern_type type, unsigned char index, 1710 char *pattern); 1711 1712 /* * 1713 * @ingroup hi_wifi_basic 1714 * @brief Set wow_sleep .CNcomment:设置wow_sleep 睡眠.CNend 1715 * 1716 * @attention: the only valid parameter is 1 now, it means that host request for sleep. other value of parameter 1717 'en' is not support 1718 该API当前唯一有效参数为1, 用来设置host侧请求睡眠,其他参数值暂不支持 1719 * @param ifname [IN] Type #const char *, device name. 1720 * @param en [IN] Type #unsigned char, wow_sleep switch, 1-sleep, 0-wakeup. 1721 1722 * @retval #HISI_OK Excute successfully 1723 * @retval #Other Error code 1724 * @par Dependency: 1725 * @li hi_wifi_api.h: WiFi API 1726 * @see NULL 1727 * @since Hi3881_V100R001C00 1728 */ 1729 unsigned char hi_wifi_wow_host_sleep_switch(const char *ifname, unsigned char en); 1730 1731 /* * 1732 * @ingroup hi_wifi_basic 1733 * @brief Set dhcp offload on/off.CNcomment:设置dhcp offload 打开/关闭.CNend 1734 * 1735 * @par Description: 1736 * Set dhcp offload on with ip address, or set dhcp offload off. 1737 * CNcomment:设置dhcp offload打开、并且设置相应ip地址,或者设置dhcp offload关闭.CNend 1738 * 1739 * @attention NULL 1740 * @param ifname [IN] Type #const char *, device name. 1741 * @param en [IN] Type #unsigned char, dhcp offload type, 1-on, 0-off. 1742 * @param ip [IN] Type #unsigned int, ip address in network byte order, eg:192.168.50.4 -> 1743 * 0x0432A8C0. 1744 * 1745 * @retval #HISI_OK Excute successfully 1746 * @retval #Other Error code 1747 * @par Dependency: 1748 * @li hi_wifi_api.h: WiFi API 1749 * @see NULL 1750 * @since Hi3881_V100R001C00 1751 */ 1752 unsigned char hi_wifi_dhcp_offload_setting(const char *ifname, unsigned char en, unsigned int ip); 1753 1754 /* * 1755 * @ingroup hi_wifi_basic 1756 * @brief Set arp offload on/off.CNcomment:设置arp offload 打开/关闭.CNend 1757 * 1758 * @par Description: 1759 * Set arp offload on with ip address, or set arp offload off. 1760 * CNcomment:设置arp offload打开、并且设置相应ip地址,或者设置arp offload关闭.CNend 1761 * 1762 * @attention NULL 1763 * @param ifname [IN] Type #const char *, device name. 1764 * @param en [IN] Type #unsigned char, arp offload type, 1-on, 0-off. 1765 * @param ip [IN] Type #unsigned int, ip address in network byte order, eg:192.168.50.4 -> 1766 * 0x0432A8C0. 1767 * 1768 * @retval #HISI_OK Excute successfully 1769 * @retval #Other Error code 1770 * @par Dependency: 1771 * @li hi_wifi_api.h: WiFi API 1772 * @see NULL 1773 * @since Hi3881_V100R001C00 1774 */ 1775 unsigned char hi_wifi_arp_offload_setting(const char *ifname, unsigned char en, unsigned int ip); 1776 1777 /* * 1778 * @ingroup hi_wifi_basic 1779 * @brief Get rssi value.CNcomment:获取rssi值.CNend 1780 * 1781 * @par Description: 1782 * Get current rssi of ap which sta connected to.CNcomment:获取sta当前关联的ap的rssi值.CNend 1783 * 1784 * @attention NULL 1785 * @param NULL 1786 * 1787 * @retval #0x7F Invalid value. 1788 * @retval #Other rssi 1789 * @par Dependency: 1790 * @li hi_wifi_api.h: WiFi API 1791 * @see NULL 1792 * @since Hi3881_V100R001C00 1793 */ 1794 int hi_wifi_sta_get_ap_rssi(void); 1795 1796 /* * 1797 * @ingroup hi_wifi_basic 1798 * @brief Set retry params.CNcomment:设置软件重传策略.CNend 1799 * 1800 * @par Description: 1801 * Set retry params.CNcomment:设置指定接口的软件重传策略.CNend 1802 * 1803 * @attention 1.Need call befora start sta or softap.CNcomment:1.本API需要在STA或AP start之后调用.CNend 1804 * @param ifname [IN] Type #const char * interface name.CNcomment:接口名.CNend 1805 * @param type [IN] Type #unsigned char retry type. 1806 * CNcomment:0:次数重传(数据帧); 1:次数重传(管理帧); 2:时间重传.CNend 1807 * @param limit [IN] Type #unsigned char limit value. 1808 * CNcomment:重传次数(0~15次)/重传时间(0~200个时间粒度,时间粒度10ms).CNend 1809 * 1810 * @retval #HISI_OK Excute successfully 1811 * @retval #Other Error code 1812 * @par Dependency: 1813 * @li hi_wifi_api.h: WiFi API 1814 * @see NULL 1815 * @since Hi3881_V100R001C00 1816 */ 1817 unsigned int hi_wifi_set_retry_params(const char *ifname, unsigned char type, unsigned char limit); 1818 1819 /* * 1820 * @ingroup hi_wifi_basic 1821 * @brief Set sta plat pm mode.CNcomment:设置STA的平台低功耗模式.CNend 1822 * 1823 * @par Description: 1824 * Set sta pm mode.CNcomment:设置STA的FAST_PS、PSPOLL_PS、uapsd低功耗模式.CNend 1825 * 1826 * @attention NULL 1827 * @param sleep_mode [IN] Type #unsigned char, 0-no_sleep, 1-light_sleep, 2-deep_sleep. 1828 * 1829 * @retval #HISI_OK Excute successfully 1830 * @retval #Other Error code 1831 * @par Dependency: 1832 * @li hi_wifi_api.h: WiFi API 1833 * @see NULL 1834 * @since Hi3881_V100R001C00 1835 */ 1836 int hi_wifi_set_plat_ps_mode(unsigned char sleep_mode); 1837 1838 /* * 1839 * @ingroup hi_wifi_basic 1840 * @brief Set sta plat pm disable.CNcomment:去使能device的平台低功耗.CNend 1841 * 1842 * @par Description: 1843 * Set sta plat pm disable.CNcomment:去使能device的平台低功耗.CNend 1844 * 1845 * @attention NULL 1846 * @param NULL 1847 * 1848 * @retval #HISI_OK Excute successfully 1849 * @retval #Other Error code 1850 * @par Dependency: 1851 * @li hi_wifi_api.h: WiFi API 1852 * @see NULL 1853 * @since Hi3881_V100R001C00 1854 */ 1855 unsigned int hi_wifi_plat_pm_disable(void); 1856 1857 1858 /* * 1859 * @ingroup hi_wifi_basic 1860 * @brief Set sta plat pm enable.CNcomment:使能device的平台低功耗.CNend 1861 * 1862 * @par Description: 1863 * Set sta plat pm enable.CNcomment:使能device的平台低功耗.CNend 1864 * 1865 * @attention NULL 1866 * @param NULL 1867 * 1868 * @retval #HISI_OK Excute successfully 1869 * @retval #Other Error code 1870 * @par Dependency: 1871 * @li hi_wifi_api.h: WiFi API 1872 * @see NULL 1873 * @since Hi3881_V100R001C00 1874 */ 1875 unsigned int hi_wifi_plat_pm_enable(void); 1876 1877 /* * 1878 * @ingroup hi_wifi_basic 1879 * @brief host notifies device of host's sleep state.CNcomment:host将睡眠状态告知device.CNend 1880 * 1881 * @par Description: 1882 * host notifies device of host's sleep state.CNcomment:host将睡眠状态告知device.CNend 1883 * 1884 * @attention Once the device receives the host's sleep message, it will no longer send data to 1885 * the host unless the host wakes up the device or the device wakes up the Host.CNcomment:一旦device 1886 * 收到host的睡眠消息,将不再向host发送数据,除非host唤醒device或者device唤醒Host.CNend 1887 * @param slp [IN] Type #bool, host sleep status, 0-wake, 1-sleep. 1888 * 1889 * @retval #HISI_OK Excute successfully 1890 * @retval #Other Error code 1891 * @par Dependency: 1892 * @li hi_wifi_api.h: WiFi API 1893 * @see NULL 1894 * @since Hi3881_V100R001C00 1895 */ 1896 unsigned int hi_wifi_host_request_sleep(bool slp); 1897 1898 /* * 1899 * @ingroup hi_wifi_basic 1900 * @brief Set cca threshold.CNcomment:设置CCA门限.CNend 1901 * 1902 * @par Description: 1903 * Set cca threshold.CNcomment:设置CCA门限.CNend 1904 * 1905 * @attention CNcomment:1.threshold设置范围是-128~126时,阈值固定为设置值.CNend\n 1906 * CNcomment:2.threshold设置值为127时,恢复默认阈值-62dBm,并使能动态调整.CNend 1907 * @param ifname [IN] Type #char *, device name. CNcomment:接口名.CNend 1908 * @param threshold [IN] Type #char, threshold. CNcomment:门限值.CNend 1909 * 1910 * @retval #HISI_OK Excute successfully 1911 * @retval #Other Error code 1912 * 1913 * @par Dependency: 1914 * @li hi_wifi_api.h: WiFi API 1915 * @see NULL 1916 * @since Hi3881_V100R001C00 1917 */ 1918 unsigned int hi_wifi_set_cca_threshold(const char *ifname, signed char threshold); 1919 1920 /* * 1921 * @ingroup hi_wifi_basic 1922 * @brief Set tcp mode.CNcomment:设置tpc开关.CNend 1923 * 1924 * @par Description: 1925 * Set tpc mode.CNcomment:设置tpc开关.CNend 1926 * 1927 * @attention 1.Mode set to 1, enable auto power control. set to 0, disable it. 1928 * CNcomment:1.mode范围是0~1,1:打开发送功率自动控制,0:关闭发送功率自动控制.CNend 1929 * @param ifname [IN] Type #char *, device name. CNcomment:接口名.CNend 1930 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 1931 * @param tpc_value [IN] Type #unsigned int, tpc_value. CNcomment:tpc开关.CNend 1932 * 1933 * @retval #HISI_OK Excute successfully 1934 * @retval #Other Error code 1935 * 1936 * @par Dependency: 1937 * @li hi_wifi_api.h: WiFi API 1938 * @see NULL 1939 * @since Hi3881_V100R001C00 1940 */ 1941 unsigned int hi_wifi_set_tpc(const char *ifname, unsigned char ifname_len, unsigned int tpc_value); 1942 1943 /* * 1944 * @ingroup hi_wifi_basic 1945 * @brief Set customize parameters.CNcomment:设置定制化参数.CNend 1946 * 1947 * @par Description: 1948 * Set customize parameters:设置定制化参数.CNend 1949 * 1950 * @attention 1.rssi_offset:rx rssi compnesation val. CNcomment:1.rssi_offset:rx rssi的补偿偏移值.CNend 1951 * @attention 2.freq_comp:3 elements refer to enter and quit temp freq compensation threshold, and compensation val. 1952 CNcomment:2.freq_comp:3个元素分别对应进入频偏补偿的温度阈值,退出补偿的温度阈值和高温频偏补偿值.CNend 1953 * @attention 3.dbb_params:first 5 elements are dbb scales, 6th is freq and band power offset, 7th is evm related val. 1954 CNcomment:3.dbb_params:前5个是dbb scale配置值,第6个是频偏和band功率补偿值,第7个是evm的配置值.CNend 1955 * @attention 4.ch_txpwr_offset:tx power offset of 13 channels, for FCC.ch 14 or upper use the cfg val of ch 13. 1956 CNcomment:4.ch_txpwr_offset:对应13个信道的功率偏移,配置符合FCC要求的功率,大于13信道使用13信道的值.CNend 1957 * @param params [IN] Type #hi_wifi_customize_params *, parameters. CNcomment:定制化参数.CNend 1958 * 1959 * @retval #HISI_OK Excute successfully 1960 * @retval #Other Error code 1961 * 1962 * @par Dependency: 1963 * @li hi_wifi_api.h: WiFi API 1964 * @see NULL 1965 * @since Hi3881_V100R001C00 1966 */ 1967 unsigned int hi_wifi_set_customize_params(hi_wifi_customize_params *params); 1968 1969 /* * 1970 * @ingroup hi_wifi_basic 1971 * @brief Register function callback of report datarate and average send times. 1972 * CNcomment:注册上报实际吞吐量、平均发送次数函数回调.CNend 1973 * 1974 * @par Description: 1975 * Register function callback of report datarate and average send times 1976 * CNcomment:注册上报实际吞吐量、平均发送次数函数回调.CNend 1977 * 1978 * @attention 1.function callback type must been suited to hi_wifi_report_tx_params_callback. 1979 CNcomment:1.回调函数必须是 hi_wifi_report_tx_params_callback 类型.CNend 1980 * 1981 * @param func [IN] type #hi_wifi_report_tx_params_callback, report tx params callback. CNcomment:上报实际吞吐量、 1982 平均发送次数函数回调。Nend 1983 * @retval None 1984 * @par Dependency: 1985 * @li hi_wifi_api.h: WiFi API 1986 * @see NULL 1987 * @since Hi3881_V100R001C00 1988 */ 1989 void hi_wifi_register_tx_params_callback(hi_wifi_report_tx_params_callback func); 1990 1991 /* * 1992 * @ingroup hi_wifi_basic 1993 * @brief Get datarate.CNcomment:获取实际速率及平均发送次数.CNend 1994 * 1995 * @par Description: 1996 * Get goodput and average send times.CNcomment:获取实际速率及平均发送次数.CNend 1997 * 1998 * @attention 1. Call hi_wifi_register_datarate_callback before call this function. 1999 * CNcomment:1. 调用本函数前,调用 hi_wifi_register_datarate_callback 注册回调.CNend 2000 * 2. after call this function, result will be reported by register function. 2001 * CNcomment:2. 函数执行结果,通过注册的回调函数通知.CNend 2002 * @param ifname [IN] Type #char *, device name. CNcomment:接口名.CNend 2003 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 2004 * 2005 * @retval #HISI_OK Excute successfully 2006 * @retval #Other Error code 2007 * 2008 * @par Dependency: 2009 * @li hi_wifi_api.h: WiFi API 2010 * @see NULL 2011 * @since Hi3881_V100R001C00 2012 */ 2013 unsigned int hi_wifi_get_tx_params(const char *ifname, unsigned char ifname_len); 2014 2015 /* * 2016 * @ingroup hi_wifi_basic 2017 * @brief register driver callback interface.CNcomment:注册驱动事件回调函数接口.CNend 2018 * 2019 * @par Description: 2020 * register driver callback interface.CNcomment:注册驱动事件回调函数接口.CNend 2021 * 2022 * @attention NULL 2023 * @param event_cb [OUT] Type #hi_wifi_driver_event_cb, event callback .CNcomment:回调函数.CNend 2024 * 2025 * @retval #HISI_OK Execute successfully. 2026 * @retval #HISI_FAIL Execute failed. 2027 * @par Dependency: 2028 * @li hi_wifi_api.h: WiFi API 2029 * @see NULL 2030 * @since Hi3881_V100R001C00 2031 */ 2032 int hi_wifi_register_driver_event_callback(hi_wifi_driver_event_cb event_cb); 2033 2034 /* * 2035 * @ingroup 2036 * @brief sdio send message to reset device. CNcomment:SDIO发送复位设备消息.CNend 2037 * 2038 * @par Description: 2039 * sdio send message to reset device.CNcomment:SDIO发送复位设备消息.CNend 2040 * 2041 * @attention NULL 2042 * 2043 * @retval #HISI_OK Execute successfully. 2044 * @retval #HISI_FAIL Execute failed. 2045 * @par Dependency: 2046 * @li hi_wifi_api.h: WiFi API 2047 * @see NULL 2048 * @since Hi3881_V100R001C00 2049 */ 2050 int hi_wifi_soft_reset_device(void); 2051 2052 /* * 2053 * @ingroup 2054 * @brief enable device's gpio soft reset function. CNcomment:使能设备GPIO软复位功能.CNend 2055 * 2056 * @par Description: 2057 * when function enabled, device will reset after receive GPIO5's Falling edge interrupt. default not enabled. 2058 CNcomment:使能该功能后,device响应GPIO5的下降沿中断进行软复位,默认该功能未使能.CNend 2059 * 2060 * @attention should call after wifi init.CNcomment:须在WIFI初始化成功后调用.CNend 2061 * 2062 * @retval #HISI_OK Execute successfully. 2063 * @retval #Other Error code 2064 * @par Dependency: 2065 * @li hi_wifi_api.h: WiFi API 2066 * @see NULL 2067 * @since Hi3881_V100R001C00 2068 */ 2069 unsigned int hi_wifi_open_gpio_soft_reset_device(void); 2070 2071 /* * 2072 * @ingroup 2073 * @brief disable device's gpio soft reset function. CNcomment:禁用设备GPIO软复位功能.CNend 2074 * 2075 * @par Description: 2076 * disable device's gpio soft reset function. CNcomment:禁用设备GPIO软复位功能.CNend 2077 * 2078 * @attention should call after wifi init.CNcomment:须在WIFI初始化成功后调用.CNend 2079 * 2080 * @retval #HISI_OK Execute successfully. 2081 * @retval #Other Error code 2082 * @par Dependency: 2083 * @li hi_wifi_api.h: WiFi API 2084 * @see NULL 2085 * @since Hi3881_V100R001C00 2086 */ 2087 unsigned int hi_wifi_close_gpio_soft_reset_device(void); 2088 2089 #ifdef __cplusplus 2090 #if __cplusplus 2091 } 2092 #endif 2093 #endif 2094 2095 #endif /* end of hi_wifi_api.h */ 2096