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