1/* 2 * Copyright (C) 2021-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 wifi 26 * @since 6 27 */ 28declare namespace wifi { 29 /** 30 * Enables Wi-Fi. 31 * 32 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 33 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 34 * @syscap SystemCapability.Communication.WiFi.STA 35 * @systemapi Hide this for inner system use. 36 * @since 6 37 * @deprecated since 9 38 * @useinstead ohos.wifiManager/wifiManager.enableWifi 39 */ 40 function enableWifi(): boolean; 41 42 /** 43 * Disables Wi-Fi. 44 * 45 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 46 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 47 * @syscap SystemCapability.Communication.WiFi.STA 48 * @systemapi Hide this for inner system use. 49 * @since 6 50 * @deprecated since 9 51 * @useinstead ohos.wifiManager/wifiManager.disableWifi 52 */ 53 function disableWifi(): boolean; 54 55 /** 56 * Queries the Wi-Fi status 57 * 58 * @permission ohos.permission.GET_WIFI_INFO 59 * @returns { boolean } Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise. 60 * @syscap SystemCapability.Communication.WiFi.STA 61 * @since 6 62 * @deprecated since 9 63 * @useinstead ohos.wifiManager/wifiManager.isWifiActive 64 */ 65 function isWifiActive(): boolean; 66 67 /** 68 * Scans Wi-Fi hotspot. 69 * 70 * <p>This API works in asynchronous mode.</p> 71 * 72 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION 73 * @returns { boolean } Returns {@code true} if the accessibility is succeed; returns {@code false} otherwise. 74 * @syscap SystemCapability.Communication.WiFi.STA 75 * @since 6 76 * @deprecated since 9 77 * @useinstead ohos.wifiManager/wifiManager.scan 78 */ 79 function scan(): boolean; 80 81 /** 82 * Obtains the hotspot information that scanned. 83 * 84 * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) 85 * @returns { Promise<Array<WifiScanInfo>> } Returns information about scanned Wi-Fi hotspot if any. 86 * @syscap SystemCapability.Communication.WiFi.STA 87 * @since 6 88 * @deprecated since 9 89 * @useinstead ohos.wifiManager/wifiManager.getScanInfoList 90 */ 91 function getScanInfos(): Promise<Array<WifiScanInfo>>; 92 93 /** 94 * Obtains the hotspot information that scanned. 95 * 96 * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) 97 * @param { AsyncCallback<Array<WifiScanInfo>> } get information about scanned Wi-Fi hotspot if any. 98 * @syscap SystemCapability.Communication.WiFi.STA 99 * @since 6 100 * @deprecated since 9 101 * @useinstead ohos.wifiManager/wifiManager.getScanInfoList 102 */ 103 function getScanInfos(callback: AsyncCallback<Array<WifiScanInfo>>): void; 104 105 /** 106 * Adds Wi-Fi connection configuration to the device. 107 * 108 * <p>The configuration will be updated when the configuration is added.</p> 109 * 110 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 111 * @param { WifiDeviceConfig } config Indicates the device configuration for connection to the Wi-Fi network. 112 * @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. 113 * @syscap SystemCapability.Communication.WiFi.STA 114 * @systemapi Hide this for inner system use. 115 * @since 6 116 * @deprecated since 9 117 * @useinstead ohos.wifiManager/wifiManager.addDeviceConfig 118 */ 119 function addDeviceConfig(config: WifiDeviceConfig): Promise<number>; 120 121 /** 122 * Adds Wi-Fi connection configuration to the device. 123 * 124 * <p>The configuration will be updated when the configuration is added.</p> 125 * 126 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 127 * @param { WifiDeviceConfig } config Indicates the device configuration for connection to the Wi-Fi network. 128 * @param { AsyncCallback<number> } 129 * @syscap SystemCapability.Communication.WiFi.STA 130 * @systemapi Hide this for inner system use. 131 * @since 6 132 * @deprecated since 9 133 * @useinstead ohos.wifiManager/wifiManager.addDeviceConfig 134 */ 135 function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void; 136 137 /** 138 * Adds a specified untrusted hotspot configuration. 139 * 140 * <p>This method adds one configuration at a time. After this configuration is added, 141 * your device will determine whether to connect to the hotspot. 142 * 143 * @permission ohos.permission.SET_WIFI_INFO 144 * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network. 145 * @returns { Promise<boolean> } Returns {@code true} if the untrusted hotspot configuration is added, returns {@code false} otherwise. 146 * @syscap SystemCapability.Communication.WiFi.STA 147 * @since 7 148 * @deprecated since 9 149 * @useinstead ohos.wifiManager/wifiManager.addCandidateConfig 150 */ 151 function addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean>; 152 153 /** 154 * Adds a specified untrusted hotspot configuration. 155 * 156 * <p>This method adds one configuration at a time. After this configuration is added, 157 * your device will determine whether to connect to the hotspot. 158 * 159 * @permission ohos.permission.SET_WIFI_INFO 160 * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network. 161 * @param { AsyncCallback<boolean> } 162 * @syscap SystemCapability.Communication.WiFi.STA 163 * @since 7 164 * @deprecated since 9 165 * @useinstead ohos.wifiManager/wifiManager.addCandidateConfig 166 */ 167 function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void; 168 169 /** 170 * Removes a specified untrusted hotspot configuration. 171 * 172 * <p>This method removes one configuration at a time. 173 * 174 * @permission ohos.permission.SET_WIFI_INFO 175 * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network. 176 * @returns { Promise<boolean> } Returns {@code true} if the untrusted hotspot configuration is removed, returns {@code false} otherwise. 177 * @syscap SystemCapability.Communication.WiFi.STA 178 * @since 7 179 * @deprecated since 9 180 * @useinstead ohos.wifiManager/wifiManager.removeCandidateConfig 181 */ 182 function removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean>; 183 184 /** 185 * Removes a specified untrusted hotspot configuration. 186 * 187 * <p>This method removes one configuration at a time. 188 * 189 * @permission ohos.permission.SET_WIFI_INFO 190 * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network. 191 * @param { AsyncCallback<boolean> } 192 * @syscap SystemCapability.Communication.WiFi.STA 193 * @since 7 194 * @deprecated since 9 195 * @useinstead ohos.wifiManager/wifiManager.removeCandidateConfig 196 */ 197 function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void; 198 199 /** 200 * Connects to Wi-Fi network. 201 * 202 * @permission ohos.permission.MANAGE_WIFI_CONNECTION 203 * @param { number } networkId ID of the connected network. 204 * @returns { boolean } Returns {@code true} if the network connection is successful, returns {@code false} otherwise. 205 * @syscap SystemCapability.Communication.WiFi.STA 206 * @systemapi Hide this for inner system use. 207 * @since 6 208 * @deprecated since 9 209 * @useinstead ohos.wifiManager/wifiManager.connectToNetwork 210 */ 211 function connectToNetwork(networkId: number): boolean; 212 213 /** 214 * Connects to Wi-Fi network. 215 * 216 * 217 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG and 218 * ohos.permission.MANAGE_WIFI_CONNECTION 219 * @param { WifiDeviceConfig } config Indicates the device configuration for connection to the Wi-Fi network. 220 * @returns { boolean } Returns {@code true} if the network connection is successful, returns {@code false} otherwise. 221 * @syscap SystemCapability.Communication.WiFi.STA 222 * @systemapi Hide this for inner system use. 223 * @since 6 224 * @deprecated since 9 225 * @useinstead ohos.wifiManager/wifiManager.connectToDevice 226 */ 227 function connectToDevice(config: WifiDeviceConfig): boolean; 228 229 /** 230 * Disconnect Wi-Fi network. 231 * 232 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 233 * @returns { boolean } Returns {@code true} for disconnecting network success, returns {@code false} otherwise. 234 * @syscap SystemCapability.Communication.WiFi.STA 235 * @systemapi Hide this for inner system use. 236 * @since 6 237 * @deprecated since 9 238 * @useinstead ohos.wifiManager/wifiManager.disconnect 239 */ 240 function disconnect(): boolean; 241 242 /** 243 * Calculates the Wi-Fi signal level based on the Wi-Fi RSSI and frequency band. 244 * 245 * @permission ohos.permission.GET_WIFI_INFO 246 * @param { number } rssi Indicates the Wi-Fi RSSI. 247 * @param { number } band Indicates the Wi-Fi frequency band. 248 * @returns { number } Returns Wi-Fi signal level ranging from 0 to 4. 249 * @syscap SystemCapability.Communication.WiFi.STA 250 * @since 6 251 * @deprecated since 9 252 * @useinstead ohos.wifiManager/wifiManager.getSignalLevel 253 */ 254 function getSignalLevel(rssi: number, band: number): number; 255 256 /** 257 * Obtains information about a Wi-Fi connection. 258 * 259 * @permission ohos.permission.GET_WIFI_INFO 260 * @returns { Promise<WifiLinkedInfo> } Returns Wi-Fi linked information. 261 * @syscap SystemCapability.Communication.WiFi.STA 262 * @since 6 263 * @deprecated since 9 264 * @useinstead ohos.wifiManager/wifiManager.getLinkedInfo 265 */ 266 function getLinkedInfo(): Promise<WifiLinkedInfo>; 267 268 /** 269 * Obtains information about a Wi-Fi connection. 270 * 271 * @permission ohos.permission.GET_WIFI_INFO 272 * @param { AsyncCallback<WifiLinkedInfo> } get Wi-Fi linked information. 273 * @syscap SystemCapability.Communication.WiFi.STA 274 * @since 6 275 * @deprecated since 9 276 * @useinstead ohos.wifiManager/wifiManager.getLinkedInfo 277 */ 278 function getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void; 279 280 /** 281 * Checks whether a Wi-Fi connection has been set up. 282 * 283 * @permission ohos.permission.GET_WIFI_INFO 284 * @returns { boolean } Returns {@code true} if a Wi-Fi connection has been set up, returns {@code false} otherwise. 285 * @syscap SystemCapability.Communication.WiFi.STA 286 * @since 7 287 * @deprecated since 9 288 * @useinstead ohos.wifiManager/wifiManager.isConnected 289 */ 290 function isConnected(): boolean; 291 292 /** 293 * Obtains the features supported by this device. 294 * 295 * <p>To check whether this device supports a specified feature. 296 * 297 * @permission ohos.permission.GET_WIFI_INFO 298 * @returns { number }Returns the features supported by this device. 299 * @syscap SystemCapability.Communication.WiFi.Core 300 * @systemapi Hide this for inner system use. 301 * @since 7 302 * @deprecated since 9 303 * @useinstead ohos.wifiManager/wifiManager.getSupportedFeatures 304 */ 305 function getSupportedFeatures(): number; 306 307 /** 308 * Checks whether this device supports a specified feature. 309 * 310 * @permission ohos.permission.GET_WIFI_INFO 311 * @param { number } featureId Indicates the ID of the feature. 312 * @returns { boolean } Returns {@code true} if this device supports the specified feature, returns {@code false} otherwise. 313 * @syscap SystemCapability.Communication.WiFi.Core 314 * @since 7 315 * @deprecated since 9 316 * @useinstead ohos.wifiManager/wifiManager.isFeatureSupported 317 */ 318 function isFeatureSupported(featureId: number): boolean; 319 320 /** 321 * Obtains the MAC address of a Wi-Fi device. Wi-Fi must be enabled. 322 * 323 * <p>The MAC address is unique and cannot be changed. 324 * 325 * @permission ohos.permission.GET_WIFI_LOCAL_MAC and ohos.permission.GET_WIFI_INFO 326 * @returns { string[] } Returns the MAC address of the Wi-Fi device. 327 * @syscap SystemCapability.Communication.WiFi.STA 328 * @systemapi Hide this for inner system use. 329 * @since 7 330 * @deprecated since 9 331 * @useinstead ohos.wifiManager/wifiManager.getDeviceMacAddress 332 */ 333 function getDeviceMacAddress(): string[]; 334 335 /** 336 * Obtains the IP information of a Wi-Fi connection. 337 * 338 * <p>The IP information includes the host IP address, gateway address, and DNS information. 339 * 340 * @permission ohos.permission.GET_WIFI_INFO 341 * @returns { IpInfo } Returns the IP information of the Wi-Fi connection. 342 * @syscap SystemCapability.Communication.WiFi.STA 343 * @since 7 344 * @deprecated since 9 345 * @useinstead ohos.wifiManager/wifiManager.getIpInfo 346 */ 347 function getIpInfo(): IpInfo; 348 349 /** 350 * Obtains the country code of this device. 351 * 352 * @permission ohos.permission.GET_WIFI_INFO 353 * @returns { string } Returns the country code of this device. 354 * @syscap SystemCapability.Communication.WiFi.Core 355 * @since 7 356 * @deprecated since 9 357 * @useinstead ohos.wifiManager/wifiManager.getCountryCode 358 */ 359 function getCountryCode(): string; 360 361 /** 362 * Re-associate to current network. 363 * 364 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 365 * @returns { boolean } {@code true} if the Wi-Fi network is re-associate successfully. 366 * @syscap SystemCapability.Communication.WiFi.STA 367 * @systemapi Hide this for inner system use. 368 * @since 7 369 * @deprecated since 9 370 * @useinstead ohos.wifiManager/wifiManager.reassociate 371 */ 372 function reassociate(): boolean; 373 374 /** 375 * Re-connects to current network. 376 * 377 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 378 * @returns { boolean } {@code true} if the Wi-Fi network is re-connect successfully. 379 * @syscap SystemCapability.Communication.WiFi.STA 380 * @systemapi Hide this for inner system use. 381 * @since 7 382 * @deprecated since 9 383 * @useinstead ohos.wifiManager/wifiManager.reconnect 384 */ 385 function reconnect(): boolean; 386 387 /** 388 * Obtains the list of all existing Wi-Fi configurations. 389 * 390 * <p>You can obtain only the Wi-Fi configurations you created on your own application. 391 * 392 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.GET_WIFI_CONFIG 393 * @returns { Array<WifiDeviceConfig> } sReturns the list of all existing Wi-Fi configurations you created on your application. 394 * @syscap SystemCapability.Communication.WiFi.STA 395 * @systemapi Hide this for inner system use. 396 * @since 7 397 * @deprecated since 9 398 * @useinstead ohos.wifiManager/wifiManager.getDeviceConfigs 399 */ 400 function getDeviceConfigs(): Array<WifiDeviceConfig>; 401 402 /** 403 * Updates the specified Wi-Fi configuration. 404 * 405 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG 406 * @param { WifiDeviceConfig } config Indicates the Wi-Fi configuration to update. 407 * @returns { number } Returns the network ID in the updated Wi-Fi configuration if the update is successful; 408 * returns {@code -1} if the specified Wi-Fi configuration is not contained in the list. 409 * @syscap SystemCapability.Communication.WiFi.STA 410 * @systemapi Hide this for inner system use. 411 * @since 7 412 * @deprecated since 9 413 * @useinstead ohos.wifiManager/wifiManager.updateDeviceConfig 414 */ 415 function updateNetwork(config: WifiDeviceConfig): number; 416 417 /** 418 * Disables a specified network. 419 * 420 * <p>The disabled network will not be associated with again. 421 * 422 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 423 * @param { number } netId Identifies the network to disable. 424 * @returns { boolean } Returns {@code true} if the specified network is disabled, returns {@code false} otherwise. 425 * @syscap SystemCapability.Communication.WiFi.STA 426 * @systemapi Hide this for inner system use. 427 * @since 7 428 * @deprecated since 9 429 * @useinstead ohos.wifiManager/wifiManager.disableDeviceConfig 430 */ 431 function disableNetwork(netId: number): boolean; 432 433 /** 434 * Removes all the saved Wi-Fi configurations. 435 * 436 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 437 * @returns { boolean } Returns {@code true} if all the saved Wi-Fi configurations are removed; 438 * returns {@code false} otherwise. 439 * @syscap SystemCapability.Communication.WiFi.STA 440 * @systemapi Hide this for inner system use. 441 * @since 7 442 * @deprecated since 9 443 * @useinstead ohos.wifiManager/wifiManager.removeAllDeviceConfigs 444 */ 445 function removeAllNetwork(): boolean; 446 447 /** 448 * Deletes a Wi-Fi network with a specified ID. 449 * 450 * <p>After a Wi-Fi network is deleted, its configuration will be deleted from the list of Wi-Fi configurations. 451 * If the Wi-Fi network is being connected, the connection will be interrupted. 452 * The application can only delete Wi-Fi networks it has created. 453 * 454 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 455 * @param { number } id Indicates the ID of the Wi-Fi network, 456 * which can be obtained using the {@link #addDeviceConfig} or {@link #getLinkedInfo} method. 457 * @returns { boolean } Returns {@code true} if the Wi-Fi network is deleted successfully, returns {@code false} otherwise. 458 * @syscap SystemCapability.Communication.WiFi.STA 459 * @systemapi Hide this for inner system use. 460 * @since 7 461 * @deprecated since 9 462 * @useinstead ohos.wifiManager/wifiManager.removeDeviceConfig 463 */ 464 function removeDevice(id: number): boolean; 465 466 /** 467 * Enables a Wi-Fi hotspot. 468 * 469 * <p>This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled. 470 * 471 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 472 * @returns { boolean } Returns {@code true} if this method is called successfully, returns {@code false} otherwise. 473 * @syscap SystemCapability.Communication.WiFi.AP.Core 474 * @systemapi Hide this for inner system use. 475 * @since 7 476 * @deprecated since 9 477 * @useinstead ohos.wifiManager/wifiManager.enableHotspot 478 */ 479 function enableHotspot(): boolean; 480 481 /** 482 * Disables a Wi-Fi hotspot. 483 * 484 * <p>This method is asynchronous. If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled. 485 * 486 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 487 * @returns { boolean } Returns {@code true} if this method is called successfully, returns {@code false} otherwise. 488 * @syscap SystemCapability.Communication.WiFi.AP.Core 489 * @systemapi Hide this for inner system use. 490 * @since 7 491 * @deprecated since 9 492 * @useinstead ohos.wifiManager/wifiManager.disableHotspot 493 */ 494 function disableHotspot(): boolean; 495 496 /** 497 * Checks whether a device serving as a Wi-Fi hotspot supports both the 2.4 GHz and 5 GHz Wi-Fi. 498 * 499 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT 500 * @returns { boolean } Returns {@code true} if the method is called successfully, returns {@code false} otherwise. 501 * @syscap SystemCapability.Communication.WiFi.AP.Core 502 * @systemapi Hide this for inner system use. 503 * @since 7 504 * @deprecated since 9 505 * @useinstead ohos.wifiManager/wifiManager.isHotspotDualBandSupported 506 */ 507 function isHotspotDualBandSupported(): boolean; 508 509 /** 510 * Checks whether Wi-Fi hotspot is active on a device. 511 * 512 * @permission ohos.permission.GET_WIFI_INFO 513 * @returns { boolean } Returns {@code true} if Wi-Fi hotspot is enabled, returns {@code false} otherwise. 514 * @syscap SystemCapability.Communication.WiFi.AP.Core 515 * @systemapi Hide this for inner system use. 516 * @since 7 517 * @deprecated since 9 518 * @useinstead ohos.wifiManager/wifiManager.isHotspotActive 519 */ 520 function isHotspotActive(): boolean; 521 522 /** 523 * Sets the hotspot for a device. 524 * 525 * <p>Only OPEN and WPA2 PSK hotspot can be configured. 526 * 527 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 528 * @param { HotspotConfig } Indicates the Wi-Fi hotspot configuration. 529 * The SSID and {@code securityType} must be available and correct. 530 * If {@code securityType} is not {@code open}, {@code preSharedKey} must be available and correct. 531 * @returns { boolean } Returns {@code true} if the method is called successfully, returns {@code false} otherwise. 532 * @syscap SystemCapability.Communication.WiFi.AP.Core 533 * @systemapi Hide this for inner system use. 534 * @since 7 535 * @deprecated since 9 536 * @useinstead ohos.wifiManager/wifiManager.setHotspotConfig 537 */ 538 function setHotspotConfig(config: HotspotConfig): boolean; 539 540 /** 541 * Obtains the Wi-Fi hotspot configuration. 542 * 543 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG 544 * @returns { HotspotConfig } Returns the configuration of an existing or enabled Wi-Fi hotspot. 545 * @syscap SystemCapability.Communication.WiFi.AP.Core 546 * @systemapi Hide this for inner system use. 547 * @since 7 548 * @deprecated since 9 549 * @useinstead ohos.wifiManager/wifiManager.getHotspotConfig 550 */ 551 function getHotspotConfig(): HotspotConfig; 552 553 /** 554 * Obtains the list of clients that are connected to a Wi-Fi hotspot. 555 * 556 * <p>This method can only be used on a device that serves as a Wi-Fi hotspot. 557 * 558 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT 559 * @returns { Array<StationInfo> } Returns the list of clients that are connected to the Wi-Fi hotspot. 560 * @syscap SystemCapability.Communication.WiFi.AP.Core 561 * @systemapi Hide this for inner system use. 562 * @since 7 563 * @deprecated since 9 564 * @useinstead ohos.wifiManager/wifiManager.getHotspotStations 565 */ 566 function getStations(): Array<StationInfo>; 567 568 /** 569 * Obtains information about a P2P connection. 570 * 571 * @permission ohos.permission.GET_WIFI_INFO 572 * @returns { Promise<WifiP2pLinkedInfo> } Returns the P2P connection information. 573 * @syscap SystemCapability.Communication.WiFi.P2P 574 * @since 8 575 * @deprecated since 9 576 * @useinstead ohos.wifiManager/wifiManager.getP2pLinkedInfo 577 */ 578 function getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo>; 579 580 /** 581 * Obtains information about a P2P connection. 582 * 583 * @permission ohos.permission.GET_WIFI_INFO 584 * @param { AsyncCallback<WifiP2pLinkedInfo> } get the P2P connection information. 585 * @syscap SystemCapability.Communication.WiFi.P2P 586 * @since 8 587 * @deprecated since 9 588 * @useinstead ohos.wifiManager/wifiManager.getP2pLinkedInfo 589 */ 590 function getP2pLinkedInfo(callback: AsyncCallback<WifiP2pLinkedInfo>): void; 591 592 /** 593 * Obtains information about the current group. 594 * 595 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 596 * @returns { Promise<WifiP2pGroupInfo> } Returns the current group information. 597 * @syscap SystemCapability.Communication.WiFi.P2P 598 * @since 8 599 * @deprecated since 9 600 * @useinstead ohos.wifiManager/wifiManager.getCurrentGroup 601 */ 602 function getCurrentGroup(): Promise<WifiP2pGroupInfo>; 603 604 /** 605 * Obtains information about the current group. 606 * 607 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 608 * @param { AsyncCallback<WifiP2pGroupInfo> } get the current group information. 609 * @syscap SystemCapability.Communication.WiFi.P2P 610 * @since 8 611 * @deprecated since 9 612 * @useinstead ohos.wifiManager/wifiManager.getCurrentGroup 613 */ 614 function getCurrentGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void; 615 616 /** 617 * Obtains the information about the found devices. 618 * 619 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 620 * @returns { Promise<WifiP2pDevice[]> } Returns the found devices list. 621 * @syscap SystemCapability.Communication.WiFi.P2P 622 * @since 8 623 * @deprecated since 9 624 * @useinstead ohos.wifiManager/wifiManager.getP2pPeerDevices 625 */ 626 function getP2pPeerDevices(): Promise<WifiP2pDevice[]>; 627 628 /** 629 * Obtains the information about the found devices. 630 * 631 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 632 * @param { AsyncCallback<WifiP2pDevice[]> } Returns the found devices list. 633 * @syscap SystemCapability.Communication.WiFi.P2P 634 * @since 8 635 * @deprecated since 9 636 * @useinstead ohos.wifiManager/wifiManager.getP2pPeerDevices 637 */ 638 function getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void; 639 640 /** 641 * Creates a P2P group. 642 * 643 * @permission ohos.permission.GET_WIFI_INFO 644 * @param { WifiP2PConfig } config Indicates the configuration for creating a group. 645 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 646 * @syscap SystemCapability.Communication.WiFi.P2P 647 * @since 8 648 * @deprecated since 9 649 * @useinstead ohos.wifiManager/wifiManager.createP2pGroup 650 */ 651 function createGroup(config: WifiP2PConfig): boolean; 652 653 /** 654 * Removes a P2P group. 655 * 656 * @permission ohos.permission.GET_WIFI_INFO 657 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 658 * @syscap SystemCapability.Communication.WiFi.P2P 659 * @since 8 660 * @deprecated since 9 661 * @useinstead ohos.wifiManager/wifiManager.removeP2pGroup 662 */ 663 function removeGroup(): boolean; 664 665 /** 666 * Initiates a P2P connection to a device with the specified configuration. 667 * 668 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 669 * @param { WifiP2PConfig } config Indicates the configuration for connecting to a specific group. 670 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 671 * @syscap SystemCapability.Communication.WiFi.P2P 672 * @since 8 673 * @deprecated since 9 674 * @useinstead ohos.wifiManager/wifiManager.p2pConnect 675 */ 676 function p2pConnect(config: WifiP2PConfig): boolean; 677 678 /** 679 * Canceling a P2P connection. 680 * 681 * @permission ohos.permission.GET_WIFI_INFO 682 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 683 * @syscap SystemCapability.Communication.WiFi.P2P 684 * @since 8 685 * @deprecated since 9 686 * @useinstead ohos.wifiManager/wifiManager.p2pCancelConnect 687 */ 688 function p2pCancelConnect(): boolean; 689 690 /** 691 * Discover Wi-Fi P2P devices. 692 * 693 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 694 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 695 * @syscap SystemCapability.Communication.WiFi.P2P 696 * @since 8 697 * @deprecated since 9 698 * @useinstead ohos.wifiManager/wifiManager.startDiscoverP2pDevices 699 */ 700 function startDiscoverDevices(): boolean; 701 702 /** 703 * Stops discovering Wi-Fi P2P devices. 704 * 705 * @permission ohos.permission.GET_WIFI_INFO 706 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 707 * @syscap SystemCapability.Communication.WiFi.P2P 708 * @since 8 709 * @deprecated since 9 710 * @useinstead ohos.wifiManager/wifiManager.stopDiscoverP2pDevices 711 */ 712 function stopDiscoverDevices(): boolean; 713 714 /** 715 * Deletes the persistent P2P group with the specified network ID. 716 * 717 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 718 * @param { number } Indicates the network ID of the group to be deleted. 719 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 720 * @syscap SystemCapability.Communication.WiFi.P2P 721 * @systemapi Hide this for inner system use. 722 * @since 8 723 * @deprecated since 9 724 * @useinstead ohos.wifiManager/wifiManager.deletePersistentP2pGroup 725 */ 726 function deletePersistentGroup(netId: number): boolean; 727 728 /** 729 * Sets the name of the Wi-Fi P2P device. 730 * 731 * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION 732 * @param { string } devName Indicates the name to be set. 733 * @returns { boolean } Returns {@code true} if the operation is successful, returns {@code false} otherwise. 734 * @syscap SystemCapability.Communication.WiFi.P2P 735 * @systemapi Hide this for inner system use. 736 * @since 8 737 * @deprecated since 9 738 * @useinstead ohos.wifiManager/wifiManager.setP2pDeviceName 739 */ 740 function setDeviceName(devName: string): boolean; 741 742 /** 743 * Subscribe Wi-Fi status change events. 744 * 745 * @permission ohos.permission.GET_WIFI_INFO 746 * @param { 'wifiStateChange' } type - event name. 747 * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating 748 * @syscap SystemCapability.Communication.WiFi.STA 749 * @since 7 750 * @deprecated since 9 751 * @useinstead ohos.wifiManager/wifiManager.on#event:wifiStateChange 752 */ 753 function on(type: 'wifiStateChange', callback: Callback<number>): void; 754 755 /** 756 * Unsubscribe Wi-Fi status change events. 757 * 758 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 759 * 760 * @permission ohos.permission.GET_WIFI_INFO 761 * @param { 'wifiStateChange' } type - event name. 762 * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating 763 * @syscap SystemCapability.Communication.WiFi.STA 764 * @since 7 765 * @deprecated since 9 766 * @useinstead ohos.wifiManager/wifiManager.off#event:wifiStateChange 767 */ 768 function off(type: 'wifiStateChange', callback?: Callback<number>): void; 769 770 /** 771 * Subscribe Wi-Fi connection change events. 772 * 773 * @permission ohos.permission.GET_WIFI_INFO 774 * @param { 'wifiConnectionChange' } type - event name. 775 * @param { Callback<number> } callback - the callback of on, 0: disconnected, 1: connected 776 * @syscap SystemCapability.Communication.WiFi.STA 777 * @since 7 778 * @deprecated since 9 779 * @useinstead ohos.wifiManager/wifiManager.on#event:wifiConnectionChange 780 */ 781 function on(type: 'wifiConnectionChange', callback: Callback<number>): void; 782 783 /** 784 * Unsubscribe Wi-Fi connection change events. 785 * 786 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 787 * 788 * @permission ohos.permission.GET_WIFI_INFO 789 * @param { 'wifiConnectionChange' } type - event name. 790 * @param { Callback<number> } callback - the callback of on, 0: disconnected, 1: connected 791 * @syscap SystemCapability.Communication.WiFi.STA 792 * @since 7 793 * @deprecated since 9 794 * @useinstead ohos.wifiManager/wifiManager.off#event:wifiConnectionChange 795 */ 796 function off(type: 'wifiConnectionChange', callback?: Callback<number>): void; 797 798 /** 799 * Subscribe Wi-Fi scan status change events. 800 * 801 * @permission ohos.permission.GET_WIFI_INFO 802 * @param { 'wifiScanStateChange' } type - event name. 803 * @param { Callback<number> } callback - the callback of on, 0: scan fail, 1: scan success 804 * @syscap SystemCapability.Communication.WiFi.STA 805 * @since 7 806 * @deprecated since 9 807 * @useinstead ohos.wifiManager/wifiManager.on#event:wifiScanStateChange 808 */ 809 function on(type: 'wifiScanStateChange', callback: Callback<number>): void; 810 811 /** 812 * Unsubscribe Wi-Fi scan status change events. 813 * 814 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 815 * 816 * @permission ohos.permission.GET_WIFI_INFO 817 * @param { 'wifiScanStateChange' } type - event name. 818 * @param { Callback<number> } callback - the callback of on, 0: scan fail, 1: scan success 819 * @syscap SystemCapability.Communication.WiFi.STA 820 * @since 7 821 * @deprecated since 9 822 * @useinstead ohos.wifiManager/wifiManager.off#event:wifiScanStateChange 823 */ 824 function off(type: 'wifiScanStateChange', callback?: Callback<number>): void; 825 826 /** 827 * Subscribe Wi-Fi rssi change events. 828 * 829 * @permission ohos.permission.GET_WIFI_INFO 830 * @param { 'wifiRssiChange' } type - event name. 831 * @param { Callback<number> } callback - the callback of on 832 * @syscap SystemCapability.Communication.WiFi.STA 833 * @since 7 834 * @deprecated since 9 835 * @useinstead ohos.wifiManager/wifiManager.on#event:wifiRssiChange 836 */ 837 function on(type: 'wifiRssiChange', callback: Callback<number>): void; 838 839 /** 840 * Unsubscribe Wi-Fi rssi change events. 841 * 842 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 843 * 844 * @permission ohos.permission.GET_WIFI_INFO 845 * @param { 'wifiRssiChange' } type - event name. 846 * @param { Callback<number> } callback - the callback of on 847 * @syscap SystemCapability.Communication.WiFi.STA 848 * @since 7 849 * @deprecated since 9 850 * @useinstead ohos.wifiManager/wifiManager.off#event:wifiRssiChange 851 */ 852 function off(type: 'wifiRssiChange', callback?: Callback<number>): void; 853 854 /** 855 * Subscribe Wi-Fi stream change events. 856 * 857 * @permission ohos.permission.MANAGE_WIFI_CONNECTION 858 * @param { 'streamChange' } type - event name. 859 * @param { Callback<number> } callback - the callback of on, 1: stream down, 2: stream up, 3: stream bidirectional 860 * @syscap SystemCapability.Communication.WiFi.STA 861 * @systemapi Hide this for inner system use. 862 * @since 7 863 * @deprecated since 9 864 * @useinstead ohos.wifiManager/wifiManager.on#event:streamChange 865 */ 866 function on(type: 'streamChange', callback: Callback<number>): void; 867 868 /** 869 * Unsubscribe Wi-Fi stream change events. 870 * 871 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 872 * 873 * @permission ohos.permission.MANAGE_WIFI_CONNECTION 874 * @param { 'streamChange' } type - event name. 875 * @param { Callback<number> } callback - the callback of on, 1: stream down, 2: stream up, 3: stream bidirectional 876 * @syscap SystemCapability.Communication.WiFi.STA 877 * @systemapi Hide this for inner system use. 878 * @since 7 879 * @deprecated since 9 880 * @useinstead ohos.wifiManager/wifiManager.off#event:streamChange 881 */ 882 function off(type: 'streamChange', callback?: Callback<number>): void; 883 884 /** 885 * Subscribe Wi-Fi hotspot state change events. 886 * 887 * @permission ohos.permission.GET_WIFI_INFO 888 * @param { 'hotspotStateChange' } type - event name. 889 * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating 890 * @syscap SystemCapability.Communication.WiFi.AP.Core 891 * @since 7 892 * @deprecated since 9 893 * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStateChange 894 */ 895 function on(type: 'hotspotStateChange', callback: Callback<number>): void; 896 897 /** 898 * Unsubscribe Wi-Fi hotspot state change events. 899 * 900 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 901 * 902 * @permission ohos.permission.GET_WIFI_INFO 903 * @param { 'hotspotStateChange' } type - event name. 904 * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating 905 * @syscap SystemCapability.Communication.WiFi.AP.Core 906 * @since 7 907 * @deprecated since 9 908 * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStateChange 909 */ 910 function off(type: 'hotspotStateChange', callback?: Callback<number>): void; 911 912 /** 913 * Subscribe Wi-Fi hotspot sta join events. 914 * 915 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 916 * @param { 'hotspotStaJoin' } type - event name. 917 * @param { Callback<StationInfo> } callback - the callback of on 918 * @syscap SystemCapability.Communication.WiFi.AP.Core 919 * @systemapi Hide this for inner system use. 920 * @since 7 921 * @deprecated since 9 922 * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStaJoin 923 */ 924 function on(type: 'hotspotStaJoin', callback: Callback<StationInfo>): void; 925 926 /** 927 * Unsubscribe Wi-Fi hotspot sta join events. 928 * 929 * <p>All callback functions will be deregistered If there is no specific callback parameter.</p> 930 * 931 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 932 * @param { 'hotspotStaJoin' } type - event name. 933 * @param { Callback<StationInfo> } callback - the callback of on 934 * @syscap SystemCapability.Communication.WiFi.AP.Core 935 * @systemapi Hide this for inner system use. 936 * @since 7 937 * @deprecated since 9 938 * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStaJoin 939 */ 940 function off(type: 'hotspotStaJoin', callback?: Callback<StationInfo>): void; 941 942 /** 943 * Subscribe Wi-Fi hotspot sta leave events. 944 * 945 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 946 * @param { 'hotspotStaLeave' } type - event name. 947 * @param { Callback<StationInfo> } callback - the callback of on 948 * @syscap SystemCapability.Communication.WiFi.AP.Core 949 * @systemapi Hide this for inner system use. 950 * @since 7 951 * @deprecated since 9 952 * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStaLeave 953 */ 954 function on(type: 'hotspotStaLeave', callback: Callback<StationInfo>): void; 955 956 /** 957 * Unsubscribe Wi-Fi hotspot sta leave events. 958 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT 959 * @param { 'hotspotStaLeave' } type - event name. 960 * @param { Callback<StationInfo> } callback - the callback of on 961 * @syscap SystemCapability.Communication.WiFi.AP.Core 962 * @systemapi Hide this for inner system use. 963 * @since 7 964 * @deprecated since 9 965 * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStaLeave 966 */ 967 function off(type: 'hotspotStaLeave', callback?: Callback<StationInfo>): void; 968 969 /** 970 * Subscribe P2P status change events. 971 * 972 * @permission ohos.permission.GET_WIFI_INFO 973 * @param { 'p2pStateChange' } type - event name. 974 * @param { Callback<number> } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed 975 * @syscap SystemCapability.Communication.WiFi.P2P 976 * @since 8 977 * @deprecated since 9 978 * @useinstead ohos.wifiManager/wifiManager.on#event:p2pStateChange 979 */ 980 function on(type: 'p2pStateChange', callback: Callback<number>): void; 981 982 /** 983 * Unsubscribe P2P status change events. 984 * 985 * @permission ohos.permission.GET_WIFI_INFO 986 * @param { 'p2pStateChange' } type - event name. 987 * @param { Callback<number> } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed 988 * @syscap SystemCapability.Communication.WiFi.P2P 989 * @since 8 990 * @deprecated since 9 991 * @useinstead ohos.wifiManager/wifiManager.off#event:p2pStateChange 992 */ 993 function off(type: 'p2pStateChange', callback?: Callback<number>): void; 994 995 /** 996 * Subscribe P2P connection change events. 997 * 998 * @permission ohos.permission.GET_WIFI_INFO 999 * @param { 'p2pConnectionChange' } type - event name. 1000 * @param { Callback<WifiP2pLinkedInfo> } callback - the callback of on 1001 * @syscap SystemCapability.Communication.WiFi.P2P 1002 * @since 8 1003 * @deprecated since 9 1004 * @useinstead ohos.wifiManager/wifiManager.on#event:p2pConnectionChange 1005 */ 1006 function on(type: 'p2pConnectionChange', callback: Callback<WifiP2pLinkedInfo>): void; 1007 1008 /** 1009 * Unsubscribe P2P connection change events. 1010 * 1011 * @permission ohos.permission.GET_WIFI_INFO 1012 * @param { 'p2pConnectionChange' } type - event name. 1013 * @param { Callback<WifiP2pLinkedInfo> } callback - the callback of on 1014 * @syscap SystemCapability.Communication.WiFi.P2P 1015 * @since 8 1016 * @deprecated since 9 1017 * @useinstead ohos.wifiManager/wifiManager.off#event:p2pConnectionChange 1018 */ 1019 function off(type: 'p2pConnectionChange', callback?: Callback<WifiP2pLinkedInfo>): void; 1020 1021 /** 1022 * Subscribe P2P local device change events. 1023 * 1024 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 1025 * @param { 'p2pDeviceChange' } type - event name. 1026 * @param { Callback<WifiP2pDevice> } callback - the callback of on 1027 * @syscap SystemCapability.Communication.WiFi.P2P 1028 * @since 8 1029 * @deprecated since 9 1030 * @useinstead ohos.wifiManager/wifiManager.on#event:p2pDeviceChange 1031 */ 1032 function on(type: 'p2pDeviceChange', callback: Callback<WifiP2pDevice>): void; 1033 1034 /** 1035 * Unsubscribe P2P local device change events. 1036 * 1037 * @permission ohos.permission.LOCATION 1038 * @param { 'p2pDeviceChange' } type - event name. 1039 * @param { Callback<WifiP2pDevice> } callback - the callback of on 1040 * @syscap SystemCapability.Communication.WiFi.P2P 1041 * @since 8 1042 * @deprecated since 9 1043 * @useinstead ohos.wifiManager/wifiManager.off#event:p2pDeviceChange 1044 */ 1045 function off(type: 'p2pDeviceChange', callback?: Callback<WifiP2pDevice>): void; 1046 1047 /** 1048 * Subscribe P2P peer device change events. 1049 * 1050 * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION 1051 * @param { 'p2pPeerDeviceChange' } type - event name. 1052 * @param { Callback<WifiP2pDevice[]> } callback - the callback of on 1053 * @syscap SystemCapability.Communication.WiFi.P2P 1054 * @since 8 1055 * @deprecated since 9 1056 * @useinstead ohos.wifiManager/wifiManager.on#event:p2pPeerDeviceChange 1057 */ 1058 function on(type: 'p2pPeerDeviceChange', callback: Callback<WifiP2pDevice[]>): void; 1059 1060 /** 1061 * Unsubscribe P2P peer device change events. 1062 * 1063 * @permission ohos.permission.LOCATION 1064 * @param { 'p2pPeerDeviceChange' } type - event name. 1065 * @param { Callback<WifiP2pDevice[]> } callback - the callback of on 1066 * @syscap SystemCapability.Communication.WiFi.P2P 1067 * @since 8 1068 * @deprecated since 9 1069 * @useinstead ohos.wifiManager/wifiManager.off#event:p2pPeerDeviceChange 1070 */ 1071 function off(type: 'p2pPeerDeviceChange', callback?: Callback<WifiP2pDevice[]>): void; 1072 1073 /** 1074 * Subscribe P2P persistent group change events. 1075 * 1076 * @permission ohos.permission.GET_WIFI_INFO 1077 * @param { 'p2pPersistentGroupChange' } type - event name. 1078 * @param { Callback<void> } callback - the callback of on 1079 * @syscap SystemCapability.Communication.WiFi.P2P 1080 * @since 8 1081 * @deprecated since 9 1082 * @useinstead ohos.wifiManager/wifiManager.on#event:p2pPersistentGroupChange 1083 */ 1084 function on(type: 'p2pPersistentGroupChange', callback: Callback<void>): void; 1085 1086 /** 1087 * Unsubscribe P2P persistent group change events. 1088 * 1089 * @permission ohos.permission.GET_WIFI_INFO 1090 * @param { 'p2pPersistentGroupChange' } type - event name. 1091 * @param { Callback<void> } callback - the callback of on 1092 * @syscap SystemCapability.Communication.WiFi.P2P 1093 * @since 8 1094 * @deprecated since 9 1095 * @useinstead ohos.wifiManager/wifiManager.off#event:p2pPersistentGroupChange 1096 */ 1097 function off(type: 'p2pPersistentGroupChange', callback?: Callback<void>): void; 1098 1099 /** 1100 * Subscribe P2P discovery events. 1101 * 1102 * @permission ohos.permission.GET_WIFI_INFO 1103 * @param { 'p2pDiscoveryChange' } type - event name. 1104 * @param { Callback<number> } callback - the callback of on 1105 * @syscap SystemCapability.Communication.WiFi.P2P 1106 * @since 8 1107 * @deprecated since 9 1108 * @useinstead ohos.wifiManager/wifiManager.on#event:p2pDiscoveryChange 1109 */ 1110 function on(type: 'p2pDiscoveryChange', callback: Callback<number>): void; 1111 1112 /** 1113 * Unsubscribe P2P discovery events. 1114 * 1115 * @permission ohos.permission.GET_WIFI_INFO 1116 * @param { 'p2pDiscoveryChange' } type - event name. 1117 * @param { Callback<number> } callback - the callback of on 1118 * @syscap SystemCapability.Communication.WiFi.P2P 1119 * @since 8 1120 * @deprecated since 9 1121 * @useinstead ohos.wifiManager/wifiManager.off#event:p2pDiscoveryChange 1122 */ 1123 function off(type: 'p2pDiscoveryChange', callback?: Callback<number>): void; 1124 1125 /** 1126 * Wi-Fi device configuration information. 1127 * 1128 * @interface WifiDeviceConfig 1129 * @syscap SystemCapability.Communication.WiFi.STA 1130 * @since 6 1131 * @deprecated since 9 1132 * @useinstead ohos.wifiManager/wifiManager.WifiDeviceConfig 1133 */ 1134 interface WifiDeviceConfig { 1135 /** Wi-Fi SSID: the maximum length is 32 1136 * @syscap SystemCapability.Communication.WiFi.STA 1137 * @since 6 1138 * @deprecated since 9 1139 */ 1140 ssid: string; 1141 1142 /** Wi-Fi bssid(MAC): the length is 6 1143 * @syscap SystemCapability.Communication.WiFi.STA 1144 * @since 6 1145 * @deprecated since 9 1146 */ 1147 bssid: string; 1148 1149 /** Wi-Fi key: maximum length is 64 1150 * @syscap SystemCapability.Communication.WiFi.STA 1151 * @since 6 1152 * @deprecated since 9 1153 */ 1154 preSharedKey: string; 1155 1156 /** Hide SSID or not, false(default): not hide 1157 * @syscap SystemCapability.Communication.WiFi.STA 1158 * @since 6 1159 * @deprecated since 9 1160 */ 1161 isHiddenSsid: boolean; 1162 1163 /** Security type: reference definition of WifiSecurityType 1164 * @syscap SystemCapability.Communication.WiFi.STA 1165 * @since 6 1166 * @deprecated since 9 1167 */ 1168 securityType: WifiSecurityType; 1169 1170 /** The UID of the Wi-Fi configuration creator 1171 * @syscap SystemCapability.Communication.WiFi.STA 1172 * @since 6 1173 * @deprecated since 9 1174 */ 1175 /* @systemapi */ 1176 creatorUid: number; 1177 1178 /** Disable reason 1179 * @syscap SystemCapability.Communication.WiFi.STA 1180 * @since 6 1181 * @deprecated since 9 1182 */ 1183 /* @systemapi */ 1184 disableReason: number; 1185 1186 /** Allocated networkId 1187 * @syscap SystemCapability.Communication.WiFi.STA 1188 * @since 6 1189 * @deprecated since 9 1190 */ 1191 /* @systemapi */ 1192 netId: number; 1193 1194 /** Random mac type 1195 * @syscap SystemCapability.Communication.WiFi.STA 1196 * @since 6 1197 * @deprecated since 9 1198 */ 1199 /* @systemapi */ 1200 randomMacType: number; 1201 1202 /** Random mac address, the length is 6 1203 * @syscap SystemCapability.Communication.WiFi.STA 1204 * @since 6 1205 * @deprecated since 9 1206 */ 1207 /* @systemapi */ 1208 randomMacAddr: string; 1209 1210 /** IP Type 1211 * @syscap SystemCapability.Communication.WiFi.STA 1212 * @since 6 1213 * @deprecated since 9 1214 */ 1215 /* @systemapi */ 1216 ipType: IpType; 1217 1218 /** IP config of static 1219 * @syscap SystemCapability.Communication.WiFi.STA 1220 * @since 6 1221 * @deprecated since 9 1222 */ 1223 /* @systemapi */ 1224 staticIp: IpConfig; 1225 } 1226 1227 /** 1228 * Wi-Fi IP configuration information. 1229 * 1230 * @interface IpConfig 1231 * @syscap SystemCapability.Communication.WiFi.STA 1232 * @systemapi Hide this for inner system use. 1233 * @since 7 1234 * @deprecated since 9 1235 * @useinstead ohos.wifiManager/wifiManager.IpConfig 1236 */ 1237 interface IpConfig { 1238 /** 1239 * IP address. 1240 * @syscap SystemCapability.Communication.WiFi.STA 1241 * @systemapi Hide this for inner system use. 1242 * @since 7 1243 * @deprecated since 9 1244 */ 1245 ipAddress: number; 1246 1247 /** 1248 * Gate way. 1249 * @syscap SystemCapability.Communication.WiFi.STA 1250 * @systemapi Hide this for inner system use. 1251 * @since 7 1252 * @deprecated since 9 1253 */ 1254 gateway: number; 1255 1256 /** 1257 * DNS servers. 1258 * @syscap SystemCapability.Communication.WiFi.STA 1259 * @systemapi Hide this for inner system use. 1260 * @since 7 1261 * @deprecated since 9 1262 */ 1263 dnsServers: number[]; 1264 1265 /** 1266 * Domains. 1267 * @syscap SystemCapability.Communication.WiFi.STA 1268 * @systemapi Hide this for inner system use. 1269 * @since 7 1270 * @deprecated since 9 1271 */ 1272 domains: Array<string>; 1273 } 1274 1275 /** 1276 * Describes the scanned Wi-Fi information. 1277 * 1278 * @interface WifiScanInfo 1279 * @syscap SystemCapability.Communication.WiFi.STA 1280 * @since 6 1281 * @deprecated since 9 1282 * @useinstead ohos.wifiManager/wifiManager.WifiScanInfo 1283 */ 1284 interface WifiScanInfo { 1285 /** Wi-Fi SSID: the maximum length is 32 1286 * @syscap SystemCapability.Communication.WiFi.STA 1287 * @since 6 1288 * @deprecated since 9 1289 */ 1290 ssid: string; 1291 1292 /** Wi-Fi bssid(MAC): the length is 6 1293 * @syscap SystemCapability.Communication.WiFi.STA 1294 * @since 6 1295 * @deprecated since 9 1296 */ 1297 bssid: string; 1298 1299 /** Hotspot capability 1300 * @syscap SystemCapability.Communication.WiFi.STA 1301 * @since 6 1302 * @deprecated since 9 1303 */ 1304 capabilities: string; 1305 1306 /** Security type: reference definition of WifiSecurityType 1307 * @syscap SystemCapability.Communication.WiFi.STA 1308 * @since 6 1309 * @deprecated since 9 1310 */ 1311 securityType: WifiSecurityType; 1312 1313 /** Received signal strength indicator (RSSI) 1314 * @syscap SystemCapability.Communication.WiFi.STA 1315 * @since 6 1316 * @deprecated since 9 1317 */ 1318 rssi: number; 1319 1320 /** Frequency band, 1: 2.4G, 2: 5G 1321 * @syscap SystemCapability.Communication.WiFi.STA 1322 * @since 6 1323 * @deprecated since 9 1324 */ 1325 band: number; 1326 1327 /** Frequency 1328 * @syscap SystemCapability.Communication.WiFi.STA 1329 * @since 6 1330 * @deprecated since 9 1331 */ 1332 frequency: number; 1333 1334 /** Channel width 1335 * @syscap SystemCapability.Communication.WiFi.STA 1336 * @since 6 1337 * @deprecated since 9 1338 */ 1339 channelWidth: number; 1340 1341 /** 1342 * Time stamp 1343 * @syscap SystemCapability.Communication.WiFi.STA 1344 * @since 6 1345 * @deprecated since 9 1346 */ 1347 timestamp: number; 1348 } 1349 1350 /** 1351 * Describes the wifi security type. 1352 * 1353 * @enum { number } WifiSecurityType 1354 * @syscap SystemCapability.Communication.WiFi.Core 1355 * @since 6 1356 * @deprecated since 9 1357 * @useinstead ohos.wifiManager/wifiManager.WifiSecurityType 1358 */ 1359 enum WifiSecurityType { 1360 /** Invalid security type 1361 * @syscap SystemCapability.Communication.WiFi.Core 1362 * @since 6 1363 * @deprecated since 9 1364 */ 1365 WIFI_SEC_TYPE_INVALID = 0, 1366 1367 /** Open 1368 * @syscap SystemCapability.Communication.WiFi.Core 1369 * @since 6 1370 * @deprecated since 9 1371 */ 1372 WIFI_SEC_TYPE_OPEN = 1, 1373 1374 /** 1375 * Wired Equivalent Privacy (WEP) 1376 * @syscap SystemCapability.Communication.WiFi.Core 1377 * @since 6 1378 * @deprecated since 9 1379 * */ 1380 WIFI_SEC_TYPE_WEP = 2, 1381 1382 /** 1383 * Pre-shared key (PSK) 1384 * @syscap SystemCapability.Communication.WiFi.Core 1385 * @since 6 1386 * @deprecated since 9 1387 * */ 1388 WIFI_SEC_TYPE_PSK = 3, 1389 1390 /** 1391 * Simultaneous Authentication of Equals (SAE) 1392 * @syscap SystemCapability.Communication.WiFi.Core 1393 * @since 6 1394 * @deprecated since 9 1395 * */ 1396 WIFI_SEC_TYPE_SAE = 4, 1397 } 1398 1399 /** 1400 * Wi-Fi connection information. 1401 * 1402 * @interface WifiLinkedInfo 1403 * @syscap SystemCapability.Communication.WiFi.STA 1404 * @since 6 1405 * @deprecated since 9 1406 * @useinstead ohos.wifiManager/wifiManager.WifiLinkedInfo 1407 */ 1408 interface WifiLinkedInfo { 1409 /** 1410 * The SSID of the Wi-Fi hotspot 1411 * @syscap SystemCapability.Communication.WiFi.STA 1412 * @since 6 1413 * @deprecated since 9 1414 * */ 1415 ssid: string; 1416 1417 /** 1418 * The BSSID of the Wi-Fi hotspot 1419 * @syscap SystemCapability.Communication.WiFi.STA 1420 * @since 6 1421 * @deprecated since 9 1422 * */ 1423 bssid: string; 1424 1425 /** 1426 * The ID(uniquely identifies) of a Wi-Fi connection. 1427 * @syscap SystemCapability.Communication.WiFi.STA 1428 * @since 6 1429 * @deprecated since 9 1430 * */ 1431 /* @systemapi */ 1432 networkId: number; 1433 1434 /** 1435 * The RSSI(dBm) of a Wi-Fi access point. 1436 * @syscap SystemCapability.Communication.WiFi.STA 1437 * @since 6 1438 * @deprecated since 9 1439 * */ 1440 rssi: number; 1441 1442 /** 1443 * The frequency band of a Wi-Fi access point. 1444 * @syscap SystemCapability.Communication.WiFi.STA 1445 * @since 6 1446 * @deprecated since 9 1447 * */ 1448 band: number; 1449 1450 /** 1451 * The speed of a Wi-Fi access point. 1452 * @syscap SystemCapability.Communication.WiFi.STA 1453 * @since 6 1454 * @deprecated since 9 1455 * */ 1456 linkSpeed: number; 1457 1458 /** 1459 * The frequency of a Wi-Fi access point. 1460 * @syscap SystemCapability.Communication.WiFi.STA 1461 * @since 6 1462 * @deprecated since 9 1463 * */ 1464 frequency: number; 1465 1466 /** 1467 * Whether the SSID of the access point (AP) of this Wi-Fi connection is hidden. 1468 * @syscap SystemCapability.Communication.WiFi.STA 1469 * @since 6 1470 * @deprecated since 9 1471 * */ 1472 isHidden: boolean; 1473 1474 /** 1475 * Whether this Wi-Fi connection restricts the data volume. 1476 * @syscap SystemCapability.Communication.WiFi.STA 1477 * @since 6 1478 * @deprecated since 9 1479 */ 1480 isRestricted: boolean; 1481 1482 /** 1483 * 1484 * The load value of this Wi-Fi connection. A greater value indicates a higher load. 1485 * @syscap SystemCapability.Communication.WiFi.STA 1486 * @since 6 1487 * @deprecated since 9 1488 * */ 1489 /* @systemapi */ 1490 chload: number; 1491 1492 /** 1493 * The signal-to-noise ratio (SNR) of this Wi-Fi connection. 1494 * @syscap SystemCapability.Communication.WiFi.STA 1495 * @since 6 1496 * @deprecated since 9 1497 * */ 1498 /* @systemapi */ 1499 snr: number; 1500 1501 /** 1502 * 1503 * The Wi-Fi MAC address of a device. 1504 * @syscap SystemCapability.Communication.WiFi.STA 1505 * @since 6 1506 * @deprecated since 9 1507 * */ 1508 macAddress: string; 1509 1510 /** 1511 * The IP address of this Wi-Fi connection. 1512 * @syscap SystemCapability.Communication.WiFi.STA 1513 * @since 6 1514 * @deprecated since 9 1515 * */ 1516 ipAddress: number; 1517 1518 /** 1519 * 1520 * The state of the supplicant of this Wi-Fi connection. 1521 * @syscap SystemCapability.Communication.WiFi.STA 1522 * @since 6 1523 * @deprecated since 9 1524 * */ 1525 /* @systemapi */ 1526 suppState: SuppState; 1527 1528 /** 1529 * The state of this Wi-Fi connection. 1530 * @syscap SystemCapability.Communication.WiFi.STA 1531 * @since 6 1532 * @deprecated since 9 1533 * */ 1534 connState: ConnState; 1535 } 1536 1537 /** 1538 * Wi-Fi IP information. 1539 * 1540 * @interface IpInfo 1541 * @syscap SystemCapability.Communication.WiFi.STA 1542 * @since 7 1543 * @deprecated since 9 1544 * @useinstead ohos.wifiManager/wifiManager.IpInfo 1545 */ 1546 interface IpInfo { 1547 /** 1548 * The IP address of the Wi-Fi connection 1549 * @syscap SystemCapability.Communication.WiFi.AP.Core 1550 * @since 7 1551 * @deprecated since 9 1552 * */ 1553 ipAddress: number; 1554 1555 /** 1556 * The gateway of the Wi-Fi connection 1557 * @syscap SystemCapability.Communication.WiFi.AP.Core 1558 * @since 7 1559 * @deprecated since 9 1560 * */ 1561 gateway: number; 1562 1563 /** 1564 * The network mask of the Wi-Fi connection 1565 * @syscap SystemCapability.Communication.WiFi.AP.Core 1566 * @since 7 1567 * @deprecated since 9 1568 * */ 1569 netmask: number; 1570 1571 /** 1572 * 1573 * The primary DNS server IP address of the Wi-Fi connection 1574 * @syscap SystemCapability.Communication.WiFi.AP.Core 1575 * @since 7 1576 * @deprecated since 9 1577 * */ 1578 primaryDns: number; 1579 1580 /** T 1581 * he secondary DNS server IP address of the Wi-Fi connection 1582 * @syscap SystemCapability.Communication.WiFi.AP.Core 1583 * @since 7 1584 * @deprecated since 9 1585 * */ 1586 secondDns: number; 1587 1588 /** 1589 * The DHCP server IP address of the Wi-Fi connection 1590 * @syscap SystemCapability.Communication.WiFi.AP.Core 1591 * @since 7 1592 * @deprecated since 9 1593 * */ 1594 serverIp: number; 1595 1596 /** 1597 * The IP address lease duration of the Wi-Fi connection 1598 * @syscap SystemCapability.Communication.WiFi.AP.Core 1599 * @since 7 1600 * @deprecated since 9 1601 * */ 1602 leaseDuration: number; 1603 } 1604 1605 /** 1606 * Wi-Fi hotspot configuration information. 1607 * 1608 * @interface HotspotConfig 1609 * @syscap SystemCapability.Communication.WiFi.AP.Core 1610 * @systemapi Hide this for inner system use. 1611 * @since 7 1612 * @deprecated since 9 1613 * @useinstead ohos.wifiManager/wifiManager.HotspotConfig 1614 */ 1615 interface HotspotConfig { 1616 /** 1617 * The SSID of the Wi-Fi hotspot 1618 * @syscap SystemCapability.Communication.WiFi.AP.Core 1619 * @systemapi 1620 * @since 7 1621 * @deprecated since 9 1622 * */ 1623 ssid: string; 1624 1625 /** 1626 * The encryption mode of the Wi-Fi hotspot 1627 * @syscap SystemCapability.Communication.WiFi.AP.Core 1628 * @systemapi 1629 * @since 7 1630 * @deprecated since 9 1631 * */ 1632 securityType: WifiSecurityType; 1633 1634 /** 1635 * The frequency band of the Wi-Fi hotspot 1636 * @syscap SystemCapability.Communication.WiFi.AP.Core 1637 * @systemapi 1638 * @since 7 1639 * @deprecated since 9 1640 * */ 1641 band: number; 1642 1643 /** 1644 * The password of the Wi-Fi hotspot 1645 * @syscap SystemCapability.Communication.WiFi.AP.Core 1646 * @systemapi 1647 * @since 7 1648 * @deprecated since 9 1649 * */ 1650 preSharedKey: string; 1651 1652 /** 1653 * The maximum number of connections allowed by the Wi-Fi hotspot 1654 * @syscap SystemCapability.Communication.WiFi.AP.Core 1655 * @systemapi 1656 * @since 7 1657 * @deprecated since 9 1658 * */ 1659 maxConn: number; 1660 } 1661 1662 /** 1663 * Wi-Fi station information. 1664 * 1665 * @interface StationInfo 1666 * @syscap SystemCapability.Communication.WiFi.AP.Core 1667 * @systemapi Hide this for inner system use. 1668 * @since 7 1669 * @deprecated since 9 1670 * @useinstead ohos.wifiManager/wifiManager.StationInfo 1671 */ 1672 interface StationInfo { 1673 /** 1674 * the network name of the Wi-Fi client 1675 * @syscap SystemCapability.Communication.WiFi.AP.Core 1676 * @systemapi 1677 * @since 7 1678 * @deprecated since 9 1679 * */ 1680 name: string; 1681 1682 /** 1683 * The MAC address of the Wi-Fi client 1684 * @syscap SystemCapability.Communication.WiFi.AP.Core 1685 * @systemapi 1686 * @since 7 1687 * @deprecated since 9 1688 * */ 1689 macAddress: string; 1690 1691 /** 1692 * The IP address of the Wi-Fi client 1693 * @syscap SystemCapability.Communication.WiFi.AP.Core 1694 * @systemapi 1695 * @since 7 1696 * @deprecated since 9 1697 * */ 1698 ipAddress: string; 1699 } 1700 1701 /** 1702 * Wi-Fi IP type enumeration. 1703 * 1704 * @enum { number } IpType 1705 * @syscap SystemCapability.Communication.WiFi.STA 1706 * @systemapi Hide this for inner system use. 1707 * @since 7 1708 * @deprecated since 9 1709 * @useinstead ohos.wifiManager/wifiManager.IpType 1710 */ 1711 enum IpType { 1712 /** 1713 * Use statically configured IP settings 1714 * @syscap SystemCapability.Communication.WiFi.STA 1715 * @systemapi 1716 * @since 7 1717 * @deprecated since 9 1718 * */ 1719 STATIC, 1720 1721 /** 1722 * Use dynamically configured IP settings 1723 * @syscap SystemCapability.Communication.WiFi.STA 1724 * @systemapi 1725 * @since 7 1726 * @deprecated since 9 1727 * */ 1728 DHCP, 1729 1730 /** 1731 * No IP details are assigned 1732 * @syscap SystemCapability.Communication.WiFi.STA 1733 * @systemapi 1734 * @since 7 1735 * @deprecated since 9 1736 * */ 1737 UNKNOWN, 1738 } 1739 1740 /** 1741 * The state of the supplicant enumeration. 1742 * 1743 * @enum { number } SuppState 1744 * @syscap SystemCapability.Communication.WiFi.STA 1745 * @systemapi Hide this for inner system use. 1746 * @since 6 1747 * @deprecated since 9 1748 * @useinstead ohos.wifiManager/wifiManager.SuppState 1749 */ 1750 export enum SuppState { 1751 /** The supplicant is not associated with or is disconnected from the AP. 1752 * @syscap SystemCapability.Communication.WiFi.STA 1753 * @systemapi 1754 * @since 6 1755 * @deprecated since 9 1756 */ 1757 DISCONNECTED, 1758 1759 /** 1760 * The network interface is disabled. 1761 * @syscap SystemCapability.Communication.WiFi.STA 1762 * @systemapi 1763 * @since 6 1764 * @deprecated since 9 1765 * */ 1766 INTERFACE_DISABLED, 1767 1768 /** 1769 * The supplicant is disabled. 1770 * @syscap SystemCapability.Communication.WiFi.STA 1771 * @systemapi 1772 * @since 6 1773 * @deprecated since 9 1774 * */ 1775 INACTIVE, 1776 1777 /** 1778 * The supplicant is scanning for a Wi-Fi connection. 1779 * @syscap SystemCapability.Communication.WiFi.STA 1780 * @systemapi 1781 * @since 6 1782 * @deprecated since 9 1783 * */ 1784 SCANNING, 1785 1786 /** 1787 * The supplicant is authenticating with a specified AP. 1788 * @syscap SystemCapability.Communication.WiFi.STA 1789 * @systemapi 1790 * @since 6 1791 * @deprecated since 9 1792 * */ 1793 AUTHENTICATING, 1794 1795 /** 1796 * The supplicant is associating with a specified AP. 1797 * @syscap SystemCapability.Communication.WiFi.STA 1798 * @systemapi 1799 * @since 6 1800 * @deprecated since 9 1801 * */ 1802 ASSOCIATING, 1803 1804 /** 1805 * The supplicant is associated with a specified AP. 1806 * @syscap SystemCapability.Communication.WiFi.STA 1807 * @systemapi 1808 * @since 6 1809 * @deprecated since 9 1810 * */ 1811 ASSOCIATED, 1812 1813 /** 1814 * The four-way handshake is ongoing. 1815 * @syscap SystemCapability.Communication.WiFi.STA 1816 * @systemapi 1817 * @since 6 1818 * @deprecated since 9 1819 * */ 1820 FOUR_WAY_HANDSHAKE, 1821 1822 /** The group handshake is ongoing. 1823 * @syscap SystemCapability.Communication.WiFi.STA 1824 * @systemapi 1825 * @since 6 1826 * @deprecated since 9 1827 */ 1828 GROUP_HANDSHAKE, 1829 1830 /** 1831 * All authentication is completed. 1832 * @syscap SystemCapability.Communication.WiFi.STA 1833 * @systemapi 1834 * @since 6 1835 * @deprecated since 9 1836 * */ 1837 COMPLETED, 1838 1839 /** 1840 * Failed to establish a connection to the supplicant. 1841 * @syscap SystemCapability.Communication.WiFi.STA 1842 * @systemapi 1843 * @since 6 1844 * @deprecated since 9 1845 * */ 1846 UNINITIALIZED, 1847 1848 /** 1849 * The supplicant is in an unknown or invalid state. 1850 * @syscap SystemCapability.Communication.WiFi.STA 1851 * @systemapi 1852 * @since 6 1853 * @deprecated since 9 1854 * */ 1855 INVALID 1856 } 1857 1858 /** 1859 * The state of Wi-Fi connection enumeration. 1860 * 1861 * @enum { number } ConnState 1862 * @syscap SystemCapability.Communication.WiFi.STA 1863 * @since 6 1864 * @deprecated since 9 1865 * @useinstead ohos.wifiManager/wifiManager.ConnState 1866 */ 1867 export enum ConnState { 1868 /** 1869 * The device is searching for an available AP. 1870 * @syscap SystemCapability.Communication.WiFi.STA 1871 * @since 6 1872 * @deprecated since 9 1873 * */ 1874 SCANNING, 1875 1876 /** 1877 * The Wi-Fi connection is being set up. 1878 * @syscap SystemCapability.Communication.WiFi.STA 1879 * @since 6 1880 * @deprecated since 9 1881 * */ 1882 CONNECTING, 1883 1884 /** 1885 * The Wi-Fi connection is being authenticated. 1886 * @syscap SystemCapability.Communication.WiFi.STA 1887 * @since 6 1888 * @deprecated since 9 1889 * */ 1890 AUTHENTICATING, 1891 1892 /** 1893 * The IP address of the Wi-Fi connection is being obtained. 1894 * @syscap SystemCapability.Communication.WiFi.STA 1895 * @since 6 1896 * @deprecated since 9 1897 * */ 1898 OBTAINING_IPADDR, 1899 1900 /** 1901 * The Wi-Fi connection has been set up. 1902 * @syscap SystemCapability.Communication.WiFi.STA 1903 * @since 6 1904 * @deprecated since 9 1905 * */ 1906 CONNECTED, 1907 1908 /** 1909 * The Wi-Fi connection is being torn down. 1910 * @syscap SystemCapability.Communication.WiFi.STA 1911 * @since 6 1912 * @deprecated since 9 1913 * */ 1914 DISCONNECTING, 1915 1916 /** 1917 * The Wi-Fi connection has been torn down. 1918 * @syscap SystemCapability.Communication.WiFi.STA 1919 * @since 6 1920 * @deprecated since 9 1921 * */ 1922 DISCONNECTED, 1923 1924 /** 1925 * Failed to set up the Wi-Fi connection. 1926 * @syscap SystemCapability.Communication.WiFi.STA 1927 * @since 6 1928 * @deprecated since 9 1929 * */ 1930 UNKNOWN 1931 } 1932 1933 /** 1934 * P2P device information. 1935 * 1936 * @interface WifiP2pDevice 1937 * @syscap SystemCapability.Communication.WiFi.P2P 1938 * @since 8 1939 * @deprecated since 9 1940 * @useinstead ohos.wifiManager/wifiManager.WifiP2pDevice 1941 */ 1942 interface WifiP2pDevice { 1943 /** 1944 * Device name 1945 * @syscap SystemCapability.Communication.WiFi.P2P 1946 * @since 8 1947 * @deprecated since 9 1948 * */ 1949 deviceName: string; 1950 1951 /** 1952 * Device mac address 1953 * @syscap SystemCapability.Communication.WiFi.P2P 1954 * @since 8 1955 * @deprecated since 9 1956 * */ 1957 deviceAddress: string; 1958 1959 /** 1960 * Primary device type 1961 * @syscap SystemCapability.Communication.WiFi.P2P 1962 * @since 8 1963 * @deprecated since 9 1964 * */ 1965 primaryDeviceType: string; 1966 1967 /** 1968 * Device status 1969 * @syscap SystemCapability.Communication.WiFi.P2P 1970 * @since 8 1971 * @deprecated since 9 1972 * */ 1973 deviceStatus: P2pDeviceStatus; 1974 1975 /** 1976 * Device group capabilities 1977 * @syscap SystemCapability.Communication.WiFi.P2P 1978 * @since 8 1979 * @deprecated since 9 1980 * */ 1981 groupCapabilitys: number; 1982 } 1983 1984 /** 1985 * P2P config. 1986 * @interface WifiP2PConfig 1987 * @syscap SystemCapability.Communication.WiFi.P2P 1988 * @since 8 1989 * @deprecated since 9 1990 * @useinstead ohos.wifiManager/wifiManager.WifiP2PConfig 1991 */ 1992 interface WifiP2PConfig { 1993 /** 1994 * Device mac address s 1995 * @syscap SystemCapability.Communication.WiFi.P2P 1996 * @since 8 1997 * @deprecated since 9 1998 */ 1999 deviceAddress: string; 2000 2001 /** 2002 * Group network ID. When creating a group, -1 indicates creates a temporary group, 2003 * -2: indicates creates a persistent group 2004 * @syscap SystemCapability.Communication.WiFi.P2P 2005 * @since 8 2006 * @deprecated since 9 2007 */ 2008 netId: number; 2009 2010 /** 2011 * The passphrase of this {@code WifiP2pConfig} instance 2012 * @syscap SystemCapability.Communication.WiFi.P2P 2013 * @since 8 2014 * @deprecated since 9 2015 * */ 2016 passphrase: string; 2017 2018 /** 2019 * Group name 2020 * @syscap SystemCapability.Communication.WiFi.P2P 2021 * @since 8 2022 * @deprecated since 9 2023 * */ 2024 groupName: string; 2025 2026 /** 2027 * Group owner band 2028 * @syscap SystemCapability.Communication.WiFi.P2P 2029 * @since 8 2030 * @deprecated since 9 2031 * */ 2032 goBand: GroupOwnerBand; 2033 } 2034 2035 /** 2036 * P2P group information. 2037 * @interface WifiP2pGroupInfo 2038 * @syscap SystemCapability.Communication.WiFi.P2P 2039 * @since 8 2040 * @deprecated since 9 2041 * @useinstead ohos.wifiManager/wifiManager.WifiP2pGroupInfo 2042 */ 2043 interface WifiP2pGroupInfo { 2044 /** 2045 * Indicates whether it is group owner 2046 * @syscap SystemCapability.Communication.WiFi.P2P 2047 * @since 8 2048 * @deprecated since 9 2049 * */ 2050 isP2pGo: boolean; 2051 2052 /** 2053 * Group owner information 2054 * @syscap SystemCapability.Communication.WiFi.P2P 2055 * @since 8 2056 * @deprecated since 9 2057 * */ 2058 ownerInfo: WifiP2pDevice; 2059 2060 /** 2061 * The group passphrase 2062 * @syscap SystemCapability.Communication.WiFi.P2P 2063 * @since 8 2064 * @deprecated since 9 2065 * */ 2066 passphrase: string; 2067 2068 /** 2069 * Interface name 2070 * @syscap SystemCapability.Communication.WiFi.P2P 2071 * @since 8 2072 * @deprecated since 9 2073 * */ 2074 interface: string; 2075 2076 /** 2077 * Group name 2078 * @syscap SystemCapability.Communication.WiFi.P2P 2079 * @since 8 2080 * @deprecated since 9 2081 * */ 2082 groupName: string; 2083 2084 /** Network ID 2085 * @syscap SystemCapability.Communication.WiFi.P2P 2086 * @since 8 2087 * @deprecated since 9 2088 */ 2089 networkId: number; 2090 2091 /** Frequency 2092 * @syscap SystemCapability.Communication.WiFi.P2P 2093 * @since 8 2094 * @deprecated since 9 2095 */ 2096 frequency: number; 2097 2098 /** 2099 * Client list 2100 * @syscap SystemCapability.Communication.WiFi.P2P 2101 * @since 8 2102 * @deprecated since 9 2103 * */ 2104 clientDevices: WifiP2pDevice[]; 2105 2106 /** 2107 * Group owner IP address 2108 * @syscap SystemCapability.Communication.WiFi.P2P 2109 * @since 8 2110 * @deprecated since 9 2111 * */ 2112 goIpAddress: string; 2113 } 2114 2115 /** 2116 * P2P connection status. 2117 * 2118 * @enum { number } P2pConnectState 2119 * @syscap SystemCapability.Communication.WiFi.P2P 2120 * @since 8 2121 * @deprecated since 9 2122 * @useinstead ohos.wifiManager/wifiManager.P2pConnectState 2123 */ 2124 enum P2pConnectState { 2125 /** 2126 * p2p is disconnected. 2127 * @syscap SystemCapability.Communication.WiFi.P2P 2128 * @since 8 2129 * @deprecated since 9 2130 */ 2131 DISCONNECTED = 0, 2132 2133 /** 2134 * p2p is connected. 2135 * @syscap SystemCapability.Communication.WiFi.P2P 2136 * @since 8 2137 * @deprecated since 9 2138 */ 2139 CONNECTED = 1, 2140 } 2141 2142 /** 2143 * P2P linked information. 2144 * @typedef WifiP2pLinkedInfo 2145 * @syscap SystemCapability.Communication.WiFi.P2P 2146 * @since 8 2147 * @deprecated since 9 2148 * @useinstead ohos.wifiManager/wifiManager.WifiP2pLinkedInfo 2149 */ 2150 interface WifiP2pLinkedInfo { 2151 /** 2152 * Connection status 2153 * @syscap SystemCapability.Communication.WiFi.P2P 2154 * @since 8 2155 * @deprecated since 9 2156 * */ 2157 connectState: P2pConnectState; 2158 2159 /** 2160 * Indicates whether it is group owner 2161 * @syscap SystemCapability.Communication.WiFi.P2P 2162 * @since 8 2163 * @deprecated since 9 2164 * */ 2165 isGroupOwner: boolean; 2166 2167 /** 2168 * Group owner address 2169 * @syscap SystemCapability.Communication.WiFi.P2P 2170 * @since 8 2171 * @deprecated since 9 2172 * */ 2173 groupOwnerAddr: string; 2174 } 2175 2176 /** 2177 * P2P device status. 2178 * 2179 * @enum { number } P2pDeviceStatus 2180 * @syscap SystemCapability.Communication.WiFi.P2P 2181 * @since 8 2182 * @deprecated since 9 2183 * @useinstead ohos.wifiManager/wifiManager.P2pDeviceStatus 2184 */ 2185 enum P2pDeviceStatus { 2186 /** 2187 * Indicate p2p device is connected. 2188 * @syscap SystemCapability.Communication.WiFi.P2P 2189 * @since 8 2190 * @deprecated since 9 2191 */ 2192 CONNECTED = 0, 2193 2194 /** 2195 * Indicate p2p device is invited. 2196 * @syscap SystemCapability.Communication.WiFi.P2P 2197 * @since 8 2198 * @deprecated since 9 2199 */ 2200 INVITED = 1, 2201 2202 /** 2203 * Indicate p2p device is failed. 2204 * @syscap SystemCapability.Communication.WiFi.P2P 2205 * @since 8 2206 * @deprecated since 9 2207 */ 2208 FAILED = 2, 2209 2210 /** 2211 * Indicate p2p device is available. 2212 * @syscap SystemCapability.Communication.WiFi.P2P 2213 * @since 8 2214 * @deprecated since 9 2215 */ 2216 AVAILABLE = 3, 2217 2218 /** 2219 * Indicate p2p device is unavailable. 2220 * @syscap SystemCapability.Communication.WiFi.P2P 2221 * @since 8 2222 * @deprecated since 9 2223 */ 2224 UNAVAILABLE = 4, 2225 } 2226 2227 /** 2228 * P2P group owner band. 2229 * 2230 * @enum { number } GroupOwnerBand 2231 * @syscap SystemCapability.Communication.WiFi.P2P 2232 * @since 8 2233 * @deprecated since 9 2234 * @useinstead ohos.wifiManager/wifiManager.GroupOwnerBand 2235 */ 2236 enum GroupOwnerBand { 2237 /** 2238 * default band. 2239 * @syscap SystemCapability.Communication.WiFi.P2P 2240 * @since 8 2241 * @deprecated since 9 2242 */ 2243 GO_BAND_AUTO = 0, 2244 2245 /** 2246 * 2.4G band. 2247 * @syscap SystemCapability.Communication.WiFi.P2P 2248 * @since 8 2249 * @deprecated since 9 2250 */ 2251 GO_BAND_2GHZ = 1, 2252 2253 /** 2254 * 5G band. 2255 * @syscap SystemCapability.Communication.WiFi.P2P 2256 * @since 8 2257 * @deprecated since 9 2258 */ 2259 GO_BAND_5GHZ = 2, 2260 } 2261} 2262 2263export default wifi; 2264