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