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