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