1/* 2 * Copyright (C) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ConnectivityKit 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22 23/** 24 * Provides methods to operate or manage Wi-Fi. 25 * @namespace wifiManager 26 * @since 9 27 */ 28/** 29 * Provides methods to operate or manage Wi-Fi. 30 * @namespace wifiManager 31 * @atomicservice 32 * @since 11 33 */ 34/** 35 * Provides methods to operate or manage Wi-Fi. 36 * @namespace wifiManager 37 * @syscap SystemCapability.Communication.WiFi.STA 38 * @crossplatform 39 * @atomicservice 40 * @since 12 41 */ 42declare namespace wifiManager { 43 /** 44 * Enable Wi-Fi. 45 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 46 * @throws {BusinessError} 201 - Permission denied. 47 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 48 * @throws {BusinessError} 801 - Capability not supported. 49 * @throws {BusinessError} 2501000 - Operation failed. 50 * @throws {BusinessError} 2501003 - Failed for wifi is closing. 51 * @syscap SystemCapability.Communication.WiFi.STA 52 * @systemapi Hide this for inner system use. 53 * @since 9 54 */ 55 function enableWifi(): void; 56 57 /** 58 * Disable Wi-Fi. 59 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 60 * @throws {BusinessError} 201 - Permission denied. 61 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 62 * @throws {BusinessError} 801 - Capability not supported. 63 * @throws {BusinessError} 2501000 - Operation failed. 64 * @throws {BusinessError} 2501004 - Failed for wifi is opening. 65 * @syscap SystemCapability.Communication.WiFi.STA 66 * @systemapi Hide this for inner system use. 67 * @since 9 68 */ 69 function disableWifi(): void; 70 71 /** 72 * Enable semi - Wifi. 73 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 74 * @throws {BusinessError} 201 - Permission denied. 75 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 76 * @throws {BusinessError} 801 - Capability not supported. 77 * @throws {BusinessError} 2501000 - Operation failed. 78 * @throws {BusinessError} 2501004 - Failed for wifi is opening. 79 * @syscap SystemCapability.Communication.WiFi.STA 80 * @systemapi Hide this for inner system use. 81 * @since 12 82 */ 83 function enableSemiWifi(): void; 84 85 /** 86 * Query the Wi-Fi status 87 * @permission ohos.permission.GET_WIFI_INFO 88 * @returns { boolean } Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise. 89 * @throws {BusinessError} 201 - Permission denied. 90 * @throws {BusinessError} 801 - Capability not supported. 91 * @throws {BusinessError} 2501000 - Operation failed. 92 * @syscap SystemCapability.Communication.WiFi.STA 93 * @since 9 94 */ 95 /** 96 * Query the Wi-Fi status 97 * @permission ohos.permission.GET_WIFI_INFO 98 * @returns { boolean } Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise. 99 * @throws {BusinessError} 201 - Permission denied. 100 * @throws {BusinessError} 801 - Capability not supported. 101 * @throws {BusinessError} 2501000 - Operation failed. 102 * @syscap SystemCapability.Communication.WiFi.STA 103 * @atomicservice 104 * @since 11 105 */ 106 /** 107 * Query the Wi-Fi status 108 * @permission ohos.permission.GET_WIFI_INFO 109 * @returns { boolean } Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise. 110 * @throws {BusinessError} 201 - Permission denied. 111 * @throws {BusinessError} 801 - Capability not supported. 112 * @throws {BusinessError} 2501000 - Operation failed. 113 * @syscap SystemCapability.Communication.WiFi.STA 114 * @crossplatform 115 * @atomicservice 116 * @since 12 117 */ 118 /** 119 * Query the Wi-Fi status 120 * @returns { boolean } Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise. 121 * @throws {BusinessError} 801 - Capability not supported. 122 * @throws {BusinessError} 2501000 - Operation failed. 123 * @syscap SystemCapability.Communication.WiFi.STA 124 * @crossplatform 125 * @atomicservice 126 * @since 13 127 */ 128 function isWifiActive(): boolean; 129 130 /** 131 * Scan Wi-Fi hotspot, This API works in asynchronous mode. 132 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 133 * @throws {BusinessError} 201 - Permission denied. 134 * @throws {BusinessError} 801 - Capability not supported. 135 * @throws {BusinessError} 2501000 - Operation failed. 136 * @syscap SystemCapability.Communication.WiFi.STA 137 * @since 9 138 * @deprecated since 10 139 * @useinstead wifiManager.startScan 140 */ 141 function scan(): void; 142 143 /** 144 * Scan Wi-Fi hotspot. 145 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 146 * @throws {BusinessError} 201 - Permission denied. 147 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 148 * @throws {BusinessError} 801 - Capability not supported. 149 * @throws {BusinessError} 2501000 - Operation failed. 150 * @syscap SystemCapability.Communication.WiFi.STA 151 * @systemapi Hide this for inner system use. 152 * @since 10 153 */ 154 function startScan(): void; 155 156 /** 157 * Obtain the scanned sta list. 158 * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or 159 * (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) 160 * @returns { Promise<Array<WifiScanInfo>> } Returns information about scanned Wi-Fi hotspot if any. 161 * @throws {BusinessError} 201 - Permission denied. 162 * @throws {BusinessError} 801 - Capability not supported. 163 * @throws {BusinessError} 2501000 - Operation failed. 164 * @syscap SystemCapability.Communication.WiFi.STA 165 * @since 9 166 * @deprecated since 10 167 * @useinstead wifiManager.getScanInfoList 168 */ 169 function getScanResults(): Promise<Array<WifiScanInfo>>; 170 171 /** 172 * Obtains information about a Wi-Fi detail state. 173 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 174 * @returns { WifiDetailState } Returns information about wifi state. 175 * @throws {BusinessError} 201 - Permission denied. 176 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 177 * @throws {BusinessError} 801 - Capability not supported. 178 * @throws {BusinessError} 2501000 - Operation failed. 179 * @syscap SystemCapability.Communication.WiFi.STA 180 * @systemapi Hide this for inner system use. 181 * @since 12 182 */ 183 function getWifiDetailState(): WifiDetailState; 184 185 /** 186 * Obtain the scanned sta list. 187 * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or 188 * (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) 189 * @param { AsyncCallback<Array<WifiScanInfo>> } callback - Returns information about scanned Wi-Fi hotspot if any. 190 * @throws {BusinessError} 201 - Permission denied. 191 * @throws {BusinessError} 801 - Capability not supported. 192 * @throws {BusinessError} 2501000 - Operation failed. 193 * @syscap SystemCapability.Communication.WiFi.STA 194 * @since 9 195 * @deprecated since 10 196 * @useinstead wifiManager.getScanInfoList 197 */ 198 function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void; 199 200 /** 201 * Obtain the scanned sta list. 202 * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or 203 * (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) 204 * @returns { Array<WifiScanInfo> } Returns information about scanned Wi-Fi hotspot if any. 205 * @throws {BusinessError} 201 - Permission denied. 206 * @throws {BusinessError} 801 - Capability not supported. 207 * @throws {BusinessError} 2501000 - Operation failed. 208 * @syscap SystemCapability.Communication.WiFi.STA 209 * @since 9 210 * @deprecated since 10 211 * @useinstead wifiManager.getScanInfoList 212 */ 213 function getScanResultsSync(): Array<WifiScanInfo>; 214 215 /** 216 * Obtain the scanned station list. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid. 217 * @permission ohos.permission.GET_WIFI_INFO 218 * @returns { Array<WifiScanInfo> } Returns information about scanned Wi-Fi hotspot if any. 219 * @throws {BusinessError} 201 - Permission denied. 220 * @throws {BusinessError} 801 - Capability not supported. 221 * @throws {BusinessError} 2501000 - Operation failed. 222 * @syscap SystemCapability.Communication.WiFi.STA 223 * @since 10 224 */ 225 226 /** 227 * Obtain the scanned station list. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid. 228 * @permission ohos.permission.GET_WIFI_INFO 229 * @returns { Array<WifiScanInfo> } Returns information about scanned Wi-Fi hotspot if any. 230 * @throws {BusinessError} 201 - Permission denied. 231 * @throws {BusinessError} 801 - Capability not supported. 232 * @throws {BusinessError} 2501000 - Operation failed. 233 * @syscap SystemCapability.Communication.WiFi.STA 234 * @atomicservice 235 * @since 12 236 */ 237 function getScanInfoList(): Array<WifiScanInfo>; 238 239 /** 240 * User can trigger scan even Wi-Fi is disabled. 241 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 242 * @param { boolean } isScanAlwaysAllowed - true for allow trigger scan, otherwise don't allow trigger scan when Wi-Fi is disabled. 243 * @throws {BusinessError} 201 - Permission denied. 244 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 245 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 246 * @throws {BusinessError} 801 - Capability not supported. 247 * @throws {BusinessError} 2501000 - Operation failed. 248 * @syscap SystemCapability.Communication.WiFi.STA 249 * @systemapi Hide this for inner system use. 250 * @since 10 251 */ 252 function setScanAlwaysAllowed(isScanAlwaysAllowed: boolean): void; 253 254 /** 255 * Get scan always allowed flag. 256 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 257 * @returns { boolean } Returns {@code true} if scan running state is true, returns {@code false} otherwise. 258 * @throws {BusinessError} 201 - Permission denied. 259 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 260 * @throws {BusinessError} 801 - Capability not supported. 261 * @throws {BusinessError} 2501000 - Operation failed. 262 * @syscap SystemCapability.Communication.WiFi.STA 263 * @systemapi Hide this for inner system use. 264 * @since 10 265 */ 266 function getScanAlwaysAllowed(): boolean; 267 268 /** 269 * Add Wi-Fi connection configuration to the device. The configuration will be updated when the configuration is added.</p> 270 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 271 * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network. 272 * @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. 273 * @throws {BusinessError} 201 - Permission denied. 274 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 275 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 276 * 2. Incorrect parameter types. 3.Parameter verification failed. 277 * @throws {BusinessError} 801 - Capability not supported. 278 * @throws {BusinessError} 2501000 - Operation failed. 279 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 280 * @syscap SystemCapability.Communication.WiFi.STA 281 * @systemapi Hide this for inner system use. 282 * @since 9 283 */ 284 function addDeviceConfig(config: WifiDeviceConfig): Promise<number>; 285 286 /** 287 * Add Wi-Fi connection configuration to the device. The configuration will be updated when the configuration is added.</p> 288 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 289 * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network. 290 * @param { AsyncCallback<number> } callback - Indicates call back of addDeviceConfig. 291 * @throws {BusinessError} 201 - Permission denied. 292 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 293 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 294 * 2. Incorrect parameter types. 3.Parameter verification failed. 295 * @throws {BusinessError} 801 - Capability not supported. 296 * @throws {BusinessError} 2501000 - Operation failed. 297 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 298 * @syscap SystemCapability.Communication.WiFi.STA 299 * @systemapi Hide this for inner system use. 300 * @since 9 301 */ 302 function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void; 303 304 /** 305 * Add a specified candidate hotspot configuration and returns the networkId. 306 * This method adds one configuration at a time. After this configuration is added, 307 * your device will determine whether to connect to the hotspot. 308 * The app must be in the foreground. 309 * @permission ohos.permission.SET_WIFI_INFO 310 * @param { WifiDeviceConfig } config - candidate config. 311 * @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. 312 * @throws {BusinessError} 201 - Permission denied. 313 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 314 * 2. Incorrect parameter types. 3.Parameter verification failed. 315 * @throws {BusinessError} 801 - Capability not supported. 316 * @throws {BusinessError} 2501000 - Operation failed. 317 * @syscap SystemCapability.Communication.WiFi.STA 318 * @since 9 319 */ 320 321 /** 322 * Add a specified candidate hotspot configuration and returns the networkId. 323 * This method adds one configuration at a time. After this configuration is added, 324 * your device will determine whether to connect to the hotspot. 325 * The app must be in the foreground. 326 * @permission ohos.permission.SET_WIFI_INFO 327 * @param { WifiDeviceConfig } config - candidate config. 328 * @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. 329 * @throws {BusinessError} 201 - Permission denied. 330 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 331 * 2. Incorrect parameter types. 3.Parameter verification failed. 332 * @throws {BusinessError} 801 - Capability not supported. 333 * @throws {BusinessError} 2501000 - Operation failed. 334 * @syscap SystemCapability.Communication.WiFi.STA 335 * @atomicservice 336 * @since 12 337 */ 338 function addCandidateConfig(config: WifiDeviceConfig): Promise<number>; 339 340 /** 341 * Add a specified candidate hotspot configuration and returns the networkId. 342 * This method adds one configuration at a time. After this configuration is added, 343 * your device will determine whether to connect to the hotspot. 344 * The app must be in the foreground. 345 * @permission ohos.permission.SET_WIFI_INFO 346 * @param { WifiDeviceConfig } config - candidate config. 347 * @param { AsyncCallback<number> } callback - Indicates call back of addCandidateConfig. 348 * @throws {BusinessError} 201 - Permission denied. 349 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 350 * 2. Incorrect parameter types. 3.Parameter verification failed. 351 * @throws {BusinessError} 801 - Capability not supported. 352 * @throws {BusinessError} 2501000 - Operation failed. 353 * @syscap SystemCapability.Communication.WiFi.STA 354 * @since 9 355 */ 356 357 /** 358 * Add a specified candidate hotspot configuration and returns the networkId. 359 * This method adds one configuration at a time. After this configuration is added, 360 * your device will determine whether to connect to the hotspot. 361 * The app must be in the foreground. 362 * @permission ohos.permission.SET_WIFI_INFO 363 * @param { WifiDeviceConfig } config - candidate config. 364 * @param { AsyncCallback<number> } callback - Indicates call back of addCandidateConfig. 365 * @throws {BusinessError} 201 - Permission denied. 366 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 367 * 2. Incorrect parameter types. 3.Parameter verification failed. 368 * @throws {BusinessError} 801 - Capability not supported. 369 * @throws {BusinessError} 2501000 - Operation failed. 370 * @syscap SystemCapability.Communication.WiFi.STA 371 * @atomicservice 372 * @since 12 373 */ 374 function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void; 375 376 /** 377 * Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed 378 * to be removed. 379 * The app must be in the foreground. 380 * @permission ohos.permission.SET_WIFI_INFO 381 * @param { number } networkId - Network ID which will be removed. 382 * @returns { Promise<void> } Return results. 383 * @throws {BusinessError} 201 - Permission denied. 384 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 385 * 2. Incorrect parameter types. 3.Parameter verification failed. 386 * @throws {BusinessError} 801 - Capability not supported. 387 * @throws {BusinessError} 2501000 - Operation failed. 388 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 389 * @syscap SystemCapability.Communication.WiFi.STA 390 * @since 9 391 */ 392 393 /** 394 * Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed 395 * to be removed. 396 * The app must be in the foreground. 397 * @permission ohos.permission.SET_WIFI_INFO 398 * @param { number } networkId - Network ID which will be removed. 399 * @returns { Promise<void> } Return results. 400 * @throws {BusinessError} 201 - Permission denied. 401 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 402 * 2. Incorrect parameter types. 3.Parameter verification failed. 403 * @throws {BusinessError} 801 - Capability not supported. 404 * @throws {BusinessError} 2501000 - Operation failed. 405 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 406 * @syscap SystemCapability.Communication.WiFi.STA 407 * @atomicservice 408 * @since 12 409 */ 410 function removeCandidateConfig(networkId: number): Promise<void>; 411 412 /** 413 * Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed 414 * to be removed. 415 * The app must be in the foreground 416 * @permission ohos.permission.SET_WIFI_INFO 417 * @param { number } networkId - Network ID which will be removed. 418 * @param { AsyncCallback<void> } callback - Indicates call back of removeCandidateConfig. 419 * @throws {BusinessError} 201 - Permission denied. 420 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 421 * 2. Incorrect parameter types. 3.Parameter verification failed. 422 * @throws {BusinessError} 801 - Capability not supported. 423 * @throws {BusinessError} 2501000 - Operation failed. 424 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 425 * @syscap SystemCapability.Communication.WiFi.STA 426 * @since 9 427 */ 428 429 /** 430 * Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed 431 * to be removed. 432 * The app must be in the foreground. 433 * @permission ohos.permission.SET_WIFI_INFO 434 * @param { number } networkId - Network ID which will be removed. 435 * @param { AsyncCallback<void> } callback - Indicates call back of removeCandidateConfig. 436 * @throws {BusinessError} 201 - Permission denied. 437 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 438 * 2. Incorrect parameter types. 3.Parameter verification failed. 439 * @throws {BusinessError} 801 - Capability not supported. 440 * @throws {BusinessError} 2501000 - Operation failed. 441 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 442 * @syscap SystemCapability.Communication.WiFi.STA 443 * @atomicservice 444 * @since 12 445 */ 446 function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void; 447 448 /** 449 * Obtain the list of all existed candidate Wi-Fi configurations which added by ourself. 450 * You can obtain only the Wi-Fi configurations you created on your own application. 451 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 452 * @returns { Array<WifiDeviceConfig> } Returns the list of all existed Wi-Fi configurations you created on your application. 453 * @throws {BusinessError} 201 - Permission denied. 454 * @throws {BusinessError} 801 - Capability not supported. 455 * @throws {BusinessError} 2501000 - Operation failed. 456 * @syscap SystemCapability.Communication.WiFi.STA 457 * @since 9 458 */ 459 /** 460 * Obtain the list of all existed candidate Wi-Fi configurations which added by ourself. 461 * You can obtain only the Wi-Fi configurations you created on your own application. 462 * @permission ohos.permission.GET_WIFI_INFO 463 * @returns { Array<WifiDeviceConfig> } Returns the list of all existed Wi-Fi configurations you created on your application. 464 * @throws {BusinessError} 201 - Permission denied. 465 * @throws {BusinessError} 801 - Capability not supported. 466 * @throws {BusinessError} 2501000 - Operation failed. 467 * @syscap SystemCapability.Communication.WiFi.STA 468 * @since 10 469 */ 470 471 /** 472 * Obtain the list of all existed candidate Wi-Fi configurations which added by ourself. 473 * You can obtain only the Wi-Fi configurations you created on your own application. 474 * @permission ohos.permission.GET_WIFI_INFO 475 * @returns { Array<WifiDeviceConfig> } Returns the list of all existed Wi-Fi configurations you created on your application. 476 * @throws {BusinessError} 201 - Permission denied. 477 * @throws {BusinessError} 801 - Capability not supported. 478 * @throws {BusinessError} 2501000 - Operation failed. 479 * @syscap SystemCapability.Communication.WiFi.STA 480 * @atomicservice 481 * @since 12 482 */ 483 function getCandidateConfigs(): Array<WifiDeviceConfig>; 484 485 /** 486 * Connect to a specified candidate hotspot by networkId, only the configuration which is added by ourself 487 * is allowed to be connected. This method connect to a configuration at a time. 488 * The app must be in the foreground. 489 * @permission ohos.permission.SET_WIFI_INFO 490 * @param { number } networkId - Network ID which will be connected. The value of networkId cannot be less than 0. 491 * @throws {BusinessError} 201 - Permission denied. 492 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 493 * 2. Incorrect parameter types. 3.Parameter verification failed. 494 * @throws {BusinessError} 801 - Capability not supported. 495 * @throws {BusinessError} 2501000 - Operation failed. 496 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 497 * @syscap SystemCapability.Communication.WiFi.STA 498 * @since 9 499 */ 500 501 /** 502 * Connect to a specified candidate hotspot by networkId, only the configuration which is added by ourself 503 * is allowed to be connected. This method connect to a configuration at a time. 504 * The app must be in the foreground. 505 * @permission ohos.permission.SET_WIFI_INFO 506 * @param { number } networkId - Network ID which will be connected. The value of networkId cannot be less than 0. 507 * @throws {BusinessError} 201 - Permission denied. 508 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 509 * 2. Incorrect parameter types. 3.Parameter verification failed. 510 * @throws {BusinessError} 801 - Capability not supported. 511 * @throws {BusinessError} 2501000 - Operation failed. 512 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 513 * @syscap SystemCapability.Communication.WiFi.STA 514 * @atomicservice 515 * @since 12 516 */ 517 function connectToCandidateConfig(networkId: number): void; 518 519 /** 520 * Connect to Wi-Fi hotspot by networkId. 521 * @permission ohos.permission.MANAGE_WIFI_CONNECTION 522 * @param { number } networkId - ID of the connected network. The value of networkId cannot be less than 0. 523 * @throws {BusinessError} 201 - Permission denied. 524 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 525 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 526 * 2. Incorrect parameter types. 3.Parameter verification failed. 527 * @throws {BusinessError} 801 - Capability not supported. 528 * @throws {BusinessError} 2501000 - Operation failed. 529 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 530 * @syscap SystemCapability.Communication.WiFi.STA 531 * @systemapi Hide this for inner system use. 532 * @since 9 533 */ 534 function connectToNetwork(networkId: number): void; 535 536 /** 537 * Connect to Wi-Fi hotspot by WifiDeviceConfig. 538 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG and 539 * ohos.permission.MANAGE_WIFI_CONNECTION 540 * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi hotspot. 541 * @throws {BusinessError} 201 - Permission denied. 542 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 543 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 544 * 2. Incorrect parameter types. 3.Parameter verification failed. 545 * @throws {BusinessError} 801 - Capability not supported. 546 * @throws {BusinessError} 2501000 - Operation failed. 547 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 548 * @syscap SystemCapability.Communication.WiFi.STA 549 * @systemapi Hide this for inner system use. 550 * @since 9 551 */ 552 function connectToDevice(config: WifiDeviceConfig): void; 553 554 /** 555 * Disconnect connection between sta and Wi-Fi hotspot. 556 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 557 * @throws {BusinessError} 201 - Permission denied. 558 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 559 * @throws {BusinessError} 801 - Capability not supported. 560 * @throws {BusinessError} 2501000 - Operation failed. 561 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 562 * @syscap SystemCapability.Communication.WiFi.STA 563 * @systemapi Hide this for inner system use. 564 * @since 9 565 */ 566 function disconnect(): void; 567 568 /** 569 * Calculate the Wi-Fi signal level based on the Wi-Fi RSSI and frequency band. 570 * @permission ohos.permission.GET_WIFI_INFO 571 * @param { number } rssi - Indicates the Wi-Fi RSSI. 572 * @param { number } band - Indicates the Wi-Fi frequency band. 573 * @returns { number } Returns Wi-Fi signal level ranging from 0 to 4. 574 * @throws {BusinessError} 201 - Permission denied. 575 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 576 * 2. Incorrect parameter types. 577 * @throws {BusinessError} 801 - Capability not supported. 578 * @throws {BusinessError} 2501000 - Operation failed. 579 * @syscap SystemCapability.Communication.WiFi.STA 580 * @since 9 581 */ 582 function getSignalLevel(rssi: number, band: number): number; 583 584 /** 585 * Obtain connection information about the Wi-Fi connection. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid. 586 * @permission ohos.permission.GET_WIFI_INFO 587 * @returns { Promise<WifiLinkedInfo> } Returns Wi-Fi linked information. 588 * @throws {BusinessError} 201 - Permission denied. 589 * @throws {BusinessError} 801 - Capability not supported. 590 * @throws {BusinessError} 2501000 - Operation failed. 591 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 592 * @syscap SystemCapability.Communication.WiFi.STA 593 * @since 9 594 */ 595 596 /** 597 * Obtain connection information about the Wi-Fi connection. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid. 598 * @permission ohos.permission.GET_WIFI_INFO 599 * @returns { Promise<WifiLinkedInfo> } Returns Wi-Fi linked information. 600 * @throws {BusinessError} 201 - Permission denied. 601 * @throws {BusinessError} 801 - Capability not supported. 602 * @throws {BusinessError} 2501000 - Operation failed. 603 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 604 * @syscap SystemCapability.Communication.WiFi.STA 605 * @crossplatform 606 * @atomicservice 607 * @since 12 608 */ 609 function getLinkedInfo(): Promise<WifiLinkedInfo>; 610 611 /** 612 * Obtain connection information about the Wi-Fi connection. 613 * @permission ohos.permission.GET_WIFI_INFO 614 * @param { AsyncCallback<WifiLinkedInfo> } callback - Indicates callback of function. 615 * @throws {BusinessError} 201 - Permission denied. 616 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 617 * 2. Incorrect parameter types. 618 * @throws {BusinessError} 801 - Capability not supported. 619 * @throws {BusinessError} 2501000 - Operation failed. 620 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 621 * @syscap SystemCapability.Communication.WiFi.STA 622 * @since 9 623 */ 624 /** 625 * Obtain connection information about the Wi-Fi connection. 626 * @permission ohos.permission.GET_WIFI_INFO 627 * @param { AsyncCallback<WifiLinkedInfo> } callback - Indicates callback of function. 628 * @throws {BusinessError} 201 - Permission denied. 629 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 630 * 2. Incorrect parameter types. 631 * @throws {BusinessError} 801 - Capability not supported. 632 * @throws {BusinessError} 2501000 - Operation failed. 633 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 634 * @syscap SystemCapability.Communication.WiFi.STA 635 * @crossplatform 636 * @since 12 637 */ 638 function getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void; 639 640 /** 641 * Check whether the Wi-Fi connection has been set up. 642 * @permission ohos.permission.GET_WIFI_INFO 643 * @returns { boolean } Returns {@code true} if a Wi-Fi connection has been set up, returns {@code false} otherwise. 644 * @throws {BusinessError} 201 - Permission denied. 645 * @throws {BusinessError} 801 - Capability not supported. 646 * @throws {BusinessError} 2501000 - Operation failed. 647 * @syscap SystemCapability.Communication.WiFi.STA 648 * @since 9 649 */ 650 651 /** 652 * Check whether the Wi-Fi connection has been set up. 653 * @permission ohos.permission.GET_WIFI_INFO 654 * @returns { boolean } Returns {@code true} if a Wi-Fi connection has been set up, returns {@code false} otherwise. 655 * @throws {BusinessError} 201 - Permission denied. 656 * @throws {BusinessError} 801 - Capability not supported. 657 * @throws {BusinessError} 2501000 - Operation failed. 658 * @syscap SystemCapability.Communication.WiFi.STA 659 * @crossplatform 660 * @atomicservice 661 * @since 12 662 */ 663 function isConnected(): boolean; 664 665 /** 666 * Obtain the features supported by the device. 667 * To check whether this device supports a specified feature. 668 * @permission ohos.permission.GET_WIFI_INFO 669 * @returns { number } Returns the features supported by this device. 670 * @throws {BusinessError} 201 - Permission denied. 671 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 672 * @throws {BusinessError} 801 - Capability not supported. 673 * @throws {BusinessError} 2401000 - Operation failed. 674 * @syscap SystemCapability.Communication.WiFi.Core 675 * @systemapi Hide this for inner system use. 676 * @since 9 677 */ 678 function getSupportedFeatures(): number; 679 680 /** 681 * Check whether the device supports a specified feature. 682 * @permission ohos.permission.GET_WIFI_INFO 683 * @param { number } featureId Indicates the ID of the feature. 684 * @returns { boolean } Returns {@code true} if this device supports the specified feature, returns {@code false} otherwise. 685 * @throws {BusinessError} 201 - Permission denied. 686 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 687 * 2. Incorrect parameter types. 688 * @throws {BusinessError} 801 - Capability not supported. 689 * @throws {BusinessError} 2401000 - Operation failed. 690 * @syscap SystemCapability.Communication.WiFi.Core 691 * @since 9 692 */ 693 function isFeatureSupported(featureId: number): boolean; 694 695 /** 696 * Obtain the MAC address of a Wi-Fi device. Wi-Fi must be enabled. 697 * The MAC address is unique and cannot be changed. 698 * @permission ohos.permission.GET_WIFI_LOCAL_MAC and ohos.permission.GET_WIFI_INFO 699 * @returns { string[] } Returns the MAC address of the Wi-Fi device. 700 * @throws {BusinessError} 201 - Permission denied. 701 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 702 * @throws {BusinessError} 801 - Capability not supported. 703 * @throws {BusinessError} 2501000 - Operation failed. 704 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 705 * @syscap SystemCapability.Communication.WiFi.STA 706 * @systemapi Hide this for inner system use. 707 * @since 9 708 */ 709 function getDeviceMacAddress(): string[]; 710 711 /** 712 * Obtain the IP information of the Wi-Fi connection. 713 * The IP information includes the host IP address, gateway address, and DNS information. 714 * @permission ohos.permission.GET_WIFI_INFO 715 * @returns { IpInfo } Returns the IP information of the Wi-Fi connection. 716 * @throws {BusinessError} 201 - Permission denied. 717 * @throws {BusinessError} 801 - Capability not supported. 718 * @throws {BusinessError} 2501000 - Operation failed. 719 * @syscap SystemCapability.Communication.WiFi.STA 720 * @since 9 721 */ 722 function getIpInfo(): IpInfo; 723 724 /** 725 * Obtain the IPv6 information of the Wi-Fi connection. 726 * The IPv6 information includes the host IP address, gateway address, and DNS information. 727 * @permission ohos.permission.GET_WIFI_INFO 728 * @returns { Ipv6Info } Returns the IPv6 information of the Wi-Fi connection. 729 * @throws {BusinessError} 201 - Permission denied. 730 * @throws {BusinessError} 801 - Capability not supported. 731 * @throws {BusinessError} 2501000 - Operation failed. 732 * @syscap SystemCapability.Communication.WiFi.STA 733 * @since 10 734 */ 735 function getIpv6Info(): Ipv6Info; 736 737 /** 738 * Obtain the country code of the device. 739 * @permission ohos.permission.GET_WIFI_INFO 740 * @returns { string } Returns the country code of this device. 741 * @throws {BusinessError} 201 - Permission denied. 742 * @throws {BusinessError} 801 - Capability not supported. 743 * @throws {BusinessError} 2401000 - Operation failed. 744 * @syscap SystemCapability.Communication.WiFi.Core 745 * @since 9 746 */ 747 function getCountryCode(): string; 748 749 /** 750 * Re-associate to current network. 751 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 752 * @throws {BusinessError} 201 - Permission denied. 753 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 754 * @throws {BusinessError} 801 - Capability not supported. 755 * @throws {BusinessError} 2501000 - Operation failed. 756 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 757 * @syscap SystemCapability.Communication.WiFi.STA 758 * @systemapi Hide this for inner system use. 759 * @since 9 760 */ 761 function reassociate(): void; 762 763 /** 764 * Re-connect to current network. 765 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 766 * @throws {BusinessError} 201 - Permission denied. 767 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 768 * @throws {BusinessError} 801 - Capability not supported. 769 * @throws {BusinessError} 2501000 - Operation failed. 770 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 771 * @syscap SystemCapability.Communication.WiFi.STA 772 * @systemapi Hide this for inner system use. 773 * @since 9 774 */ 775 function reconnect(): void; 776 777 /** 778 * Obtain the list of all existed Wi-Fi configurations. 779 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.GET_WIFI_CONFIG 780 * @returns { Array<WifiDeviceConfig> } Returns the list of all existing Wi-Fi configurations you created on your application. 781 * @throws {BusinessError} 201 - Permission denied. 782 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 783 * @throws {BusinessError} 801 - Capability not supported. 784 * @throws {BusinessError} 2501000 - Operation failed. 785 * @syscap SystemCapability.Communication.WiFi.STA 786 * @systemapi Hide this for inner system use. 787 * @since 9 788 */ 789 /** 790 * Obtain the list of all existed Wi-Fi configurations. 791 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 792 * @returns { Array<WifiDeviceConfig> } Returns the list of all existing Wi-Fi configurations you created on your application. 793 * @throws {BusinessError} 201 - Permission denied. 794 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 795 * @throws {BusinessError} 801 - Capability not supported. 796 * @throws {BusinessError} 2501000 - Operation failed. 797 * @syscap SystemCapability.Communication.WiFi.STA 798 * @systemapi Hide this for inner system use. 799 * @since 10 800 */ 801 function getDeviceConfigs(): Array<WifiDeviceConfig>; 802 803 /** 804 * Update the specified Wi-Fi configuration. 805 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 806 * @param { WifiDeviceConfig } config Indicates the Wi-Fi configuration to update. 807 * @returns { number } Returns the network ID in the updated Wi-Fi configuration if the update is successful; 808 * returns {@code -1} if the specified Wi-Fi configuration is not contained in the list. 809 * @throws {BusinessError} 201 - Permission denied. 810 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 811 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 812 * 2. Incorrect parameter types. 3.Parameter verification failed. 813 * @throws {BusinessError} 801 - Capability not supported. 814 * @throws {BusinessError} 2501000 - Operation failed. 815 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 816 * @syscap SystemCapability.Communication.WiFi.STA 817 * @systemapi Hide this for inner system use. 818 * @since 9 819 */ 820 function updateNetwork(config: WifiDeviceConfig): number; 821 822 /** 823 * Disable the specified DeviceConfig by networkId. 824 * The disabled DeviceConfig will not be associated with again. 825 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 826 * @param { number } netId Identifies the network to disable. The value of networkId cannot be less than 0. 827 * @throws {BusinessError} 201 - Permission denied. 828 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 829 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 830 * 2. Incorrect parameter types. 3.Parameter verification failed. 831 * @throws {BusinessError} 801 - Capability not supported. 832 * @throws {BusinessError} 2501000 - Operation failed. 833 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 834 * @syscap SystemCapability.Communication.WiFi.STA 835 * @systemapi Hide this for inner system use. 836 * @since 9 837 */ 838 function disableNetwork(netId: number): void; 839 840 /** 841 * Remove all the saved Wi-Fi configurations. 842 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 843 * @throws {BusinessError} 201 - Permission denied. 844 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 845 * @throws {BusinessError} 801 - Capability not supported. 846 * @throws {BusinessError} 2501000 - Operation failed. 847 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 848 * @syscap SystemCapability.Communication.WiFi.STA 849 * @systemapi Hide this for inner system use. 850 * @since 9 851 */ 852 function removeAllNetwork(): void; 853 854 /** 855 * Remove a Wi-Fi DeviceConfig with networkId. 856 * After a Wi-Fi DeviceConfig is removed, its configuration will be deleted from the list of Wi-Fi configurations. 857 * If the Wi-Fi DeviceConfig is being connected, the connection will be interrupted. 858 * The application can only delete Wi-Fi DeviceConfig it has created. 859 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 860 * @param { number } id - Indicate the ID of the Wi-Fi DeviceConfig. The value of networkId cannot be less than 0. 861 * @throws {BusinessError} 201 - Permission denied. 862 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 863 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 864 * 2. Incorrect parameter types. 3.Parameter verification failed. 865 * @throws {BusinessError} 801 - Capability not supported. 866 * @throws {BusinessError} 2501000 - Operation failed. 867 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 868 * @syscap SystemCapability.Communication.WiFi.STA 869 * @systemapi Hide this for inner system use. 870 * @since 9 871 */ 872 function removeDevice(id: number): void; 873 874 /** 875 * Check whether the current device supports the specified band. 876 * @permission ohos.permission.GET_WIFI_INFO 877 * @param { WifiBandType } bandType - Indicates the band type. 878 * @returns { boolean }Returns {@code true} if the specified band is supported, returns {@code false} otherwise. 879 * @throws {BusinessError} 201 - Permission denied. 880 * @throws {BusinessError} 801 - Capability not supported. 881 * @throws {BusinessError} 2501000 - Operation failed. 882 * @syscap SystemCapability.Communication.WiFi.STA 883 * @since 10 884 */ 885 function isBandTypeSupported(bandType: WifiBandType): boolean; 886 887 /** 888 * Obtain the supported 5G channel list of the device. 889 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 890 * @returns { Array<number> } Returns 5G channel list. 891 * @throws {BusinessError} 201 - Permission denied. 892 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 893 * @throws {BusinessError} 801 - Capability not supported. 894 * @throws {BusinessError} 2501000 - Operation failed. 895 * @syscap SystemCapability.Communication.WiFi.STA 896 * @systemapi Hide this for inner system use. 897 * @since 10 898 */ 899 function get5GChannelList(): Array<number>; 900 901 /** 902 * Obtain the latest disconnected reason. 903 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 904 * @returns { DisconnectedReason } Returns the latest disconnected reason. 905 * @throws {BusinessError} 201 - Permission denied. 906 * @throws {BusinessError} 801 - Capability not supported. 907 * @throws {BusinessError} 2501000 - Operation failed. 908 * @syscap SystemCapability.Communication.WiFi.STA 909 * @systemapi Hide this for inner system use. 910 * @since 10 911 */ 912 function getDisconnectedReason(): DisconnectedReason; 913 914 /** 915 * Start Portal certification. 916 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 917 * @throws {BusinessError} 201 - Permission denied. 918 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 919 * @throws {BusinessError} 801 - Capability not supported. 920 * @throws {BusinessError} 2501000 - Operation failed. 921 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 922 * @syscap SystemCapability.Communication.WiFi.STA 923 * @systemapi Hide this for inner system use. 924 * @since 11 925 */ 926 function startPortalCertification(): void; 927 928 /** 929 * Whether the hotspot is metered hotspot or not. 930 * @permission ohos.permission.GET_WIFI_INFO 931 * @returns { boolean } Returns {@code true} if the hotspot is metered hotspot, returns {@code false} otherwise. 932 * @throws {BusinessError} 201 - Permission denied. 933 * @throws {BusinessError} 801 - Capability not supported. 934 * @throws {BusinessError} 2501000 - Operation failed. 935 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 936 * @syscap SystemCapability.Communication.WiFi.STA 937 * @since 11 938 */ 939 function isMeteredHotspot(): boolean; 940 941 /** 942 * Enable hiLink handshake. 943 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 944 * @param { boolean } isHiLinkEnable - Indicates the HiLink enable or not. 945 * @param { string } bssid - Indicates the Wi-Fi bssid. 946 * @param { WifiDeviceConfig } config - Indicates the Wi-Fi device config. 947 * @throws {BusinessError} 201 - Permission denied. 948 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 949 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 950 * 2. Incorrect parameter types. 3.Parameter verification failed. 951 * @throws {BusinessError} 801 - Capability not supported. 952 * @throws {BusinessError} 2501000 - Operation failed. 953 * @throws {BusinessError} 2501001 - Wi-Fi STA disabled. 954 * @syscap SystemCapability.Communication.WiFi.STA 955 * @systemapi Hide this for inner system use. 956 * @since 12 957 */ 958 function enableHiLinkHandshake(isHiLinkEnable: boolean, bssid: string, config: WifiDeviceConfig): void; 959 960 /** 961 * Reset all saved device configure. 962 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 963 * @throws {BusinessError} 201 - Permission denied. 964 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 965 * @throws {BusinessError} 801 - Capability not supported. 966 * @throws {BusinessError} 2501000 - Operation failed. 967 * @syscap SystemCapability.Communication.WiFi.STA 968 * @systemapi Hide this for inner system use. 969 * @since 11 970 */ 971 function factoryReset(): void; 972 973 /** 974 * Enable Wi-Fi hotspot function. 975 * This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled. 976 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 977 * @throws {BusinessError} 201 - Permission denied. 978 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 979 * @throws {BusinessError} 801 - Capability not supported. 980 * @throws {BusinessError} 2601000 - Operation failed. 981 * @syscap SystemCapability.Communication.WiFi.AP.Core 982 * @systemapi Hide this for inner system use. 983 * @since 9 984 */ 985 function enableHotspot(): void; 986 987 /** 988 * Disable Wi-Fi hotspot function. 989 * This method is asynchronous. If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled. 990 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 991 * @throws {BusinessError} 201 - Permission denied. 992 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 993 * @throws {BusinessError} 801 - Capability not supported. 994 * @throws {BusinessError} 2601000 - Operation failed. 995 * @syscap SystemCapability.Communication.WiFi.AP.Core 996 * @systemapi Hide this for inner system use. 997 * @since 9 998 */ 999 function disableHotspot(): void; 1000 1001 /** 1002 * Check whether a device serving as a Wi-Fi hotspot supports both the 2.4 GHz and 5 GHz Wi-Fi. 1003 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT 1004 * @returns { boolean } Returns {@code true} if the method is called successfully, returns {@code false} otherwise. 1005 * @throws {BusinessError} 201 - Permission denied. 1006 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1007 * @throws {BusinessError} 801 - Capability not supported. 1008 * @throws {BusinessError} 2601000 - Operation failed. 1009 * @syscap SystemCapability.Communication.WiFi.AP.Core 1010 * @systemapi Hide this for inner system use. 1011 * @since 9 1012 */ 1013 function isHotspotDualBandSupported(): boolean; 1014 1015 /** 1016 * Check whether Wi-Fi hotspot is active on a device. 1017 * @permission ohos.permission.GET_WIFI_INFO 1018 * @returns { boolean } {@code true} if Wi-Fi hotspot is enabled, returns {@code false} otherwise. 1019 * @throws {BusinessError} 201 - Permission denied. 1020 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1021 * @throws {BusinessError} 801 - Capability not supported. 1022 * @throws {BusinessError} 2601000 - Operation failed. 1023 * @syscap SystemCapability.Communication.WiFi.AP.Core 1024 * @systemapi Hide this for inner system use. 1025 * @since 9 1026 */ 1027 function isHotspotActive(): boolean; 1028 1029 /** 1030 * Set the hotspot configuration for the device. 1031 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 1032 * @param { HotspotConfig } config - Indicates the Wi-Fi hotspot configuration. 1033 * The SSID and {@code securityType} must be available and correct. 1034 * If {@code securityType} is not {@code open}, {@code preSharedKey} must be available and correct. 1035 * @throws {BusinessError} 201 - Permission denied. 1036 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1037 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Incorrect parameter types. 1038 * 2.Parameter verification failed. 1039 * @throws {BusinessError} 801 - Capability not supported. 1040 * @throws {BusinessError} 2601000 - Operation failed. 1041 * @syscap SystemCapability.Communication.WiFi.AP.Core 1042 * @systemapi Hide this for inner system use. 1043 * @since 9 1044 */ 1045 function setHotspotConfig(config: HotspotConfig): void; 1046 1047 /** 1048 * Obtain the Wi-Fi hotspot configuration. 1049 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 1050 * @returns { HotspotConfig } Returns the configuration of an existed or enabled Wi-Fi hotspot. 1051 * @throws {BusinessError} 201 - Permission denied. 1052 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1053 * @throws {BusinessError} 801 - Capability not supported. 1054 * @throws {BusinessError} 2601000 - Operation failed. 1055 * @syscap SystemCapability.Communication.WiFi.AP.Core 1056 * @systemapi Hide this for inner system use. 1057 * @since 9 1058 */ 1059 function getHotspotConfig(): HotspotConfig; 1060 1061 /** 1062 * Obtain the list of stations that are connected to the Wi-Fi hotspot. 1063 * This method can only be used on a device that serves as a Wi-Fi hotspot. 1064 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT 1065 * @returns { Array<StationInfo> } the list of clients that are connected to the Wi-Fi hotspot. 1066 * @throws {BusinessError} 201 - Permission denied. 1067 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1068 * @throws {BusinessError} 801 - Capability not supported. 1069 * @throws {BusinessError} 2601000 - Operation failed. 1070 * @syscap SystemCapability.Communication.WiFi.AP.Core 1071 * @systemapi Hide this for inner system use. 1072 * @since 9 1073 */ 1074 /** 1075 * Obtain the list of stations that are connected to the Wi-Fi hotspot. 1076 * This method can only be used on a device that serves as a Wi-Fi hotspot. 1077 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT 1078 * @returns { Array<StationInfo> } the list of clients that are connected to the Wi-Fi hotspot. 1079 * @throws {BusinessError} 201 - Permission denied. 1080 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1081 * @throws {BusinessError} 801 - Capability not supported. 1082 * @throws {BusinessError} 2601000 - Operation failed. 1083 * @syscap SystemCapability.Communication.WiFi.AP.Core 1084 * @systemapi Hide this for inner system use. 1085 * @since 10 1086 */ 1087 function getStations(): Array<StationInfo>; 1088 1089 /** 1090 * Add the station into the block list, the station can NOT access the hotspot. 1091 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT 1092 * @param { StationInfo } stationInfo - station which will be added in the block list. 1093 * @throws {BusinessError} 201 - Permission denied. 1094 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1095 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1.Incorrect parameter types. 1096 * 2.Parameter verification failed. 1097 * @throws {BusinessError} 801 - Capability not supported. 1098 * @throws {BusinessError} 2601000 - Operation failed. 1099 * @syscap SystemCapability.Communication.WiFi.AP.Core 1100 * @systemapi Hide this for inner system use. 1101 * @since 11 1102 */ 1103 function addHotspotBlockList(stationInfo: StationInfo); 1104 1105 /** 1106 * Delete the station from block list, the station can access the hotspot. 1107 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT 1108 * @param { StationInfo } stationInfo - station which will be deleted in the block list. 1109 * @throws {BusinessError} 201 - Permission denied. 1110 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1111 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1.Incorrect parameter types. 1112 * 2.Parameter verification failed. 1113 * @throws {BusinessError} 801 - Capability not supported. 1114 * @throws {BusinessError} 2601000 - Operation failed. 1115 * @syscap SystemCapability.Communication.WiFi.AP.Core 1116 * @systemapi Hide this for inner system use. 1117 * @since 11 1118 */ 1119 function delHotspotBlockList(stationInfo: StationInfo); 1120 1121 /** 1122 * Get all the stations in the block list. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid. 1123 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT 1124 * @returns { Array<StationInfo> } stations in the block list. 1125 * @throws {BusinessError} 201 - Permission denied. 1126 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1127 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1128 * @throws {BusinessError} 801 - Capability not supported. 1129 * @throws {BusinessError} 2601000 - Hotspot module error. 1130 * @syscap SystemCapability.Communication.WiFi.AP.Core 1131 * @systemapi Hide this for inner system use. 1132 * @since 11 1133 */ 1134 function getHotspotBlockList(): Array<StationInfo>; 1135 1136 /** 1137 * Obtain information about the P2P connection. 1138 * @permission ohos.permission.GET_WIFI_INFO 1139 * @returns { Promise<WifiP2pLinkedInfo> } Returns p2p linked information. 1140 * @throws {BusinessError} 201 - Permission denied. 1141 * @throws {BusinessError} 801 - Capability not supported. 1142 * @throws {BusinessError} 2801000 - Operation failed. 1143 * @syscap SystemCapability.Communication.WiFi.P2P 1144 * @since 9 1145 */ 1146 function getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo>; 1147 1148 /** 1149 * Obtain information about the P2P connection. 1150 * @permission ohos.permission.GET_WIFI_INFO 1151 * @param { AsyncCallback<WifiP2pLinkedInfo> } callback - Indicates callback of function. 1152 * @throws {BusinessError} 201 - Permission denied. 1153 * @throws {BusinessError} 801 - Capability not supported. 1154 * @throws {BusinessError} 2801000 - P2P module error. 1155 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1156 * @syscap SystemCapability.Communication.WiFi.P2P 1157 * @since 9 1158 */ 1159 function getP2pLinkedInfo(callback: AsyncCallback<WifiP2pLinkedInfo>): void; 1160 1161 /** 1162 * Obtain information about the current p2p group. 1163 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1164 * @returns { Promise<WifiP2pGroupInfo> } Returns p2p group information. 1165 * @throws {BusinessError} 201 - Permission denied. 1166 * @throws {BusinessError} 801 - Capability not supported. 1167 * @throws {BusinessError} 2801000 - Operation failed. 1168 * @syscap SystemCapability.Communication.WiFi.P2P 1169 * @since 9 1170 */ 1171 /** 1172 * Obtain information about the current p2p group. 1173 * @permission ohos.permission.GET_WIFI_INFO 1174 * @returns { Promise<WifiP2pGroupInfo> } Returns p2p group information. 1175 * @throws {BusinessError} 201 - Permission denied. 1176 * @throws {BusinessError} 801 - Capability not supported. 1177 * @throws {BusinessError} 2801000 - Operation failed. 1178 * @syscap SystemCapability.Communication.WiFi.P2P 1179 * @since 10 1180 */ 1181 function getCurrentGroup(): Promise<WifiP2pGroupInfo>; 1182 1183 /** 1184 * Obtain information about the current p2p group. 1185 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1186 * @param { AsyncCallback<WifiP2pGroupInfo> } callback - Indicates callback of function. 1187 * @throws {BusinessError} 201 - Permission denied. 1188 * @throws {BusinessError} 801 - Capability not supported. 1189 * @throws {BusinessError} 2801000 - P2P module error. 1190 * @syscap SystemCapability.Communication.WiFi.P2P 1191 * @since 9 1192 */ 1193 /** 1194 * Obtain information about the current p2p group. 1195 * @permission ohos.permission.GET_WIFI_INFO 1196 * @param { AsyncCallback<WifiP2pGroupInfo> } callback - Indicates callback of function. 1197 * @throws {BusinessError} 201 - Permission denied. 1198 * @throws {BusinessError} 801 - Capability not supported. 1199 * @throws {BusinessError} 2801000 - P2P module error. 1200 * @syscap SystemCapability.Communication.WiFi.P2P 1201 * @since 10 1202 */ 1203 function getCurrentGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void; 1204 1205 /** 1206 * Obtain the information about the found devices. 1207 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1208 * @returns { Promise<WifiP2pDevice[]> } Returns p2p device information. 1209 * @throws {BusinessError} 201 - Permission denied. 1210 * @throws {BusinessError} 801 - Capability not supported. 1211 * @throws {BusinessError} 2801000 - Operation failed. 1212 * @syscap SystemCapability.Communication.WiFi.P2P 1213 * @since 9 1214 */ 1215 /** 1216 * Obtain the information about the found devices. 1217 * @permission ohos.permission.GET_WIFI_INFO 1218 * @returns { Promise<WifiP2pDevice[]> } Returns p2p device information. 1219 * @throws {BusinessError} 201 - Permission denied. 1220 * @throws {BusinessError} 801 - Capability not supported. 1221 * @throws {BusinessError} 2801000 - Operation failed. 1222 * @syscap SystemCapability.Communication.WiFi.P2P 1223 * @since 10 1224 */ 1225 function getP2pPeerDevices(): Promise<WifiP2pDevice[]>; 1226 1227 /** 1228 * Obtain the information about the found devices. 1229 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1230 * @param { AsyncCallback<WifiP2pDevice[]> } callback - Indicates callback of function. 1231 * @throws {BusinessError} 201 - Permission denied. 1232 * @throws {BusinessError} 801 - Capability not supported. 1233 * @throws {BusinessError} 2801000 - P2P module error. 1234 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1235 * @syscap SystemCapability.Communication.WiFi.P2P 1236 * @since 9 1237 */ 1238 /** 1239 * Obtain the information about the found devices. 1240 * @permission ohos.permission.GET_WIFI_INFO 1241 * @param { AsyncCallback<WifiP2pDevice[]> } callback - Indicates callback of function. 1242 * @throws {BusinessError} 201 - Permission denied. 1243 * @throws {BusinessError} 801 - Capability not supported. 1244 * @throws {BusinessError} 2801000 - P2P module error. 1245 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1246 * @syscap SystemCapability.Communication.WiFi.P2P 1247 * @since 10 1248 */ 1249 function getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void; 1250 1251 /** 1252 * Obtain the information about own device information. 1253 * DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00", 1254 * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted. 1255 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 1256 * @returns { Promise<WifiP2pDevice> } Returns the information about own device info. 1257 * @throws {BusinessError} 201 - Permission denied. 1258 * @throws {BusinessError} 801 - Capability not supported. 1259 * @throws {BusinessError} 2801000 - Operation failed. 1260 * @syscap SystemCapability.Communication.WiFi.P2P 1261 * @since 9 1262 */ 1263 /** 1264 * Obtain the information about own device information. 1265 * DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00", 1266 * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted. 1267 * @permission ohos.permission.GET_WIFI_INFO 1268 * @returns { Promise<WifiP2pDevice> } Returns the information about own device info. 1269 * @throws {BusinessError} 201 - Permission denied. 1270 * @throws {BusinessError} 801 - Capability not supported. 1271 * @throws {BusinessError} 2801000 - Operation failed. 1272 * @syscap SystemCapability.Communication.WiFi.P2P 1273 * @since 11 1274 */ 1275 function getP2pLocalDevice(): Promise<WifiP2pDevice>; 1276 1277 /** 1278 * Obtain the information about own device information. 1279 * DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00", 1280 * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted. 1281 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 1282 * @param { AsyncCallback<WifiP2pDevice> } callback - Indicates callback of function. 1283 * @throws {BusinessError} 201 - Permission denied. 1284 * @throws {BusinessError} 801 - Capability not supported. 1285 * @throws {BusinessError} 2801000 - P2P module error. 1286 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1287 * @syscap SystemCapability.Communication.WiFi.P2P 1288 * @since 9 1289 */ 1290 /** 1291 * Obtain the information about own device information. 1292 * DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00", 1293 * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted. 1294 * @permission ohos.permission.GET_WIFI_INFO 1295 * @param { AsyncCallback<WifiP2pDevice> } callback - Indicates callback of function. 1296 * @throws {BusinessError} 201 - Permission denied. 1297 * @throws {BusinessError} 801 - Capability not supported. 1298 * @throws {BusinessError} 2801000 - P2P module error. 1299 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1300 * @syscap SystemCapability.Communication.WiFi.P2P 1301 * @since 11 1302 */ 1303 function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void; 1304 1305 /** 1306 * Create a P2P group. 1307 * @permission ohos.permission.GET_WIFI_INFO 1308 * @param { WifiP2PConfig } config - Indicates the configuration for a group. 1309 * @throws {BusinessError} 201 - Permission denied. 1310 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1.Incorrect parameter types. 1311 * 2.Parameter verification failed. 1312 * @throws {BusinessError} 801 - Capability not supported. 1313 * @throws {BusinessError} 2801000 - Operation failed. 1314 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1315 * @syscap SystemCapability.Communication.WiFi.P2P 1316 * @since 9 1317 */ 1318 function createGroup(config: WifiP2PConfig): void; 1319 1320 /** 1321 * Remove a P2P group. 1322 * @permission ohos.permission.GET_WIFI_INFO 1323 * @throws {BusinessError} 201 - Permission denied. 1324 * @throws {BusinessError} 801 - Capability not supported. 1325 * @throws {BusinessError} 2801000 - Operation failed. 1326 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1327 * @syscap SystemCapability.Communication.WiFi.P2P 1328 * @since 9 1329 */ 1330 function removeGroup(): void; 1331 1332 /** 1333 * Initiate a P2P connection to a device with the specified configuration. 1334 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1335 * @param { WifiP2PConfig } config - Indicates the configuration for connecting to a specific group. 1336 * @throws {BusinessError} 201 - Permission denied. 1337 * @throws {BusinessError} 401 - Invalid parameters. 1338 * @throws {BusinessError} 801 - Capability not supported. 1339 * @throws {BusinessError} 2801000 - Operation failed. 1340 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1341 * @syscap SystemCapability.Communication.WiFi.P2P 1342 * @since 9 1343 */ 1344 /** 1345 * Initiate a P2P connection to a device with the specified configuration. 1346 * @permission ohos.permission.GET_WIFI_INFO 1347 * @param { WifiP2PConfig } config - Indicates the configuration for connecting to a specific group. 1348 * @throws {BusinessError} 201 - Permission denied. 1349 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1.Incorrect parameter types. 1350 * 2.Parameter verification failed. 1351 * @throws {BusinessError} 801 - Capability not supported. 1352 * @throws {BusinessError} 2801000 - Operation failed. 1353 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1354 * @syscap SystemCapability.Communication.WiFi.P2P 1355 * @since 10 1356 */ 1357 function p2pConnect(config: WifiP2PConfig): void; 1358 1359 /** 1360 * Stop an ongoing p2p connection that is being established. 1361 * @permission ohos.permission.GET_WIFI_INFO 1362 * @throws {BusinessError} 201 - Permission denied. 1363 * @throws {BusinessError} 801 - Capability not supported. 1364 * @throws {BusinessError} 2801000 - Operation failed. 1365 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1366 * @syscap SystemCapability.Communication.WiFi.P2P 1367 * @since 9 1368 */ 1369 function p2pCancelConnect(): void; 1370 1371 /** 1372 * Start discover Wi-Fi P2P devices. 1373 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1374 * @throws {BusinessError} 201 - Permission denied. 1375 * @throws {BusinessError} 801 - Capability not supported. 1376 * @throws {BusinessError} 2801000 - Operation failed. 1377 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1378 * @syscap SystemCapability.Communication.WiFi.P2P 1379 * @since 9 1380 */ 1381 /** 1382 * Start discover Wi-Fi P2P devices. 1383 * @permission ohos.permission.GET_WIFI_INFO 1384 * @throws {BusinessError} 201 - Permission denied. 1385 * @throws {BusinessError} 801 - Capability not supported. 1386 * @throws {BusinessError} 2801000 - Operation failed. 1387 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1388 * @syscap SystemCapability.Communication.WiFi.P2P 1389 * @since 10 1390 */ 1391 function startDiscoverDevices(): void; 1392 1393 /** 1394 * Stop discover Wi-Fi P2P devices. 1395 * @permission ohos.permission.GET_WIFI_INFO 1396 * @throws {BusinessError} 201 - Permission denied. 1397 * @throws {BusinessError} 801 - Capability not supported. 1398 * @throws {BusinessError} 2801000 - Operation failed. 1399 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1400 * @syscap SystemCapability.Communication.WiFi.P2P 1401 * @since 9 1402 */ 1403 function stopDiscoverDevices(): void; 1404 1405 /** 1406 * Delete the persistent P2P group with the specified network ID. 1407 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 1408 * @param { number } netId - Indicates the network ID of the group to be deleted. 1409 * @throws {BusinessError} 201 - Permission denied. 1410 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1411 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1.Incorrect parameter types. 1412 * @throws {BusinessError} 801 - Capability not supported. 1413 * @throws {BusinessError} 2801000 - Operation failed. 1414 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1415 * @syscap SystemCapability.Communication.WiFi.P2P 1416 * @systemapi Hide this for inner system use. 1417 * @since 9 1418 */ 1419 function deletePersistentGroup(netId: number): void; 1420 1421 /** 1422 * Obtain information about the groups. 1423 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1424 * @returns { Promise<Array<WifiP2pGroupInfo>> } Returns the information about own device info. 1425 * @throws {BusinessError} 201 - Permission denied. 1426 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1427 * @throws {BusinessError} 801 - Capability not supported. 1428 * @throws {BusinessError} 2801000 - Operation failed. 1429 * @syscap SystemCapability.Communication.WiFi.P2P 1430 * @systemapi Hide this for inner system use. 1431 * @since 9 1432 */ 1433 /** 1434 * Obtain information about the groups. 1435 * @permission ohos.permission.GET_WIFI_INFO 1436 * @returns { Promise<Array<WifiP2pGroupInfo>> } Returns the information about own device info. 1437 * @throws {BusinessError} 201 - Permission denied. 1438 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1439 * @throws {BusinessError} 801 - Capability not supported. 1440 * @throws {BusinessError} 2801000 - Operation failed. 1441 * @syscap SystemCapability.Communication.WiFi.P2P 1442 * @systemapi Hide this for inner system use. 1443 * @since 10 1444 */ 1445 function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>>; 1446 1447 /** 1448 * Obtain information about the groups. 1449 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1450 * @param { AsyncCallback<Array<WifiP2pGroupInfo>> } callback - Indicates callback of function. 1451 * @throws {BusinessError} 201 - Permission denied. 1452 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1453 * @throws {BusinessError} 801 - Capability not supported. 1454 * @throws {BusinessError} 2801000 - P2P module error. 1455 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1456 * @syscap SystemCapability.Communication.WiFi.P2P 1457 * @systemapi Hide this for inner system use. 1458 * @since 9 1459 */ 1460 /** 1461 * Obtain information about the groups. 1462 * @permission ohos.permission.GET_WIFI_INFO 1463 * @param { AsyncCallback<Array<WifiP2pGroupInfo>> } callback - Indicates callback of function. 1464 * @throws {BusinessError} 201 - Permission denied. 1465 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1466 * @throws {BusinessError} 801 - Capability not supported. 1467 * @throws {BusinessError} 2801000 - P2P module error. 1468 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1469 * @syscap SystemCapability.Communication.WiFi.P2P 1470 * @systemapi Hide this for inner system use. 1471 * @since 10 1472 */ 1473 function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void; 1474 1475 /** 1476 * Set the name of the Wi-Fi P2P device. 1477 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 1478 * @param { string } devName - Indicate the name to be set. 1479 * @throws {BusinessError} 201 - Permission denied. 1480 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1481 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1482 * 2. Incorrect parameter types. 3.Parameter verification failed. 1483 * @throws {BusinessError} 801 - Capability not supported. 1484 * @throws {BusinessError} 2801000 - Operation failed. 1485 * @throws {BusinessError} 2801001 - Wi-Fi STA disabled. 1486 * @syscap SystemCapability.Communication.WiFi.P2P 1487 * @systemapi Hide this for inner system use. 1488 * @since 9 1489 */ 1490 function setDeviceName(devName: string): void; 1491 1492 /** 1493 * Subscribe Wi-Fi status change events. 1494 * @permission ohos.permission.GET_WIFI_INFO 1495 * @param { 'wifiStateChange' } type - event name. 1496 * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating 1497 * @throws {BusinessError} 201 - Permission denied. 1498 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1499 * 2. Incorrect parameter types. 1500 * @throws {BusinessError} 801 - Capability not supported. 1501 * @throws {BusinessError} 2501000 - Operation failed. 1502 * @syscap SystemCapability.Communication.WiFi.STA 1503 * @since 9 1504 */ 1505 1506 /** 1507 * Subscribe Wi-Fi status change events. 1508 * @permission ohos.permission.GET_WIFI_INFO 1509 * @param { 'wifiStateChange' } type - event name. 1510 * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating 1511 * @throws {BusinessError} 201 - Permission denied. 1512 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1513 * 2. Incorrect parameter types. 1514 * @throws {BusinessError} 801 - Capability not supported. 1515 * @throws {BusinessError} 2501000 - Operation failed. 1516 * @syscap SystemCapability.Communication.WiFi.STA 1517 * @crossplatform 1518 * @atomicservice 1519 * @since 12 1520 */ 1521 function on(type: 'wifiStateChange', callback: Callback<number>): void; 1522 1523 /** 1524 * Unsubscribe Wi-Fi status change events. 1525 * 1526 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 1527 * @permission ohos.permission.GET_WIFI_INFO 1528 * @param { 'wifiStateChange' } type - event name. 1529 * @param { Callback<number> } callback - the callback of off 1530 * @throws {BusinessError} 201 - Permission denied. 1531 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1532 * 2. Incorrect parameter types. 1533 * @throws {BusinessError} 801 - Capability not supported. 1534 * @throws {BusinessError} 2501000 - Operation failed. 1535 * @syscap SystemCapability.Communication.WiFi.STA 1536 * @since 9 1537 */ 1538 1539 /** 1540 * Unsubscribe Wi-Fi status change events. 1541 * 1542 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 1543 * @permission ohos.permission.GET_WIFI_INFO 1544 * @param { 'wifiStateChange' } type - event name. 1545 * @param { Callback<number> } callback - the callback of off 1546 * @throws {BusinessError} 201 - Permission denied. 1547 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1548 * 2. Incorrect parameter types. 1549 * @throws {BusinessError} 801 - Capability not supported. 1550 * @throws {BusinessError} 2501000 - Operation failed. 1551 * @syscap SystemCapability.Communication.WiFi.STA 1552 * @crossplatform 1553 * @atomicservice 1554 * @since 12 1555 */ 1556 function off(type: 'wifiStateChange', callback?: Callback<number>): void; 1557 1558 /** 1559 * Subscribe Wi-Fi connection change events. 1560 * @permission ohos.permission.GET_WIFI_INFO 1561 * @param { 'wifiConnectionChange' } type - event name. 1562 * @param { Callback<number> } callback - the callback of on, 0: disconnected, 1: connected 1563 * @throws {BusinessError} 201 - Permission denied. 1564 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1565 * 2. Incorrect parameter types. 1566 * @throws {BusinessError} 801 - Capability not supported. 1567 * @throws {BusinessError} 2501000 - Operation failed. 1568 * @syscap SystemCapability.Communication.WiFi.STA 1569 * @since 9 1570 */ 1571 1572 /** 1573 * Subscribe Wi-Fi connection change events. 1574 * @permission ohos.permission.GET_WIFI_INFO 1575 * @param { 'wifiConnectionChange' } type - event name. 1576 * @param { Callback<number> } callback - the callback of on, 0: disconnected, 1: connected 1577 * @throws {BusinessError} 201 - Permission denied. 1578 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1579 * 2. Incorrect parameter types. 1580 * @throws {BusinessError} 801 - Capability not supported. 1581 * @throws {BusinessError} 2501000 - Operation failed. 1582 * @syscap SystemCapability.Communication.WiFi.STA 1583 * @crossplatform 1584 * @atomicservice 1585 * @since 12 1586 */ 1587 function on(type: 'wifiConnectionChange', callback: Callback<number>): void; 1588 1589 /** 1590 * Unsubscribe Wi-Fi connection change events. 1591 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1592 * @permission ohos.permission.GET_WIFI_INFO 1593 * @param { 'wifiConnectionChange' } type - event name. 1594 * @param { Callback<number> } callback - the callback of off 1595 * @throws {BusinessError} 201 - Permission denied. 1596 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1597 * 2. Incorrect parameter types. 1598 * @throws {BusinessError} 801 - Capability not supported. 1599 * @throws {BusinessError} 2501000 - Operation failed. 1600 * @syscap SystemCapability.Communication.WiFi.STA 1601 * @since 9 1602 */ 1603 1604 /** 1605 * Unsubscribe Wi-Fi connection change events. 1606 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1607 * @permission ohos.permission.GET_WIFI_INFO 1608 * @param { 'wifiConnectionChange' } type - event name. 1609 * @param { Callback<number> } callback - the callback of off 1610 * @throws {BusinessError} 201 - Permission denied. 1611 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1612 * 2. Incorrect parameter types. 1613 * @throws {BusinessError} 801 - Capability not supported. 1614 * @throws {BusinessError} 2501000 - Operation failed. 1615 * @syscap SystemCapability.Communication.WiFi.STA 1616 * @crossplatform 1617 * @atomicservice 1618 * @since 12 1619 */ 1620 function off(type: 'wifiConnectionChange', callback?: Callback<number>): void; 1621 1622 /** 1623 * Subscribe Wi-Fi scan status change events. 1624 * @permission ohos.permission.GET_WIFI_INFO 1625 * @param { 'wifiScanStateChange' } type - event name. 1626 * @param { Callback<number> } callback - the callback of on, 0: scan fail, 1: scan success 1627 * @throws {BusinessError} 201 - Permission denied. 1628 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1629 * 2. Incorrect parameter types. 1630 * @throws {BusinessError} 801 - Capability not supported. 1631 * @throws {BusinessError} 2501000 - Operation failed. 1632 * @syscap SystemCapability.Communication.WiFi.STA 1633 * @since 9 1634 */ 1635 1636 /** 1637 * Subscribe Wi-Fi scan status change events. 1638 * @permission ohos.permission.GET_WIFI_INFO 1639 * @param { 'wifiScanStateChange' } type - event name. 1640 * @param { Callback<number> } callback - the callback of on, 0: scan fail, 1: scan success 1641 * @throws {BusinessError} 201 - Permission denied. 1642 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1643 * 2. Incorrect parameter types. 1644 * @throws {BusinessError} 801 - Capability not supported. 1645 * @throws {BusinessError} 2501000 - Operation failed. 1646 * @syscap SystemCapability.Communication.WiFi.STA 1647 * @atomicservice 1648 * @since 12 1649 */ 1650 function on(type: 'wifiScanStateChange', callback: Callback<number>): void; 1651 1652 /** 1653 * Unsubscribe Wi-Fi scan status change events. 1654 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1655 * @permission ohos.permission.GET_WIFI_INFO 1656 * @param { 'wifiScanStateChange' } type - event name. 1657 * @param { Callback<number> } callback - the callback of off 1658 * @throws {BusinessError} 201 - Permission denied. 1659 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1660 * 2. Incorrect parameter types. 1661 * @throws {BusinessError} 801 - Capability not supported. 1662 * @throws {BusinessError} 2501000 - Operation failed. 1663 * @syscap SystemCapability.Communication.WiFi.STA 1664 * @since 9 1665 */ 1666 1667 /** 1668 * Unsubscribe Wi-Fi scan status change events. 1669 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1670 * @permission ohos.permission.GET_WIFI_INFO 1671 * @param { 'wifiScanStateChange' } type - event name. 1672 * @param { Callback<number> } callback - the callback of off 1673 * @throws {BusinessError} 201 - Permission denied. 1674 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1675 * 2. Incorrect parameter types. 1676 * @throws {BusinessError} 801 - Capability not supported. 1677 * @throws {BusinessError} 2501000 - Operation failed. 1678 * @syscap SystemCapability.Communication.WiFi.STA 1679 * @atomicservice 1680 * @since 12 1681 */ 1682 function off(type: 'wifiScanStateChange', callback?: Callback<number>): void; 1683 1684 /** 1685 * Subscribe Wi-Fi rssi change events. 1686 * @permission ohos.permission.GET_WIFI_INFO 1687 * @param { 'wifiRssiChange' } type - event name. 1688 * @param { Callback<number> } callback - the callback of on 1689 * @throws {BusinessError} 201 - Permission denied. 1690 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1691 * 2. Incorrect parameter types. 1692 * @throws {BusinessError} 801 - Capability not supported. 1693 * @throws {BusinessError} 2501000 - Operation failed. 1694 * @syscap SystemCapability.Communication.WiFi.STA 1695 * @since 9 1696 */ 1697 function on(type: 'wifiRssiChange', callback: Callback<number>): void; 1698 1699 /** 1700 * Unsubscribe Wi-Fi rssi change events. 1701 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1702 * @permission ohos.permission.GET_WIFI_INFO 1703 * @param { 'wifiRssiChange' } type - event name. 1704 * @param { Callback<number> } callback - the callback of off 1705 * @throws {BusinessError} 201 - Permission denied. 1706 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1707 * 2. Incorrect parameter types. 1708 * @throws {BusinessError} 801 - Capability not supported. 1709 * @throws {BusinessError} 2501000 - Operation failed. 1710 * @syscap SystemCapability.Communication.WiFi.STA 1711 * @since 9 1712 */ 1713 function off(type: 'wifiRssiChange', callback?: Callback<number>): void; 1714 1715 /** 1716 * Subscribe Wi-Fi stream change events. 1717 * @permission ohos.permission.MANAGE_WIFI_CONNECTION 1718 * @param { 'streamChange' } type - event name. 1719 * @param { Callback<number> } callback - the callback of on, 1: stream down, 2: stream up, 3: stream bidirectional 1720 * @throws {BusinessError} 201 - Permission denied. 1721 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1722 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1723 * 2. Incorrect parameter types. 1724 * @throws {BusinessError} 801 - Capability not supported. 1725 * @throws {BusinessError} 2501000 - Operation failed. 1726 * @syscap SystemCapability.Communication.WiFi.STA 1727 * @systemapi Hide this for inner system use. 1728 * @since 9 1729 */ 1730 function on(type: 'streamChange', callback: Callback<number>): void; 1731 1732 /** 1733 * Unsubscribe Wi-Fi stream change events. 1734 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1735 * @permission ohos.permission.MANAGE_WIFI_CONNECTION 1736 * @param { 'streamChange' } type - event name. 1737 * @param { Callback<number> } callback - the callback of off 1738 * @throws {BusinessError} 201 - Permission denied. 1739 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1740 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1741 * 2. Incorrect parameter types. 1742 * @throws {BusinessError} 801 - Capability not supported. 1743 * @throws {BusinessError} 2501000 - Operation failed. 1744 * @syscap SystemCapability.Communication.WiFi.STA 1745 * @systemapi Hide this for inner system use. 1746 * @since 9 1747 */ 1748 function off(type: 'streamChange', callback?: Callback<number>): void; 1749 1750 /** 1751 * Subscribe Wi-Fi device config change events. 1752 * @permission ohos.permission.GET_WIFI_INFO 1753 * @param { 'deviceConfigChange' } type - event name. 1754 * @param { Callback<number> } callback - the callback of on, 0: config is added, 1: config is changed, 2: config is removed. 1755 * @throws {BusinessError} 201 - Permission denied. 1756 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1757 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1758 * 2. Incorrect parameter types. 1759 * @throws {BusinessError} 801 - Capability not supported. 1760 * @throws {BusinessError} 2501000 - Operation failed. 1761 * @syscap SystemCapability.Communication.WiFi.STA 1762 * @systemapi Hide this for inner system use. 1763 * @since 9 1764 */ 1765 function on(type: 'deviceConfigChange', callback: Callback<number>): void; 1766 1767 /** 1768 * Subscribe Wi-Fi device config change events. 1769 * @permission ohos.permission.GET_WIFI_INFO 1770 * @param { 'deviceConfigChange' } type - event name. 1771 * @param { Callback<number> } callback - the callback of off, 0: config is added, 1: config is changed, 2: config is removed. 1772 * @throws {BusinessError} 201 - Permission denied. 1773 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1774 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1775 * 2. Incorrect parameter types. 1776 * @throws {BusinessError} 801 - Capability not supported. 1777 * @throws {BusinessError} 2501000 - Operation failed. 1778 * @syscap SystemCapability.Communication.WiFi.STA 1779 * @systemapi Hide this for inner system use. 1780 * @since 9 1781 */ 1782 function off(type: 'deviceConfigChange', callback?: Callback<number>): void; 1783 1784 /** 1785 * Subscribe Wi-Fi hotspot state change events. 1786 * @permission ohos.permission.GET_WIFI_INFO 1787 * @param { 'hotspotStateChange' } type - event name. 1788 * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating 1789 * @throws {BusinessError} 201 - Permission denied. 1790 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1791 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1792 * 2. Incorrect parameter types. 1793 * @throws {BusinessError} 801 - Capability not supported. 1794 * @throws {BusinessError} 2601000 - Operation failed. 1795 * @syscap SystemCapability.Communication.WiFi.AP.Core 1796 * @since 9 1797 */ 1798 function on(type: 'hotspotStateChange', callback: Callback<number>): void; 1799 1800 /** 1801 * Unsubscribe Wi-Fi hotspot state change events. 1802 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1803 * @permission ohos.permission.GET_WIFI_INFO 1804 * @param { 'hotspotStateChange'} type - event name. 1805 * @param { Callback<number> } callback - the callback of off 1806 * @throws {BusinessError} 201 - Permission denied. 1807 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1808 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1809 * 2. Incorrect parameter types. 1810 * @throws {BusinessError} 801 - Capability not supported. 1811 * @throws {BusinessError} 2601000 - Operation failed. 1812 * @syscap SystemCapability.Communication.WiFi.AP.Core 1813 * @since 9 1814 */ 1815 function off(type: 'hotspotStateChange', callback?: Callback<number>): void; 1816 1817 /** 1818 * Subscribe Wi-Fi hotspot sta join events. 1819 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 1820 * @param { 'hotspotStaJoin' } type - event name. 1821 * @param { Callback<StationInfo> } callback - the callback of on 1822 * @throws {BusinessError} 201 - Permission denied. 1823 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1824 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1825 * 2. Incorrect parameter types. 1826 * @throws {BusinessError} 801 - Capability not supported. 1827 * @throws {BusinessError} 2601000 - Operation failed. 1828 * @syscap SystemCapability.Communication.WiFi.AP.Core 1829 * @systemapi Hide this for inner system use. 1830 * @since 9 1831 */ 1832 function on(type: 'hotspotStaJoin', callback: Callback<StationInfo>): void; 1833 1834 /** 1835 * Unsubscribe Wi-Fi hotspot sta join events. 1836 * All callback functions will be deregistered If there is no specific callback parameter.</p> 1837 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 1838 * @param { 'hotspotStaJoin' } type - event name. 1839 * @param { Callback<StationInfo> } callback - the callback of off 1840 * @throws {BusinessError} 201 - Permission denied. 1841 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1842 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1843 * 2. Incorrect parameter types. 1844 * @throws {BusinessError} 801 - Capability not supported. 1845 * @throws {BusinessError} 2601000 - Operation failed. 1846 * @syscap SystemCapability.Communication.WiFi.AP.Core 1847 * @systemapi Hide this for inner system use. 1848 * @since 9 1849 */ 1850 function off(type: 'hotspotStaJoin', callback?: Callback<StationInfo>): void; 1851 1852 /** 1853 * Subscribe Wi-Fi hotspot sta leave events. 1854 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 1855 * @param { 'hotspotStaLeave' } type - event name. 1856 * @param { Callback<StationInfo> } callback - the callback of on 1857 * @throws {BusinessError} 201 - Permission denied. 1858 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1859 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1860 * 2. Incorrect parameter types. 1861 * @throws {BusinessError} 801 - Capability not supported. 1862 * @throws {BusinessError} 2601000 - Operation failed. 1863 * @syscap SystemCapability.Communication.WiFi.AP.Core 1864 1865 * @systemapi Hide this for inner system use. 1866 * @since 9 1867 */ 1868 function on(type: 'hotspotStaLeave', callback: Callback<StationInfo>): void; 1869 1870 /** 1871 * Unsubscribe Wi-Fi hotspot sta leave events. 1872 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 1873 * @param { 'hotspotStaLeave' } type - event name. 1874 * @param { Callback<StationInfo> } callback - the callback of off 1875 * @throws {BusinessError} 201 - Permission denied. 1876 * @throws {BusinessError} 202 - System API is not allowed called by Non-system application. 1877 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1878 * 2. Incorrect parameter types. 1879 * @throws {BusinessError} 801 - Capability not supported. 1880 * @throws {BusinessError} 2601000 - Operation failed. 1881 * @syscap SystemCapability.Communication.WiFi.AP.Core 1882 * @systemapi Hide this for inner system use. 1883 * @since 9 1884 */ 1885 function off(type: 'hotspotStaLeave', callback?: Callback<StationInfo>): void; 1886 1887 /** 1888 * Subscribe P2P status change events. 1889 * @permission ohos.permission.GET_WIFI_INFO 1890 * @param { 'p2pStateChange' } type - event name. 1891 * @param { Callback<number> } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed 1892 * @throws {BusinessError} 201 - Permission denied. 1893 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1894 * 2. Incorrect parameter types. 1895 * @throws {BusinessError} 801 - Capability not supported. 1896 * @throws {BusinessError} 2801000 - Operation failed. 1897 * @syscap SystemCapability.Communication.WiFi.P2P 1898 * @since 9 1899 */ 1900 function on(type: 'p2pStateChange', callback: Callback<number>): void; 1901 1902 /** 1903 * Unsubscribe P2P status change events. 1904 * @permission ohos.permission.GET_WIFI_INFO 1905 * @param { 'p2pStateChange' } type - event name. 1906 * @param { Callback<number> } callback - the callback of off 1907 * @throws {BusinessError} 201 - Permission denied. 1908 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1909 * 2. Incorrect parameter types. 1910 * @throws {BusinessError} 801 - Capability not supported. 1911 * @throws {BusinessError} 2801000 - Operation failed. 1912 * @syscap SystemCapability.Communication.WiFi.P2P 1913 * @since 9 1914 */ 1915 function off(type: 'p2pStateChange', callback?: Callback<number>): void; 1916 1917 /** 1918 * Subscribe P2P connection change events. 1919 * @permission ohos.permission.GET_WIFI_INFO 1920 * @param { 'p2pConnectionChange' } type - event name. 1921 * @param { Callback<WifiP2pLinkedInfo> } callback - the callback of on 1922 * @throws {BusinessError} 201 - Permission denied. 1923 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1924 * 2. Incorrect parameter types. 1925 * @throws {BusinessError} 801 - Capability not supported. 1926 * @throws {BusinessError} 2801000 - Operation failed. 1927 * @syscap SystemCapability.Communication.WiFi.P2P 1928 * @since 9 1929 */ 1930 function on(type: 'p2pConnectionChange', callback: Callback<WifiP2pLinkedInfo>): void; 1931 1932 /** 1933 * Unsubscribe P2P connection change events. 1934 * @permission ohos.permission.GET_WIFI_INFO 1935 * @param { 'p2pConnectionChange' } type - event name. 1936 * @param { Callback<WifiP2pLinkedInfo> } callback - the callback of off 1937 * @throws {BusinessError} 201 - Permission denied. 1938 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1939 * 2. Incorrect parameter types. 1940 * @throws {BusinessError} 801 - Capability not supported. 1941 * @throws {BusinessError} 2801000 - Operation failed. 1942 * @syscap SystemCapability.Communication.WiFi.P2P 1943 * @since 9 1944 */ 1945 function off(type: 'p2pConnectionChange', callback?: Callback<WifiP2pLinkedInfo>): void; 1946 1947 /** 1948 * Subscribe P2P local device change events. 1949 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1950 * @param { 'p2pDeviceChange' } type - event name. 1951 * @param { Callback<WifiP2pDevice> } callback - the callback of on 1952 * @throws {BusinessError} 201 - Permission denied. 1953 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1954 * 2. Incorrect parameter types. 1955 * @throws {BusinessError} 801 - Capability not supported. 1956 * @throws {BusinessError} 2801000 - Operation failed. 1957 * @syscap SystemCapability.Communication.WiFi.P2P 1958 * @since 9 1959 */ 1960 /** 1961 * Subscribe P2P local device change events. 1962 * @permission ohos.permission.GET_WIFI_INFO 1963 * @param { 'p2pDeviceChange' } type - event name. 1964 * @param { Callback<WifiP2pDevice> } callback - the callback of on 1965 * @throws {BusinessError} 201 - Permission denied. 1966 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1967 * 2. Incorrect parameter types. 1968 * @throws {BusinessError} 801 - Capability not supported. 1969 * @throws {BusinessError} 2801000 - Operation failed. 1970 * @syscap SystemCapability.Communication.WiFi.P2P 1971 * @since 10 1972 */ 1973 function on(type: 'p2pDeviceChange', callback: Callback<WifiP2pDevice>): void; 1974 1975 /** 1976 * Unsubscribe P2P local device change events. 1977 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 1978 * @param { 'p2pDeviceChange' } type - event name. 1979 * @param { Callback<WifiP2pDevice> } callback - the callback of off 1980 * @throws {BusinessError} 201 - Permission denied. 1981 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1982 * 2. Incorrect parameter types. 1983 * @throws {BusinessError} 801 - Capability not supported. 1984 * @throws {BusinessError} 2801000 - Operation failed. 1985 * @syscap SystemCapability.Communication.WiFi.P2P 1986 * @since 9 1987 */ 1988 /** 1989 * Unsubscribe P2P local device change events. 1990 * @param { 'p2pDeviceChange' } type - event name. 1991 * @param { Callback<WifiP2pDevice> } callback - the callback of off 1992 * @throws {BusinessError} 201 - Permission denied. 1993 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 1994 * 2. Incorrect parameter types. 1995 * @throws {BusinessError} 801 - Capability not supported. 1996 * @throws {BusinessError} 2801000 - Operation failed. 1997 * @syscap SystemCapability.Communication.WiFi.P2P 1998 * @since 10 1999 */ 2000 function off(type: 'p2pDeviceChange', callback?: Callback<WifiP2pDevice>): void; 2001 2002 /** 2003 * Subscribe P2P peer device change events. 2004 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 2005 * @param { 'p2pPeerDeviceChange' } type - event name. 2006 * @param { Callback<WifiP2pDevice[]> } callback - the callback of on 2007 * @throws {BusinessError} 201 - Permission denied. 2008 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2009 * 2. Incorrect parameter types. 2010 * @throws {BusinessError} 801 - Capability not supported. 2011 * @throws {BusinessError} 2801000 - Operation failed. 2012 * @syscap SystemCapability.Communication.WiFi.P2P 2013 * @since 9 2014 */ 2015 /** 2016 * Subscribe P2P peer device change events. 2017 * @permission ohos.permission.GET_WIFI_INFO 2018 * @param { 'p2pPeerDeviceChange' } type - event name. 2019 * @param { Callback<WifiP2pDevice[]> } callback - the callback of on 2020 * @throws {BusinessError} 201 - Permission denied. 2021 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2022 * 2. Incorrect parameter types. 2023 * @throws {BusinessError} 801 - Capability not supported. 2024 * @throws {BusinessError} 2801000 - Operation failed. 2025 * @syscap SystemCapability.Communication.WiFi.P2P 2026 * @since 10 2027 */ 2028 function on(type: 'p2pPeerDeviceChange', callback: Callback<WifiP2pDevice[]>): void; 2029 2030 /** 2031 * Unsubscribe P2P peer device change events. 2032 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 2033 * @param { 'p2pPeerDeviceChange' } type - event name. 2034 * @param { Callback<WifiP2pDevice[]> } callback - the callback of off 2035 * @throws {BusinessError} 201 - Permission denied. 2036 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2037 * 2. Incorrect parameter types. 2038 * @throws {BusinessError} 801 - Capability not supported. 2039 * @throws {BusinessError} 2801000 - Operation failed. 2040 * @syscap SystemCapability.Communication.WiFi.P2P 2041 * @since 9 2042 */ 2043 /** 2044 * Unsubscribe P2P peer device change events. 2045 * @param { 'p2pPeerDeviceChange' } type - event name. 2046 * @param { Callback<WifiP2pDevice[]> } callback - the callback of off 2047 * @throws {BusinessError} 201 - Permission denied. 2048 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2049 * 2. Incorrect parameter types. 2050 * @throws {BusinessError} 801 - Capability not supported. 2051 * @throws {BusinessError} 2801000 - Operation failed. 2052 * @syscap SystemCapability.Communication.WiFi.P2P 2053 * @since 10 2054 */ 2055 function off(type: 'p2pPeerDeviceChange', callback?: Callback<WifiP2pDevice[]>): void; 2056 2057 /** 2058 * Subscribe P2P persistent group change events. 2059 * @permission ohos.permission.GET_WIFI_INFO 2060 * @param { 'p2pPersistentGroupChange' } type - event name. 2061 * @param { Callback<void> } callback - the callback of on 2062 * @throws {BusinessError} 201 - Permission denied. 2063 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2064 * 2. Incorrect parameter types. 2065 * @throws {BusinessError} 801 - Capability not supported. 2066 * @throws {BusinessError} 2801000 - Operation failed. 2067 * @syscap SystemCapability.Communication.WiFi.P2P 2068 * @since 9 2069 */ 2070 function on(type: 'p2pPersistentGroupChange', callback: Callback<void>): void; 2071 2072 /** 2073 * Unsubscribe P2P persistent group change events. 2074 * @permission ohos.permission.GET_WIFI_INFO 2075 * @param { 'p2pPersistentGroupChange' } type - event name. 2076 * @param { Callback<void> } callback - the callback of off 2077 * @throws {BusinessError} 201 - Permission denied. 2078 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2079 * 2. Incorrect parameter types. 2080 * @throws {BusinessError} 801 - Capability not supported. 2081 * @throws {BusinessError} 2801000 - Operation failed. 2082 * @syscap SystemCapability.Communication.WiFi.P2P 2083 * @since 9 2084 */ 2085 function off(type: 'p2pPersistentGroupChange', callback?: Callback<void>): void; 2086 2087 /** 2088 * Subscribe P2P discovery events. 2089 * @permission ohos.permission.GET_WIFI_INFO 2090 * @param { 'p2pDiscoveryChange' } type - event name. 2091 * @param { Callback<number> } callback - the callback of on 2092 * @throws {BusinessError} 201 - Permission denied. 2093 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2094 * 2. Incorrect parameter types. 2095 * @throws {BusinessError} 801 - Capability not supported. 2096 * @throws {BusinessError} 2801000 - Operation failed. 2097 * @syscap SystemCapability.Communication.WiFi.P2P 2098 * @since 9 2099 */ 2100 function on(type: 'p2pDiscoveryChange', callback: Callback<number>): void; 2101 2102 /** 2103 * Unsubscribe P2P discovery events. 2104 * @permission ohos.permission.GET_WIFI_INFO 2105 * @param { 'p2pDiscoveryChange' } type - event name. 2106 * @param { Callback<number> } callback - the callback of off 2107 * @throws {BusinessError} 201 - Permission denied. 2108 * @throws {BusinessError} 401 - Invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified. 2109 * 2. Incorrect parameter types. 2110 * @throws {BusinessError} 801 - Capability not supported. 2111 * @throws {BusinessError} 2801000 - Operation failed. 2112 * @syscap SystemCapability.Communication.WiFi.P2P 2113 * @since 9 2114 */ 2115 function off(type: 'p2pDiscoveryChange', callback?: Callback<number>): void; 2116 2117 /** 2118 * Wi-Fi device address( mac / bssid ) type. 2119 * @enum { number } 2120 * @syscap SystemCapability.Communication.WiFi.Core 2121 * @since 10 2122 */ 2123 2124 /** 2125 * Wi-Fi device address( mac / bssid ) type. 2126 * @enum { number } 2127 * @syscap SystemCapability.Communication.WiFi.Core 2128 * @atomicservice 2129 * @since 12 2130 */ 2131 enum DeviceAddressType { 2132 /** 2133 * random device address 2134 * @syscap SystemCapability.Communication.WiFi.Core 2135 * @since 10 2136 */ 2137 2138 /** 2139 * random device address 2140 * @syscap SystemCapability.Communication.WiFi.Core 2141 * @atomicservice 2142 * @since 12 2143 */ 2144 RANDOM_DEVICE_ADDRESS, 2145 2146 /** 2147 * real device address 2148 * @syscap SystemCapability.Communication.WiFi.Core 2149 * @since 10 2150 */ 2151 2152 /** 2153 * real device address 2154 * @syscap SystemCapability.Communication.WiFi.Core 2155 * @atomicservice 2156 * @since 12 2157 */ 2158 REAL_DEVICE_ADDRESS, 2159 } 2160 2161 /** 2162 * Wi-Fi EAP method. 2163 * @enum { number } 2164 * @syscap SystemCapability.Communication.WiFi.STA 2165 * @since 10 2166 */ 2167 enum EapMethod { 2168 /** 2169 * EAP NONE 2170 * @syscap SystemCapability.Communication.WiFi.STA 2171 * @since 10 2172 */ 2173 EAP_NONE, 2174 /** 2175 * EAP PEAP 2176 * @syscap SystemCapability.Communication.WiFi.STA 2177 * @since 10 2178 */ 2179 EAP_PEAP, 2180 /** 2181 * EAP TLS 2182 * @syscap SystemCapability.Communication.WiFi.STA 2183 * @since 10 2184 */ 2185 EAP_TLS, 2186 /** 2187 * EAP TTLS 2188 * @syscap SystemCapability.Communication.WiFi.STA 2189 * @since 10 2190 */ 2191 EAP_TTLS, 2192 /** 2193 * EAP PWD 2194 * @syscap SystemCapability.Communication.WiFi.STA 2195 * @since 10 2196 */ 2197 EAP_PWD, 2198 /** 2199 * EAP SIM 2200 * @syscap SystemCapability.Communication.WiFi.STA 2201 * @since 10 2202 */ 2203 EAP_SIM, 2204 /** 2205 * EAP AKA 2206 * @syscap SystemCapability.Communication.WiFi.STA 2207 * @since 10 2208 */ 2209 EAP_AKA, 2210 /** 2211 * EAP AKA PRIME 2212 * @syscap SystemCapability.Communication.WiFi.STA 2213 * @since 10 2214 */ 2215 EAP_AKA_PRIME, 2216 /** 2217 * EAP UNAUTH TLS 2218 * @syscap SystemCapability.Communication.WiFi.STA 2219 * @since 10 2220 */ 2221 EAP_UNAUTH_TLS 2222 } 2223 2224 /** 2225 * Wi-Fi phase 2 method. 2226 * @enum { number } 2227 * @syscap SystemCapability.Communication.WiFi.STA 2228 * @since 10 2229 */ 2230 enum Phase2Method { 2231 /** 2232 * Phase2 NONE 2233 * @syscap SystemCapability.Communication.WiFi.STA 2234 * @since 10 2235 */ 2236 PHASE2_NONE, 2237 /** 2238 * Phase2 PAP 2239 * @syscap SystemCapability.Communication.WiFi.STA 2240 * @since 10 2241 */ 2242 PHASE2_PAP, 2243 /** 2244 * Phase2 MSCHAP 2245 * @syscap SystemCapability.Communication.WiFi.STA 2246 * @since 10 2247 */ 2248 PHASE2_MSCHAP, 2249 /** 2250 * Phase2 MSCHAPV2 2251 * @syscap SystemCapability.Communication.WiFi.STA 2252 * @since 10 2253 */ 2254 PHASE2_MSCHAPV2, 2255 /** 2256 * Phase2 GTC 2257 * @syscap SystemCapability.Communication.WiFi.STA 2258 * @since 10 2259 */ 2260 PHASE2_GTC, 2261 /** 2262 * Phase2 SIM 2263 * @syscap SystemCapability.Communication.WiFi.STA 2264 * @since 10 2265 */ 2266 PHASE2_SIM, 2267 /** 2268 * Phase2 AKA 2269 * @syscap SystemCapability.Communication.WiFi.STA 2270 * @since 10 2271 */ 2272 PHASE2_AKA, 2273 /** 2274 * Phase2 AKA+ 2275 * @syscap SystemCapability.Communication.WiFi.STA 2276 * @since 10 2277 */ 2278 PHASE2_AKA_PRIME 2279 } 2280 2281 /** 2282 * Wi-Fi disconnected reason. 2283 * @enum { number } 2284 * @syscap SystemCapability.Communication.WiFi.STA 2285 * @systemapi Hide this for inner system use. 2286 * @since 10 2287 */ 2288 enum DisconnectedReason { 2289 /** 2290 * Default reason 2291 * @syscap SystemCapability.Communication.WiFi.STA 2292 * @systemapi Hide this for inner system use. 2293 * @since 10 2294 */ 2295 DISC_REASON_DEFAULT = 0, 2296 2297 /** 2298 * Password is wrong 2299 * @syscap SystemCapability.Communication.WiFi.STA 2300 * @systemapi Hide this for inner system use. 2301 * @since 10 2302 */ 2303 DISC_REASON_WRONG_PWD = 1, 2304 2305 /** 2306 * The number of router's connection reaches the maximum number limit 2307 * @syscap SystemCapability.Communication.WiFi.STA 2308 * @systemapi Hide this for inner system use. 2309 * @since 10 2310 */ 2311 DISC_REASON_CONNECTION_FULL = 2 2312 } 2313 2314 /** 2315 * Wi-Fi detail state. 2316 * @enum { number } WifiDetailState 2317 * @syscap SystemCapability.Communication.WiFi.STA 2318 * @systemapi Hide this for inner system use. 2319 * @since 12 2320 */ 2321 enum WifiDetailState { 2322 /** 2323 * state is unknown 2324 * @syscap SystemCapability.Communication.WiFi.STA 2325 * @systemapi Hide this for inner system use. 2326 * @since 12 2327 */ 2328 UNKNOWN = -1, 2329 2330 /** 2331 * wifi is closed 2332 * @syscap SystemCapability.Communication.WiFi.STA 2333 * @systemapi Hide this for inner system use. 2334 * @since 12 2335 */ 2336 INACTIVE = 0, 2337 2338 /** 2339 * wifi is opened 2340 * @syscap SystemCapability.Communication.WiFi.STA 2341 * @systemapi Hide this for inner system use. 2342 * @since 12 2343 */ 2344 ACTIVATED = 1, 2345 2346 /** 2347 * wifi is opening 2348 * @syscap SystemCapability.Communication.WiFi.STA 2349 * @systemapi Hide this for inner system use. 2350 * @since 12 2351 */ 2352 ACTIVATING = 2, 2353 2354 /** 2355 * wifi is closing 2356 * @syscap SystemCapability.Communication.WiFi.STA 2357 * @systemapi Hide this for inner system use. 2358 * @since 12 2359 */ 2360 DEACTIVATING = 3, 2361 2362 /** 2363 * wifi sta is entering semi active 2364 * @syscap SystemCapability.Communication.WiFi.STA 2365 * @systemapi Hide this for inner system use. 2366 * @since 12 2367 */ 2368 SEMI_ACTIVATING = 4, 2369 2370 /** 2371 * wifi sta is semi active 2372 * @syscap SystemCapability.Communication.WiFi.STA 2373 * @systemapi Hide this for inner system use. 2374 * @since 12 2375 */ 2376 SEMI_ACTIVE = 5, 2377 } 2378 2379 /** 2380 * Wi-Fi Proxy method. 2381 * @enum { number } 2382 * @syscap SystemCapability.Communication.WiFi.STA 2383 * @systemapi Hide this for inner system use. 2384 * @since 10 2385 */ 2386 enum ProxyMethod { 2387 /** 2388 * No proxy is to be used. 2389 * @syscap SystemCapability.Communication.WiFi.STA 2390 * @systemapi Hide this for inner system use. 2391 * @since 10 2392 */ 2393 METHOD_NONE = 0, 2394 2395 /** 2396 * Use auto configured proxy. 2397 * @syscap SystemCapability.Communication.WiFi.STA 2398 * @systemapi Hide this for inner system use. 2399 * @since 10 2400 */ 2401 METHOD_AUTO = 1, 2402 2403 /** 2404 * Use manual configured proxy. 2405 * @syscap SystemCapability.Communication.WiFi.STA 2406 * @systemapi Hide this for inner system use. 2407 * @since 10 2408 */ 2409 METHOD_MANUAL = 2 2410 } 2411 2412 /** 2413 * Wi-Fi Category. 2414 * @enum { number } 2415 * @syscap SystemCapability.Communication.WiFi.STA 2416 * @since 12 2417 */ 2418 enum WifiCategory { 2419 /** 2420 * Default. 2421 * @syscap SystemCapability.Communication.WiFi.STA 2422 * @since 12 2423 */ 2424 DEFAULT = 1, 2425 2426 /** 2427 * Wifi6. 2428 * @syscap SystemCapability.Communication.WiFi.STA 2429 * @since 12 2430 */ 2431 WIFI6 = 2, 2432 2433 /** 2434 * Wifi6+. 2435 * @syscap SystemCapability.Communication.WiFi.STA 2436 * @since 12 2437 */ 2438 WIFI6_PLUS = 3 2439 } 2440 2441 /** 2442 * Wi-Fi Proxy config. 2443 * @typedef WifiProxyConfig 2444 * @syscap SystemCapability.Communication.WiFi.STA 2445 * @systemapi Hide this for inner system use. 2446 * @since 10 2447 */ 2448 interface WifiProxyConfig { 2449 /** 2450 * Wi-Fi proxy method 2451 * @type { ?ProxyMethod } 2452 * @syscap SystemCapability.Communication.WiFi.STA 2453 * @systemapi Hide this for inner system use. 2454 * @since 10 2455 */ 2456 proxyMethod?: ProxyMethod; 2457 2458 /** 2459 * PAC web address for auto configured proxy. 2460 * @type { ?string } 2461 * @syscap SystemCapability.Communication.WiFi.STA 2462 * @systemapi Hide this for inner system use. 2463 * @since 10 2464 */ 2465 pacWebAddress?: string; 2466 2467 /** 2468 * Server host name for manual configured proxy. 2469 * @type { ?string } 2470 * @syscap SystemCapability.Communication.WiFi.STA 2471 * @systemapi Hide this for inner system use. 2472 * @since 10 2473 */ 2474 serverHostName?: string; 2475 2476 /** 2477 * Server port for manual configured proxy. 2478 * @type { ?number } 2479 * @syscap SystemCapability.Communication.WiFi.STA 2480 * @systemapi Hide this for inner system use. 2481 * @since 10 2482 */ 2483 serverPort?: number; 2484 2485 /** 2486 * Exclusion objects for manual configured proxy. objects are separated by ','. 2487 * @type { ?string } 2488 * @syscap SystemCapability.Communication.WiFi.STA 2489 * @systemapi Hide this for inner system use. 2490 * @since 10 2491 */ 2492 exclusionObjects?: string; 2493 } 2494 2495 /** 2496 * Wi-Fi EAP config. 2497 * @typedef WifiEapConfig 2498 * @syscap SystemCapability.Communication.WiFi.STA 2499 * @since 10 2500 */ 2501 interface WifiEapConfig { 2502 /** 2503 * EAP authentication method 2504 * @type { EapMethod } 2505 * @syscap SystemCapability.Communication.WiFi.STA 2506 * @since 10 2507 */ 2508 eapMethod: EapMethod; 2509 2510 /** 2511 * Phase 2 authentication method 2512 * @type { Phase2Method } 2513 * @syscap SystemCapability.Communication.WiFi.STA 2514 * @since 10 2515 */ 2516 phase2Method: Phase2Method; 2517 2518 /** 2519 * The identity 2520 * @type { string } 2521 * @syscap SystemCapability.Communication.WiFi.STA 2522 * @since 10 2523 */ 2524 identity: string; 2525 2526 /** 2527 * Anonymous identity 2528 * @type { string } 2529 * @syscap SystemCapability.Communication.WiFi.STA 2530 * @since 10 2531 */ 2532 anonymousIdentity: string; 2533 2534 /** 2535 * Password 2536 * @type { string } 2537 * @syscap SystemCapability.Communication.WiFi.STA 2538 * @since 10 2539 */ 2540 password: string; 2541 2542 /** 2543 * CA certificate alias 2544 * @type { string } 2545 * @syscap SystemCapability.Communication.WiFi.STA 2546 * @since 10 2547 */ 2548 caCertAlias: string; 2549 2550 /** 2551 * CA certificate path 2552 * @type { string } 2553 * @syscap SystemCapability.Communication.WiFi.STA 2554 * @since 10 2555 */ 2556 caPath: string; 2557 2558 /** 2559 * Client certificate alias 2560 * @type { string } 2561 * @syscap SystemCapability.Communication.WiFi.STA 2562 * @since 10 2563 */ 2564 clientCertAlias: string; 2565 2566 /** 2567 * content of user's certificate 2568 * @type { Uint8Array } 2569 * @syscap SystemCapability.Communication.WiFi.STA 2570 * @since 10 2571 */ 2572 certEntry: Uint8Array; 2573 2574 /** 2575 * Password of user's certificate 2576 * @type { string } 2577 * @syscap SystemCapability.Communication.WiFi.STA 2578 * @since 10 2579 */ 2580 certPassword: string; 2581 2582 /** 2583 * Alternate subject match 2584 * @type { string } 2585 * @syscap SystemCapability.Communication.WiFi.STA 2586 * @since 10 2587 */ 2588 altSubjectMatch: string; 2589 2590 /** 2591 * Domain suffix match 2592 * @type { string } 2593 * @syscap SystemCapability.Communication.WiFi.STA 2594 * @since 10 2595 */ 2596 domainSuffixMatch: string; 2597 2598 /** 2599 * Realm for Passpoint credential 2600 * @type { string } 2601 * @syscap SystemCapability.Communication.WiFi.STA 2602 * @since 10 2603 */ 2604 realm: string; 2605 2606 /** 2607 * Public Land Mobile Network of the provider of Passpoint credential 2608 * @type { string } 2609 * @syscap SystemCapability.Communication.WiFi.STA 2610 * @since 10 2611 */ 2612 plmn: string; 2613 2614 /** 2615 * Sub ID of the SIM card 2616 * @type { number } 2617 * @syscap SystemCapability.Communication.WiFi.STA 2618 * @since 10 2619 */ 2620 eapSubId: number; 2621 } 2622 2623 /** 2624 * Wi-Fi device configuration information. 2625 * @typedef WifiDeviceConfig 2626 * @syscap SystemCapability.Communication.WiFi.STA 2627 * @since 9 2628 */ 2629 2630 /** 2631 * Wi-Fi device configuration information. 2632 * @typedef WifiDeviceConfig 2633 * @syscap SystemCapability.Communication.WiFi.STA 2634 * @atomicservice 2635 * @since 12 2636 */ 2637 interface WifiDeviceConfig { 2638 /** 2639 * Wi-Fi SSID: the maximum length is 32. 2640 * @type { string } 2641 * @syscap SystemCapability.Communication.WiFi.STA 2642 * @since 9 2643 */ 2644 /** 2645 * Wi-Fi SSID: the maximum length is 32. 2646 * @type { string } 2647 * @syscap SystemCapability.Communication.WiFi.STA 2648 * @atomicservice 2649 * @since 12 2650 */ 2651 ssid: string; 2652 2653 /** 2654 * Wi-Fi bssid(MAC): the length is 6. 2655 * @type { ?string } 2656 * @syscap SystemCapability.Communication.WiFi.STA 2657 * @since 9 2658 */ 2659 /** 2660 * Wi-Fi bssid(MAC): the length is 6. 2661 * @type { ?string } 2662 * @syscap SystemCapability.Communication.WiFi.STA 2663 * @atomicservice 2664 * @since 12 2665 */ 2666 bssid?: string; 2667 2668 /** 2669 * Wi-Fi bssid type. 2670 * @type { ?DeviceAddressType } 2671 * @syscap SystemCapability.Communication.WiFi.STA 2672 * @since 10 2673 */ 2674 /** 2675 * Wi-Fi bssid type. 2676 * @type { ?DeviceAddressType } 2677 * @syscap SystemCapability.Communication.WiFi.STA 2678 * @atomicservice 2679 * @since 12 2680 */ 2681 bssidType?: DeviceAddressType; 2682 2683 /** 2684 * Wi-Fi key: maximum length is 64. 2685 * @type { string } 2686 * @syscap SystemCapability.Communication.WiFi.STA 2687 * @since 9 2688 */ 2689 /** 2690 * Wi-Fi key: maximum length is 64. 2691 * @type { string } 2692 * @syscap SystemCapability.Communication.WiFi.STA 2693 * @atomicservice 2694 * @since 12 2695 */ 2696 preSharedKey: string; 2697 2698 /** 2699 * Hide SSID or not, false(default): not hide 2700 * @type { ?boolean } 2701 * @syscap SystemCapability.Communication.WiFi.STA 2702 * @since 9 2703 */ 2704 isHiddenSsid?: boolean; 2705 2706 /** 2707 * Security type: reference definition of WifiSecurityType 2708 * @type { WifiSecurityType } 2709 * @syscap SystemCapability.Communication.WiFi.STA 2710 * @since 9 2711 */ 2712 2713 /** 2714 * Security type: reference definition of WifiSecurityType 2715 * @type { WifiSecurityType } 2716 * @syscap SystemCapability.Communication.WiFi.STA 2717 * @atomicservice 2718 * @since 12 2719 */ 2720 securityType: WifiSecurityType; 2721 2722 /** 2723 * The UID of the Wi-Fi configuration creator. 2724 * @type { ?number } 2725 * @syscap SystemCapability.Communication.WiFi.STA 2726 * @systemapi Hide this for inner system use. 2727 * @since 9 2728 */ 2729 creatorUid?: number; 2730 2731 /** 2732 * Disable reason 2733 * @type { ?number } 2734 * @syscap SystemCapability.Communication.WiFi.STA 2735 * @systemapi Hide this for inner system use. 2736 * @since 9 2737 */ 2738 disableReason?: number; 2739 2740 /** 2741 * Allocated networkId 2742 * @type { ?number } 2743 * @syscap SystemCapability.Communication.WiFi.STA 2744 * @systemapi Hide this for inner system use. 2745 * @since 9 2746 */ 2747 netId?: number; 2748 2749 /** 2750 * Random mac type 2751 * @type { ?number } 2752 * @syscap SystemCapability.Communication.WiFi.STA 2753 * @systemapi Hide this for inner system use. 2754 * @since 9 2755 */ 2756 randomMacType?: number; 2757 2758 /** 2759 * Random mac address, the length is 6. 2760 * @type { ?string } 2761 * @syscap SystemCapability.Communication.WiFi.STA 2762 * @systemapi Hide this for inner system use. 2763 * @since 9 2764 */ 2765 randomMacAddr?: string; 2766 2767 /** 2768 * IP Type 2769 * @type { ?IpType } 2770 * @syscap SystemCapability.Communication.WiFi.STA 2771 * @systemapi Hide this for inner system use. 2772 * @since 9 2773 */ 2774 ipType?: IpType; 2775 2776 /** 2777 * IP config of static 2778 * @type { ?IpConfig } 2779 * @syscap SystemCapability.Communication.WiFi.STA 2780 * @systemapi Hide this for inner system use. 2781 * @since 9 2782 */ 2783 staticIp?: IpConfig; 2784 2785 /** 2786 * EAP config info. 2787 * @type { ?WifiEapConfig } 2788 * @syscap SystemCapability.Communication.WiFi.STA 2789 * @since 10 2790 */ 2791 eapConfig?: WifiEapConfig; 2792 2793 /** 2794 * Proxy config. 2795 * @type { ?WifiProxyConfig } 2796 * @syscap SystemCapability.Communication.WiFi.STA 2797 * @systemapi Hide this for inner system use. 2798 * @since 10 2799 */ 2800 proxyConfig?: WifiProxyConfig; 2801 2802 /** 2803 * WAPI config info. 2804 * @type { ?WifiWapiConfig } 2805 * @syscap SystemCapability.Communication.WiFi.STA 2806 * @since 12 2807 */ 2808 wapiConfig?: WifiWapiConfig; 2809 2810 /** 2811 * Device config status: 0 - enabled, 1 - disabled, 2 - permanent disabled, 3 - unknown. 2812 * @type { ?number } 2813 * @syscap SystemCapability.Communication.WiFi.STA 2814 * @systemapi Hide this for inner system use. 2815 * @since 12 2816 */ 2817 configStatus?: number; 2818 } 2819 2820 /** 2821 * Wi-Fi WAPI config. 2822 * @typedef WifiWapiConfig 2823 * @syscap SystemCapability.Communication.WiFi.STA 2824 * @since 12 2825 */ 2826 interface WifiWapiConfig { 2827 /** 2828 * WAPI pre-shared key type. 2829 * @type { WapiPskType } 2830 * @syscap SystemCapability.Communication.WiFi.STA 2831 * @since 12 2832 */ 2833 wapiPskType: WapiPskType; 2834 2835 /** 2836 * WAPI AS certification. 2837 * @type { string } 2838 * @syscap SystemCapability.Communication.WiFi.STA 2839 * @since 12 2840 */ 2841 wapiAsCert: string; 2842 2843 /** 2844 * WAPI user certification. 2845 * @type { string } 2846 * @syscap SystemCapability.Communication.WiFi.STA 2847 * @since 12 2848 */ 2849 wapiUserCert: string; 2850 } 2851 2852 /** 2853 * Wi-Fi IP configuration information. 2854 * @typedef IpConfig 2855 * @syscap SystemCapability.Communication.WiFi.STA 2856 * @systemapi Hide this for inner system use. 2857 * @since 9 2858 */ 2859 interface IpConfig { 2860 /** 2861 * IP address. 2862 * @type { number } 2863 * @syscap SystemCapability.Communication.WiFi.STA 2864 * @systemapi Hide this for inner system use. 2865 * @since 9 2866 */ 2867 ipAddress: number; 2868 2869 /** 2870 * Gate way. 2871 * @type { number } 2872 * @syscap SystemCapability.Communication.WiFi.STA 2873 * @systemapi Hide this for inner system use. 2874 * @since 9 2875 */ 2876 gateway: number; 2877 2878 /** 2879 * Prefix length. 2880 * @type { number } 2881 * @syscap SystemCapability.Communication.WiFi.STA 2882 * @systemapi Hide this for inner system use. 2883 * @since 9 2884 */ 2885 prefixLength: number; 2886 2887 /** 2888 * DNS servers. 2889 * @type { number[] } 2890 * @syscap SystemCapability.Communication.WiFi.STA 2891 * @systemapi Hide this for inner system use. 2892 * @since 9 2893 */ 2894 dnsServers: number[]; 2895 2896 /** 2897 * Domains. 2898 * @type { Array<string> } 2899 * @syscap SystemCapability.Communication.WiFi.STA 2900 * @systemapi Hide this for inner system use. 2901 * @since 9 2902 */ 2903 domains: Array<string>; 2904 } 2905 2906 /** 2907 * Wi-Fi information elements. 2908 * @typedef WifiInfoElem 2909 * @syscap SystemCapability.Communication.WiFi.STA 2910 * @since 9 2911 */ 2912 interface WifiInfoElem { 2913 /** 2914 * Element id 2915 * @type { number } 2916 * @syscap SystemCapability.Communication.WiFi.STA 2917 * @since 9 2918 */ 2919 eid: number; 2920 2921 /** 2922 * Element content 2923 * @type { Uint8Array } 2924 * @syscap SystemCapability.Communication.WiFi.STA 2925 * @since 9 2926 */ 2927 content: Uint8Array; 2928 } 2929 2930 /** 2931 * Describes the wifi channel width. 2932 * @enum { number } 2933 * @syscap SystemCapability.Communication.WiFi.STA 2934 * @since 9 2935 */ 2936 enum WifiChannelWidth { 2937 /** 2938 * 20MHz. 2939 * 2940 * @syscap SystemCapability.Communication.WiFi.STA 2941 * @since 9 2942 */ 2943 WIDTH_20MHZ = 0, 2944 2945 /** 2946 * 40MHz. 2947 * 2948 * @syscap SystemCapability.Communication.WiFi.STA 2949 * @since 9 2950 */ 2951 WIDTH_40MHZ = 1, 2952 2953 /** 2954 * 80MHz. 2955 * 2956 * @syscap SystemCapability.Communication.WiFi.STA 2957 * @since 9 2958 */ 2959 WIDTH_80MHZ = 2, 2960 2961 /** 2962 * 160MHz. 2963 * 2964 * @syscap SystemCapability.Communication.WiFi.STA 2965 * @since 9 2966 */ 2967 WIDTH_160MHZ = 3, 2968 2969 /** 2970 * 80MHz plus. 2971 * 2972 * @syscap SystemCapability.Communication.WiFi.STA 2973 * @since 9 2974 */ 2975 WIDTH_80MHZ_PLUS = 4, 2976 2977 /** 2978 * Invalid. 2979 * 2980 * @syscap SystemCapability.Communication.WiFi.STA 2981 * @since 9 2982 */ 2983 WIDTH_INVALID 2984 } 2985 2986 /** 2987 * Describes the scanned Wi-Fi information. 2988 * @typedef WifiScanInfo 2989 * @syscap SystemCapability.Communication.WiFi.STA 2990 * @since 9 2991 */ 2992 /** 2993 * Describes the scanned Wi-Fi information. 2994 * @typedef WifiScanInfo 2995 * @syscap SystemCapability.Communication.WiFi.STA 2996 * @atomicservice 2997 * @since 12 2998 */ 2999 interface WifiScanInfo { 3000 /** 3001 * Wi-Fi SSID: the maximum length is 32 3002 * @type { string } 3003 * @syscap SystemCapability.Communication.WiFi.STA 3004 * @since 9 3005 */ 3006 /** 3007 * Wi-Fi SSID: the maximum length is 32 3008 * @type { string } 3009 * @syscap SystemCapability.Communication.WiFi.STA 3010 * @atomicservice 3011 * @since 12 3012 */ 3013 ssid: string; 3014 3015 /** 3016 * Wi-Fi bssid(MAC): the length is 6 3017 * @type { string } 3018 * @syscap SystemCapability.Communication.WiFi.STA 3019 * @since 9 3020 */ 3021 /** 3022 * Wi-Fi bssid(MAC): the length is 6 3023 * @type { string } 3024 * @syscap SystemCapability.Communication.WiFi.STA 3025 * @atomicservice 3026 * @since 12 3027 */ 3028 bssid: string; 3029 3030 /** 3031 * Wi-Fi bssid type 3032 * @type { DeviceAddressType } 3033 * @syscap SystemCapability.Communication.WiFi.STA 3034 * @since 10 3035 */ 3036 /** 3037 * Wi-Fi bssid type 3038 * @type { DeviceAddressType } 3039 * @syscap SystemCapability.Communication.WiFi.STA 3040 * @atomicservice 3041 * @since 12 3042 */ 3043 bssidType: DeviceAddressType; 3044 3045 /** 3046 * Hotspot capability 3047 * @type { string } 3048 * @syscap SystemCapability.Communication.WiFi.STA 3049 * @since 9 3050 */ 3051 capabilities: string; 3052 3053 /** 3054 * Security type: reference definition of WifiSecurityType 3055 * @type { WifiSecurityType } 3056 * @syscap SystemCapability.Communication.WiFi.STA 3057 * @since 9 3058 */ 3059 /** 3060 * Security type: reference definition of WifiSecurityType 3061 * @type { WifiSecurityType } 3062 * @syscap SystemCapability.Communication.WiFi.STA 3063 * @atomicservice 3064 * @since 12 3065 */ 3066 securityType: WifiSecurityType; 3067 3068 /** 3069 * Received signal strength indicator (RSSI) 3070 * @type { number } 3071 * @syscap SystemCapability.Communication.WiFi.STA 3072 * @since 9 3073 */ 3074 /** 3075 * Received signal strength indicator (RSSI) 3076 * @type { number } 3077 * @syscap SystemCapability.Communication.WiFi.STA 3078 * @atomicservice 3079 * @since 12 3080 */ 3081 rssi: number; 3082 3083 /** 3084 * Frequency band, 1: 2.4G, 2: 5G 3085 * @type { number } 3086 * @syscap SystemCapability.Communication.WiFi.STA 3087 * @since 9 3088 */ 3089 band: number; 3090 3091 /** 3092 * Frequency 3093 * @type { number } 3094 * @syscap SystemCapability.Communication.WiFi.STA 3095 * @since 9 3096 */ 3097 /** 3098 * Frequency 3099 * @type { number } 3100 * @syscap SystemCapability.Communication.WiFi.STA 3101 * @atomicservice 3102 * @since 12 3103 */ 3104 frequency: number; 3105 3106 /** 3107 * Channel width 3108 * @type { number } 3109 * @syscap SystemCapability.Communication.WiFi.STA 3110 * @since 9 3111 */ 3112 channelWidth: number; 3113 3114 /** 3115 * Center frequency 0. 3116 * @type { number } 3117 * @syscap SystemCapability.Communication.WiFi.STA 3118 * @since 9 3119 */ 3120 centerFrequency0: number; 3121 3122 /** 3123 * Center frequency 1. 3124 * @type { number } 3125 * @syscap SystemCapability.Communication.WiFi.STA 3126 * @since 9 3127 */ 3128 centerFrequency1: number; 3129 3130 /** 3131 * Information elements. 3132 * @type { Array<WifiInfoElem> } 3133 * @syscap SystemCapability.Communication.WiFi.STA 3134 * @since 9 3135 */ 3136 infoElems: Array<WifiInfoElem>; 3137 3138 /** 3139 * Time stamp 3140 * @type { number } 3141 * @syscap SystemCapability.Communication.WiFi.STA 3142 * @since 9 3143 */ 3144 timestamp: number; 3145 3146 /** 3147 * Supported wifi category 3148 * @type { WifiCategory } 3149 * @syscap SystemCapability.Communication.WiFi.STA 3150 * @since 12 3151 */ 3152 supportedWifiCategory: WifiCategory; 3153 3154 /** 3155 * Whether the Wi-Fi hotspot is HiLink network. 3156 * @type { boolean } 3157 * @syscap SystemCapability.Communication.WiFi.STA 3158 * @since 12 3159 */ 3160 isHiLinkNetwork: boolean; 3161 } 3162 3163 /** 3164 * Describes the wifi security type. 3165 * @enum { number } 3166 * @syscap SystemCapability.Communication.WiFi.Core 3167 * @since 9 3168 */ 3169 /** 3170 * Describes the wifi security type. 3171 * @enum { number } 3172 * @syscap SystemCapability.Communication.WiFi.Core 3173 * @atomicservice 3174 * @since 12 3175 */ 3176 enum WifiSecurityType { 3177 /** 3178 * Invalid security type 3179 * 3180 * @syscap SystemCapability.Communication.WiFi.Core 3181 * @since 9 3182 */ 3183 WIFI_SEC_TYPE_INVALID = 0, 3184 3185 /** 3186 * Open 3187 * 3188 * @syscap SystemCapability.Communication.WiFi.Core 3189 * @since 9 3190 */ 3191 /** 3192 * Open 3193 * 3194 * @syscap SystemCapability.Communication.WiFi.Core 3195 * @atomicservice 3196 * @since 12 3197 */ 3198 WIFI_SEC_TYPE_OPEN = 1, 3199 3200 /** 3201 * Wired Equivalent Privacy (WEP) 3202 * 3203 * @syscap SystemCapability.Communication.WiFi.Core 3204 * @since 9 3205 */ 3206 WIFI_SEC_TYPE_WEP = 2, 3207 3208 /** 3209 * Pre-shared key (PSK) 3210 * 3211 * @syscap SystemCapability.Communication.WiFi.Core 3212 * @since 9 3213 */ 3214 WIFI_SEC_TYPE_PSK = 3, 3215 3216 /** 3217 * Simultaneous Authentication of Equals (SAE) 3218 * 3219 * @syscap SystemCapability.Communication.WiFi.Core 3220 * @since 9 3221 */ 3222 WIFI_SEC_TYPE_SAE = 4, 3223 3224 /** 3225 * EAP authentication. 3226 * 3227 * @syscap SystemCapability.Communication.WiFi.Core 3228 * @since 9 3229 */ 3230 WIFI_SEC_TYPE_EAP = 5, 3231 3232 /** 3233 * SUITE_B_192 192 bit level. 3234 * 3235 * @syscap SystemCapability.Communication.WiFi.Core 3236 * @since 9 3237 */ 3238 WIFI_SEC_TYPE_EAP_SUITE_B = 6, 3239 3240 /** 3241 * Opportunistic Wireless Encryption. 3242 * 3243 * @syscap SystemCapability.Communication.WiFi.Core 3244 * @since 9 3245 */ 3246 WIFI_SEC_TYPE_OWE = 7, 3247 3248 /** 3249 * WAPI certificate to be specified. 3250 * 3251 * @syscap SystemCapability.Communication.WiFi.Core 3252 * @since 9 3253 */ 3254 WIFI_SEC_TYPE_WAPI_CERT = 8, 3255 3256 /** 3257 * WAPI pre-shared key to be specified. 3258 * 3259 * @syscap SystemCapability.Communication.WiFi.Core 3260 * @since 9 3261 */ 3262 WIFI_SEC_TYPE_WAPI_PSK = 9 3263 } 3264 3265 /** 3266 * Describes the WAPI pre-shared key Type. 3267 * @enum { number } 3268 * @syscap SystemCapability.Communication.WiFi.Core 3269 * @since 12 3270 */ 3271 enum WapiPskType { 3272 /** 3273 * ASCII character type of WAPI pre-shared key. 3274 * 3275 * @syscap SystemCapability.Communication.WiFi.Core 3276 * @since 12 3277 */ 3278 WAPI_PSK_ASCII = 0, 3279 3280 /** 3281 * HEX character type of WAPI pre-shared key. 3282 * 3283 * @syscap SystemCapability.Communication.WiFi.Core 3284 * @since 12 3285 */ 3286 WAPI_PSK_HEX = 1 3287 } 3288 3289 /** 3290 * Wi-Fi band type. 3291 * @enum { number } 3292 * @syscap SystemCapability.Communication.WiFi.STA 3293 * @since 10 3294 */ 3295 enum WifiBandType { 3296 /** 3297 * Default. 3298 * 3299 * @syscap SystemCapability.Communication.WiFi.STA 3300 * @since 10 3301 */ 3302 WIFI_BAND_NONE, 3303 3304 /** 3305 * Band 2.4G. 3306 * 3307 * @syscap SystemCapability.Communication.WiFi.STA 3308 * @since 10 3309 */ 3310 WIFI_BAND_2G, 3311 3312 /** 3313 * Band 5G. 3314 * 3315 * @syscap SystemCapability.Communication.WiFi.STA 3316 * @since 10 3317 */ 3318 WIFI_BAND_5G, 3319 3320 /** 3321 * Band 6G. 3322 * 3323 * @syscap SystemCapability.Communication.WiFi.STA 3324 * @since 10 3325 */ 3326 WIFI_BAND_6G, 3327 3328 /** 3329 * Band 60G. 3330 * 3331 * @syscap SystemCapability.Communication.WiFi.STA 3332 * @since 10 3333 */ 3334 WIFI_BAND_60G 3335 } 3336 3337 /** 3338 * Wi-Fi standard. 3339 * @enum { number } 3340 * @syscap SystemCapability.Communication.WiFi.STA 3341 * @since 10 3342 */ 3343 enum WifiStandard { 3344 /** 3345 * Undefined 3346 * @syscap SystemCapability.Communication.WiFi.STA 3347 * @since 10 3348 */ 3349 WIFI_STANDARD_UNDEFINED, 3350 3351 /** 3352 * Wifi 802.11a 3353 * @syscap SystemCapability.Communication.WiFi.STA 3354 * @since 10 3355 */ 3356 WIFI_STANDARD_11A, 3357 3358 /** 3359 * Wifi 802.11b 3360 * @syscap SystemCapability.Communication.WiFi.STA 3361 * @since 10 3362 */ 3363 WIFI_STANDARD_11B, 3364 3365 /** 3366 * Wifi 802.11g 3367 * @syscap SystemCapability.Communication.WiFi.STA 3368 * @since 10 3369 */ 3370 WIFI_STANDARD_11G, 3371 3372 /** 3373 * Wifi 802.11n 3374 * @syscap SystemCapability.Communication.WiFi.STA 3375 * @since 10 3376 */ 3377 WIFI_STANDARD_11N, 3378 3379 /** 3380 * Wifi 802.11ac 3381 * @syscap SystemCapability.Communication.WiFi.STA 3382 * @since 10 3383 */ 3384 WIFI_STANDARD_11AC, 3385 3386 /** 3387 * Wifi 802.11ax 3388 * @syscap SystemCapability.Communication.WiFi.STA 3389 * @since 10 3390 */ 3391 WIFI_STANDARD_11AX, 3392 3393 /** 3394 * Wifi 802.11ad 3395 * @syscap SystemCapability.Communication.WiFi.STA 3396 * @since 10 3397 */ 3398 WIFI_STANDARD_11AD 3399 } 3400 3401 /** 3402 * Wi-Fi connection information. 3403 * @typedef WifiLinkedInfo 3404 * @syscap SystemCapability.Communication.WiFi.STA 3405 * @since 9 3406 */ 3407 3408 /** 3409 * Wi-Fi connection information. 3410 * @typedef WifiLinkedInfo 3411 * @syscap SystemCapability.Communication.WiFi.STA 3412 * @atomicservice 3413 * @since 12 3414 */ 3415 3416 interface WifiLinkedInfo { 3417 /** 3418 * The SSID of the Wi-Fi hotspot 3419 * @type { string } 3420 * @syscap SystemCapability.Communication.WiFi.STA 3421 * @since 9 3422 */ 3423 /** 3424 * The SSID of the Wi-Fi hotspot 3425 * @type { string } 3426 * @syscap SystemCapability.Communication.WiFi.STA 3427 * @atomicservice 3428 * @since 12 3429 */ 3430 ssid: string; 3431 3432 /** 3433 * The BSSID of the Wi-Fi hotspot 3434 * @type { string } 3435 * @syscap SystemCapability.Communication.WiFi.STA 3436 * @since 9 3437 */ 3438 /** 3439 * The BSSID of the Wi-Fi hotspot 3440 * @type { string } 3441 * @syscap SystemCapability.Communication.WiFi.STA 3442 * @atomicservice 3443 * @since 12 3444 */ 3445 bssid: string; 3446 3447 /** 3448 * The ID(uniquely identifies) of a Wi-Fi connection. 3449 * @type { number } 3450 * @syscap SystemCapability.Communication.WiFi.STA 3451 * @systemapi Hide this for inner system use. 3452 * @since 9 3453 */ 3454 networkId: number; 3455 3456 /** 3457 * The RSSI(dBm) of a Wi-Fi access point. 3458 * @type { number } 3459 * @syscap SystemCapability.Communication.WiFi.STA 3460 * @since 9 3461 */ 3462 /** 3463 * The RSSI(dBm) of a Wi-Fi access point. 3464 * @type { number } 3465 * @syscap SystemCapability.Communication.WiFi.STA 3466 * @atomicservice 3467 * @since 12 3468 */ 3469 rssi: number; 3470 3471 /** 3472 * The frequency band of a Wi-Fi access point. 3473 * @type { number } 3474 * @syscap SystemCapability.Communication.WiFi.STA 3475 * @since 9 3476 */ 3477 band: number; 3478 3479 /** 3480 * The speed of a Wi-Fi access point. 3481 * @type { number } 3482 * @syscap SystemCapability.Communication.WiFi.STA 3483 * @since 9 3484 */ 3485 linkSpeed: number; 3486 3487 /** 3488 * The rx speed of a Wi-Fi access point. 3489 * @type { number } 3490 * @syscap SystemCapability.Communication.WiFi.STA 3491 * @since 10 3492 */ 3493 rxLinkSpeed: number; 3494 3495 /** 3496 * Max tx speed of a Wi-Fi access point. 3497 * @type { number } 3498 * @syscap SystemCapability.Communication.WiFi.STA 3499 * @since 10 3500 */ 3501 maxSupportedTxLinkSpeed: number; 3502 3503 /** 3504 * Max rx speed of a Wi-Fi access point. 3505 * @type { number } 3506 * @syscap SystemCapability.Communication.WiFi.STA 3507 * @since 10 3508 */ 3509 maxSupportedRxLinkSpeed: number; 3510 3511 /** 3512 * The frequency of a Wi-Fi access point. 3513 * @type { number } 3514 * @syscap SystemCapability.Communication.WiFi.STA 3515 * @since 9 3516 */ 3517 /** 3518 * The frequency of a Wi-Fi access point. 3519 * @type { number } 3520 * @syscap SystemCapability.Communication.WiFi.STA 3521 * @atomicservice 3522 * @since 12 3523 */ 3524 frequency: number; 3525 3526 /** 3527 * Whether the SSID of the access point (AP) of this Wi-Fi connection is hidden. 3528 * @type { boolean } 3529 * @syscap SystemCapability.Communication.WiFi.STA 3530 * @since 9 3531 */ 3532 isHidden: boolean; 3533 3534 /** 3535 * Whether this Wi-Fi connection restricts the data volume. 3536 * @type { boolean } 3537 * @syscap SystemCapability.Communication.WiFi.STA 3538 * @since 9 3539 */ 3540 isRestricted: boolean; 3541 3542 /** 3543 * The load value of this Wi-Fi connection. A greater value indicates a higher load. 3544 * @type { number } 3545 * @syscap SystemCapability.Communication.WiFi.STA 3546 * @systemapi Hide this for inner system use. 3547 * @since 9 3548 */ 3549 chload: number; 3550 3551 /** 3552 * The signal-to-noise ratio (SNR) of this Wi-Fi connection. 3553 * @type { number } 3554 * @syscap SystemCapability.Communication.WiFi.STA 3555 * @systemapi Hide this for inner system use. 3556 * @since 9 3557 */ 3558 snr: number; 3559 3560 /** 3561 * Type of macAddress: 0 - real mac, 1 - random mac. 3562 * @type { number } 3563 * @syscap SystemCapability.Communication.WiFi.STA 3564 * @since 9 3565 */ 3566 macType: number; 3567 3568 /** 3569 * The Wi-Fi MAC address of a device. 3570 * @type { string } 3571 * @syscap SystemCapability.Communication.WiFi.STA 3572 * @since 9 3573 */ 3574 macAddress: string; 3575 3576 /** 3577 * The IP address of this Wi-Fi connection. 3578 * @type { number } 3579 * @syscap SystemCapability.Communication.WiFi.STA 3580 * @since 9 3581 */ 3582 ipAddress: number; 3583 3584 /** 3585 * The state of the supplicant of this Wi-Fi connection. 3586 * @type { SuppState } 3587 * @syscap SystemCapability.Communication.WiFi.STA 3588 * @systemapi Hide this for inner system use. 3589 * @since 9 3590 */ 3591 suppState: SuppState; 3592 3593 /** 3594 * The state of this Wi-Fi connection. 3595 * @type { ConnState } 3596 * @syscap SystemCapability.Communication.WiFi.STA 3597 * @since 9 3598 */ 3599 connState: ConnState; 3600 3601 /** 3602 * Channel width of the connected hotspot. 3603 * @type { WifiChannelWidth } 3604 * @syscap SystemCapability.Communication.WiFi.STA 3605 * @since 10 3606 */ 3607 channelWidth: WifiChannelWidth; 3608 3609 /** 3610 * Wifi standard of current connection. 3611 * @type { WifiStandard } 3612 * @syscap SystemCapability.Communication.WiFi.STA 3613 * @since 10 3614 */ 3615 wifiStandard: WifiStandard; 3616 3617 /** 3618 * Supported wifi category 3619 * @type { WifiCategory } 3620 * @syscap SystemCapability.Communication.WiFi.STA 3621 * @since 12 3622 */ 3623 supportedWifiCategory: WifiCategory; 3624 3625 /** 3626 * Whether the Wi-Fi hotspot is HiLink network. 3627 * @type { boolean } 3628 * @syscap SystemCapability.Communication.WiFi.STA 3629 * @since 12 3630 */ 3631 isHiLinkNetwork: boolean; 3632 } 3633 3634 /** 3635 * Wi-Fi IP information. 3636 * @typedef IpInfo 3637 * @syscap SystemCapability.Communication.WiFi.STA 3638 * @since 9 3639 */ 3640 interface IpInfo { 3641 /** 3642 * The IP address of the Wi-Fi connection 3643 * @type { number } 3644 * @syscap SystemCapability.Communication.WiFi.STA 3645 * @since 9 3646 */ 3647 ipAddress: number; 3648 3649 /** 3650 * The gateway of the Wi-Fi connection 3651 * @type { number } 3652 * @syscap SystemCapability.Communication.WiFi.STA 3653 * @since 9 3654 */ 3655 gateway: number; 3656 3657 /** 3658 * The network mask of the Wi-Fi connection 3659 * @type { number } 3660 * @syscap SystemCapability.Communication.WiFi.STA 3661 * @since 9 3662 */ 3663 netmask: number; 3664 3665 /** 3666 * The primary DNS server IP address of the Wi-Fi connection 3667 * @type { number } 3668 * @syscap SystemCapability.Communication.WiFi.STA 3669 * @since 9 3670 */ 3671 primaryDns: number; 3672 3673 /** 3674 * The secondary DNS server IP address of the Wi-Fi connection 3675 * @type { number } 3676 * @syscap SystemCapability.Communication.WiFi.STA 3677 * @since 9 3678 */ 3679 secondDns: number; 3680 3681 /** 3682 * The DHCP server IP address of the Wi-Fi connection 3683 * @type { number } 3684 * @syscap SystemCapability.Communication.WiFi.STA 3685 * @since 9 3686 */ 3687 serverIp: number; 3688 3689 /** 3690 * The IP address lease duration of the Wi-Fi connection 3691 * @type { number } 3692 * @syscap SystemCapability.Communication.WiFi.STA 3693 * @since 9 3694 */ 3695 leaseDuration: number; 3696 } 3697 3698 /** 3699 * Wi-Fi IPv6 information. 3700 * @typedef Ipv6Info 3701 * @syscap SystemCapability.Communication.WiFi.STA 3702 * @since 10 3703 */ 3704 interface Ipv6Info { 3705 /** 3706 * The link IPv6 address of the Wi-Fi connection 3707 * @type { string } 3708 * @syscap SystemCapability.Communication.WiFi.STA 3709 * @since 10 3710 */ 3711 linkIpv6Address: string; 3712 3713 /** 3714 * The global IPv6 address of the Wi-Fi connection 3715 * @type { string } 3716 * @syscap SystemCapability.Communication.WiFi.STA 3717 * @since 10 3718 */ 3719 globalIpv6Address: string; 3720 3721 /** 3722 * The rand Global IPv6 address of the Wi-Fi connection 3723 * @type { string } 3724 * @syscap SystemCapability.Communication.WiFi.STA 3725 * @since 10 3726 */ 3727 randomGlobalIpv6Address: string; 3728 3729 /** 3730 * The unique IPv6 address of the Wi-Fi connection 3731 * @type { ?string } 3732 * @syscap SystemCapability.Communication.WiFi.STA 3733 * @since 12 3734 */ 3735 uniqueIpv6Address?: string; 3736 3737 /** 3738 * The rand unique IPv6 address of the Wi-Fi connection 3739 * @type { ?string } 3740 * @syscap SystemCapability.Communication.WiFi.STA 3741 * @since 12 3742 */ 3743 randomUniqueIpv6Address?: string; 3744 3745 /** 3746 * The gateway of the Wi-Fi connection 3747 * @type { string } 3748 * @syscap SystemCapability.Communication.WiFi.STA 3749 * @since 10 3750 */ 3751 gateway: string; 3752 3753 /** 3754 * The network mask of the Wi-Fi connection 3755 * @type { string } 3756 * @syscap SystemCapability.Communication.WiFi.STA 3757 * @since 10 3758 */ 3759 netmask: string; 3760 3761 /** 3762 * The primary DNS server IPV6 address of the Wi-Fi connection 3763 * @type { string } 3764 * @syscap SystemCapability.Communication.WiFi.STA 3765 * @since 10 3766 */ 3767 primaryDNS: string; 3768 3769 /** 3770 * The secondary DNS server IPV6 address of the Wi-Fi connection 3771 * @type { string } 3772 * @syscap SystemCapability.Communication.WiFi.STA 3773 * @since 10 3774 */ 3775 secondDNS: string; 3776 } 3777 3778 /** 3779 * Wi-Fi hotspot configuration information. 3780 * @typedef HotspotConfig 3781 * @syscap SystemCapability.Communication.WiFi.AP.Core 3782 * @systemapi Hide this for inner system use. 3783 * @since 9 3784 */ 3785 interface HotspotConfig { 3786 /** 3787 * The SSID of the Wi-Fi hotspot 3788 * @type { string } 3789 * @syscap SystemCapability.Communication.WiFi.AP.Core 3790 * @systemapi Hide this for inner system use. 3791 * @since 9 3792 */ 3793 ssid: string; 3794 3795 /** 3796 * The encryption mode of the Wi-Fi hotspot 3797 * @type { WifiSecurityType } 3798 * @syscap SystemCapability.Communication.WiFi.AP.Core 3799 * @systemapi Hide this for inner system use. 3800 * @since 9 3801 */ 3802 securityType: WifiSecurityType; 3803 3804 /** 3805 * The frequency band of the Wi-Fi hotspot 3806 * @type { number } 3807 * @syscap SystemCapability.Communication.WiFi.AP.Core 3808 * @systemapi Hide this for inner system use. 3809 * @since 9 3810 */ 3811 band: number; 3812 3813 /** 3814 * The channel of the Wi-Fi hotspot. 3815 * @type { ?number } 3816 * @syscap SystemCapability.Communication.WiFi.AP.Core 3817 * @systemapi Hide this for inner system use. 3818 * @since 10 3819 */ 3820 channel?: number; 3821 3822 /** 3823 * The password of the Wi-Fi hotspot 3824 * @type { string } 3825 * @syscap SystemCapability.Communication.WiFi.AP.Core 3826 * @systemapi Hide this for inner system use. 3827 * @since 9 3828 */ 3829 preSharedKey: string; 3830 3831 /** 3832 * The maximum number of connections allowed by the Wi-Fi hotspot 3833 * @type { number } 3834 * @syscap SystemCapability.Communication.WiFi.AP.Core 3835 * @systemapi Hide this for inner system use. 3836 * @since 9 3837 */ 3838 maxConn: number; 3839 3840 /** 3841 * IP address of the dhcp server, it's a string, For example 192.168.43.1 3842 * @type { ?string } 3843 * @syscap SystemCapability.Communication.WiFi.AP.Core 3844 * @systemapi Hide this for inner system use. 3845 * @since 10 3846 */ 3847 ipAddress?: string; 3848 } 3849 3850 /** 3851 * Wi-Fi station information. 3852 * @typedef StationInfo 3853 * @syscap SystemCapability.Communication.WiFi.AP.Core 3854 * @systemapi Hide this for inner system use. 3855 * @since 9 3856 */ 3857 interface StationInfo { 3858 /** 3859 * The network name of the Wi-Fi client 3860 * @type { string } 3861 * @syscap SystemCapability.Communication.WiFi.AP.Core 3862 * @systemapi Hide this for inner system use. 3863 * @since 9 3864 */ 3865 name: string; 3866 3867 /** 3868 * The MAC address of the Wi-Fi client 3869 * @type { string } 3870 * @syscap SystemCapability.Communication.WiFi.AP.Core 3871 * @systemapi Hide this for inner system use. 3872 * @since 9 3873 */ 3874 macAddress: string; 3875 3876 /** 3877 * The MAC address type of the Wi-Fi client 3878 * @type { ?DeviceAddressType } 3879 * @syscap SystemCapability.Communication.WiFi.AP.Core 3880 * @systemapi Hide this for inner system use. 3881 * @since 10 3882 */ 3883 macAddressType?: DeviceAddressType; 3884 3885 /** 3886 * The IP address of the Wi-Fi client 3887 * @type { string } 3888 * @syscap SystemCapability.Communication.WiFi.AP.Core 3889 * @systemapi Hide this for inner system use. 3890 * @since 9 3891 */ 3892 ipAddress: string; 3893 } 3894 3895 /** 3896 * Wi-Fi IP type enumeration. 3897 * 3898 * @enum { number } 3899 * @syscap SystemCapability.Communication.WiFi.STA 3900 * @systemapi Hide this for inner system use. 3901 * @since 9 3902 */ 3903 enum IpType { 3904 /** 3905 * Use statically configured IP settings 3906 * @syscap SystemCapability.Communication.WiFi.STA 3907 * @systemapi Hide this for inner system use. 3908 * @since 9 3909 */ 3910 STATIC, 3911 3912 /** 3913 * Use dynamically configured IP settings 3914 * @syscap SystemCapability.Communication.WiFi.STA 3915 * @systemapi Hide this for inner system use. 3916 * @since 9 3917 */ 3918 DHCP, 3919 3920 /** 3921 * No IP details are assigned 3922 * @syscap SystemCapability.Communication.WiFi.STA 3923 * @systemapi Hide this for inner system use. 3924 * @since 9 3925 */ 3926 UNKNOWN 3927 } 3928 3929 /** 3930 * The state of the supplicant enumeration. 3931 * 3932 * @enum { number } 3933 * @syscap SystemCapability.Communication.WiFi.STA 3934 * @systemapi Hide this for inner system use. 3935 * @since 9 3936 */ 3937 export enum SuppState { 3938 /** 3939 * The supplicant is not associated with or is disconnected from the AP. 3940 * @syscap SystemCapability.Communication.WiFi.STA 3941 * @systemapi Hide this for inner system use. 3942 * @since 9 3943 */ 3944 DISCONNECTED, 3945 3946 /** 3947 * The network interface is disabled. 3948 * @syscap SystemCapability.Communication.WiFi.STA 3949 * @systemapi Hide this for inner system use. 3950 * @since 9 3951 */ 3952 INTERFACE_DISABLED, 3953 3954 /** 3955 * The supplicant is disabled. 3956 * @syscap SystemCapability.Communication.WiFi.STA 3957 * @systemapi Hide this for inner system use. 3958 * @since 9 3959 */ 3960 INACTIVE, 3961 3962 /** 3963 * The supplicant is scanning for a Wi-Fi connection. 3964 * @syscap SystemCapability.Communication.WiFi.STA 3965 * @systemapi Hide this for inner system use. 3966 * @since 9 3967 */ 3968 SCANNING, 3969 3970 /** 3971 * The supplicant is authenticating with a specified AP. 3972 * @syscap SystemCapability.Communication.WiFi.STA 3973 * @systemapi Hide this for inner system use. 3974 * @since 9 3975 */ 3976 AUTHENTICATING, 3977 3978 /** 3979 * The supplicant is associating with a specified AP. 3980 * @syscap SystemCapability.Communication.WiFi.STA 3981 * @systemapi Hide this for inner system use. 3982 * @since 9 3983 */ 3984 ASSOCIATING, 3985 3986 /** 3987 * The supplicant is associated with a specified AP. 3988 * @syscap SystemCapability.Communication.WiFi.STA 3989 * @systemapi Hide this for inner system use. 3990 * @since 9 3991 */ 3992 ASSOCIATED, 3993 3994 /** 3995 * The four-way handshake is ongoing. 3996 * @syscap SystemCapability.Communication.WiFi.STA 3997 * @systemapi Hide this for inner system use. 3998 * @since 9 3999 */ 4000 FOUR_WAY_HANDSHAKE, 4001 4002 /** 4003 * The group handshake is ongoing. 4004 * @syscap SystemCapability.Communication.WiFi.STA 4005 * @systemapi Hide this for inner system use. 4006 * @since 9 4007 */ 4008 GROUP_HANDSHAKE, 4009 4010 /** 4011 * All authentication is completed. 4012 * @syscap SystemCapability.Communication.WiFi.STA 4013 * @systemapi Hide this for inner system use. 4014 * @since 9 4015 */ 4016 COMPLETED, 4017 4018 /** 4019 * Failed to establish a connection to the supplicant. 4020 * @syscap SystemCapability.Communication.WiFi.STA 4021 * @systemapi Hide this for inner system use. 4022 * @since 9 4023 */ 4024 UNINITIALIZED, 4025 4026 /** 4027 * The supplicant is in an unknown or invalid state. 4028 * @syscap SystemCapability.Communication.WiFi.STA 4029 * @systemapi Hide this for inner system use. 4030 * @since 9 4031 */ 4032 INVALID 4033 } 4034 4035 /** 4036 * The state of Wi-Fi connection enumeration. 4037 * 4038 * @enum { number } 4039 * @syscap SystemCapability.Communication.WiFi.STA 4040 * @since 9 4041 */ 4042 export enum ConnState { 4043 /** 4044 * The device is searching for an available AP. 4045 * 4046 * @syscap SystemCapability.Communication.WiFi.STA 4047 * @since 9 4048 */ 4049 SCANNING, 4050 4051 /** 4052 * The Wi-Fi connection is being set up. 4053 * 4054 * @syscap SystemCapability.Communication.WiFi.STA 4055 * @since 9 4056 */ 4057 CONNECTING, 4058 4059 /** 4060 * The Wi-Fi connection is being authenticated. 4061 * 4062 * @syscap SystemCapability.Communication.WiFi.STA 4063 * @since 9 4064 */ 4065 AUTHENTICATING, 4066 4067 /** 4068 * The IP address of the Wi-Fi connection is being obtained. 4069 * 4070 * @syscap SystemCapability.Communication.WiFi.STA 4071 * @since 9 4072 */ 4073 OBTAINING_IPADDR, 4074 4075 /** 4076 * The Wi-Fi connection has been set up. 4077 * 4078 * @syscap SystemCapability.Communication.WiFi.STA 4079 * @since 9 4080 */ 4081 CONNECTED, 4082 4083 /** 4084 * The Wi-Fi connection is being torn down. 4085 * 4086 * @syscap SystemCapability.Communication.WiFi.STA 4087 * @since 9 4088 */ 4089 DISCONNECTING, 4090 4091 /** 4092 * The Wi-Fi connection has been torn down. 4093 * 4094 * @syscap SystemCapability.Communication.WiFi.STA 4095 * @since 9 4096 */ 4097 DISCONNECTED, 4098 4099 /** 4100 * Failed to set up the Wi-Fi connection. 4101 * 4102 * @syscap SystemCapability.Communication.WiFi.STA 4103 * @since 9 4104 */ 4105 UNKNOWN 4106 } 4107 4108 /** 4109 * P2P device information. 4110 * 4111 * @typedef WifiP2pDevice 4112 * @syscap SystemCapability.Communication.WiFi.P2P 4113 * @since 9 4114 */ 4115 interface WifiP2pDevice { 4116 /** 4117 * Device name 4118 * @type { string } 4119 * @syscap SystemCapability.Communication.WiFi.P2P 4120 * @since 9 4121 */ 4122 deviceName: string; 4123 4124 /** 4125 * Device mac address 4126 * @type { string } 4127 * @syscap SystemCapability.Communication.WiFi.P2P 4128 * @since 9 4129 */ 4130 deviceAddress: string; 4131 4132 /** 4133 * Device mac address type 4134 * @type { ?DeviceAddressType } 4135 * @syscap SystemCapability.Communication.WiFi.P2P 4136 * @since 10 4137 */ 4138 deviceAddressType?: DeviceAddressType; 4139 4140 /** 4141 * Primary device type 4142 * @type { string } 4143 * @syscap SystemCapability.Communication.WiFi.P2P 4144 * @since 9 4145 */ 4146 primaryDeviceType: string; 4147 4148 /** 4149 * Device status 4150 * @type { P2pDeviceStatus } 4151 * @syscap SystemCapability.Communication.WiFi.P2P 4152 * @since 9 4153 */ 4154 deviceStatus: P2pDeviceStatus; 4155 4156 /** 4157 * Device group capabilities 4158 * @type { number } 4159 * @syscap SystemCapability.Communication.WiFi.P2P 4160 * @since 9 4161 */ 4162 groupCapabilities: number; 4163 } 4164 4165 /** 4166 * P2P config. 4167 * 4168 * @typedef WifiP2PConfig 4169 * @syscap SystemCapability.Communication.WiFi.P2P 4170 * @since 9 4171 */ 4172 interface WifiP2PConfig { 4173 /** 4174 * Device mac address 4175 * @type { string } 4176 * @syscap SystemCapability.Communication.WiFi.P2P 4177 * @since 9 4178 */ 4179 deviceAddress: string; 4180 4181 /** 4182 * Device mac address type 4183 * @type { ?DeviceAddressType } 4184 * @syscap SystemCapability.Communication.WiFi.P2P 4185 * @since 10 4186 */ 4187 deviceAddressType?: DeviceAddressType; 4188 4189 /** 4190 * Group network ID. When creating a group, -1 indicates creates a temporary group, 4191 * -2: indicates creates a persistent group 4192 * @type { number } 4193 * @syscap SystemCapability.Communication.WiFi.P2P 4194 * @since 9 4195 */ 4196 netId: number; 4197 4198 /** 4199 * The passphrase of this {@code WifiP2pConfig} instance 4200 * @type { string } 4201 * @syscap SystemCapability.Communication.WiFi.P2P 4202 * @since 9 4203 */ 4204 passphrase: string; 4205 4206 /** 4207 * Group name 4208 * @type { string } 4209 * @syscap SystemCapability.Communication.WiFi.P2P 4210 * @since 9 4211 */ 4212 groupName: string; 4213 4214 /** 4215 * Group owner band 4216 * @type { GroupOwnerBand } 4217 * @syscap SystemCapability.Communication.WiFi.P2P 4218 * @since 9 4219 */ 4220 goBand: GroupOwnerBand; 4221 } 4222 4223 /** 4224 * P2P group information. 4225 * 4226 * @typedef WifiP2pGroupInfo 4227 * @syscap SystemCapability.Communication.WiFi.P2P 4228 * @since 9 4229 */ 4230 interface WifiP2pGroupInfo { 4231 /** 4232 * Indicates whether it is group owner 4233 * @type { boolean } 4234 * @syscap SystemCapability.Communication.WiFi.P2P 4235 * @since 9 4236 */ 4237 isP2pGo: boolean; 4238 4239 /** 4240 * Group owner information 4241 * @type { WifiP2pDevice } 4242 * @syscap SystemCapability.Communication.WiFi.P2P 4243 * @since 9 4244 */ 4245 ownerInfo: WifiP2pDevice; 4246 4247 /** 4248 * The group passphrase 4249 * @type { string } 4250 * @syscap SystemCapability.Communication.WiFi.P2P 4251 * @since 9 4252 */ 4253 passphrase: string; 4254 4255 /** 4256 * Interface name 4257 * @type { string } 4258 * @syscap SystemCapability.Communication.WiFi.P2P 4259 * @since 9 4260 */ 4261 interface: string; 4262 4263 /** 4264 * Group name 4265 * @type { string } 4266 * @syscap SystemCapability.Communication.WiFi.P2P 4267 * @since 9 4268 */ 4269 groupName: string; 4270 4271 /** 4272 * Network ID 4273 * @type { number } 4274 * @syscap SystemCapability.Communication.WiFi.P2P 4275 * @since 9 4276 */ 4277 networkId: number; 4278 4279 /** 4280 * Frequency 4281 * @type { number } 4282 * @syscap SystemCapability.Communication.WiFi.P2P 4283 * @since 9 4284 */ 4285 frequency: number; 4286 4287 /** 4288 * Client list 4289 * @type { WifiP2pDevice[] } 4290 * @syscap SystemCapability.Communication.WiFi.P2P 4291 * @since 9 4292 */ 4293 clientDevices: WifiP2pDevice[]; 4294 4295 /** 4296 * Group owner IP address 4297 * @type { string } 4298 * @syscap SystemCapability.Communication.WiFi.P2P 4299 * @since 9 4300 */ 4301 goIpAddress: string; 4302 } 4303 4304 /** 4305 * P2P connection status. 4306 * 4307 * @enum { number } 4308 * @syscap SystemCapability.Communication.WiFi.P2P 4309 * @since 9 4310 */ 4311 enum P2pConnectState { 4312 /** 4313 * p2p is disconnected 4314 * @syscap SystemCapability.Communication.WiFi.P2P 4315 * @since 9 4316 */ 4317 DISCONNECTED = 0, 4318 4319 /** 4320 * p2p is connected 4321 * @syscap SystemCapability.Communication.WiFi.P2P 4322 * @since 9 4323 */ 4324 CONNECTED = 1 4325 } 4326 4327 /** 4328 * P2P linked information. 4329 * 4330 * @typedef WifiP2pLinkedInfo 4331 * @syscap SystemCapability.Communication.WiFi.P2P 4332 * @since 9 4333 */ 4334 interface WifiP2pLinkedInfo { 4335 /** 4336 * Connection status 4337 * @type { P2pConnectState } 4338 * @syscap SystemCapability.Communication.WiFi.P2P 4339 * @since 9 4340 */ 4341 connectState: P2pConnectState; 4342 4343 /** 4344 * Indicates whether it is group owner 4345 * @type { boolean } 4346 * @syscap SystemCapability.Communication.WiFi.P2P 4347 * @since 9 4348 */ 4349 isGroupOwner: boolean; 4350 4351 /** 4352 * Group owner address 4353 * @type { string } 4354 * @syscap SystemCapability.Communication.WiFi.P2P 4355 * @since 9 4356 */ 4357 groupOwnerAddr: string; 4358 } 4359 4360 /** 4361 * P2P device status. 4362 * 4363 * @enum { number } 4364 * @syscap SystemCapability.Communication.WiFi.P2P 4365 * @since 9 4366 */ 4367 enum P2pDeviceStatus { 4368 /** 4369 * Indicate p2p device is connected. 4370 * @syscap SystemCapability.Communication.WiFi.P2P 4371 * @since 9 4372 */ 4373 CONNECTED = 0, 4374 4375 /** 4376 * Indicate p2p device is invited. 4377 * @syscap SystemCapability.Communication.WiFi.P2P 4378 * @since 9 4379 */ 4380 INVITED = 1, 4381 4382 /** 4383 * Indicate p2p device is failed. 4384 * @syscap SystemCapability.Communication.WiFi.P2P 4385 * @since 9 4386 */ 4387 FAILED = 2, 4388 4389 /** 4390 * Indicate p2p device is available. 4391 * @syscap SystemCapability.Communication.WiFi.P2P 4392 * @since 9 4393 */ 4394 AVAILABLE = 3, 4395 4396 /** 4397 * Indicate p2p device is unavailable. 4398 * @syscap SystemCapability.Communication.WiFi.P2P 4399 * @since 9 4400 */ 4401 UNAVAILABLE = 4 4402 } 4403 4404 /** 4405 * P2P group owner band. 4406 * 4407 * @enum { number } 4408 * @syscap SystemCapability.Communication.WiFi.P2P 4409 * @since 9 4410 */ 4411 enum GroupOwnerBand { 4412 /** 4413 * default band. 4414 * @syscap SystemCapability.Communication.WiFi.P2P 4415 * @since 9 4416 */ 4417 GO_BAND_AUTO = 0, 4418 4419 /** 4420 * 2.4G band. 4421 * @syscap SystemCapability.Communication.WiFi.P2P 4422 * @since 9 4423 */ 4424 GO_BAND_2GHZ = 1, 4425 4426 /** 4427 * 5G band. 4428 * @syscap SystemCapability.Communication.WiFi.P2P 4429 * @since 9 4430 */ 4431 GO_BAND_5GHZ = 2 4432 } 4433} 4434 4435export default wifiManager; 4436