• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2021-2022 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
16import { AsyncCallback, Callback } from './basic';
17
18/**
19 * Provides methods to operate or manage Wi-Fi.
20 *
21 * @since 6
22 * @import import wifi from '@ohos.wifi';
23 */
24declare namespace wifi {
25    /**
26     * Enables Wi-Fi.
27     *
28     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
29     *
30     * @since 6
31     * @syscap SystemCapability.Communication.WiFi.STA
32     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
33     * @systemapi Hide this for inner system use.
34     * @deprecated since 9
35     * @useinstead ohos.wifiManager/wifiManager.enableWifi
36     */
37    function enableWifi(): boolean;
38
39    /**
40     * Disables Wi-Fi.
41     *
42     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
43     *
44     * @since 6
45     * @syscap SystemCapability.Communication.WiFi.STA
46     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
47     * @systemapi Hide this for inner system use.
48     * @deprecated since 9
49     * @useinstead ohos.wifiManager/wifiManager.disableWifi
50     */
51    function disableWifi(): boolean;
52
53    /**
54     * Queries the Wi-Fi status
55     *
56     * @returns Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise.
57     *
58     * @since 6
59     * @syscap SystemCapability.Communication.WiFi.STA
60     * @permission ohos.permission.GET_WIFI_INFO
61     * @deprecated since 9
62     * @useinstead ohos.wifiManager/wifiManager.isWifiActive
63     */
64    function isWifiActive(): boolean;
65
66    /**
67     * Scans Wi-Fi hotspot.
68     *
69     * <p>This API works in asynchronous mode.</p>
70     *
71     * @returns Returns {@code true} if the scanning is successful, returns {@code false} otherwise.
72     *
73     * @since 6
74     * @syscap SystemCapability.Communication.WiFi.STA
75     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION
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     * @returns Returns information about scanned Wi-Fi hotspot if any.
85     *
86     * @since 6
87     * @syscap SystemCapability.Communication.WiFi.STA
88     * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION)
89     * @deprecated since 9
90     * @useinstead ohos.wifiManager/wifiManager.getScanResults
91     */
92    function getScanInfos(): Promise<Array<WifiScanInfo>>;
93    function getScanInfos(callback: AsyncCallback<Array<WifiScanInfo>>): void;
94
95    /**
96     * Adds Wi-Fi connection configuration to the device.
97     *
98     * <p>The configuration will be updated when the configuration is added.</p>
99     *
100     * @param config Indicates the device configuration for connection to the Wi-Fi network.
101     * @returns Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise.
102     *
103     * @since 6
104     * @syscap SystemCapability.Communication.WiFi.STA
105     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
106     * @systemapi Hide this for inner system use.
107     * @deprecated since 9
108     * @useinstead ohos.wifiManager/wifiManager.addDeviceConfig
109     */
110    function addDeviceConfig(config: WifiDeviceConfig): Promise<number>;
111    function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void;
112
113    /**
114     * Adds a specified untrusted hotspot configuration.
115     *
116     * <p>This method adds one configuration at a time. After this configuration is added,
117     *     your device will determine whether to connect to the hotspot.
118     *
119     * @returns Returns {@code true} if the untrusted hotspot configuration is added, returns {@code false} otherwise.
120     * @since 7
121     * @syscap SystemCapability.Communication.WiFi.STA
122     * @permission ohos.permission.SET_WIFI_INFO
123     * @deprecated since 9
124     * @useinstead ohos.wifiManager/wifiManager.addCandidateConfig
125     */
126     function addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean>;
127     function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void;
128
129     /**
130      * Removes a specified untrusted hotspot configuration.
131      *
132      * <p>This method removes one configuration at a time.
133      *
134      * @returns Returns {@code true} if the untrusted hotspot configuration is removed, returns {@code false} otherwise.
135      * @since 7
136      * @syscap SystemCapability.Communication.WiFi.STA
137      * @permission ohos.permission.SET_WIFI_INFO
138      * @deprecated since 9
139      * @useinstead ohos.wifiManager/wifiManager.removeCandidateConfig
140      */
141     function removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean>;
142     function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void;
143
144    /**
145     * Connects to Wi-Fi network.
146     *
147     * @param networkId ID of the connected network.
148     * @returns Returns {@code true} if the network connection is successful, returns {@code false} otherwise.
149     *
150     * @since 6
151     * @syscap SystemCapability.Communication.WiFi.STA
152     * @permission ohos.permission.MANAGE_WIFI_CONNECTION
153     * @systemapi Hide this for inner system use.
154     * @deprecated since 9
155     * @useinstead ohos.wifiManager/wifiManager.connectToNetwork
156     */
157    function connectToNetwork(networkId: number): boolean;
158
159    /**
160     * Connects to Wi-Fi network.
161     *
162     * @param config Indicates the device configuration for connection to the Wi-Fi network.
163     * @returns Returns {@code true} if the network connection is successful, returns {@code false} otherwise.
164     *
165     * @since 6
166     * @syscap SystemCapability.Communication.WiFi.STA
167     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG and
168     * ohos.permission.MANAGE_WIFI_CONNECTION
169     * @systemapi Hide this for inner system use.
170     * @deprecated since 9
171     * @useinstead ohos.wifiManager/wifiManager.connectToDevice
172     */
173    function connectToDevice(config: WifiDeviceConfig): boolean;
174
175    /**
176     * Disconnect Wi-Fi network.
177     *
178     * @returns Returns {@code true} for disconnecting network success, returns {@code false} otherwise.
179     *
180     * @since 6
181     * @syscap SystemCapability.Communication.WiFi.STA
182     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
183     * @systemapi Hide this for inner system use.
184     * @deprecated since 9
185     * @useinstead ohos.wifiManager/wifiManager.disconnect
186     */
187    function disconnect(): boolean;
188
189    /**
190     * Calculates the Wi-Fi signal level based on the Wi-Fi RSSI and frequency band.
191     *
192     * @param rssi Indicates the Wi-Fi RSSI.
193     * @band Indicates the Wi-Fi frequency band.
194     * @returns Returns Wi-Fi signal level ranging from 0 to 4.
195     *
196     * @since 6
197     * @syscap SystemCapability.Communication.WiFi.STA
198     * @permission ohos.permission.GET_WIFI_INFO
199     * @deprecated since 9
200     * @useinstead ohos.wifiManager/wifiManager.getSignalLevel
201     */
202    function getSignalLevel(rssi: number, band: number): number;
203
204    /**
205     * Obtains information about a Wi-Fi connection.
206     *
207     * @returns Returns the Wi-Fi connection information.
208     * @since 6
209     * @syscap SystemCapability.Communication.WiFi.STA
210     * @permission ohos.permission.GET_WIFI_INFO
211     * @deprecated since 9
212     * @useinstead ohos.wifiManager/wifiManager.getLinkedInfo
213     */
214    function getLinkedInfo(): Promise<WifiLinkedInfo>;
215    function getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void;
216
217    /**
218     * Checks whether a Wi-Fi connection has been set up.
219     *
220     * @returns Returns {@code true} if a Wi-Fi connection has been set up, returns {@code false} otherwise.
221     * @since 7
222     * @syscap SystemCapability.Communication.WiFi.STA
223     * @permission ohos.permission.GET_WIFI_INFO
224     * @deprecated since 9
225     * @useinstead ohos.wifiManager/wifiManager.isConnected
226     */
227    function isConnected(): boolean;
228
229    /**
230     * Obtains the features supported by this device.
231     *
232     * <p>To check whether this device supports a specified feature.
233     *
234     * @returns Returns the features supported by this device.
235     * @since 7
236     * @syscap SystemCapability.Communication.WiFi.Core
237     * @permission ohos.permission.GET_WIFI_INFO
238     * @systemapi Hide this for inner system use.
239     * @deprecated since 9
240     * @useinstead ohos.wifiManager/wifiManager.getSupportedFeatures
241     */
242    function getSupportedFeatures(): number;
243
244    /**
245     * Checks whether this device supports a specified feature.
246     *
247     * @param featureId Indicates the ID of the feature.
248     * @returns Returns {@code true} if this device supports the specified feature, returns {@code false} otherwise.
249     * @since 7
250     * @syscap SystemCapability.Communication.WiFi.Core
251     * @permission ohos.permission.GET_WIFI_INFO
252     * @deprecated since 9
253     * @useinstead ohos.wifiManager/wifiManager.isFeatureSupported
254     */
255    function isFeatureSupported(featureId: number): boolean;
256
257    /**
258     * Obtains the MAC address of a Wi-Fi device. Wi-Fi must be enabled.
259     *
260     * <p>The MAC address is unique and cannot be changed.
261     *
262     * @returns Returns the MAC address of the Wi-Fi device.
263     * @since 7
264     * @syscap SystemCapability.Communication.WiFi.STA
265     * @permission ohos.permission.GET_WIFI_LOCAL_MAC and ohos.permission.GET_WIFI_INFO
266     * @systemapi Hide this for inner system use.
267     * @deprecated since 9
268     * @useinstead ohos.wifiManager/wifiManager.getDeviceMacAddress
269     */
270    function getDeviceMacAddress(): string[];
271
272    /**
273     * Obtains the IP information of a Wi-Fi connection.
274     *
275     * <p>The IP information includes the host IP address, gateway address, and DNS information.
276     *
277     * @returns Returns the IP information of the Wi-Fi connection.
278     * @since 7
279     * @syscap SystemCapability.Communication.WiFi.STA
280     * @permission ohos.permission.GET_WIFI_INFO
281     * @deprecated since 9
282     * @useinstead ohos.wifiManager/wifiManager.getIpInfo
283     */
284    function getIpInfo(): IpInfo;
285
286    /**
287     * Obtains the country code of this device.
288     *
289     * @returns Returns the country code of this device.
290     * @since 7
291     * @syscap SystemCapability.Communication.WiFi.Core
292     * @permission ohos.permission.GET_WIFI_INFO
293     * @deprecated since 9
294     * @useinstead ohos.wifiManager/wifiManager.getCountryCode
295     */
296    function getCountryCode(): string;
297
298    /**
299     * Re-associate to current network.
300     *
301     * @returns {@code true} if the Wi-Fi network is re-associate successfully.
302     * @since 7
303     * @syscap SystemCapability.Communication.WiFi.STA
304     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
305     * @systemapi Hide this for inner system use.
306     * @deprecated since 9
307     * @useinstead ohos.wifiManager/wifiManager.reassociate
308     */
309    function reassociate(): boolean;
310
311    /**
312     * Re-connects to current network.
313     *
314     * @returns {@code true} if the Wi-Fi network is re-connect successfully.
315     * @since 7
316     * @syscap SystemCapability.Communication.WiFi.STA
317     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
318     * @systemapi Hide this for inner system use.
319     * @deprecated since 9
320     * @useinstead ohos.wifiManager/wifiManager.reconnect
321     */
322    function reconnect(): boolean;
323
324    /**
325     * Obtains the list of all existing Wi-Fi configurations.
326     *
327     * <p>You can obtain only the Wi-Fi configurations you created on your own application.
328     *
329     * @returns Returns the list of all existing Wi-Fi configurations you created on your application.
330     * @since 7
331     * @syscap SystemCapability.Communication.WiFi.STA
332     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.GET_WIFI_CONFIG
333     * @systemapi Hide this for inner system use.
334     * @deprecated since 9
335     * @useinstead ohos.wifiManager/wifiManager.getDeviceConfigs
336     */
337    function getDeviceConfigs(): Array<WifiDeviceConfig>;
338
339    /**
340     * Updates the specified Wi-Fi configuration.
341     *
342     * @param config Indicates the Wi-Fi configuration to update.
343     *
344     * @returns Returns the network ID in the updated Wi-Fi configuration if the update is successful;
345     *     returns {@code -1} if the specified Wi-Fi configuration is not contained in the list.
346     * @since 7
347     * @syscap SystemCapability.Communication.WiFi.STA
348     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
349     * @systemapi Hide this for inner system use.
350     * @deprecated since 9
351     * @useinstead ohos.wifiManager/wifiManager.updateNetwork
352     */
353    function updateNetwork(config: WifiDeviceConfig): number;
354
355    /**
356     * Disables a specified network.
357     *
358     * <p>The disabled network will not be associated with again.
359     *
360     * @param netId Identifies the network to disable.
361     * @returns Returns {@code true} if the specified network is disabled, returns {@code false} otherwise.
362     * @since 7
363     * @syscap SystemCapability.Communication.WiFi.STA
364     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
365     * @systemapi Hide this for inner system use.
366     * @deprecated since 9
367     * @useinstead ohos.wifiManager/wifiManager.disableNetwork
368     */
369    function disableNetwork(netId: number): boolean;
370
371    /**
372     * Removes all the saved Wi-Fi configurations.
373     *
374     * @returns Returns {@code true} if all the saved Wi-Fi configurations are removed;
375     *     returns {@code false} otherwise.
376     * @since 7
377     * @syscap SystemCapability.Communication.WiFi.STA
378     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
379     * @systemapi Hide this for inner system use.
380     * @deprecated since 9
381     * @useinstead ohos.wifiManager/wifiManager.removeAllNetwork
382     */
383    function removeAllNetwork(): boolean;
384
385    /**
386     * Deletes a Wi-Fi network with a specified ID.
387     *
388     * <p>After a Wi-Fi network is deleted, its configuration will be deleted from the list of Wi-Fi configurations.
389     * If the Wi-Fi network is being connected, the connection will be interrupted.
390     * The application can only delete Wi-Fi networks it has created.
391     *
392     * @param id Indicates the ID of the Wi-Fi network,
393     *     which can be obtained using the {@link #addDeviceConfig} or {@link #getLinkedInfo} method.
394     * @returns Returns {@code true} if the Wi-Fi network is deleted successfully, returns {@code false} otherwise.
395     * @since 7
396     * @syscap SystemCapability.Communication.WiFi.STA
397     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
398     * @systemapi Hide this for inner system use.
399     * @deprecated since 9
400     * @useinstead ohos.wifiManager/wifiManager.removeDevice
401     */
402    function removeDevice(id: number): boolean;
403
404    /**
405     * Enables a Wi-Fi hotspot.
406     *
407     * <p>This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled.
408     *
409     * @returns Returns {@code true} if this method is called successfully, returns {@code false} otherwise.
410     * @since 7
411     * @syscap SystemCapability.Communication.WiFi.AP.Core
412     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
413     * @systemapi Hide this for inner system use.
414     * @deprecated since 9
415     * @useinstead ohos.wifiManager/wifiManager.enableHotspot
416     */
417    function enableHotspot(): boolean;
418
419    /**
420     * Disables a Wi-Fi hotspot.
421     *
422     * <p>This method is asynchronous. If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled.
423     *
424     * @returns Returns {@code true} if this method is called successfully, returns {@code false} otherwise.
425     * @since 7
426     * @syscap SystemCapability.Communication.WiFi.AP.Core
427     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
428     * @systemapi Hide this for inner system use.
429     * @deprecated since 9
430     * @useinstead ohos.wifiManager/wifiManager.disableHotspot
431     */
432    function disableHotspot(): boolean;
433
434    /**
435     * Checks whether a device serving as a Wi-Fi hotspot supports both the 2.4 GHz and 5 GHz Wi-Fi.
436     *
437     * @returns Returns {@code true} if the method is called successfully, returns {@code false} otherwise.
438     * @since 7
439     * @syscap SystemCapability.Communication.WiFi.AP.Core
440     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT
441     * @systemapi Hide this for inner system use.
442     * @deprecated since 9
443     * @useinstead ohos.wifiManager/wifiManager.isHotspotDualBandSupported
444     */
445     function isHotspotDualBandSupported(): boolean;
446
447    /**
448     * Checks whether Wi-Fi hotspot is active on a device.
449     *
450     * @returns Returns {@code true} if Wi-Fi hotspot is enabled, returns {@code false} otherwise.
451     * @since 7
452     * @syscap SystemCapability.Communication.WiFi.AP.Core
453     * @permission ohos.permission.GET_WIFI_INFO
454     * @systemapi Hide this for inner system use.
455     * @deprecated since 9
456     * @useinstead ohos.wifiManager/wifiManager.isHotspotActive
457     */
458    function isHotspotActive(): boolean;
459
460    /**
461     * Sets the hotspot for a device.
462     *
463     * <p>Only OPEN and WPA2 PSK hotspot can be configured.
464     *
465     * @param config Indicates the Wi-Fi hotspot configuration.
466     *     The SSID and {@code securityType} must be available and correct.
467     *     If {@code securityType} is not {@code open}, {@code preSharedKey} must be available and correct.
468     * @returns Returns {@code true} if the method is called successfully, returns {@code false} otherwise.
469     * @since 7
470     * @syscap SystemCapability.Communication.WiFi.AP.Core
471     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
472     * @systemapi Hide this for inner system use.
473     * @deprecated since 9
474     * @useinstead ohos.wifiManager/wifiManager.setHotspotConfig
475     */
476    function setHotspotConfig(config: HotspotConfig): boolean;
477
478    /**
479     * Obtains the Wi-Fi hotspot configuration.
480     *
481     * @returns Returns the configuration of an existing or enabled Wi-Fi hotspot.
482     * @since 7
483     * @syscap SystemCapability.Communication.WiFi.AP.Core
484     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
485     * @systemapi Hide this for inner system use.
486     * @deprecated since 9
487     * @useinstead ohos.wifiManager/wifiManager.getHotspotConfig
488     */
489    function getHotspotConfig(): HotspotConfig;
490
491    /**
492     * Obtains the list of clients that are connected to a Wi-Fi hotspot.
493     *
494     * <p>This method can only be used on a device that serves as a Wi-Fi hotspot.
495     *
496     * @returns Returns the list of clients that are connected to the Wi-Fi hotspot.
497     * @since 7
498     * @syscap SystemCapability.Communication.WiFi.AP.Core
499     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT
500     * @systemapi Hide this for inner system use.
501     * @deprecated since 9
502     * @useinstead ohos.wifiManager/wifiManager.getStations
503     */
504    function getStations(): Array<StationInfo>;
505
506    /**
507     * Obtains information about a P2P connection.
508     *
509     * @returns Returns the P2P connection information.
510     * @since 8
511     * @syscap SystemCapability.Communication.WiFi.P2P
512     * @permission ohos.permission.GET_WIFI_INFO
513     * @deprecated since 9
514     * @useinstead ohos.wifiManager/wifiManager.getP2pLinkedInfo
515     */
516    function getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo>;
517    function getP2pLinkedInfo(callback: AsyncCallback<WifiP2pLinkedInfo>): void;
518
519    /**
520     * Obtains information about the current group.
521     *
522     * @returns Returns the current group information.
523     * @since 8
524     * @syscap SystemCapability.Communication.WiFi.P2P
525     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
526     * @deprecated since 9
527     * @useinstead ohos.wifiManager/wifiManager.getCurrentGroup
528     */
529    function getCurrentGroup(): Promise<WifiP2pGroupInfo>;
530    function getCurrentGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void;
531
532    /**
533     * Obtains the information about the found devices.
534     *
535     * @returns Returns the found devices list.
536     * @since 8
537     * @syscap SystemCapability.Communication.WiFi.P2P
538     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
539     * @deprecated since 9
540     * @useinstead ohos.wifiManager/wifiManager.getP2pPeerDevices
541     */
542    function getP2pPeerDevices(): Promise<WifiP2pDevice[]>;
543    function getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void;
544
545    /**
546     * Creates a P2P group.
547     *
548     * @param config Indicates the configuration for creating a group.
549     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
550     * @since 8
551     * @syscap SystemCapability.Communication.WiFi.P2P
552     * @permission ohos.permission.GET_WIFI_INFO
553     * @deprecated since 9
554     * @useinstead ohos.wifiManager/wifiManager.createGroup
555     */
556    function createGroup(config: WifiP2PConfig): boolean;
557
558    /**
559     * Removes a P2P group.
560     *
561     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
562     * @since 8
563     * @syscap SystemCapability.Communication.WiFi.P2P
564     * @permission ohos.permission.GET_WIFI_INFO
565     * @deprecated since 9
566     * @useinstead ohos.wifiManager/wifiManager.removeGroup
567     */
568    function removeGroup(): boolean;
569
570    /**
571     * Initiates a P2P connection to a device with the specified configuration.
572     *
573     * @param config Indicates the configuration for connecting to a specific group.
574     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
575     * @since 8
576     * @syscap SystemCapability.Communication.WiFi.P2P
577     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
578     * @deprecated since 9
579     * @useinstead ohos.wifiManager/wifiManager.p2pConnect
580     */
581    function p2pConnect(config: WifiP2PConfig): boolean;
582
583    /**
584     * Canceling a P2P connection.
585     *
586     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
587     * @since 8
588     * @syscap SystemCapability.Communication.WiFi.P2P
589     * @permission ohos.permission.GET_WIFI_INFO
590     * @deprecated since 9
591     * @useinstead ohos.wifiManager/wifiManager.p2pCancelConnect
592     */
593    function p2pCancelConnect(): boolean;
594
595    /**
596     * Discover Wi-Fi P2P devices.
597     *
598     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
599     * @since 8
600     * @syscap SystemCapability.Communication.WiFi.P2P
601     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
602     * @deprecated since 9
603     * @useinstead ohos.wifiManager/wifiManager.startDiscoverDevices
604     */
605    function startDiscoverDevices(): boolean;
606
607    /**
608     * Stops discovering Wi-Fi P2P devices.
609     *
610     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
611     * @since 8
612     * @syscap SystemCapability.Communication.WiFi.P2P
613     * @permission ohos.permission.GET_WIFI_INFO
614     * @deprecated since 9
615     * @useinstead ohos.wifiManager/wifiManager.stopDiscoverDevices
616     */
617    function stopDiscoverDevices(): boolean;
618
619    /**
620     * Deletes the persistent P2P group with the specified network ID.
621     *
622     * @param netId Indicates the network ID of the group to be deleted.
623     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
624     * @since 8
625     * @syscap SystemCapability.Communication.WiFi.P2P
626     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
627     * @systemapi Hide this for inner system use.
628     * @deprecated since 9
629     * @useinstead ohos.wifiManager/wifiManager.deletePersistentGroup
630     */
631    function deletePersistentGroup(netId: number): boolean;
632
633    /**
634     * Sets the name of the Wi-Fi P2P device.
635     *
636     * @param devName Indicates the name to be set.
637     * @returns Returns {@code true} if the operation is successful, returns {@code false} otherwise.
638     * @since 8
639     * @syscap SystemCapability.Communication.WiFi.P2P
640     * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
641     * @systemapi Hide this for inner system use.
642     * @deprecated since 9
643     * @useinstead ohos.wifiManager/wifiManager.setDeviceName
644     */
645    function setDeviceName(devName: string): boolean;
646
647    /**
648     * Subscribe Wi-Fi status change events.
649     *
650     * @returns Returns 0: inactive, 1: active, 2: activating, 3: deactivating
651     * @since 7
652     * @syscap SystemCapability.Communication.WiFi.STA
653     * @permission ohos.permission.GET_WIFI_INFO
654     * @deprecated since 9
655     * @useinstead ohos.wifiManager/wifiManager.on#event:wifiStateChange
656     */
657    function on(type: "wifiStateChange", callback: Callback<number>): void;
658
659    /**
660     * Unsubscribe Wi-Fi status change events.
661     *
662     * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
663     *
664     * @since 7
665     * @syscap SystemCapability.Communication.WiFi.STA
666     * @permission ohos.permission.GET_WIFI_INFO
667     * @deprecated since 9
668     * @useinstead ohos.wifiManager/wifiManager.off#event:wifiStateChange
669     */
670    function off(type: "wifiStateChange", callback?: Callback<number>): void;
671
672    /**
673     * Subscribe Wi-Fi connection change events.
674     *
675     * @returns Returns 0: disconnected, 1: connected
676     * @since 7
677     * @syscap SystemCapability.Communication.WiFi.STA
678     * @permission ohos.permission.GET_WIFI_INFO
679     * @deprecated since 9
680     * @useinstead ohos.wifiManager/wifiManager.on#event:wifiConnectionChange
681     */
682    function on(type: "wifiConnectionChange", callback: Callback<number>): void;
683
684    /**
685     * Unsubscribe Wi-Fi connection change events.
686     *
687     * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
688     *
689     * @since 7
690     * @syscap SystemCapability.Communication.WiFi.STA
691     * @permission ohos.permission.GET_WIFI_INFO
692     * @deprecated since 9
693     * @useinstead ohos.wifiManager/wifiManager.off#event:wifiConnectionChange
694     */
695    function off(type: "wifiConnectionChange", callback?: Callback<number>): void;
696
697    /**
698     * Subscribe Wi-Fi scan status change events.
699     *
700     * @returns Returns 0: scan fail, 1: scan success
701     * @since 7
702     * @syscap SystemCapability.Communication.WiFi.STA
703     * @permission ohos.permission.GET_WIFI_INFO
704     * @deprecated since 9
705     * @useinstead ohos.wifiManager/wifiManager.on#event:wifiScanStateChange
706     */
707    function on(type: "wifiScanStateChange", callback: Callback<number>): void;
708
709    /**
710     * Unsubscribe Wi-Fi scan status change events.
711     *
712     * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
713     *
714     * @since 7
715     * @syscap SystemCapability.Communication.WiFi.STA
716     * @permission ohos.permission.GET_WIFI_INFO
717     * @deprecated since 9
718     * @useinstead ohos.wifiManager/wifiManager.off#event:wifiScanStateChange
719     */
720    function off(type: "wifiScanStateChange", callback?: Callback<number>): void;
721
722    /**
723     * Subscribe Wi-Fi rssi change events.
724     *
725     * @returns Returns RSSI value in dBm
726     * @since 7
727     * @syscap SystemCapability.Communication.WiFi.STA
728     * @permission ohos.permission.GET_WIFI_INFO
729     * @deprecated since 9
730     * @useinstead ohos.wifiManager/wifiManager.on#event:wifiRssiChange
731     */
732    function on(type: "wifiRssiChange", callback: Callback<number>): void;
733
734    /**
735     * Unsubscribe Wi-Fi rssi change events.
736     *
737     * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
738     *
739     * @since 7
740     * @syscap SystemCapability.Communication.WiFi.STA
741     * @permission ohos.permission.GET_WIFI_INFO
742     * @deprecated since 9
743     * @useinstead ohos.wifiManager/wifiManager.off#event:wifiRssiChange
744     */
745    function off(type: "wifiRssiChange", callback?: Callback<number>): void;
746
747    /**
748     * Subscribe Wi-Fi stream change events.
749     *
750     * @returns Returns 0: stream none, 1: stream down, 2: stream up, 3: stream bidirectional
751     * @since 7
752     * @syscap SystemCapability.Communication.WiFi.STA
753     * @permission ohos.permission.MANAGE_WIFI_CONNECTION
754     * @systemapi Hide this for inner system use.
755     * @deprecated since 9
756     * @useinstead ohos.wifiManager/wifiManager.on#event:streamChange
757     */
758     function on(type: "streamChange", callback: Callback<number>): void;
759
760     /**
761      * Unsubscribe Wi-Fi stream change events.
762      *
763      * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
764      *
765      * @since 7
766      * @syscap SystemCapability.Communication.WiFi.STA
767      * @permission ohos.permission.MANAGE_WIFI_CONNECTION
768      * @systemapi Hide this for inner system use.
769      * @deprecated since 9
770     * @useinstead ohos.wifiManager/wifiManager.off#event:streamChange
771      */
772     function off(type: "streamChange", callback?: Callback<number>): void;
773
774    /**
775     * Subscribe Wi-Fi hotspot state change events.
776     *
777     * @returns Returns 0: inactive, 1: active, 2: activating, 3: deactivating
778     * @since 7
779     * @syscap SystemCapability.Communication.WiFi.AP.Core
780     * @permission ohos.permission.GET_WIFI_INFO
781     * @deprecated since 9
782     * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStateChange
783     */
784    function on(type: "hotspotStateChange", callback: Callback<number>): void;
785
786    /**
787     * Unsubscribe Wi-Fi hotspot state change events.
788     *
789     * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
790     *
791     * @since 7
792     * @syscap SystemCapability.Communication.WiFi.AP.Core
793     * @permission ohos.permission.GET_WIFI_INFO
794     * @deprecated since 9
795     * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStateChange
796     */
797    function off(type: "hotspotStateChange", callback?: Callback<number>): void;
798
799    /**
800     * Subscribe Wi-Fi hotspot sta join events.
801     *
802     * @returns Returns StationInfo
803     * @since 7
804     * @syscap SystemCapability.Communication.WiFi.AP.Core
805     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
806     * @systemapi Hide this for inner system use.
807     * @deprecated since 9
808     * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStaJoin
809     */
810    function on(type: "hotspotStaJoin", callback: Callback<StationInfo>): void;
811
812    /**
813     * Unsubscribe Wi-Fi hotspot sta join events.
814     *
815     * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
816     *
817     * @since 7
818     * @syscap SystemCapability.Communication.WiFi.AP.Core
819     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
820     * @systemapi Hide this for inner system use.
821     * @deprecated since 9
822     * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStaJoin
823     */
824    function off(type: "hotspotStaJoin", callback?: Callback<StationInfo>): void;
825
826    /**
827     * Subscribe Wi-Fi hotspot sta leave events.
828     *
829     * @returns Returns {@link #StationInfo} object
830     * @since 7
831     * @syscap SystemCapability.Communication.WiFi.AP.Core
832     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
833     * @systemapi Hide this for inner system use.
834     * @deprecated since 9
835     * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStaLeave
836     */
837    function on(type: "hotspotStaLeave", callback: Callback<StationInfo>): void;
838
839    /**
840     * Unsubscribe Wi-Fi hotspot sta leave events.
841     *
842     * @returns Returns {@link #StationInfo} object
843     * @since 7
844     * @syscap SystemCapability.Communication.WiFi.AP.Core
845     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
846     * @systemapi Hide this for inner system use.
847     * @deprecated since 9
848     * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStaLeave
849     */
850    function off(type: "hotspotStaLeave", callback?: Callback<StationInfo>): void;
851
852    /**
853     * Subscribe P2P status change events.
854     *
855     * @returns Returns 1: idle, 2: starting, 3:started, 4: closing, 5: closed
856     * @since 8
857     * @syscap SystemCapability.Communication.WiFi.P2P
858     * @permission ohos.permission.GET_WIFI_INFO
859     * @deprecated since 9
860     * @useinstead ohos.wifiManager/wifiManager.on#event:p2pStateChange
861     */
862    function on(type: "p2pStateChange", callback: Callback<number>): void;
863
864    /**
865     * Unsubscribe P2P status change events.
866     *
867     * @since 8
868     * @syscap SystemCapability.Communication.WiFi.P2P
869     * @permission ohos.permission.GET_WIFI_INFO
870     * @deprecated since 9
871     * @useinstead ohos.wifiManager/wifiManager.off#event:p2pStateChange
872     */
873    function off(type: "p2pStateChange", callback?: Callback<number>): void;
874
875    /**
876     * Subscribe P2P connection change events.
877     *
878     * @returns Returns WifiP2pLinkedInfo
879     * @since 8
880     * @syscap SystemCapability.Communication.WiFi.P2P
881     * @permission ohos.permission.GET_WIFI_INFO
882     * @deprecated since 9
883     * @useinstead ohos.wifiManager/wifiManager.on#event:p2pConnectionChange
884     */
885    function on(type: "p2pConnectionChange", callback: Callback<WifiP2pLinkedInfo>): void;
886
887    /**
888     * Unsubscribe P2P connection change events.
889     *
890     * @since 8
891     * @syscap SystemCapability.Communication.WiFi.P2P
892     * @permission ohos.permission.GET_WIFI_INFO
893     * @deprecated since 9
894     * @useinstead ohos.wifiManager/wifiManager.off#event:p2pConnectionChange
895     */
896    function off(type: "p2pConnectionChange", callback?: Callback<WifiP2pLinkedInfo>): void;
897
898    /**
899     * Subscribe P2P local device change events.
900     *
901     * @returns Returns WifiP2pDevice
902     * @since 8
903     * @syscap SystemCapability.Communication.WiFi.P2P
904     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
905     * @deprecated since 9
906     * @useinstead ohos.wifiManager/wifiManager.on#event:p2pDeviceChange
907     */
908    function on(type: "p2pDeviceChange", callback: Callback<WifiP2pDevice>): void;
909
910    /**
911     * Unsubscribe P2P local device change events.
912     *
913     * @returns Returns WifiP2pDevice
914     * @since 8
915     * @syscap SystemCapability.Communication.WiFi.P2P
916     * @permission ohos.permission.LOCATION
917     * @deprecated since 9
918     * @useinstead ohos.wifiManager/wifiManager.off#event:p2pDeviceChange
919     */
920    function off(type: "p2pDeviceChange", callback?: Callback<WifiP2pDevice>): void;
921
922    /**
923     * Subscribe P2P peer device change events.
924     *
925     * @returns Returns WifiP2pDevice[]
926     * @since 8
927     * @syscap SystemCapability.Communication.WiFi.P2P
928     * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION
929     * @deprecated since 9
930     * @useinstead ohos.wifiManager/wifiManager.on#event:p2pPeerDeviceChange
931     */
932    function on(type: "p2pPeerDeviceChange", callback: Callback<WifiP2pDevice[]>): void;
933
934    /**
935     * Unsubscribe P2P peer device change events.
936     *
937     * @since 8
938     * @syscap SystemCapability.Communication.WiFi.P2P
939     * @permission ohos.permission.LOCATION
940     * @deprecated since 9
941     * @useinstead ohos.wifiManager/wifiManager.off#event:p2pPeerDeviceChange
942     */
943    function off(type: "p2pPeerDeviceChange", callback?: Callback<WifiP2pDevice[]>): void;
944
945    /**
946     * Subscribe P2P persistent group change events.
947     *
948     * @returns Returns void
949     * @since 8
950     * @syscap SystemCapability.Communication.WiFi.P2P
951     * @permission ohos.permission.GET_WIFI_INFO
952     * @deprecated since 9
953     * @useinstead ohos.wifiManager/wifiManager.on#event:p2pPersistentGroupChange
954     */
955    function on(type: "p2pPersistentGroupChange", callback: Callback<void>): void;
956
957    /**
958     * Unsubscribe P2P persistent group change events.
959     *
960     * @since 8
961     * @syscap SystemCapability.Communication.WiFi.P2P
962     * @permission ohos.permission.GET_WIFI_INFO
963     * @deprecated since 9
964     * @useinstead ohos.wifiManager/wifiManager.off#event:p2pPersistentGroupChange
965     */
966    function off(type: "p2pPersistentGroupChange", callback?: Callback<void>): void;
967
968    /**
969     * Subscribe P2P discovery events.
970     *
971     * @returns Returns 0: initial state, 1: discovery succeeded
972     * @since 8
973     * @syscap SystemCapability.Communication.WiFi.P2P
974     * @permission ohos.permission.GET_WIFI_INFO
975     * @deprecated since 9
976     * @useinstead ohos.wifiManager/wifiManager.on#event:p2pDiscoveryChange
977     */
978    function on(type: "p2pDiscoveryChange", callback: Callback<number>): void;
979
980    /**
981     * Unsubscribe P2P discovery events.
982     *
983     * @since 8
984     * @syscap SystemCapability.Communication.WiFi.P2P
985     * @permission ohos.permission.GET_WIFI_INFO
986     * @deprecated since 9
987     * @useinstead ohos.wifiManager/wifiManager.off#event:p2pDiscoveryChange
988     */
989    function off(type: "p2pDiscoveryChange", callback?: Callback<number>): void;
990
991    /**
992     * Wi-Fi device configuration information.
993     *
994     * @since 6
995     * @syscap SystemCapability.Communication.WiFi.STA
996     * @deprecated since 9
997     * @useinstead ohos.wifiManager/wifiManager.WifiDeviceConfig
998     */
999    interface WifiDeviceConfig {
1000        /** Wi-Fi SSID: the maximum length is 32 */
1001        ssid: string;
1002
1003        /** Wi-Fi bssid(MAC): the length is 6 */
1004        bssid: string;
1005
1006        /** Wi-Fi key: maximum length is 64 */
1007        preSharedKey: string;
1008
1009        /** Hide SSID or not, false(default): not hide */
1010        isHiddenSsid: boolean;
1011
1012        /** Security type: reference definition of WifiSecurityType */
1013        securityType: WifiSecurityType;
1014
1015        /** The UID of the Wi-Fi configuration creator */
1016        /* @systemapi */
1017        creatorUid: number;
1018
1019        /** Disable reason */
1020        /* @systemapi */
1021        disableReason: number;
1022
1023        /** Allocated networkId */
1024        /* @systemapi */
1025        netId: number;
1026
1027        /** Random mac type */
1028        /* @systemapi */
1029        randomMacType: number;
1030
1031        /** Random mac address, the length is 6 */
1032        /* @systemapi */
1033        randomMacAddr: string;
1034
1035        /** IP Type */
1036        /* @systemapi */
1037        ipType: IpType;
1038
1039        /** IP config of static */
1040        /* @systemapi */
1041        staticIp: IpConfig;
1042    }
1043
1044    /**
1045     * Wi-Fi IP configuration information.
1046     *
1047     * @since 7
1048     * @systemapi Hide this for inner system use.
1049     * @syscap SystemCapability.Communication.WiFi.STA
1050     * @deprecated since 9
1051     * @useinstead ohos.wifiManager/wifiManager.IpConfig
1052     */
1053    interface IpConfig {
1054        ipAddress: number;
1055        gateway: number;
1056        dnsServers: number[];
1057        domains: Array<string>;
1058    }
1059
1060    /**
1061     * Describes the scanned Wi-Fi information.
1062     *
1063     * @since 6
1064     * @syscap SystemCapability.Communication.WiFi.STA
1065     * @deprecated since 9
1066     * @useinstead ohos.wifiManager/wifiManager.WifiScanInfo
1067     */
1068    interface WifiScanInfo {
1069        /** Wi-Fi SSID: the maximum length is 32 */
1070        ssid: string;
1071
1072        /** Wi-Fi bssid(MAC): the length is 6 */
1073        bssid: string;
1074
1075        /** Hotspot capability */
1076        capabilities: string;
1077
1078        /** Security type: reference definition of WifiSecurityType */
1079        securityType: WifiSecurityType;
1080
1081        /** Received signal strength indicator (RSSI) */
1082        rssi: number;
1083
1084        /** Frequency band, 1: 2.4G, 2: 5G */
1085        band: number;
1086
1087        /** Frequency */
1088        frequency: number;
1089
1090        /** Channel width */
1091        channelWidth: number;
1092
1093        /** Time stamp */
1094        timestamp: number;
1095    }
1096
1097    /**
1098     * Describes the wifi security type.
1099     *
1100     * @since 6
1101     * @syscap SystemCapability.Communication.WiFi.Core
1102     * @deprecated since 9
1103     * @useinstead ohos.wifiManager/wifiManager.WifiSecurityType
1104     */
1105    enum WifiSecurityType {
1106        /** Invalid security type */
1107        WIFI_SEC_TYPE_INVALID = 0,
1108
1109        /** Open */
1110        WIFI_SEC_TYPE_OPEN = 1,
1111
1112        /** Wired Equivalent Privacy (WEP) */
1113        WIFI_SEC_TYPE_WEP = 2,
1114
1115        /** Pre-shared key (PSK) */
1116        WIFI_SEC_TYPE_PSK = 3,
1117
1118        /** Simultaneous Authentication of Equals (SAE) */
1119        WIFI_SEC_TYPE_SAE = 4,
1120    }
1121
1122    /**
1123     * Wi-Fi connection information.
1124     *
1125     * @since 6
1126     * @syscap SystemCapability.Communication.WiFi.STA
1127     * @deprecated since 9
1128     * @useinstead ohos.wifiManager/wifiManager.WifiLinkedInfo
1129     */
1130    interface WifiLinkedInfo {
1131        /** The SSID of the Wi-Fi hotspot */
1132        ssid: string;
1133
1134        /** The BSSID of the Wi-Fi hotspot */
1135        bssid: string;
1136
1137        /** The ID(uniquely identifies) of a Wi-Fi connection. */
1138        /* @systemapi */
1139        networkId: number;
1140
1141        /** The RSSI(dBm) of a Wi-Fi access point. */
1142        rssi: number;
1143
1144        /** The frequency band of a Wi-Fi access point. */
1145        band: number;
1146
1147        /** The speed of a Wi-Fi access point. */
1148        linkSpeed: number;
1149
1150        /** The frequency of a Wi-Fi access point. */
1151        frequency: number;
1152
1153        /** Whether the SSID of the access point (AP) of this Wi-Fi connection is hidden. */
1154        isHidden: boolean;
1155
1156        /** Whether this Wi-Fi connection restricts the data volume. */
1157        isRestricted: boolean;
1158
1159        /** The load value of this Wi-Fi connection. A greater value indicates a higher load. */
1160        /* @systemapi */
1161        chload: number;
1162
1163        /** The signal-to-noise ratio (SNR) of this Wi-Fi connection. */
1164        /* @systemapi */
1165        snr: number;
1166
1167        /** The Wi-Fi MAC address of a device. */
1168        macAddress: string;
1169
1170        /** The IP address of this Wi-Fi connection. */
1171        ipAddress: number;
1172
1173        /** The state of the supplicant of this Wi-Fi connection. */
1174        /* @systemapi */
1175        suppState: SuppState;
1176
1177        /** The state of this Wi-Fi connection. */
1178        connState: ConnState;
1179    }
1180
1181    /**
1182     * Wi-Fi IP information.
1183     *
1184     * @since 7
1185     * @syscap SystemCapability.Communication.WiFi.STA
1186     * @deprecated since 9
1187     * @useinstead ohos.wifiManager/wifiManager.IpInfo
1188     */
1189    interface IpInfo {
1190        /** The IP address of the Wi-Fi connection */
1191        ipAddress: number;
1192
1193        /** The gateway of the Wi-Fi connection */
1194        gateway: number;
1195
1196        /** The network mask of the Wi-Fi connection */
1197        netmask: number;
1198
1199        /** The primary DNS server IP address of the Wi-Fi connection */
1200        primaryDns: number;
1201
1202        /** The secondary DNS server IP address of the Wi-Fi connection */
1203        secondDns: number;
1204
1205        /** The DHCP server IP address of the Wi-Fi connection */
1206        serverIp: number;
1207
1208        /** The IP address lease duration of the Wi-Fi connection */
1209        leaseDuration: number;
1210    }
1211
1212    /**
1213     * Wi-Fi hotspot configuration information.
1214     *
1215     * @since 7
1216     * @systemapi Hide this for inner system use.
1217     * @syscap SystemCapability.Communication.WiFi.AP.Core
1218     * @deprecated since 9
1219     * @useinstead ohos.wifiManager/wifiManager.HotspotConfig
1220     */
1221    interface HotspotConfig {
1222        /** The SSID of the Wi-Fi hotspot */
1223        ssid: string;
1224
1225        /** The encryption mode of the Wi-Fi hotspot */
1226        securityType: WifiSecurityType;
1227
1228        /** The frequency band of the Wi-Fi hotspot */
1229        band: number;
1230
1231        /** The password of the Wi-Fi hotspot */
1232        preSharedKey: string;
1233
1234        /** The maximum number of connections allowed by the Wi-Fi hotspot */
1235        maxConn: number;
1236    }
1237
1238    /**
1239     * Wi-Fi station information.
1240     *
1241     * @since 7
1242     * @systemapi Hide this for inner system use.
1243     * @syscap SystemCapability.Communication.WiFi.AP.Core
1244     * @deprecated since 9
1245     * @useinstead ohos.wifiManager/wifiManager.StationInfo
1246     */
1247    interface StationInfo {
1248        /** the network name of the Wi-Fi client */
1249        name: string;
1250
1251        /** The MAC address of the Wi-Fi client */
1252        macAddress: string;
1253
1254        /** The IP address of the Wi-Fi client */
1255        ipAddress: string;
1256    }
1257
1258    /**
1259     * Wi-Fi IP type enumeration.
1260     *
1261     * @since 7
1262     * @systemapi Hide this for inner system use.
1263     * @syscap SystemCapability.Communication.WiFi.STA
1264     * @deprecated since 9
1265     * @useinstead ohos.wifiManager/wifiManager.IpType
1266     */
1267     enum IpType {
1268        /** Use statically configured IP settings */
1269        STATIC,
1270
1271        /** Use dynamically configured IP settings */
1272        DHCP,
1273
1274        /** No IP details are assigned */
1275        UNKNOWN,
1276    }
1277
1278    /**
1279     * The state of the supplicant enumeration.
1280     *
1281     * @since 6
1282     * @systemapi Hide this for inner system use.
1283     * @syscap SystemCapability.Communication.WiFi.STA
1284     * @deprecated since 9
1285     * @useinstead ohos.wifiManager/wifiManager.SuppState
1286     */
1287    export enum SuppState {
1288        /** The supplicant is not associated with or is disconnected from the AP. */
1289        DISCONNECTED,
1290
1291        /** The network interface is disabled. */
1292        INTERFACE_DISABLED,
1293
1294        /** The supplicant is disabled. */
1295        INACTIVE,
1296
1297        /** The supplicant is scanning for a Wi-Fi connection. */
1298        SCANNING,
1299
1300        /** The supplicant is authenticating with a specified AP. */
1301        AUTHENTICATING,
1302
1303        /** The supplicant is associating with a specified AP. */
1304        ASSOCIATING,
1305
1306        /** The supplicant is associated with a specified AP. */
1307        ASSOCIATED,
1308
1309        /** The four-way handshake is ongoing. */
1310        FOUR_WAY_HANDSHAKE,
1311
1312        /** The group handshake is ongoing. */
1313        GROUP_HANDSHAKE,
1314
1315        /** All authentication is completed. */
1316        COMPLETED,
1317
1318        /** Failed to establish a connection to the supplicant. */
1319        UNINITIALIZED,
1320
1321        /** The supplicant is in an unknown or invalid state. */
1322        INVALID
1323    }
1324
1325    /**
1326     * The state of Wi-Fi connection enumeration.
1327     *
1328     * @since 6
1329     * @syscap SystemCapability.Communication.WiFi.STA
1330     * @deprecated since 9
1331     * @useinstead ohos.wifiManager/wifiManager.ConnState
1332     */
1333    export enum ConnState {
1334        /** The device is searching for an available AP. */
1335        SCANNING,
1336
1337        /** The Wi-Fi connection is being set up. */
1338        CONNECTING,
1339
1340        /** The Wi-Fi connection is being authenticated. */
1341        AUTHENTICATING,
1342
1343        /** The IP address of the Wi-Fi connection is being obtained. */
1344        OBTAINING_IPADDR,
1345
1346        /** The Wi-Fi connection has been set up. */
1347        CONNECTED,
1348
1349        /** The Wi-Fi connection is being torn down. */
1350        DISCONNECTING,
1351
1352        /** The Wi-Fi connection has been torn down. */
1353        DISCONNECTED,
1354
1355        /** Failed to set up the Wi-Fi connection. */
1356        UNKNOWN
1357    }
1358
1359    /**
1360     * P2P device information.
1361     *
1362     * @since 8
1363     * @syscap SystemCapability.Communication.WiFi.P2P
1364     * @deprecated since 9
1365     * @useinstead ohos.wifiManager/wifiManager.WifiP2pDevice
1366     */
1367    interface WifiP2pDevice {
1368        /** Device name */
1369        deviceName: string;
1370
1371        /** Device mac address */
1372        deviceAddress: string;
1373
1374        /** Primary device type */
1375        primaryDeviceType: string;
1376
1377        /** Device status */
1378        deviceStatus: P2pDeviceStatus;
1379
1380        /** Device group capabilitys */
1381        groupCapabilitys: number;
1382    }
1383
1384    /**
1385     * P2P config.
1386     *
1387     * @since 8
1388     * @syscap SystemCapability.Communication.WiFi.P2P
1389     * @deprecated since 9
1390     * @useinstead ohos.wifiManager/wifiManager.WifiP2PConfig
1391     */
1392    interface WifiP2PConfig {
1393        /** Device mac address */
1394        deviceAddress: string;
1395
1396        /**
1397         * Group network ID. When creating a group, -1 indicates creates a temporary group,
1398         * -2: indicates creates a persistent group
1399         */
1400        netId: number;
1401
1402        /* The passphrase of this {@code WifiP2pConfig} instance */
1403        passphrase: string;
1404
1405        /** Group name */
1406        groupName: string;
1407
1408        /** Group owner band */
1409        goBand: GroupOwnerBand;
1410    }
1411
1412    /**
1413     * P2P group information.
1414     *
1415     * @since 8
1416     * @syscap SystemCapability.Communication.WiFi.P2P
1417     * @deprecated since 9
1418     * @useinstead ohos.wifiManager/wifiManager.WifiP2pGroupInfo
1419     */
1420    interface WifiP2pGroupInfo {
1421        /** Indicates whether it is group owner */
1422        isP2pGo: boolean;
1423
1424        /** Group owner information */
1425        ownerInfo: WifiP2pDevice;
1426
1427        /** The group passphrase */
1428        passphrase: string;
1429
1430        /** Interface name */
1431        interface: string;
1432
1433        /** Group name */
1434        groupName: string;
1435
1436        /** Network ID */
1437        networkId: number;
1438
1439        /** Frequency */
1440        frequency: number;
1441
1442        /** Client list */
1443        clientDevices: WifiP2pDevice[];
1444
1445        /** Group owner IP address */
1446        goIpAddress: string;
1447    }
1448
1449    /**
1450     * P2P connection status.
1451     *
1452     * @since 8
1453     * @syscap SystemCapability.Communication.WiFi.P2P
1454     * @deprecated since 9
1455     * @useinstead ohos.wifiManager/wifiManager.P2pConnectState
1456     */
1457    enum P2pConnectState {
1458        DISCONNECTED = 0,
1459        CONNECTED = 1,
1460    }
1461
1462    /**
1463     * P2P linked information.
1464     *
1465     * @since 8
1466     * @syscap SystemCapability.Communication.WiFi.P2P
1467     * @deprecated since 9
1468     * @useinstead ohos.wifiManager/wifiManager.WifiP2pLinkedInfo
1469     */
1470    interface WifiP2pLinkedInfo {
1471        /** Connection status */
1472        connectState: P2pConnectState;
1473
1474        /** Indicates whether it is group owner */
1475        isGroupOwner: boolean;
1476
1477        /** Group owner address */
1478        groupOwnerAddr: string;
1479    }
1480
1481    /**
1482     * P2P device status.
1483     *
1484     * @since 8
1485     * @syscap SystemCapability.Communication.WiFi.P2P
1486     * @deprecated since 9
1487     * @useinstead ohos.wifiManager/wifiManager.P2pDeviceStatus
1488     */
1489    enum P2pDeviceStatus {
1490        CONNECTED = 0,
1491        INVITED = 1,
1492        FAILED = 2,
1493        AVAILABLE = 3,
1494        UNAVAILABLE = 4,
1495    }
1496
1497    /**
1498     * P2P group owner band.
1499     *
1500     * @since 8
1501     * @syscap SystemCapability.Communication.WiFi.P2P
1502     * @deprecated since 9
1503     * @useinstead ohos.wifiManager/wifiManager.GroupOwnerBand
1504     */
1505    enum GroupOwnerBand {
1506        GO_BAND_AUTO = 0,
1507        GO_BAND_2GHZ = 1,
1508        GO_BAND_5GHZ = 2,
1509    }
1510}
1511
1512export default wifi;
1513