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