• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback, Callback } from './@ohos.base';
17
18/**
19 * Provides methods to operate or manage Wi-Fi.
20 * @namespace wifiManager
21 * @since 9
22 */
23declare namespace wifiManager {
24  /**
25   * Enable Wi-Fi.
26   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
27   * @throws {BusinessError} 201 - Permission denied.
28   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
29   * @throws {BusinessError} 801 - Capability not supported.
30   * @throws {BusinessError} 2501000 - Operation failed.
31   * @throws {BusinessError} 2501003 - Failed for wifi is closing.
32   * @syscap SystemCapability.Communication.WiFi.STA
33   * @systemapi Hide this for inner system use.
34   * @since 9
35   */
36  function enableWifi(): void;
37
38  /**
39   * Disable Wi-Fi.
40   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
41   * @throws {BusinessError} 201 - Permission denied.
42   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
43   * @throws {BusinessError} 801 - Capability not supported.
44   * @throws {BusinessError} 2501000 - Operation failed.
45   * @throws {BusinessError} 2501004 - Failed for wifi is opening.
46   * @syscap SystemCapability.Communication.WiFi.STA
47   * @systemapi Hide this for inner system use.
48   * @since 9
49   */
50  function disableWifi(): void;
51
52  /**
53   * Query the Wi-Fi status
54   * @permission ohos.permission.GET_WIFI_INFO
55   * @returns { boolean } Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise.
56   * @throws {BusinessError} 201 - Permission denied.
57   * @throws {BusinessError} 801 - Capability not supported.
58   * @throws {BusinessError} 2501000 - Operation failed.
59   * @syscap SystemCapability.Communication.WiFi.STA
60   * @since 9
61   */
62  function isWifiActive(): boolean;
63
64  /**
65   * Scan Wi-Fi hotspot, This API works in asynchronous mode.
66   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
67   * @throws {BusinessError} 201 - Permission denied.
68   * @throws {BusinessError} 801 - Capability not supported.
69   * @throws {BusinessError} 2501000 - Operation failed.
70   * @syscap SystemCapability.Communication.WiFi.STA
71   * @since 9
72   * @deprecated since 10
73   * @useinstead wifiManager.startScan
74   */
75  function scan(): void;
76
77  /**
78   * Scan Wi-Fi hotspot.
79   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
80   * @throws {BusinessError} 201 - Permission denied.
81   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
82   * @throws {BusinessError} 801 - Capability not supported.
83   * @throws {BusinessError} 2501000 - Operation failed.
84   * @syscap SystemCapability.Communication.WiFi.STA
85   * @systemapi Hide this for inner system use.
86   * @since 10
87   */
88  function startScan(): void;
89
90  /**
91   * Obtain the scanned sta list.
92   * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or
93   * (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION))
94   * @returns { Promise<Array<WifiScanInfo>> } Returns information about scanned Wi-Fi hotspot if any.
95   * @throws {BusinessError} 201 - Permission denied.
96   * @throws {BusinessError} 801 - Capability not supported.
97   * @throws {BusinessError} 2501000 - Operation failed.
98   * @syscap SystemCapability.Communication.WiFi.STA
99   * @since 9
100   * @deprecated since 10
101   * @useinstead wifiManager.getScanInfoList
102   */
103  function getScanResults(): Promise<Array<WifiScanInfo>>;
104
105
106  /**
107   * Obtain the scanned sta list.
108   * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or
109   * (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION))
110   * @param { AsyncCallback<Array<WifiScanInfo>> } callback - Returns information about scanned Wi-Fi hotspot if any.
111   * @throws {BusinessError} 201 - Permission denied.
112   * @throws {BusinessError} 801 - Capability not supported.
113   * @throws {BusinessError} 2501000 - Operation failed.
114   * @syscap SystemCapability.Communication.WiFi.STA
115   * @since 9
116   * @deprecated since 10
117   * @useinstead wifiManager.getScanInfoList
118   */
119  function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void;
120
121  /**
122   * Obtain the scanned sta list.
123   * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or
124   * (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION))
125   * @returns { Array<WifiScanInfo> } Returns information about scanned Wi-Fi hotspot if any.
126   * @throws {BusinessError} 201 - Permission denied.
127   * @throws {BusinessError} 801 - Capability not supported.
128   * @throws {BusinessError} 2501000 - Operation failed.
129   * @syscap SystemCapability.Communication.WiFi.STA
130   * @since 9
131   * @deprecated since 10
132   * @useinstead wifiManager.getScanInfoList
133   */
134  function getScanResultsSync(): Array<WifiScanInfo>;
135
136  /**
137   * Obtain the scanned station list. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid.
138   * @permission ohos.permission.GET_WIFI_INFO
139   * @returns { Array<WifiScanInfo> } Returns information about scanned Wi-Fi hotspot if any.
140   * @throws {BusinessError} 201 - Permission denied.
141   * @throws {BusinessError} 801 - Capability not supported.
142   * @throws {BusinessError} 2501000 - Operation failed.
143   * @syscap SystemCapability.Communication.WiFi.STA
144   * @since 10
145   */
146  function getScanInfoList(): Array<WifiScanInfo>;
147
148  /**
149   * User can trigger scan even Wi-Fi is disabled.
150   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
151   * @param { boolean } isScanAlwaysAllowed - true for allow trigger scan, otherwise don't allow trigger scan when Wi-Fi is disabled.
152   * @throws {BusinessError} 201 - Permission denied.
153   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
154   * @throws {BusinessError} 401 - Invalid parameters.
155   * @throws {BusinessError} 801 - Capability not supported.
156   * @throws {BusinessError} 2501000 - Operation failed.
157   * @syscap SystemCapability.Communication.WiFi.STA
158   * @systemapi Hide this for inner system use.
159   * @since 10
160   */
161  function setScanAlwaysAllowed(isScanAlwaysAllowed: boolean): void;
162
163  /**
164   * Get scan always allowed flag.
165   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
166   * @returns { boolean } Returns {@code true} if scan running state is true, returns {@code false} otherwise.
167   * @throws {BusinessError} 201 - Permission denied.
168   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
169   * @throws {BusinessError} 801 - Capability not supported.
170   * @throws {BusinessError} 2501000 - Operation failed.
171   * @syscap SystemCapability.Communication.WiFi.STA
172   * @systemapi Hide this for inner system use.
173   * @since 10
174   */
175  function getScanAlwaysAllowed(): boolean;
176
177  /**
178   * Add Wi-Fi connection configuration to the device. The configuration will be updated when the configuration is added.</p>
179   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
180   * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network.
181   * @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise.
182   * @throws {BusinessError} 201 - Permission denied.
183   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
184   * @throws {BusinessError} 401 - Invalid parameters.
185   * @throws {BusinessError} 801 - Capability not supported.
186   * @throws {BusinessError} 2501000 - Operation failed.
187   * @syscap SystemCapability.Communication.WiFi.STA
188   * @systemapi Hide this for inner system use.
189   * @since 9
190   */
191  function addDeviceConfig(config: WifiDeviceConfig): Promise<number>;
192
193  /**
194   * Add Wi-Fi connection configuration to the device. The configuration will be updated when the configuration is added.</p>
195   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
196   * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network.
197   * @param { AsyncCallback<number> } callback - Indicates call back of addDeviceConfig.
198   * @throws {BusinessError} 201 - Permission denied.
199   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
200   * @throws {BusinessError} 401 - Invalid parameters.
201   * @throws {BusinessError} 801 - Capability not supported.
202   * @throws {BusinessError} 2501000 - Operation failed.
203   * @syscap SystemCapability.Communication.WiFi.STA
204   * @systemapi Hide this for inner system use.
205   * @since 9
206   */
207  function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void;
208
209  /**
210  * Add a specified candidate hotspot configuration and returns the networkId.
211  * This method adds one configuration at a time. After this configuration is added,
212  *     your device will determine whether to connect to the hotspot.
213  * @permission ohos.permission.SET_WIFI_INFO
214  * @param { WifiDeviceConfig } config - candidate config.
215  * @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise.
216  * @throws {BusinessError} 201 - Permission denied.
217  * @throws {BusinessError} 401 - Invalid parameters.
218  * @throws {BusinessError} 801 - Capability not supported.
219  * @throws {BusinessError} 2501000 - Operation failed.
220  * @syscap SystemCapability.Communication.WiFi.STA
221  * @since 9
222  */
223  function addCandidateConfig(config: WifiDeviceConfig): Promise<number>;
224
225  /**
226  * Add a specified candidate hotspot configuration and returns the networkId.
227  * This method adds one configuration at a time. After this configuration is added,
228  *     your device will determine whether to connect to the hotspot.
229  * @permission ohos.permission.SET_WIFI_INFO
230  * @param { WifiDeviceConfig } config - candidate config.
231  * @param { AsyncCallback<number> } callback - Indicates call back of addCandidateConfig.
232  * @throws {BusinessError} 201 - Permission denied.
233  * @throws {BusinessError} 401 - Invalid parameters.
234  * @throws {BusinessError} 801 - Capability not supported.
235  * @throws {BusinessError} 2501000 - Operation failed.
236  * @syscap SystemCapability.Communication.WiFi.STA
237  * @since 9
238  */
239  function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void;
240
241  /**
242   * Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed
243   * to be removed.
244   * @permission ohos.permission.SET_WIFI_INFO
245   * @param { number } networkId - Network ID which will be removed.
246   * @returns { Promise<void> } Return results.
247   * @throws {BusinessError} 201 - Permission denied.
248   * @throws {BusinessError} 401 - Invalid parameters.
249   * @throws {BusinessError} 801 - Capability not supported.
250   * @throws {BusinessError} 2501000 - Operation failed.
251   * @syscap SystemCapability.Communication.WiFi.STA
252   * @since 9
253   */
254  function removeCandidateConfig(networkId: number): Promise<void>;
255
256  /**
257   * Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed
258   * to be removed.
259   * @permission ohos.permission.SET_WIFI_INFO
260   * @param { number } networkId - Network ID which will be removed.
261   * @param { AsyncCallback<void> } callback - Indicates call back of removeCandidateConfig.
262   * @throws {BusinessError} 201 - Permission denied.
263   * @throws {BusinessError} 401 - Invalid parameters.
264   * @throws {BusinessError} 801 - Capability not supported.
265   * @throws {BusinessError} 2501000 - Operation failed.
266   * @syscap SystemCapability.Communication.WiFi.STA
267   * @since 9
268   */
269  function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void;
270
271  /**
272   * Obtain the list of all existed candidate Wi-Fi configurations which added by ourself.
273   * You can obtain only the Wi-Fi configurations you created on your own application.
274   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
275   * @returns { Array<WifiDeviceConfig> } Returns the list of all existed Wi-Fi configurations you created on your application.
276   * @throws {BusinessError} 201 - Permission denied.
277   * @throws {BusinessError} 801 - Capability not supported.
278   * @throws {BusinessError} 2501000 - Operation failed.
279   * @syscap SystemCapability.Communication.WiFi.STA
280   * @since 9
281   */
282  /**
283   * Obtain the list of all existed candidate Wi-Fi configurations which added by ourself.
284   * You can obtain only the Wi-Fi configurations you created on your own application.
285   * @permission ohos.permission.GET_WIFI_INFO
286   * @returns { Array<WifiDeviceConfig> } Returns the list of all existed Wi-Fi configurations you created on your application.
287   * @throws {BusinessError} 201 - Permission denied.
288   * @throws {BusinessError} 801 - Capability not supported.
289   * @throws {BusinessError} 2501000 - Operation failed.
290   * @syscap SystemCapability.Communication.WiFi.STA
291   * @since 10
292   */
293  function getCandidateConfigs(): Array<WifiDeviceConfig>;
294
295  /**
296   * Connect to a specified candidate hotspot by networkId, only the configuration which is added by ourself
297   * is allowed to be connected. This method connect to a configuration at a time.
298   * @permission ohos.permission.SET_WIFI_INFO
299   * @param { number } networkId - Network ID which will be connected.
300   * @throws {BusinessError} 201 - Permission denied.
301   * @throws {BusinessError} 401 - Invalid parameters.
302   * @throws {BusinessError} 801 - Capability not supported.
303   * @throws {BusinessError} 2501000 - Operation failed.
304   * @throws {BusinessError} 2501001 - Wifi is closed.
305   * @syscap SystemCapability.Communication.WiFi.STA
306   * @since 9
307   */
308  function connectToCandidateConfig(networkId: number): void;
309
310  /**
311   * Connect to Wi-Fi hotspot by networkId.
312   * @permission ohos.permission.MANAGE_WIFI_CONNECTION
313   * @param { number } networkId - ID of the connected network.
314   * @throws {BusinessError} 201 - Permission denied.
315   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
316   * @throws {BusinessError} 401 - Invalid parameters.
317   * @throws {BusinessError} 801 - Capability not supported.
318   * @throws {BusinessError} 2501000 - Operation failed.
319   * @throws {BusinessError} 2501001 - Wifi is closed.
320   * @syscap SystemCapability.Communication.WiFi.STA
321   * @systemapi Hide this for inner system use.
322   * @since 9
323   */
324  function connectToNetwork(networkId: number): void;
325
326  /**
327   * Connect to Wi-Fi hotspot by WifiDeviceConfig.
328   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG and
329   * ohos.permission.MANAGE_WIFI_CONNECTION
330   * @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi hotspot.
331   * @throws {BusinessError} 201 - Permission denied.
332   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
333   * @throws {BusinessError} 401 - Invalid parameters.
334   * @throws {BusinessError} 801 - Capability not supported.
335   * @throws {BusinessError} 2501000 - Operation failed.
336   * @throws {BusinessError} 2501001 - Wifi is closed.
337   * @syscap SystemCapability.Communication.WiFi.STA
338   * @systemapi Hide this for inner system use.
339   * @since 9
340   */
341  function connectToDevice(config: WifiDeviceConfig): void;
342
343  /**
344   * Disconnect connection between sta and Wi-Fi hotspot.
345   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
346   * @throws {BusinessError} 201 - Permission denied.
347   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
348   * @throws {BusinessError} 801 - Capability not supported.
349   * @throws {BusinessError} 2501000 - Operation failed.
350   * @syscap SystemCapability.Communication.WiFi.STA
351   * @systemapi Hide this for inner system use.
352   * @since 9
353   */
354  function disconnect(): void;
355
356  /**
357   * Calculate the Wi-Fi signal level based on the Wi-Fi RSSI and frequency band.
358   * @permission ohos.permission.GET_WIFI_INFO
359   * @param { number } rssi - Indicates the Wi-Fi RSSI.
360   * @param { number } band - Indicates the Wi-Fi frequency band.
361   * @returns { number } Returns Wi-Fi signal level ranging from 0 to 4.
362   * @throws {BusinessError} 201 - Permission denied.
363   * @throws {BusinessError} 401 - Invalid parameters.
364   * @throws {BusinessError} 801 - Capability not supported.
365   * @throws {BusinessError} 2501000 - Operation failed.
366   * @syscap SystemCapability.Communication.WiFi.STA
367   * @since 9
368   */
369  function getSignalLevel(rssi: number, band: number): number;
370
371  /**
372   * Obtain connection information about the Wi-Fi connection.
373   * @permission ohos.permission.GET_WIFI_INFO
374   * @returns { Promise<WifiLinkedInfo> } Returns Wi-Fi linked information.
375   * @throws {BusinessError} 201 - Permission denied.
376   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
377   * @throws {BusinessError} 801 - Capability not supported.
378   * @throws {BusinessError} 2501000 - Operation failed.
379   * @throws {BusinessError} 2501001 - Wifi is closed.
380   * @syscap SystemCapability.Communication.WiFi.STA
381   * @since 9
382   */
383  function getLinkedInfo(): Promise<WifiLinkedInfo>;
384
385  /**
386   * Obtain connection information about the Wi-Fi connection.
387   * @permission ohos.permission.GET_WIFI_INFO
388   * @param { AsyncCallback<WifiLinkedInfo> } callback - Indicates callback of function.
389   * @throws {BusinessError} 201 - Permission denied.
390   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
391   * @throws {BusinessError} 801 - Capability not supported.
392   * @throws {BusinessError} 2501000 - Operation failed.
393   * @throws {BusinessError} 2501001 - Wifi is closed.
394   * @syscap SystemCapability.Communication.WiFi.STA
395   * @since 9
396   */
397  function getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void;
398
399  /**
400   * Check whether the Wi-Fi connection has been set up.
401   * @permission ohos.permission.GET_WIFI_INFO
402   * @returns { boolean } Returns {@code true} if a Wi-Fi connection has been set up, returns {@code false} otherwise.
403   * @throws {BusinessError} 201 - Permission denied.
404   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
405   * @throws {BusinessError} 801 - Capability not supported.
406   * @throws {BusinessError} 2501000 - Operation failed.
407   * @syscap SystemCapability.Communication.WiFi.STA
408   * @since 9
409   */
410  function isConnected(): boolean;
411
412  /**
413   * Obtain the features supported by the device.
414   * To check whether this device supports a specified feature.
415   * @permission ohos.permission.GET_WIFI_INFO
416   * @returns { number } Returns the features supported by this device.
417   * @throws {BusinessError} 201 - Permission denied.
418   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
419   * @throws {BusinessError} 801 - Capability not supported.
420   * @throws {BusinessError} 2401000 - Operation failed.
421   * @syscap SystemCapability.Communication.WiFi.Core
422   * @systemapi Hide this for inner system use.
423   * @since 9
424   */
425  function getSupportedFeatures(): number;
426
427  /**
428   * Check whether the device supports a specified feature.
429   * @permission ohos.permission.GET_WIFI_INFO
430   * @param { number } featureId Indicates the ID of the feature.
431   * @returns { boolean } Returns {@code true} if this device supports the specified feature, returns {@code false} otherwise.
432   * @throws {BusinessError} 201 - Permission denied.
433   * @throws {BusinessError} 401 - Invalid parameters.
434   * @throws {BusinessError} 801 - Capability not supported.
435   * @throws {BusinessError} 2401000 - Operation failed.
436   * @syscap SystemCapability.Communication.WiFi.Core
437   * @since 9
438   */
439  function isFeatureSupported(featureId: number): boolean;
440
441  /**
442   * Obtain the MAC address of a Wi-Fi device. Wi-Fi must be enabled.
443   * The MAC address is unique and cannot be changed.
444   * @permission ohos.permission.GET_WIFI_LOCAL_MAC and ohos.permission.GET_WIFI_INFO
445   * @returns { string[] } Returns the MAC address of the Wi-Fi device.
446   * @throws {BusinessError} 201 - Permission denied.
447   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
448   * @throws {BusinessError} 801 - Capability not supported.
449   * @throws {BusinessError} 2501000 - Operation failed.
450   * @throws {BusinessError} 2501001 - Wifi is closed.
451   * @syscap SystemCapability.Communication.WiFi.STA
452   * @systemapi Hide this for inner system use.
453   * @since 9
454   */
455  function getDeviceMacAddress(): string[];
456
457  /**
458   * Obtain the IP information of the Wi-Fi connection.
459   * The IP information includes the host IP address, gateway address, and DNS information.
460   * @permission ohos.permission.GET_WIFI_INFO
461   * @returns { IpInfo } Returns the IP information of the Wi-Fi connection.
462   * @throws {BusinessError} 201 - Permission denied.
463   * @throws {BusinessError} 801 - Capability not supported.
464   * @throws {BusinessError} 2501000 - Operation failed.
465   * @syscap SystemCapability.Communication.WiFi.STA
466   * @since 9
467   */
468  function getIpInfo(): IpInfo;
469
470  /**
471   * Obtain the IPv6 information of the Wi-Fi connection.
472   * The IPv6 information includes the host IP address, gateway address, and DNS information.
473   * @permission ohos.permission.GET_WIFI_INFO
474   * @returns { Ipv6Info } Returns the IPv6 information of the Wi-Fi connection.
475   * @throws {BusinessError} 201 - Permission denied.
476   * @throws {BusinessError} 801 - Capability not supported.
477   * @throws {BusinessError} 2501000 - Operation failed.
478   * @syscap SystemCapability.Communication.WiFi.STA
479   * @since 10
480   */
481  function getIpv6Info(): Ipv6Info;
482
483  /**
484   * Obtain the country code of the device.
485   * @permission ohos.permission.GET_WIFI_INFO
486   * @returns { string } Returns the country code of this device.
487   * @throws {BusinessError} 201 - Permission denied.
488   * @throws {BusinessError} 801 - Capability not supported.
489   * @throws {BusinessError} 2401000 - Operation failed.
490   * @syscap SystemCapability.Communication.WiFi.Core
491   * @since 9
492   */
493  function getCountryCode(): string;
494
495  /**
496   * Re-associate to current network.
497   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
498   * @throws {BusinessError} 201 - Permission denied.
499   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
500   * @throws {BusinessError} 801 - Capability not supported.
501   * @throws {BusinessError} 2501000 - Operation failed.
502   * @throws {BusinessError} 2501001 - Wifi is closed.
503   * @syscap SystemCapability.Communication.WiFi.STA
504   * @systemapi Hide this for inner system use.
505   * @since 9
506   */
507  function reassociate(): void;
508
509  /**
510   * Re-connect to current network.
511   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
512   * @throws {BusinessError} 201 - Permission denied.
513   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
514   * @throws {BusinessError} 801 - Capability not supported.
515   * @throws {BusinessError} 2501000 - Operation failed.
516   * @throws {BusinessError} 2501001 - Wifi is closed.
517   * @syscap SystemCapability.Communication.WiFi.STA
518   * @systemapi Hide this for inner system use.
519   * @since 9
520   */
521  function reconnect(): void;
522
523  /**
524   * Obtain the list of all existed Wi-Fi configurations.
525   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.GET_WIFI_CONFIG
526   * @returns { Array<WifiDeviceConfig> } Returns the list of all existing Wi-Fi configurations you created on your application.
527   * @throws {BusinessError} 201 - Permission denied.
528   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
529   * @throws {BusinessError} 801 - Capability not supported.
530   * @throws {BusinessError} 2501000 - Operation failed.
531   * @syscap SystemCapability.Communication.WiFi.STA
532   * @systemapi Hide this for inner system use.
533   * @since 9
534   */
535  /**
536   * Obtain the list of all existed Wi-Fi configurations.
537   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
538   * @returns { Array<WifiDeviceConfig> } Returns the list of all existing Wi-Fi configurations you created on your application.
539   * @throws {BusinessError} 201 - Permission denied.
540   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
541   * @throws {BusinessError} 801 - Capability not supported.
542   * @throws {BusinessError} 2501000 - Operation failed.
543   * @syscap SystemCapability.Communication.WiFi.STA
544   * @systemapi Hide this for inner system use.
545   * @since 10
546   */
547  function getDeviceConfigs(): Array<WifiDeviceConfig>;
548
549  /**
550   * Update the specified Wi-Fi configuration.
551   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
552   * @param { WifiDeviceConfig } config Indicates the Wi-Fi configuration to update.
553   * @returns { number } Returns the network ID in the updated Wi-Fi configuration if the update is successful;
554   *     returns {@code -1} if the specified Wi-Fi configuration is not contained in the list.
555   * @throws {BusinessError} 201 - Permission denied.
556   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
557   * @throws {BusinessError} 401 - Invalid parameters.
558   * @throws {BusinessError} 801 - Capability not supported.
559   * @throws {BusinessError} 2501000 - Operation failed.
560   * @syscap SystemCapability.Communication.WiFi.STA
561   * @systemapi Hide this for inner system use.
562   * @since 9
563   */
564  function updateNetwork(config: WifiDeviceConfig): number;
565
566  /**
567   * Disable the specified DeviceConfig by networkId.
568   * The disabled DeviceConfig will not be associated with again.
569   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
570   * @param { number } netId Identifies the network to disable.
571   * @throws {BusinessError} 201 - Permission denied.
572   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
573   * @throws {BusinessError} 401 - Invalid parameters.
574   * @throws {BusinessError} 801 - Capability not supported.
575   * @throws {BusinessError} 2501000 - Operation failed.
576   * @syscap SystemCapability.Communication.WiFi.STA
577   * @systemapi Hide this for inner system use.
578   * @since 9
579   */
580  function disableNetwork(netId: number): void;
581
582  /**
583   * Remove all the saved Wi-Fi configurations.
584   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
585   * @throws {BusinessError} 201 - Permission denied.
586   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
587   * @throws {BusinessError} 801 - Capability not supported.
588   * @throws {BusinessError} 2501000 - Operation failed.
589   * @syscap SystemCapability.Communication.WiFi.STA
590   * @systemapi Hide this for inner system use.
591   * @since 9
592   */
593  function removeAllNetwork(): void;
594
595  /**
596   * Remove a Wi-Fi DeviceConfig with networkId.
597   * After a Wi-Fi DeviceConfig is removed, its configuration will be deleted from the list of Wi-Fi configurations.
598   * If the Wi-Fi DeviceConfig is being connected, the connection will be interrupted.
599   * The application can only delete Wi-Fi DeviceConfig it has created.
600   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
601   * @param { number } id - Indicate the ID of the Wi-Fi DeviceConfig.
602   * @throws {BusinessError} 201 - Permission denied.
603   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
604   * @throws {BusinessError} 401 - Invalid parameters.
605   * @throws {BusinessError} 801 - Capability not supported.
606   * @throws {BusinessError} 2501000 - Operation failed.
607   * @syscap SystemCapability.Communication.WiFi.STA
608   * @systemapi Hide this for inner system use.
609   * @since 9
610   */
611  function removeDevice(id: number): void;
612
613  /**
614   * Check whether the current device supports the specified band.
615   * @permission ohos.permission.GET_WIFI_INFO
616   * @param { WifiBandType } bandType - Indicates the band type.
617   * @returns { boolean }Returns {@code true} if the specified band is supported, returns {@code false} otherwise.
618   * @throws {BusinessError} 201 - Permission denied.
619   * @throws {BusinessError} 801 - Capability not supported.
620   * @throws {BusinessError} 2501000 - Operation failed.
621   * @syscap SystemCapability.Communication.WiFi.STA
622   * @since 10
623   */
624  function isBandTypeSupported(bandType: WifiBandType): boolean;
625
626  /**
627   * Obtain the supported 5G channel list of the device.
628   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
629   * @returns { Array<number> } Returns 5G channel list.
630   * @throws {BusinessError} 201 - Permission denied.
631   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
632   * @throws {BusinessError} 801 - Capability not supported.
633   * @throws {BusinessError} 2501000 - Operation failed.
634   * @syscap SystemCapability.Communication.WiFi.STA
635   * @systemapi Hide this for inner system use.
636   * @since 10
637   */
638  function get5GChannelList(): Array<number>;
639
640  /**
641   * Obtain the latest disconnected reason.
642   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
643   * @returns { DisconnectedReason } Returns the latest disconnected reason.
644   * @throws {BusinessError} 201 - Permission denied.
645   * @throws {BusinessError} 801 - Capability not supported.
646   * @throws {BusinessError} 2501000 - Operation failed.
647   * @syscap SystemCapability.Communication.WiFi.STA
648   * @systemapi Hide this for inner system use.
649   * @since 10
650   */
651  function getDisconnectedReason(): DisconnectedReason;
652
653  /**
654   * Enable Wi-Fi hotspot function.
655   * This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled.
656   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
657   * @throws {BusinessError} 201 - Permission denied.
658   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
659   * @throws {BusinessError} 801 - Capability not supported.
660   * @throws {BusinessError} 2601000 - Operation failed.
661   * @syscap SystemCapability.Communication.WiFi.AP.Core
662   * @systemapi Hide this for inner system use.
663   * @since 9
664   */
665  function enableHotspot(): void;
666
667  /**
668   * Disable Wi-Fi hotspot function.
669   * This method is asynchronous. If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled.
670   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
671   * @throws {BusinessError} 201 - Permission denied.
672   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
673   * @throws {BusinessError} 801 - Capability not supported.
674   * @throws {BusinessError} 2601000 - Operation failed.
675   * @syscap SystemCapability.Communication.WiFi.AP.Core
676   * @systemapi Hide this for inner system use.
677   * @since 9
678   */
679  function disableHotspot(): void;
680
681  /**
682   * Check whether a device serving as a Wi-Fi hotspot supports both the 2.4 GHz and 5 GHz Wi-Fi.
683   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT
684   * @returns { boolean } Returns {@code true} if the method is called successfully, returns {@code false} otherwise.
685   * @throws {BusinessError} 201 - Permission denied.
686   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
687   * @throws {BusinessError} 801 - Capability not supported.
688   * @throws {BusinessError} 2601000 - Operation failed.
689   * @syscap SystemCapability.Communication.WiFi.AP.Core
690   * @systemapi Hide this for inner system use.
691   * @since 9
692   */
693  function isHotspotDualBandSupported(): boolean;
694
695  /**
696   * Check whether Wi-Fi hotspot is active on a device.
697   * @permission ohos.permission.GET_WIFI_INFO
698   * @returns { boolean } {@code true} if Wi-Fi hotspot is enabled, returns {@code false} otherwise.
699   * @throws {BusinessError} 201 - Permission denied.
700   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
701   * @throws {BusinessError} 801 - Capability not supported.
702   * @throws {BusinessError} 2601000 - Operation failed.
703   * @syscap SystemCapability.Communication.WiFi.AP.Core
704   * @systemapi Hide this for inner system use.
705   * @since 9
706   */
707  function isHotspotActive(): boolean;
708
709  /**
710   * Set the hotspot configuration for the device.
711   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
712   * @param { HotspotConfig } config - Indicates the Wi-Fi hotspot configuration.
713   *     The SSID and {@code securityType} must be available and correct.
714   *     If {@code securityType} is not {@code open}, {@code preSharedKey} must be available and correct.
715   * @throws {BusinessError} 201 - Permission denied.
716   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
717   * @throws {BusinessError} 401 - Invalid parameters.
718   * @throws {BusinessError} 801 - Capability not supported.
719   * @throws {BusinessError} 2601000 - Operation failed.
720   * @syscap SystemCapability.Communication.WiFi.AP.Core
721   * @systemapi Hide this for inner system use.
722   * @since 9
723   */
724  function setHotspotConfig(config: HotspotConfig): void;
725
726  /**
727   * Obtain the Wi-Fi hotspot configuration.
728   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
729   * @returns { HotspotConfig } Returns the configuration of an existed or enabled Wi-Fi hotspot.
730   * @throws {BusinessError} 201 - Permission denied.
731   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
732   * @throws {BusinessError} 801 - Capability not supported.
733   * @throws {BusinessError} 2601000 - Operation failed.
734   * @syscap SystemCapability.Communication.WiFi.AP.Core
735   * @systemapi Hide this for inner system use.
736   * @since 9
737   */
738  function getHotspotConfig(): HotspotConfig;
739
740  /**
741   * Obtain the list of stations that are connected to the Wi-Fi hotspot.
742   * This method can only be used on a device that serves as a Wi-Fi hotspot.
743   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT
744   * @returns { Array<StationInfo> } the list of clients that are connected to the Wi-Fi hotspot.
745   * @throws {BusinessError} 201 - Permission denied.
746   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
747   * @throws {BusinessError} 801 - Capability not supported.
748   * @throws {BusinessError} 2601000 - Operation failed.
749   * @syscap SystemCapability.Communication.WiFi.AP.Core
750   * @systemapi Hide this for inner system use.
751   * @since 9
752   */
753  /**
754   * Obtain the list of stations that are connected to the Wi-Fi hotspot.
755   * This method can only be used on a device that serves as a Wi-Fi hotspot.
756   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT
757   * @returns { Array<StationInfo> } the list of clients that are connected to the Wi-Fi hotspot.
758   * @throws {BusinessError} 201 - Permission denied.
759   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
760   * @throws {BusinessError} 801 - Capability not supported.
761   * @throws {BusinessError} 2601000 - Operation failed.
762   * @syscap SystemCapability.Communication.WiFi.AP.Core
763   * @systemapi Hide this for inner system use.
764   * @since 10
765   */
766  function getStations(): Array<StationInfo>;
767
768  /**
769   * Obtain information about the P2P connection.
770   * @permission ohos.permission.GET_WIFI_INFO
771   * @returns { Promise<WifiP2pLinkedInfo> } Returns p2p linked information.
772   * @throws {BusinessError} 201 - Permission denied.
773   * @throws {BusinessError} 801 - Capability not supported.
774   * @throws {BusinessError} 2801000 - Operation failed.
775   * @syscap SystemCapability.Communication.WiFi.P2P
776   * @since 9
777   */
778  function getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo>;
779
780  /**
781   * Obtain information about the P2P connection.
782   * @permission ohos.permission.GET_WIFI_INFO
783   * @param { AsyncCallback<WifiP2pLinkedInfo> } callback - Indicates callback of function.
784   * @throws {BusinessError} 201 - Permission denied.
785   * @throws {BusinessError} 801 - Capability not supported.
786   * @throws {BusinessError} 2801000 - Operation failed.
787   * @syscap SystemCapability.Communication.WiFi.P2P
788   * @since 9
789   */
790  function getP2pLinkedInfo(callback: AsyncCallback<WifiP2pLinkedInfo>): void;
791
792  /**
793   * Obtain information about the current p2p group.
794   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
795   * @returns { Promise<WifiP2pGroupInfo> } Returns p2p group information.
796   * @throws {BusinessError} 201 - Permission denied.
797   * @throws {BusinessError} 801 - Capability not supported.
798   * @throws {BusinessError} 2801000 - Operation failed.
799   * @syscap SystemCapability.Communication.WiFi.P2P
800   * @since 9
801   */
802  /**
803   * Obtain information about the current p2p group.
804   * @permission ohos.permission.GET_WIFI_INFO
805   * @returns { Promise<WifiP2pGroupInfo> } Returns p2p group information.
806   * @throws {BusinessError} 201 - Permission denied.
807   * @throws {BusinessError} 801 - Capability not supported.
808   * @throws {BusinessError} 2801000 - Operation failed.
809   * @syscap SystemCapability.Communication.WiFi.P2P
810   * @since 10
811   */
812  function getCurrentGroup(): Promise<WifiP2pGroupInfo>;
813
814  /**
815   * Obtain information about the current p2p group.
816   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
817   * @param { AsyncCallback<WifiP2pGroupInfo> } callback - Indicates callback of function.
818   * @throws {BusinessError} 201 - Permission denied.
819   * @throws {BusinessError} 801 - Capability not supported.
820   * @throws {BusinessError} 2801000 - Operation failed.
821   * @syscap SystemCapability.Communication.WiFi.P2P
822   * @since 9
823   */
824  /**
825   * Obtain information about the current p2p group.
826   * @permission ohos.permission.GET_WIFI_INFO
827   * @param { AsyncCallback<WifiP2pGroupInfo> } callback - Indicates callback of function.
828   * @throws {BusinessError} 201 - Permission denied.
829   * @throws {BusinessError} 801 - Capability not supported.
830   * @throws {BusinessError} 2801000 - Operation failed.
831   * @syscap SystemCapability.Communication.WiFi.P2P
832   * @since 10
833   */
834  function getCurrentGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void;
835
836  /**
837   * Obtain the information about the found devices.
838   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
839   * @returns { Promise<WifiP2pDevice[]> } Returns p2p device information.
840   * @throws {BusinessError} 201 - Permission denied.
841   * @throws {BusinessError} 801 - Capability not supported.
842   * @throws {BusinessError} 2801000 - Operation failed.
843   * @syscap SystemCapability.Communication.WiFi.P2P
844   * @since 9
845   */
846  /**
847   * Obtain the information about the found devices.
848   * @permission ohos.permission.GET_WIFI_INFO
849   * @returns { Promise<WifiP2pDevice[]> } Returns p2p device information.
850   * @throws {BusinessError} 201 - Permission denied.
851   * @throws {BusinessError} 801 - Capability not supported.
852   * @throws {BusinessError} 2801000 - Operation failed.
853   * @syscap SystemCapability.Communication.WiFi.P2P
854   * @since 10
855   */
856  function getP2pPeerDevices(): Promise<WifiP2pDevice[]>;
857
858  /**
859   * Obtain the information about the found devices.
860   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
861   * @param { AsyncCallback<WifiP2pDevice[]> } callback - Indicates callback of function.
862   * @throws {BusinessError} 201 - Permission denied.
863   * @throws {BusinessError} 801 - Capability not supported.
864   * @throws {BusinessError} 2801000 - Operation failed.
865   * @syscap SystemCapability.Communication.WiFi.P2P
866   * @since 9
867   */
868  /**
869   * Obtain the information about the found devices.
870   * @permission ohos.permission.GET_WIFI_INFO
871   * @param { AsyncCallback<WifiP2pDevice[]> } callback - Indicates callback of function.
872   * @throws {BusinessError} 201 - Permission denied.
873   * @throws {BusinessError} 801 - Capability not supported.
874   * @throws {BusinessError} 2801000 - Operation failed.
875   * @syscap SystemCapability.Communication.WiFi.P2P
876   * @since 10
877   */
878  function getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void;
879
880  /**
881   * Obtain the information about own device information.
882   * DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00",
883   * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted.
884   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
885   * @returns { Promise<WifiP2pDevice> } Returns the information about own device info.
886   * @throws {BusinessError} 201 - Permission denied.
887   * @throws {BusinessError} 801 - Capability not supported.
888   * @throws {BusinessError} 2801000 - Operation failed.
889   * @syscap SystemCapability.Communication.WiFi.P2P
890   * @since 9
891   */
892  function getP2pLocalDevice(): Promise<WifiP2pDevice>;
893
894  /**
895   * Obtain the information about own device information.
896   * DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00",
897   * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted.
898   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
899   * @param { AsyncCallback<WifiP2pDevice> } callback - Indicates callback of function.
900   * @throws {BusinessError} 201 - Permission denied.
901   * @throws {BusinessError} 801 - Capability not supported.
902   * @throws {BusinessError} 2801000 - Operation failed.
903   * @syscap SystemCapability.Communication.WiFi.P2P
904   * @since 9
905   */
906  function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void;
907
908  /**
909   * Create a P2P group.
910   * @permission ohos.permission.GET_WIFI_INFO
911   * @param { WifiP2PConfig } config - Indicates the configuration for a group.
912   * @throws {BusinessError} 201 - Permission denied.
913   * @throws {BusinessError} 401 - Invalid parameters.
914   * @throws {BusinessError} 801 - Capability not supported.
915   * @throws {BusinessError} 2801000 - Operation failed.
916   * @syscap SystemCapability.Communication.WiFi.P2P
917   * @since 9
918   */
919  function createGroup(config: WifiP2PConfig): void;
920
921  /**
922   * Remove a P2P group.
923   * @permission ohos.permission.GET_WIFI_INFO
924   * @throws {BusinessError} 201 - Permission denied.
925   * @throws {BusinessError} 801 - Capability not supported.
926   * @throws {BusinessError} 2801000 - Operation failed.
927   * @syscap SystemCapability.Communication.WiFi.P2P
928   * @since 9
929   */
930  function removeGroup(): void;
931
932  /**
933   * Initiate a P2P connection to a device with the specified configuration.
934   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
935   * @param { WifiP2PConfig } config - Indicates the configuration for connecting to a specific group.
936   * @throws {BusinessError} 201 - Permission denied.
937   * @throws {BusinessError} 401 - Invalid parameters.
938   * @throws {BusinessError} 801 - Capability not supported.
939   * @throws {BusinessError} 2801000 - Operation failed.
940   * @syscap SystemCapability.Communication.WiFi.P2P
941   * @since 9
942   */
943  /**
944   * Initiate a P2P connection to a device with the specified configuration.
945   * @permission ohos.permission.GET_WIFI_INFO
946   * @param { WifiP2PConfig } config - Indicates the configuration for connecting to a specific group.
947   * @throws {BusinessError} 201 - Permission denied.
948   * @throws {BusinessError} 401 - Invalid parameters.
949   * @throws {BusinessError} 801 - Capability not supported.
950   * @throws {BusinessError} 2801000 - Operation failed.
951   * @syscap SystemCapability.Communication.WiFi.P2P
952   * @since 10
953   */
954  function p2pConnect(config: WifiP2PConfig): void;
955
956  /**
957   * Stop an ongoing p2p connection that is being established.
958   * @permission ohos.permission.GET_WIFI_INFO
959   * @throws {BusinessError} 201 - Permission denied.
960   * @throws {BusinessError} 801 - Capability not supported.
961   * @throws {BusinessError} 2801000 - Operation failed.
962   * @syscap SystemCapability.Communication.WiFi.P2P
963   * @since 9
964   */
965  function p2pCancelConnect(): void;
966
967  /**
968   * Start discover Wi-Fi P2P devices.
969   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
970   * @throws {BusinessError} 201 - Permission denied.
971   * @throws {BusinessError} 801 - Capability not supported.
972   * @throws {BusinessError} 2801000 - Operation failed.
973   * @syscap SystemCapability.Communication.WiFi.P2P
974   * @since 9
975   */
976  /**
977   * Start discover Wi-Fi P2P devices.
978   * @permission ohos.permission.GET_WIFI_INFO
979   * @throws {BusinessError} 201 - Permission denied.
980   * @throws {BusinessError} 801 - Capability not supported.
981   * @throws {BusinessError} 2801000 - Operation failed.
982   * @syscap SystemCapability.Communication.WiFi.P2P
983   * @since 10
984   */
985  function startDiscoverDevices(): void;
986
987  /**
988   * Stop discover Wi-Fi P2P devices.
989   * @permission ohos.permission.GET_WIFI_INFO
990   * @throws {BusinessError} 201 - Permission denied.
991   * @throws {BusinessError} 801 - Capability not supported.
992   * @throws {BusinessError} 2801000 - Operation failed.
993   * @syscap SystemCapability.Communication.WiFi.P2P
994   * @since 9
995   */
996  function stopDiscoverDevices(): void;
997
998  /**
999   * Delete the persistent P2P group with the specified network ID.
1000   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
1001   * @param { number } netId - Indicates the network ID of the group to be deleted.
1002   * @throws {BusinessError} 201 - Permission denied.
1003   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1004   * @throws {BusinessError} 401 - Invalid parameters.
1005   * @throws {BusinessError} 801 - Capability not supported.
1006   * @throws {BusinessError} 2801000 - Operation failed.
1007   * @syscap SystemCapability.Communication.WiFi.P2P
1008   * @systemapi Hide this for inner system use.
1009   * @since 9
1010   */
1011  function deletePersistentGroup(netId: number): void;
1012
1013  /**
1014   * Obtain information about the groups.
1015   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
1016   * @returns { Promise<Array<WifiP2pGroupInfo>> } Returns the information about own device info.
1017   * @throws {BusinessError} 201 - Permission denied.
1018   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1019   * @throws {BusinessError} 801 - Capability not supported.
1020   * @throws {BusinessError} 2801000 - Operation failed.
1021   * @syscap SystemCapability.Communication.WiFi.P2P
1022   * @systemapi Hide this for inner system use.
1023   * @since 9
1024   */
1025  /**
1026   * Obtain information about the groups.
1027   * @permission ohos.permission.GET_WIFI_INFO
1028   * @returns { Promise<Array<WifiP2pGroupInfo>> } Returns the information about own device info.
1029   * @throws {BusinessError} 201 - Permission denied.
1030   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1031   * @throws {BusinessError} 801 - Capability not supported.
1032   * @throws {BusinessError} 2801000 - Operation failed.
1033   * @syscap SystemCapability.Communication.WiFi.P2P
1034   * @systemapi Hide this for inner system use.
1035   * @since 10
1036   */
1037  function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>>;
1038
1039  /**
1040   * Obtain information about the groups.
1041   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
1042   * @param { AsyncCallback<Array<WifiP2pGroupInfo>> } callback - Indicates callback of function.
1043   * @throws {BusinessError} 201 - Permission denied.
1044   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1045   * @throws {BusinessError} 801 - Capability not supported.
1046   * @throws {BusinessError} 2801000 - Operation failed.
1047   * @syscap SystemCapability.Communication.WiFi.P2P
1048   * @systemapi Hide this for inner system use.
1049   * @since 9
1050   */
1051  /**
1052   * Obtain information about the groups.
1053   * @permission ohos.permission.GET_WIFI_INFO
1054   * @param { AsyncCallback<Array<WifiP2pGroupInfo>> } callback - Indicates callback of function.
1055   * @throws {BusinessError} 201 - Permission denied.
1056   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1057   * @throws {BusinessError} 801 - Capability not supported.
1058   * @throws {BusinessError} 2801000 - Operation failed.
1059   * @syscap SystemCapability.Communication.WiFi.P2P
1060   * @systemapi Hide this for inner system use.
1061   * @since 10
1062   */
1063  function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void;
1064
1065  /**
1066   * Set the name of the Wi-Fi P2P device.
1067   * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
1068   * @param { string } devName - Indicate the name to be set.
1069   * @throws {BusinessError} 201 - Permission denied.
1070   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1071   * @throws {BusinessError} 401 - Invalid parameters.
1072   * @throws {BusinessError} 801 - Capability not supported.
1073   * @throws {BusinessError} 2801000 - Operation failed.
1074   * @syscap SystemCapability.Communication.WiFi.P2P
1075   * @systemapi Hide this for inner system use.
1076   * @since 9
1077   */
1078  function setDeviceName(devName: string): void;
1079
1080  /**
1081   * Subscribe Wi-Fi status change events.
1082   * @permission ohos.permission.GET_WIFI_INFO
1083   * @param { 'wifiStateChange' } type - event name.
1084   * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
1085   * @throws {BusinessError} 201 - Permission denied.
1086   * @throws {BusinessError} 401 - Invalid parameters.
1087   * @throws {BusinessError} 801 - Capability not supported.
1088   * @throws {BusinessError} 2501000 - Operation failed.
1089   * @syscap SystemCapability.Communication.WiFi.STA
1090   * @since 9
1091   */
1092  function on(type: 'wifiStateChange', callback: Callback<number>): void;
1093
1094  /**
1095   * Unsubscribe Wi-Fi status change events.
1096   *
1097   * <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
1098   * @permission ohos.permission.GET_WIFI_INFO
1099   * @param { 'wifiStateChange' } type - event name.
1100   * @param { Callback<number> } callback - the callback of off
1101   * @throws {BusinessError} 201 - Permission denied.
1102   * @throws {BusinessError} 401 - Invalid parameters.
1103   * @throws {BusinessError} 801 - Capability not supported.
1104   * @throws {BusinessError} 2501000 - Operation failed.
1105   * @syscap SystemCapability.Communication.WiFi.STA
1106   * @since 9
1107   */
1108  function off(type: 'wifiStateChange', callback?: Callback<number>): void;
1109
1110  /**
1111   * Subscribe Wi-Fi connection change events.
1112   * @permission ohos.permission.GET_WIFI_INFO
1113   * @param { 'wifiConnectionChange' } type - event name.
1114   * @param { Callback<number> } callback - the callback of on, 0: disconnected, 1: connected
1115   * @throws {BusinessError} 201 - Permission denied.
1116   * @throws {BusinessError} 401 - Invalid parameters.
1117   * @throws {BusinessError} 801 - Capability not supported.
1118   * @throws {BusinessError} 2501000 - Operation failed.
1119   * @syscap SystemCapability.Communication.WiFi.STA
1120   * @since 9
1121   */
1122  function on(type: 'wifiConnectionChange', callback: Callback<number>): void;
1123
1124  /**
1125   * Unsubscribe Wi-Fi connection change events.
1126   * All callback functions will be deregistered If there is no specific callback parameter.</p>
1127   * @permission ohos.permission.GET_WIFI_INFO
1128   * @param { 'wifiConnectionChange' } type - event name.
1129   * @param { Callback<number> } callback - the callback of off
1130   * @throws {BusinessError} 201 - Permission denied.
1131   * @throws {BusinessError} 401 - Invalid parameters.
1132   * @throws {BusinessError} 801 - Capability not supported.
1133   * @throws {BusinessError} 2501000 - Operation failed.
1134   * @syscap SystemCapability.Communication.WiFi.STA
1135   * @since 9
1136   */
1137  function off(type: 'wifiConnectionChange', callback?: Callback<number>): void;
1138
1139  /**
1140   * Subscribe Wi-Fi scan status change events.
1141   * @permission ohos.permission.GET_WIFI_INFO
1142   * @param { 'wifiScanStateChange' } type - event name.
1143   * @param { Callback<number> } callback - the callback of on, 0: scan fail, 1: scan success
1144   * @throws {BusinessError} 201 - Permission denied.
1145   * @throws {BusinessError} 401 - Invalid parameters.
1146   * @throws {BusinessError} 801 - Capability not supported.
1147   * @throws {BusinessError} 2501000 - Operation failed.
1148   * @syscap SystemCapability.Communication.WiFi.STA
1149   * @since 9
1150   */
1151  function on(type: 'wifiScanStateChange', callback: Callback<number>): void;
1152
1153  /**
1154   * Unsubscribe Wi-Fi scan status change events.
1155   * All callback functions will be deregistered If there is no specific callback parameter.</p>
1156   * @permission ohos.permission.GET_WIFI_INFO
1157   * @param { 'wifiScanStateChange' } type - event name.
1158   * @param { Callback<number> } callback - the callback of off
1159   * @throws {BusinessError} 201 - Permission denied.
1160   * @throws {BusinessError} 401 - Invalid parameters.
1161   * @throws {BusinessError} 801 - Capability not supported.
1162   * @throws {BusinessError} 2501000 - Operation failed.
1163   * @syscap SystemCapability.Communication.WiFi.STA
1164   * @since 9
1165   */
1166  function off(type: 'wifiScanStateChange', callback?: Callback<number>): void;
1167
1168  /**
1169   * Subscribe Wi-Fi rssi change events.
1170   * @permission ohos.permission.GET_WIFI_INFO
1171   * @param { 'wifiRssiChange' } type - event name.
1172   * @param { Callback<number> } callback - the callback of on
1173   * @throws {BusinessError} 201 - Permission denied.
1174   * @throws {BusinessError} 401 - Invalid parameters.
1175   * @throws {BusinessError} 801 - Capability not supported.
1176   * @throws {BusinessError} 2501000 - Operation failed.
1177   * @syscap SystemCapability.Communication.WiFi.STA
1178   * @since 9
1179   */
1180  function on(type: 'wifiRssiChange', callback: Callback<number>): void;
1181
1182  /**
1183   * Unsubscribe Wi-Fi rssi change events.
1184   * All callback functions will be deregistered If there is no specific callback parameter.</p>
1185   * @permission ohos.permission.GET_WIFI_INFO
1186   * @param { 'wifiRssiChange' } type - event name.
1187   * @param { Callback<number> } callback - the callback of off
1188   * @throws {BusinessError} 201 - Permission denied.
1189   * @throws {BusinessError} 401 - Invalid parameters.
1190   * @throws {BusinessError} 801 - Capability not supported.
1191   * @throws {BusinessError} 2501000 - Operation failed.
1192   * @syscap SystemCapability.Communication.WiFi.STA
1193   * @since 9
1194   */
1195  function off(type: 'wifiRssiChange', callback?: Callback<number>): void;
1196
1197  /**
1198   * Subscribe Wi-Fi stream change events.
1199   * @permission ohos.permission.MANAGE_WIFI_CONNECTION
1200   * @param { 'streamChange' } type - event name.
1201   * @param { Callback<number> } callback - the callback of on, 1: stream down, 2: stream up, 3: stream bidirectional
1202   * @throws {BusinessError} 201 - Permission denied.
1203   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1204   * @throws {BusinessError} 401 - Invalid parameters.
1205   * @throws {BusinessError} 801 - Capability not supported.
1206   * @throws {BusinessError} 2501000 - Operation failed.
1207   * @syscap SystemCapability.Communication.WiFi.STA
1208   * @systemapi Hide this for inner system use.
1209   * @since 9
1210   */
1211  function on(type: 'streamChange', callback: Callback<number>): void;
1212
1213  /**
1214   * Unsubscribe Wi-Fi stream change events.
1215   * All callback functions will be deregistered If there is no specific callback parameter.</p>
1216   * @permission ohos.permission.MANAGE_WIFI_CONNECTION
1217   * @param { 'streamChange' } type - event name.
1218   * @param { Callback<number> } callback - the callback of off
1219   * @throws {BusinessError} 201 - Permission denied.
1220   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1221   * @throws {BusinessError} 401 - Invalid parameters.
1222   * @throws {BusinessError} 801 - Capability not supported.
1223   * @throws {BusinessError} 2501000 - Operation failed.
1224   * @syscap SystemCapability.Communication.WiFi.STA
1225   * @systemapi Hide this for inner system use.
1226   * @since 9
1227   */
1228  function off(type: 'streamChange', callback?: Callback<number>): void;
1229
1230  /**
1231   * Subscribe Wi-Fi device config change events.
1232   * @permission ohos.permission.GET_WIFI_INFO
1233   * @param { 'deviceConfigChange' } type - event name.
1234   * @param { Callback<number> } callback - the callback of on, 0: config is added, 1: config is changed, 2: config is removed.
1235   * @throws {BusinessError} 201 - Permission denied.
1236   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1237   * @throws {BusinessError} 401 - Invalid parameters.
1238   * @throws {BusinessError} 801 - Capability not supported.
1239   * @throws {BusinessError} 2501000 - Operation failed.
1240   * @syscap SystemCapability.Communication.WiFi.STA
1241   * @systemapi Hide this for inner system use.
1242   * @since 9
1243   */
1244  function on(type: 'deviceConfigChange', callback: Callback<number>): void;
1245
1246  /**
1247   * Subscribe Wi-Fi device config change events.
1248   * @permission ohos.permission.GET_WIFI_INFO
1249   * @param { 'deviceConfigChange' } type - event name.
1250   * @param { Callback<number> } callback - the callback of off, 0: config is added, 1: config is changed, 2: config is removed.
1251   * @throws {BusinessError} 201 - Permission denied.
1252   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1253   * @throws {BusinessError} 401 - Invalid parameters.
1254   * @throws {BusinessError} 801 - Capability not supported.
1255   * @throws {BusinessError} 2501000 - Operation failed.
1256   * @syscap SystemCapability.Communication.WiFi.STA
1257   * @systemapi Hide this for inner system use.
1258   * @since 9
1259   */
1260  function off(type: 'deviceConfigChange', callback?: Callback<number>): void;
1261
1262  /**
1263   * Subscribe Wi-Fi hotspot state change events.
1264   * @permission ohos.permission.GET_WIFI_INFO
1265   * @param { 'hotspotStateChange' } type - event name.
1266   * @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
1267   * @throws {BusinessError} 201 - Permission denied.
1268   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1269   * @throws {BusinessError} 401 - Invalid parameters.
1270   * @throws {BusinessError} 801 - Capability not supported.
1271   * @throws {BusinessError} 2601000 - Operation failed.
1272   * @syscap SystemCapability.Communication.WiFi.AP.Core
1273   * @since 9
1274   */
1275  function on(type: 'hotspotStateChange', callback: Callback<number>): void;
1276
1277  /**
1278   * Unsubscribe Wi-Fi hotspot state change events.
1279   * All callback functions will be deregistered If there is no specific callback parameter.</p>
1280   * @permission ohos.permission.GET_WIFI_INFO
1281   * @param { 'hotspotStateChange'} type - event name.
1282   * @param { Callback<number> } callback - the callback of off
1283   * @throws {BusinessError} 201 - Permission denied.
1284   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1285   * @throws {BusinessError} 401 - Invalid parameters.
1286   * @throws {BusinessError} 801 - Capability not supported.
1287   * @throws {BusinessError} 2601000 - Operation failed.
1288   * @syscap SystemCapability.Communication.WiFi.AP.Core
1289   * @since 9
1290   */
1291  function off(type: 'hotspotStateChange', callback?: Callback<number>): void;
1292
1293  /**
1294   * Subscribe Wi-Fi hotspot sta join events.
1295   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
1296   * @param { 'hotspotStaJoin' } type - event name.
1297   * @param { Callback<StationInfo> } callback - the callback of on
1298   * @throws {BusinessError} 201 - Permission denied.
1299   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1300   * @throws {BusinessError} 401 - Invalid parameters.
1301   * @throws {BusinessError} 801 - Capability not supported.
1302   * @throws {BusinessError} 2601000 - Operation failed.
1303   * @syscap SystemCapability.Communication.WiFi.AP.Core
1304   * @systemapi Hide this for inner system use.
1305   * @since 9
1306   */
1307  function on(type: 'hotspotStaJoin', callback: Callback<StationInfo>): void;
1308
1309  /**
1310   * Unsubscribe Wi-Fi hotspot sta join events.
1311   * All callback functions will be deregistered If there is no specific callback parameter.</p>
1312   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
1313   * @param { 'hotspotStaJoin' } type - event name.
1314   * @param { Callback<StationInfo> } callback - the callback of off
1315   * @throws {BusinessError} 201 - Permission denied.
1316   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1317   * @throws {BusinessError} 401 - Invalid parameters.
1318   * @throws {BusinessError} 801 - Capability not supported.
1319   * @throws {BusinessError} 2601000 - Operation failed.
1320   * @syscap SystemCapability.Communication.WiFi.AP.Core
1321   * @systemapi Hide this for inner system use.
1322   * @since 9
1323   */
1324  function off(type: 'hotspotStaJoin', callback?: Callback<StationInfo>): void;
1325
1326  /**
1327   * Subscribe Wi-Fi hotspot sta leave events.
1328   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
1329   * @param { 'hotspotStaLeave' } type - event name.
1330   * @param { Callback<StationInfo> } callback - the callback of on
1331   * @throws {BusinessError} 201 - Permission denied.
1332   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1333   * @throws {BusinessError} 401 - Invalid parameters.
1334   * @throws {BusinessError} 801 - Capability not supported.
1335   * @throws {BusinessError} 2601000 - Operation failed.
1336   * @syscap SystemCapability.Communication.WiFi.AP.Core
1337
1338   * @systemapi Hide this for inner system use.
1339   * @since 9
1340   */
1341  function on(type: 'hotspotStaLeave', callback: Callback<StationInfo>): void;
1342
1343  /**
1344   * Unsubscribe Wi-Fi hotspot sta leave events.
1345   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT
1346   * @param { 'hotspotStaLeave' } type - event name.
1347   * @param { Callback<StationInfo> } callback - the callback of off
1348   * @throws {BusinessError} 201 - Permission denied.
1349   * @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
1350   * @throws {BusinessError} 401 - Invalid parameters.
1351   * @throws {BusinessError} 801 - Capability not supported.
1352   * @throws {BusinessError} 2601000 - Operation failed.
1353   * @syscap SystemCapability.Communication.WiFi.AP.Core
1354   * @systemapi Hide this for inner system use.
1355   * @since 9
1356   */
1357  function off(type: 'hotspotStaLeave', callback?: Callback<StationInfo>): void;
1358
1359  /**
1360   * Subscribe P2P status change events.
1361   * @permission ohos.permission.GET_WIFI_INFO
1362   * @param { 'p2pStateChange' } type - event name.
1363   * @param { Callback<number> } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed
1364   * @throws {BusinessError} 201 - Permission denied.
1365   * @throws {BusinessError} 401 - Invalid parameters.
1366   * @throws {BusinessError} 801 - Capability not supported.
1367   * @throws {BusinessError} 2801000 - Operation failed.
1368   * @syscap SystemCapability.Communication.WiFi.P2P
1369   * @since 9
1370   */
1371  function on(type: 'p2pStateChange', callback: Callback<number>): void;
1372
1373  /**
1374   * Unsubscribe P2P status change events.
1375   * @permission ohos.permission.GET_WIFI_INFO
1376   * @param { 'p2pStateChange' } type - event name.
1377   * @param { Callback<number> } callback - the callback of off
1378   * @throws {BusinessError} 201 - Permission denied.
1379   * @throws {BusinessError} 401 - Invalid parameters.
1380   * @throws {BusinessError} 801 - Capability not supported.
1381   * @throws {BusinessError} 2801000 - Operation failed.
1382   * @syscap SystemCapability.Communication.WiFi.P2P
1383   * @since 9
1384   */
1385  function off(type: 'p2pStateChange', callback?: Callback<number>): void;
1386
1387  /**
1388   * Subscribe P2P connection change events.
1389   * @permission ohos.permission.GET_WIFI_INFO
1390   * @param { 'p2pConnectionChange' } type - event name.
1391   * @param { Callback<WifiP2pLinkedInfo> } callback - the callback of on
1392   * @throws {BusinessError} 201 - Permission denied.
1393   * @throws {BusinessError} 401 - Invalid parameters.
1394   * @throws {BusinessError} 801 - Capability not supported.
1395   * @throws {BusinessError} 2801000 - Operation failed.
1396   * @syscap SystemCapability.Communication.WiFi.P2P
1397   * @since 9
1398   */
1399  function on(type: 'p2pConnectionChange', callback: Callback<WifiP2pLinkedInfo>): void;
1400
1401  /**
1402   * Unsubscribe P2P connection change events.
1403   * @permission ohos.permission.GET_WIFI_INFO
1404   * @param { 'p2pConnectionChange' } type - event name.
1405   * @param { Callback<WifiP2pLinkedInfo> } callback - the callback of off
1406   * @throws {BusinessError} 201 - Permission denied.
1407   * @throws {BusinessError} 401 - Invalid parameters.
1408   * @throws {BusinessError} 801 - Capability not supported.
1409   * @throws {BusinessError} 2801000 - Operation failed.
1410   * @syscap SystemCapability.Communication.WiFi.P2P
1411   * @since 9
1412   */
1413  function off(type: 'p2pConnectionChange', callback?: Callback<WifiP2pLinkedInfo>): void;
1414
1415  /**
1416   * Subscribe P2P local device change events.
1417   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
1418   * @param { 'p2pDeviceChange' } type - event name.
1419   * @param { Callback<WifiP2pDevice> } callback - the callback of on
1420   * @throws {BusinessError} 201 - Permission denied.
1421   * @throws {BusinessError} 401 - Invalid parameters.
1422   * @throws {BusinessError} 801 - Capability not supported.
1423   * @throws {BusinessError} 2801000 - Operation failed.
1424   * @syscap SystemCapability.Communication.WiFi.P2P
1425   * @since 9
1426   */
1427  /**
1428   * Subscribe P2P local device change events.
1429   * @permission ohos.permission.GET_WIFI_INFO
1430   * @param { 'p2pDeviceChange' } type - event name.
1431   * @param { Callback<WifiP2pDevice> } callback - the callback of on
1432   * @throws {BusinessError} 201 - Permission denied.
1433   * @throws {BusinessError} 401 - Invalid parameters.
1434   * @throws {BusinessError} 801 - Capability not supported.
1435   * @throws {BusinessError} 2801000 - Operation failed.
1436   * @syscap SystemCapability.Communication.WiFi.P2P
1437   * @since 10
1438   */
1439  function on(type: 'p2pDeviceChange', callback: Callback<WifiP2pDevice>): void;
1440
1441  /**
1442   * Unsubscribe P2P local device change events.
1443   * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
1444   * @param { 'p2pDeviceChange' } type - event name.
1445   * @param { Callback<WifiP2pDevice> } callback - the callback of off
1446   * @throws {BusinessError} 201 - Permission denied.
1447   * @throws {BusinessError} 401 - Invalid parameters.
1448   * @throws {BusinessError} 801 - Capability not supported.
1449   * @throws {BusinessError} 2801000 - Operation failed.
1450   * @syscap SystemCapability.Communication.WiFi.P2P
1451   * @since 9
1452   */
1453  /**
1454   * Unsubscribe P2P local device change events.
1455   * @param { 'p2pDeviceChange' } type - event name.
1456   * @param { Callback<WifiP2pDevice> } callback - the callback of off
1457   * @throws {BusinessError} 201 - Permission denied.
1458   * @throws {BusinessError} 401 - Invalid parameters.
1459   * @throws {BusinessError} 801 - Capability not supported.
1460   * @throws {BusinessError} 2801000 - Operation failed.
1461   * @syscap SystemCapability.Communication.WiFi.P2P
1462   * @since 10
1463   */
1464  function off(type: 'p2pDeviceChange', callback?: Callback<WifiP2pDevice>): void;
1465
1466  /**
1467   * Subscribe P2P peer device change events.
1468   * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
1469   * @param { 'p2pPeerDeviceChange' } type - event name.
1470   * @param { Callback<WifiP2pDevice[]> } callback - the callback of on
1471   * @throws {BusinessError} 201 - Permission denied.
1472   * @throws {BusinessError} 401 - Invalid parameters.
1473   * @throws {BusinessError} 801 - Capability not supported.
1474   * @throws {BusinessError} 2801000 - Operation failed.
1475   * @syscap SystemCapability.Communication.WiFi.P2P
1476   * @since 9
1477   */
1478  /**
1479   * Subscribe P2P peer device change events.
1480   * @permission ohos.permission.GET_WIFI_INFO
1481   * @param { 'p2pPeerDeviceChange' } type - event name.
1482   * @param { Callback<WifiP2pDevice[]> } callback - the callback of on
1483   * @throws {BusinessError} 201 - Permission denied.
1484   * @throws {BusinessError} 401 - Invalid parameters.
1485   * @throws {BusinessError} 801 - Capability not supported.
1486   * @throws {BusinessError} 2801000 - Operation failed.
1487   * @syscap SystemCapability.Communication.WiFi.P2P
1488   * @since 10
1489   */
1490  function on(type: 'p2pPeerDeviceChange', callback: Callback<WifiP2pDevice[]>): void;
1491
1492  /**
1493   * Unsubscribe P2P peer device change events.
1494   * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
1495   * @param { 'p2pPeerDeviceChange' } type - event name.
1496   * @param { Callback<WifiP2pDevice[]> } callback - the callback of off
1497   * @throws {BusinessError} 201 - Permission denied.
1498   * @throws {BusinessError} 401 - Invalid parameters.
1499   * @throws {BusinessError} 801 - Capability not supported.
1500   * @throws {BusinessError} 2801000 - Operation failed.
1501   * @syscap SystemCapability.Communication.WiFi.P2P
1502   * @since 9
1503   */
1504  /**
1505   * Unsubscribe P2P peer device change events.
1506   * @param { 'p2pPeerDeviceChange' } type - event name.
1507   * @param { Callback<WifiP2pDevice[]> } callback - the callback of off
1508   * @throws {BusinessError} 201 - Permission denied.
1509   * @throws {BusinessError} 401 - Invalid parameters.
1510   * @throws {BusinessError} 801 - Capability not supported.
1511   * @throws {BusinessError} 2801000 - Operation failed.
1512   * @syscap SystemCapability.Communication.WiFi.P2P
1513   * @since 10
1514   */
1515  function off(type: 'p2pPeerDeviceChange', callback?: Callback<WifiP2pDevice[]>): void;
1516
1517  /**
1518   * Subscribe P2P persistent group change events.
1519   * @permission ohos.permission.GET_WIFI_INFO
1520   * @param { 'p2pPersistentGroupChange' } type - event name.
1521   * @param { Callback<void> } callback - the callback of on
1522   * @throws {BusinessError} 201 - Permission denied.
1523   * @throws {BusinessError} 401 - Invalid parameters.
1524   * @throws {BusinessError} 801 - Capability not supported.
1525   * @throws {BusinessError} 2801000 - Operation failed.
1526   * @syscap SystemCapability.Communication.WiFi.P2P
1527   * @since 9
1528   */
1529  function on(type: 'p2pPersistentGroupChange', callback: Callback<void>): void;
1530
1531  /**
1532   * Unsubscribe P2P persistent group change events.
1533   * @permission ohos.permission.GET_WIFI_INFO
1534   * @param { 'p2pPersistentGroupChange' } type - event name.
1535   * @param { Callback<void> } callback - the callback of off
1536   * @throws {BusinessError} 201 - Permission denied.
1537   * @throws {BusinessError} 401 - Invalid parameters.
1538   * @throws {BusinessError} 801 - Capability not supported.
1539   * @throws {BusinessError} 2801000 - Operation failed.
1540   * @syscap SystemCapability.Communication.WiFi.P2P
1541   * @since 9
1542   */
1543  function off(type: 'p2pPersistentGroupChange', callback?: Callback<void>): void;
1544
1545  /**
1546   * Subscribe P2P discovery events.
1547   * @permission ohos.permission.GET_WIFI_INFO
1548   * @param { 'p2pDiscoveryChange' } type - event name.
1549   * @param { Callback<number> } callback - the callback of on
1550   * @throws {BusinessError} 201 - Permission denied.
1551   * @throws {BusinessError} 401 - Invalid parameters.
1552   * @throws {BusinessError} 801 - Capability not supported.
1553   * @throws {BusinessError} 2801000 - Operation failed.
1554   * @syscap SystemCapability.Communication.WiFi.P2P
1555   * @since 9
1556   */
1557  function on(type: 'p2pDiscoveryChange', callback: Callback<number>): void;
1558
1559  /**
1560   * Unsubscribe P2P discovery events.
1561   * @permission ohos.permission.GET_WIFI_INFO
1562   * @param { 'p2pDiscoveryChange' } type - event name.
1563   * @param { Callback<number> } callback - the callback of off
1564   * @throws {BusinessError} 201 - Permission denied.
1565   * @throws {BusinessError} 401 - Invalid parameters.
1566   * @throws {BusinessError} 801 - Capability not supported.
1567   * @throws {BusinessError} 2801000 - Operation failed.
1568   * @syscap SystemCapability.Communication.WiFi.P2P
1569   * @since 9
1570   */
1571  function off(type: 'p2pDiscoveryChange', callback?: Callback<number>): void;
1572
1573  /**
1574   * Wi-Fi device address( mac / bssid ) type.
1575   * @enum { number }
1576   * @syscap SystemCapability.Communication.WiFi.Core
1577   * @since 10
1578   */
1579  enum DeviceAddressType {
1580    /**
1581     * random device address
1582     * @syscap SystemCapability.Communication.WiFi.Core
1583     * @since 10
1584     */
1585    RANDOM_DEVICE_ADDRESS,
1586
1587    /**
1588     * real device address
1589     * @syscap SystemCapability.Communication.WiFi.Core
1590     * @since 10
1591     */
1592    REAL_DEVICE_ADDRESS,
1593  }
1594
1595  /**
1596   * Wi-Fi EAP method.
1597   * @enum { number }
1598   * @syscap SystemCapability.Communication.WiFi.STA
1599   * @since 10
1600   */
1601  enum EapMethod {
1602    /**
1603     * EAP NONE
1604     * @syscap SystemCapability.Communication.WiFi.STA
1605     * @since 10
1606     */
1607    EAP_NONE,
1608    /**
1609     * EAP PEAP
1610     * @syscap SystemCapability.Communication.WiFi.STA
1611     * @since 10
1612     */
1613    EAP_PEAP,
1614    /**
1615     * EAP TLS
1616     * @syscap SystemCapability.Communication.WiFi.STA
1617     * @since 10
1618     */
1619    EAP_TLS,
1620    /**
1621     * EAP TTLS
1622     * @syscap SystemCapability.Communication.WiFi.STA
1623     * @since 10
1624     */
1625    EAP_TTLS,
1626    /**
1627     * EAP PWD
1628     * @syscap SystemCapability.Communication.WiFi.STA
1629     * @since 10
1630     */
1631    EAP_PWD,
1632    /**
1633     * EAP SIM
1634     * @syscap SystemCapability.Communication.WiFi.STA
1635     * @since 10
1636     */
1637    EAP_SIM,
1638    /**
1639     * EAP AKA
1640     * @syscap SystemCapability.Communication.WiFi.STA
1641     * @since 10
1642     */
1643    EAP_AKA,
1644    /**
1645     * EAP AKA PRIME
1646     * @syscap SystemCapability.Communication.WiFi.STA
1647     * @since 10
1648     */
1649    EAP_AKA_PRIME,
1650    /**
1651     * EAP UNAUTH TLS
1652     * @syscap SystemCapability.Communication.WiFi.STA
1653     * @since 10
1654     */
1655    EAP_UNAUTH_TLS
1656  }
1657
1658  /**
1659   * Wi-Fi phase 2 method.
1660   * @enum { number }
1661   * @syscap SystemCapability.Communication.WiFi.STA
1662   * @since 10
1663   */
1664  enum Phase2Method {
1665    /**
1666     * Phase2 NONE
1667     * @syscap SystemCapability.Communication.WiFi.STA
1668     * @since 10
1669     */
1670    PHASE2_NONE,
1671    /**
1672     * Phase2 PAP
1673     * @syscap SystemCapability.Communication.WiFi.STA
1674     * @since 10
1675     */
1676    PHASE2_PAP,
1677    /**
1678     * Phase2 MSCHAP
1679     * @syscap SystemCapability.Communication.WiFi.STA
1680     * @since 10
1681     */
1682    PHASE2_MSCHAP,
1683    /**
1684     * Phase2 MSCHAPV2
1685     * @syscap SystemCapability.Communication.WiFi.STA
1686     * @since 10
1687     */
1688    PHASE2_MSCHAPV2,
1689    /**
1690     * Phase2 GTC
1691     * @syscap SystemCapability.Communication.WiFi.STA
1692     * @since 10
1693     */
1694    PHASE2_GTC,
1695    /**
1696     * Phase2 SIM
1697     * @syscap SystemCapability.Communication.WiFi.STA
1698     * @since 10
1699     */
1700    PHASE2_SIM,
1701    /**
1702     * Phase2 AKA
1703     * @syscap SystemCapability.Communication.WiFi.STA
1704     * @since 10
1705     */
1706    PHASE2_AKA,
1707    /**
1708     * Phase2 AKA+
1709     * @syscap SystemCapability.Communication.WiFi.STA
1710     * @since 10
1711     */
1712    PHASE2_AKA_PRIME
1713  }
1714
1715  /**
1716   * Wi-Fi disconnected reason.
1717   * @enum { number }
1718   * @syscap SystemCapability.Communication.WiFi.STA
1719   * @systemapi Hide this for inner system use.
1720   * @since 10
1721   */
1722  enum DisconnectedReason {
1723    /**
1724     * Default reason
1725     * @syscap SystemCapability.Communication.WiFi.STA
1726     * @systemapi Hide this for inner system use.
1727     * @since 10
1728     */
1729    DISC_REASON_DEFAULT = 0,
1730
1731    /**
1732     * Password is wrong
1733     * @syscap SystemCapability.Communication.WiFi.STA
1734     * @systemapi Hide this for inner system use.
1735     * @since 10
1736     */
1737    DISC_REASON_WRONG_PWD = 1,
1738
1739    /**
1740     * The number of router's connection reaches the maximum number limit
1741     * @syscap SystemCapability.Communication.WiFi.STA
1742     * @systemapi Hide this for inner system use.
1743     * @since 10
1744     */
1745    DISC_REASON_CONNECTION_FULL = 2
1746  }
1747
1748  /**
1749   * Wi-Fi Proxy method.
1750   * @enum { number }
1751   * @syscap SystemCapability.Communication.WiFi.STA
1752   * @systemapi Hide this for inner system use.
1753   * @since 10
1754   */
1755  enum ProxyMethod {
1756    /**
1757     * No proxy is to be used.
1758     * @syscap SystemCapability.Communication.WiFi.STA
1759     * @systemapi Hide this for inner system use.
1760     * @since 10
1761     */
1762    METHOD_NONE = 0,
1763
1764    /**
1765     * Use auto configured proxy.
1766     * @syscap SystemCapability.Communication.WiFi.STA
1767     * @systemapi Hide this for inner system use.
1768     * @since 10
1769     */
1770    METHOD_AUTO = 1,
1771
1772    /**
1773     * Use manual configured proxy.
1774     * @syscap SystemCapability.Communication.WiFi.STA
1775     * @systemapi Hide this for inner system use.
1776     * @since 10
1777     */
1778    METHOD_MANUAL = 2
1779  }
1780
1781  /**
1782   * Wi-Fi Proxy config.
1783   * @typedef WifiProxyConfig
1784   * @syscap SystemCapability.Communication.WiFi.STA
1785   * @systemapi Hide this for inner system use.
1786   * @since 10
1787   */
1788  interface WifiProxyConfig {
1789    /**
1790     * Wi-Fi proxy method
1791     * @syscap SystemCapability.Communication.WiFi.STA
1792     * @systemapi Hide this for inner system use.
1793     * @since 10
1794     */
1795    proxyMethod?: ProxyMethod;
1796
1797    /**
1798     * PAC web address for auto configured proxy.
1799     * @syscap SystemCapability.Communication.WiFi.STA
1800     * @systemapi Hide this for inner system use.
1801     * @since 10
1802     */
1803    pacWebAddress?: string;
1804
1805    /**
1806     * Server host name for manual configured proxy.
1807     * @syscap SystemCapability.Communication.WiFi.STA
1808     * @systemapi Hide this for inner system use.
1809     * @since 10
1810     */
1811    serverHostName?: string;
1812
1813    /**
1814     * Server port for manual configured proxy.
1815     * @syscap SystemCapability.Communication.WiFi.STA
1816     * @systemapi Hide this for inner system use.
1817     * @since 10
1818     */
1819    serverPort?: number;
1820
1821    /**
1822     * Exclusion objects for manual configured proxy. objects are separated by ','.
1823     * @syscap SystemCapability.Communication.WiFi.STA
1824     * @systemapi Hide this for inner system use.
1825     * @since 10
1826     */
1827    exclusionObjects?: string;
1828  }
1829
1830  /**
1831   * Wi-Fi EAP config.
1832   * @typedef WifiEapConfig
1833   * @syscap SystemCapability.Communication.WiFi.STA
1834   * @since 10
1835   */
1836  interface WifiEapConfig {
1837    /**
1838     * EAP authentication method
1839     * @syscap SystemCapability.Communication.WiFi.STA
1840     * @since 10
1841     */
1842    eapMethod: EapMethod;
1843
1844    /**
1845     * Phase 2 authentication method
1846     * @syscap SystemCapability.Communication.WiFi.STA
1847     * @since 10
1848     */
1849    phase2Method: Phase2Method;
1850
1851    /**
1852     * The identity
1853     * @syscap SystemCapability.Communication.WiFi.STA
1854     * @since 10
1855     */
1856    identity: string;
1857
1858    /**
1859     * Anonymous identity
1860     * @syscap SystemCapability.Communication.WiFi.STA
1861     * @since 10
1862     */
1863    anonymousIdentity: string;
1864
1865    /**
1866     * Password
1867     * @syscap SystemCapability.Communication.WiFi.STA
1868     * @since 10
1869     */
1870    password: string;
1871
1872    /**
1873     * CA certificate alias
1874     * @type { string }
1875     * @syscap SystemCapability.Communication.WiFi.STA
1876     * @since 10
1877     */
1878    caCertAlias: string;
1879
1880    /**
1881     * CA certificate path
1882     * @syscap SystemCapability.Communication.WiFi.STA
1883     * @since 10
1884     */
1885    caPath: string;
1886
1887    /**
1888     * Client certificate alias
1889     * @type { string }
1890     * @syscap SystemCapability.Communication.WiFi.STA
1891     * @since 10
1892     */
1893    clientCertAlias: string;
1894
1895    /**
1896     * content of user's certificate
1897     * @syscap SystemCapability.Communication.WiFi.STA
1898     * @since 10
1899     */
1900    certEntry: Uint8Array;
1901
1902    /**
1903     * Password of user's certificate
1904     * @syscap SystemCapability.Communication.WiFi.STA
1905     * @since 10
1906     */
1907    certPassword: string;
1908
1909    /**
1910     * Alternate subject match
1911     * @syscap SystemCapability.Communication.WiFi.STA
1912     * @since 10
1913     */
1914    altSubjectMatch: string;
1915
1916    /**
1917     * Domain suffix match
1918     * @syscap SystemCapability.Communication.WiFi.STA
1919     * @since 10
1920     */
1921    domainSuffixMatch: string;
1922
1923    /**
1924     * Realm for Passpoint credential
1925     * @syscap SystemCapability.Communication.WiFi.STA
1926     * @since 10
1927     */
1928    realm: string;
1929
1930    /**
1931     * Public Land Mobile Network of the provider of Passpoint credential
1932     * @syscap SystemCapability.Communication.WiFi.STA
1933     * @since 10
1934     */
1935    plmn: string;
1936
1937    /**
1938     * Sub ID of the SIM card
1939     * @type { number }
1940     * @syscap SystemCapability.Communication.WiFi.STA
1941     * @since 10
1942     */
1943    eapSubId: number;
1944  }
1945
1946  /**
1947   * Wi-Fi device configuration information.
1948   * @typedef WifiDeviceConfig
1949   * @syscap SystemCapability.Communication.WiFi.STA
1950   * @since 9
1951   */
1952  interface WifiDeviceConfig {
1953    /**
1954     * Wi-Fi SSID: the maximum length is 32.
1955     * @syscap SystemCapability.Communication.WiFi.STA
1956     * @since 9
1957     */
1958    ssid: string;
1959
1960    /**
1961     * Wi-Fi bssid(MAC): the length is 6.
1962     * @syscap SystemCapability.Communication.WiFi.STA
1963     * @since 9
1964     */
1965    bssid?: string;
1966
1967    /**
1968     * Wi-Fi bssid type.
1969     * @type { ?DeviceAddressType }
1970     * @syscap SystemCapability.Communication.WiFi.STA
1971     * @since 10
1972     */
1973    bssidType?: DeviceAddressType;
1974
1975    /**
1976     * Wi-Fi key: maximum length is 64.
1977     * @syscap SystemCapability.Communication.WiFi.STA
1978     * @since 9
1979     */
1980    preSharedKey: string;
1981
1982    /**
1983     * Hide SSID or not, false(default): not hide
1984     * @syscap SystemCapability.Communication.WiFi.STA
1985     * @since 9
1986     */
1987    isHiddenSsid?: boolean;
1988
1989    /**
1990     * Security type: reference definition of WifiSecurityType
1991     * @syscap SystemCapability.Communication.WiFi.STA
1992     * @since 9
1993     */
1994    securityType: WifiSecurityType;
1995
1996    /**
1997     * The UID of the Wi-Fi configuration creator.
1998     * @syscap SystemCapability.Communication.WiFi.STA
1999     * @systemapi Hide this for inner system use.
2000     * @since 9
2001     */
2002    creatorUid?: number;
2003
2004    /**
2005     * Disable reason
2006     * @syscap SystemCapability.Communication.WiFi.STA
2007     * @systemapi Hide this for inner system use.
2008     * @since 9
2009     */
2010    disableReason?: number;
2011
2012    /**
2013     * Allocated networkId
2014     * @syscap SystemCapability.Communication.WiFi.STA
2015     * @systemapi Hide this for inner system use.
2016     * @since 9
2017     */
2018    netId?: number;
2019
2020    /**
2021     * Random mac type
2022     * @syscap SystemCapability.Communication.WiFi.STA
2023     * @systemapi Hide this for inner system use.
2024     * @since 9
2025     */
2026    randomMacType?: number;
2027
2028    /**
2029     * Random mac address, the length is 6.
2030     * @syscap SystemCapability.Communication.WiFi.STA
2031     * @systemapi Hide this for inner system use.
2032     * @since 9
2033     */
2034    randomMacAddr?: string;
2035
2036    /**
2037     * IP Type
2038     * @syscap SystemCapability.Communication.WiFi.STA
2039     * @systemapi Hide this for inner system use.
2040     * @since 9
2041     */
2042    ipType?: IpType;
2043
2044    /**
2045     * IP config of static
2046     * @syscap SystemCapability.Communication.WiFi.STA
2047     * @systemapi Hide this for inner system use.
2048     * @since 9
2049     */
2050    staticIp?: IpConfig;
2051
2052    /**
2053     * EAP config info.
2054     * @type { ?WifiEapConfig }
2055     * @syscap SystemCapability.Communication.WiFi.STA
2056     * @since 10
2057     */
2058    eapConfig?: WifiEapConfig;
2059
2060    /**
2061     * Proxy config.
2062     * @syscap SystemCapability.Communication.WiFi.STA
2063     * @systemapi Hide this for inner system use.
2064     * @since 10
2065     */
2066    proxyConfig?: WifiProxyConfig;
2067  }
2068
2069  /**
2070   * Wi-Fi IP configuration information.
2071   * @typedef IpConfig
2072   * @syscap SystemCapability.Communication.WiFi.STA
2073   * @systemapi Hide this for inner system use.
2074   * @since 9
2075   */
2076  interface IpConfig {
2077    /**
2078     * IP address.
2079     * @syscap SystemCapability.Communication.WiFi.STA
2080     * @systemapi Hide this for inner system use.
2081     * @since 9
2082     */
2083    ipAddress: number;
2084
2085    /**
2086     * Gate way.
2087     * @syscap SystemCapability.Communication.WiFi.STA
2088     * @systemapi Hide this for inner system use.
2089     * @since 9
2090     */
2091    gateway: number;
2092
2093    /**
2094     * Prefix length.
2095     * @syscap SystemCapability.Communication.WiFi.STA
2096     * @systemapi Hide this for inner system use.
2097     * @since 9
2098     */
2099    prefixLength: number;
2100
2101    /**
2102     * DNS servers.
2103     * @syscap SystemCapability.Communication.WiFi.STA
2104     * @systemapi Hide this for inner system use.
2105     * @since 9
2106     */
2107    dnsServers: number[];
2108
2109    /**
2110     * Domains.
2111     * @syscap SystemCapability.Communication.WiFi.STA
2112     * @systemapi Hide this for inner system use.
2113     * @since 9
2114     */
2115    domains: Array<string>;
2116  }
2117
2118  /**
2119   * Wi-Fi information elements.
2120   * @typedef WifiInfoElem
2121   * @syscap SystemCapability.Communication.WiFi.STA
2122   * @since 9
2123   */
2124  interface WifiInfoElem {
2125    /**
2126     * Element id
2127     *
2128     * @syscap SystemCapability.Communication.WiFi.STA
2129     * @since 9
2130     */
2131    eid: number;
2132
2133    /**
2134     * Element content
2135     *
2136     * @syscap SystemCapability.Communication.WiFi.STA
2137     * @since 9
2138     */
2139    content: Uint8Array;
2140  }
2141
2142  /**
2143   * Describes the wifi channel width.
2144   * @enum { number }
2145   * @syscap SystemCapability.Communication.WiFi.STA
2146   * @since 9
2147   */
2148  enum WifiChannelWidth {
2149    /**
2150     * 20MHz.
2151     *
2152     * @syscap SystemCapability.Communication.WiFi.STA
2153     * @since 9
2154     */
2155    WIDTH_20MHZ = 0,
2156
2157    /**
2158     * 40MHz.
2159     *
2160     * @syscap SystemCapability.Communication.WiFi.STA
2161     * @since 9
2162     */
2163    WIDTH_40MHZ = 1,
2164
2165    /**
2166     * 80MHz.
2167     *
2168     * @syscap SystemCapability.Communication.WiFi.STA
2169     * @since 9
2170     */
2171    WIDTH_80MHZ = 2,
2172
2173    /**
2174     * 160MHz.
2175     *
2176     * @syscap SystemCapability.Communication.WiFi.STA
2177     * @since 9
2178     */
2179    WIDTH_160MHZ = 3,
2180
2181    /**
2182     * 80MHz plus.
2183     *
2184     * @syscap SystemCapability.Communication.WiFi.STA
2185     * @since 9
2186     */
2187    WIDTH_80MHZ_PLUS = 4,
2188
2189    /**
2190     * Invalid.
2191     *
2192     * @syscap SystemCapability.Communication.WiFi.STA
2193     * @since 9
2194     */
2195    WIDTH_INVALID
2196  }
2197
2198  /**
2199   * Describes the scanned Wi-Fi information.
2200   * @typedef WifiScanInfo
2201   * @syscap SystemCapability.Communication.WiFi.STA
2202   * @since 9
2203   */
2204  interface WifiScanInfo {
2205    /**
2206     * Wi-Fi SSID: the maximum length is 32
2207     *
2208     * @syscap SystemCapability.Communication.WiFi.STA
2209     * @since 9
2210     */
2211    ssid: string;
2212
2213    /**
2214     * Wi-Fi bssid(MAC): the length is 6
2215     *
2216     * @syscap SystemCapability.Communication.WiFi.STA
2217     * @since 9
2218     */
2219    bssid: string;
2220
2221    /**
2222     * Wi-Fi bssid type
2223     * @type { DeviceAddressType }
2224     * @syscap SystemCapability.Communication.WiFi.STA
2225     * @since 10
2226     */
2227    bssidType: DeviceAddressType;
2228
2229    /**
2230     * Hotspot capability
2231     *
2232     * @syscap SystemCapability.Communication.WiFi.STA
2233     * @since 9
2234     */
2235    capabilities: string;
2236
2237    /**
2238     * Security type: reference definition of WifiSecurityType
2239     *
2240     * @syscap SystemCapability.Communication.WiFi.STA
2241     * @since 9
2242     */
2243    securityType: WifiSecurityType;
2244
2245    /**
2246     * Received signal strength indicator (RSSI)
2247     *
2248     * @syscap SystemCapability.Communication.WiFi.STA
2249     * @since 9
2250     */
2251    rssi: number;
2252
2253    /**
2254     * Frequency band, 1: 2.4G, 2: 5G
2255     *
2256     * @syscap SystemCapability.Communication.WiFi.STA
2257     * @since 9
2258     */
2259    band: number;
2260
2261    /**
2262     * Frequency
2263     *
2264     * @syscap SystemCapability.Communication.WiFi.STA
2265     * @since 9
2266     */
2267    frequency: number;
2268
2269    /**
2270     * Channel width
2271     *
2272     * @syscap SystemCapability.Communication.WiFi.STA
2273     * @since 9
2274     */
2275    channelWidth: number;
2276
2277    /**
2278     * Center frequency 0.
2279     *
2280     * @syscap SystemCapability.Communication.WiFi.STA
2281     * @since 9
2282     */
2283    centerFrequency0: number;
2284
2285    /**
2286     * Center frequency 1.
2287     *
2288     * @syscap SystemCapability.Communication.WiFi.STA
2289     * @since 9
2290     */
2291    centerFrequency1: number;
2292
2293    /**
2294     * Information elements.
2295     *
2296     * @syscap SystemCapability.Communication.WiFi.STA
2297     * @since 9
2298     */
2299    infoElems: Array<WifiInfoElem>;
2300
2301    /**
2302     * Time stamp
2303     *
2304     * @syscap SystemCapability.Communication.WiFi.STA
2305     * @since 9
2306     */
2307    timestamp: number;
2308  }
2309
2310  /**
2311   * Describes the wifi security type.
2312   * @enum { number }
2313   * @syscap SystemCapability.Communication.WiFi.Core
2314   * @since 9
2315   */
2316  enum WifiSecurityType {
2317    /**
2318     * Invalid security type
2319     *
2320     * @syscap SystemCapability.Communication.WiFi.Core
2321     * @since 9
2322     */
2323    WIFI_SEC_TYPE_INVALID = 0,
2324
2325    /**
2326     * Open
2327     *
2328     * @syscap SystemCapability.Communication.WiFi.Core
2329     * @since 9
2330     */
2331    WIFI_SEC_TYPE_OPEN = 1,
2332
2333    /**
2334     * Wired Equivalent Privacy (WEP)
2335     *
2336     * @syscap SystemCapability.Communication.WiFi.Core
2337     * @since 9
2338     */
2339    WIFI_SEC_TYPE_WEP = 2,
2340
2341    /**
2342     * Pre-shared key (PSK)
2343     *
2344     * @syscap SystemCapability.Communication.WiFi.Core
2345     * @since 9
2346     */
2347    WIFI_SEC_TYPE_PSK = 3,
2348
2349    /**
2350     * Simultaneous Authentication of Equals (SAE)
2351     *
2352     * @syscap SystemCapability.Communication.WiFi.Core
2353     * @since 9
2354     */
2355    WIFI_SEC_TYPE_SAE = 4,
2356
2357    /**
2358     * EAP authentication.
2359     *
2360     * @syscap SystemCapability.Communication.WiFi.Core
2361     * @since 9
2362     */
2363    WIFI_SEC_TYPE_EAP = 5,
2364
2365    /**
2366     * SUITE_B_192 192 bit level.
2367     *
2368     * @syscap SystemCapability.Communication.WiFi.Core
2369     * @since 9
2370     */
2371    WIFI_SEC_TYPE_EAP_SUITE_B = 6,
2372
2373    /**
2374     * Opportunistic Wireless Encryption.
2375     *
2376     * @syscap SystemCapability.Communication.WiFi.Core
2377     * @since 9
2378     */
2379    WIFI_SEC_TYPE_OWE = 7,
2380
2381    /**
2382     * WAPI certificate to be specified.
2383     *
2384     * @syscap SystemCapability.Communication.WiFi.Core
2385     * @since 9
2386     */
2387    WIFI_SEC_TYPE_WAPI_CERT = 8,
2388
2389    /**
2390     * WAPI pre-shared key to be specified.
2391     *
2392     * @syscap SystemCapability.Communication.WiFi.Core
2393     * @since 9
2394     */
2395    WIFI_SEC_TYPE_WAPI_PSK = 9
2396  }
2397
2398  /**
2399   * Wi-Fi band type.
2400   * @enum { number }
2401   * @syscap SystemCapability.Communication.WiFi.STA
2402   * @since 10
2403   */
2404  enum WifiBandType {
2405    /**
2406     * Default.
2407     *
2408     * @syscap SystemCapability.Communication.WiFi.STA
2409     * @since 10
2410     */
2411    WIFI_BAND_NONE,
2412
2413    /**
2414     * Band 2.4G.
2415     *
2416     * @syscap SystemCapability.Communication.WiFi.STA
2417     * @since 10
2418     */
2419    WIFI_BAND_2G,
2420
2421    /**
2422     * Band 5G.
2423     *
2424     * @syscap SystemCapability.Communication.WiFi.STA
2425     * @since 10
2426     */
2427    WIFI_BAND_5G,
2428
2429    /**
2430     * Band 6G.
2431     *
2432     * @syscap SystemCapability.Communication.WiFi.STA
2433     * @since 10
2434     */
2435    WIFI_BAND_6G,
2436
2437    /**
2438     * Band 60G.
2439     *
2440     * @syscap SystemCapability.Communication.WiFi.STA
2441     * @since 10
2442     */
2443    WIFI_BAND_60G
2444  }
2445
2446  /**
2447   * Wi-Fi standard.
2448   * @enum { number }
2449   * @syscap SystemCapability.Communication.WiFi.STA
2450   * @since 10
2451   */
2452  enum WifiStandard {
2453    /**
2454     * Undefined
2455     * @syscap SystemCapability.Communication.WiFi.STA
2456     * @since 10
2457     */
2458    WIFI_STANDARD_UNDEFINED,
2459
2460    /**
2461     * Wifi 802.11a
2462     * @syscap SystemCapability.Communication.WiFi.STA
2463     * @since 10
2464     */
2465    WIFI_STANDARD_11A,
2466
2467    /**
2468     * Wifi 802.11b
2469     * @syscap SystemCapability.Communication.WiFi.STA
2470     * @since 10
2471     */
2472    WIFI_STANDARD_11B,
2473
2474    /**
2475     * Wifi 802.11g
2476     * @syscap SystemCapability.Communication.WiFi.STA
2477     * @since 10
2478     */
2479    WIFI_STANDARD_11G,
2480
2481    /**
2482     * Wifi 802.11n
2483     * @syscap SystemCapability.Communication.WiFi.STA
2484     * @since 10
2485     */
2486    WIFI_STANDARD_11N,
2487
2488    /**
2489     * Wifi 802.11ac
2490     * @syscap SystemCapability.Communication.WiFi.STA
2491     * @since 10
2492     */
2493    WIFI_STANDARD_11AC,
2494
2495    /**
2496     * Wifi 802.11ax
2497     * @syscap SystemCapability.Communication.WiFi.STA
2498     * @since 10
2499     */
2500    WIFI_STANDARD_11AX,
2501
2502    /**
2503     * Wifi 802.11ad
2504     * @syscap SystemCapability.Communication.WiFi.STA
2505     * @since 10
2506     */
2507    WIFI_STANDARD_11AD
2508  }
2509
2510  /**
2511   * Wi-Fi connection information.
2512   * @typedef WifiLinkedInfo
2513   * @syscap SystemCapability.Communication.WiFi.STA
2514   * @since 9
2515   */
2516  interface WifiLinkedInfo {
2517    /**
2518     * The SSID of the Wi-Fi hotspot
2519     * @syscap SystemCapability.Communication.WiFi.STA
2520     * @since 9
2521     */
2522    ssid: string;
2523
2524    /**
2525     * The BSSID of the Wi-Fi hotspot
2526     * @syscap SystemCapability.Communication.WiFi.STA
2527     * @since 9
2528     */
2529    bssid: string;
2530
2531    /**
2532     * The ID(uniquely identifies) of a Wi-Fi connection.
2533     * @syscap SystemCapability.Communication.WiFi.STA
2534     * @systemapi Hide this for inner system use.
2535     * @since 9
2536     */
2537    networkId: number;
2538
2539    /**
2540     * The RSSI(dBm) of a Wi-Fi access point.
2541     * @syscap SystemCapability.Communication.WiFi.STA
2542     * @since 9
2543     */
2544    rssi: number;
2545
2546    /**
2547     * The frequency band of a Wi-Fi access point.
2548     * @syscap SystemCapability.Communication.WiFi.STA
2549     * @since 9
2550     */
2551    band: number;
2552
2553    /**
2554     * The speed of a Wi-Fi access point.
2555     * @syscap SystemCapability.Communication.WiFi.STA
2556     * @since 9
2557     */
2558    linkSpeed: number;
2559
2560    /**
2561     * The rx speed of a Wi-Fi access point.
2562     * @syscap SystemCapability.Communication.WiFi.STA
2563     * @since 10
2564     */
2565    rxLinkSpeed: number;
2566
2567    /**
2568     * Max tx speed of a Wi-Fi access point.
2569     * @syscap SystemCapability.Communication.WiFi.STA
2570     * @since 10
2571     */
2572    maxSupportedTxLinkSpeed: number;
2573
2574    /**
2575     * Max rx speed of a Wi-Fi access point.
2576     * @syscap SystemCapability.Communication.WiFi.STA
2577     * @since 10
2578     */
2579    maxSupportedRxLinkSpeed: number;
2580
2581    /**
2582     * The frequency of a Wi-Fi access point.
2583     * @syscap SystemCapability.Communication.WiFi.STA
2584     * @since 9
2585     */
2586    frequency: number;
2587
2588    /**
2589     * Whether the SSID of the access point (AP) of this Wi-Fi connection is hidden.
2590     * @syscap SystemCapability.Communication.WiFi.STA
2591     * @since 9
2592     */
2593    isHidden: boolean;
2594
2595    /**
2596     * Whether this Wi-Fi connection restricts the data volume.
2597     * @syscap SystemCapability.Communication.WiFi.STA
2598     * @since 9
2599     */
2600    isRestricted: boolean;
2601
2602    /**
2603     * The load value of this Wi-Fi connection. A greater value indicates a higher load.
2604     * @syscap SystemCapability.Communication.WiFi.STA
2605     * @systemapi Hide this for inner system use.
2606     * @since 9
2607     */
2608    chload: number;
2609
2610    /**
2611     * The signal-to-noise ratio (SNR) of this Wi-Fi connection.
2612     * @syscap SystemCapability.Communication.WiFi.STA
2613     * @systemapi Hide this for inner system use.
2614     * @since 9
2615     */
2616    snr: number;
2617
2618    /**
2619     * Type of macAddress: 0 - real mac, 1 - random mac.
2620     * @syscap SystemCapability.Communication.WiFi.STA
2621     * @since 9
2622     */
2623    macType: number;
2624
2625    /**
2626     * The Wi-Fi MAC address of a device.
2627     * @syscap SystemCapability.Communication.WiFi.STA
2628     * @since 9
2629     */
2630    macAddress: string;
2631
2632    /**
2633     * The IP address of this Wi-Fi connection.
2634     * @syscap SystemCapability.Communication.WiFi.STA
2635     * @since 9
2636     */
2637    ipAddress: number;
2638
2639    /**
2640     * The state of the supplicant of this Wi-Fi connection.
2641     * @syscap SystemCapability.Communication.WiFi.STA
2642     * @systemapi Hide this for inner system use.
2643     * @since 9
2644     */
2645    suppState: SuppState;
2646
2647    /**
2648     * The state of this Wi-Fi connection.
2649     * @syscap SystemCapability.Communication.WiFi.STA
2650     * @since 9
2651     */
2652    connState: ConnState;
2653
2654    /**
2655     * Channel width of the connected hotspot.
2656     * @syscap SystemCapability.Communication.WiFi.STA
2657     * @since 10
2658     */
2659    channelWidth: WifiChannelWidth;
2660
2661    /**
2662     * Wifi standard of current connection.
2663     * @syscap SystemCapability.Communication.WiFi.STA
2664     * @since 10
2665     */
2666    wifiStandard: WifiStandard;
2667  }
2668
2669  /**
2670   * Wi-Fi IP information.
2671   * @typedef IpInfo
2672   * @syscap SystemCapability.Communication.WiFi.STA
2673   * @since 9
2674   */
2675  interface IpInfo {
2676    /**
2677     * The IP address of the Wi-Fi connection
2678     *
2679     * @syscap SystemCapability.Communication.WiFi.STA
2680     * @since 9
2681     */
2682    ipAddress: number;
2683
2684    /**
2685     * The gateway of the Wi-Fi connection
2686     *
2687     * @syscap SystemCapability.Communication.WiFi.STA
2688     * @since 9
2689     */
2690    gateway: number;
2691
2692    /**
2693     * The network mask of the Wi-Fi connection
2694     *
2695     * @syscap SystemCapability.Communication.WiFi.STA
2696     * @since 9
2697     */
2698    netmask: number;
2699
2700    /**
2701     * The primary DNS server IP address of the Wi-Fi connection
2702     *
2703     * @syscap SystemCapability.Communication.WiFi.STA
2704     * @since 9
2705     */
2706    primaryDns: number;
2707
2708    /**
2709     * The secondary DNS server IP address of the Wi-Fi connection
2710     *
2711     * @syscap SystemCapability.Communication.WiFi.STA
2712     * @since 9
2713     */
2714    secondDns: number;
2715
2716    /**
2717     * The DHCP server IP address of the Wi-Fi connection
2718     * @syscap SystemCapability.Communication.WiFi.STA
2719     * @since 9
2720     */
2721    serverIp: number;
2722
2723    /**
2724     * The IP address lease duration of the Wi-Fi connection
2725     * @syscap SystemCapability.Communication.WiFi.STA
2726     * @since 9
2727     */
2728    leaseDuration: number;
2729  }
2730
2731  /**
2732   * Wi-Fi IPv6 information.
2733   * @typedef Ipv6Info
2734   * @syscap SystemCapability.Communication.WiFi.STA
2735   * @since 10
2736   */
2737  interface Ipv6Info {
2738    /**
2739     * The link IPv6 address of the Wi-Fi connection
2740     *
2741     * @syscap SystemCapability.Communication.WiFi.STA
2742     * @since 10
2743     */
2744    linkIpv6Address: string;
2745
2746    /**
2747     * The global IPv6 address of the Wi-Fi connection
2748     *
2749     * @syscap SystemCapability.Communication.WiFi.STA
2750     * @since 10
2751     */
2752    globalIpv6Address: string;
2753
2754    /**
2755     * The rand Global IPv6 address of the Wi-Fi connection
2756     *
2757     * @syscap SystemCapability.Communication.WiFi.STA
2758     * @since 10
2759     */
2760    randomGlobalIpv6Address: string;
2761
2762    /**
2763     * The gateway of the Wi-Fi connection
2764     *
2765     * @syscap SystemCapability.Communication.WiFi.STA
2766     * @since 10
2767     */
2768    gateway: string;
2769
2770    /**
2771     * The network mask of the Wi-Fi connection
2772     *
2773     * @syscap SystemCapability.Communication.WiFi.STA
2774     * @since 10
2775     */
2776    netmask: string;
2777
2778    /**
2779     * The primary DNS server IPV6 address of the Wi-Fi connection
2780     *
2781     * @syscap SystemCapability.Communication.WiFi.STA
2782     * @since 10
2783     */
2784    primaryDNS: string;
2785
2786    /**
2787     * The secondary DNS server IPV6 address of the Wi-Fi connection
2788     *
2789     * @syscap SystemCapability.Communication.WiFi.STA
2790     * @since 10
2791     */
2792    secondDNS: string;
2793  }
2794
2795  /**
2796   * Wi-Fi hotspot configuration information.
2797   * @typedef HotspotConfig
2798   * @syscap SystemCapability.Communication.WiFi.AP.Core
2799   * @systemapi Hide this for inner system use.
2800   * @since 9
2801   */
2802  interface HotspotConfig {
2803    /**
2804     * The SSID of the Wi-Fi hotspot
2805     * @syscap SystemCapability.Communication.WiFi.AP.Core
2806     * @systemapi Hide this for inner system use.
2807     * @since 9
2808     */
2809    ssid: string;
2810
2811    /**
2812     * The encryption mode of the Wi-Fi hotspot
2813     * @syscap SystemCapability.Communication.WiFi.AP.Core
2814     * @systemapi Hide this for inner system use.
2815     * @since 9
2816     */
2817    securityType: WifiSecurityType;
2818
2819    /**
2820     * The frequency band of the Wi-Fi hotspot
2821     * @syscap SystemCapability.Communication.WiFi.AP.Core
2822     * @systemapi Hide this for inner system use.
2823     * @since 9
2824     */
2825    band: number;
2826
2827    /**
2828     * The channel of the Wi-Fi hotspot.
2829     * @syscap SystemCapability.Communication.WiFi.AP.Core
2830     * @systemapi Hide this for inner system use.
2831     * @since 10
2832     */
2833    channel?: number;
2834
2835    /**
2836     * The password of the Wi-Fi hotspot
2837     * @syscap SystemCapability.Communication.WiFi.AP.Core
2838     * @systemapi Hide this for inner system use.
2839     * @since 9
2840     */
2841    preSharedKey: string;
2842
2843    /**
2844     * The maximum number of connections allowed by the Wi-Fi hotspot
2845     * @syscap SystemCapability.Communication.WiFi.AP.Core
2846     * @systemapi Hide this for inner system use.
2847     * @since 9
2848     */
2849    maxConn: number;
2850
2851    /**
2852     * IP address of the dhcp server, it's a string, For example 192.168.43.1
2853     * @syscap SystemCapability.Communication.WiFi.AP.Core
2854     * @systemapi Hide this for inner system use.
2855     * @since 10
2856     */
2857    ipAddress?: string;
2858  }
2859
2860  /**
2861   * Wi-Fi station information.
2862   * @typedef StationInfo
2863   * @syscap SystemCapability.Communication.WiFi.AP.Core
2864   * @systemapi Hide this for inner system use.
2865   * @since 9
2866   */
2867  interface StationInfo {
2868    /**
2869     * The network name of the Wi-Fi client
2870     * @syscap SystemCapability.Communication.WiFi.AP.Core
2871     * @systemapi Hide this for inner system use.
2872     * @since 9
2873     */
2874    name: string;
2875
2876    /**
2877     * The MAC address of the Wi-Fi client
2878     * @syscap SystemCapability.Communication.WiFi.AP.Core
2879     * @systemapi Hide this for inner system use.
2880     * @since 9
2881     */
2882    macAddress: string;
2883
2884    /**
2885     * The MAC address type of the Wi-Fi client
2886     * @type { ?DeviceAddressType }
2887     * @syscap SystemCapability.Communication.WiFi.AP.Core
2888     * @systemapi Hide this for inner system use.
2889     * @since 10
2890     */
2891    macAddressType?: DeviceAddressType;
2892
2893    /**
2894     * The IP address of the Wi-Fi client
2895     * @syscap SystemCapability.Communication.WiFi.AP.Core
2896     * @systemapi Hide this for inner system use.
2897     * @since 9
2898     */
2899    ipAddress: string;
2900  }
2901
2902  /**
2903   * Wi-Fi IP type enumeration.
2904   *
2905   * @enum { number }
2906   * @syscap SystemCapability.Communication.WiFi.STA
2907   * @systemapi Hide this for inner system use.
2908   * @since 9
2909   */
2910  enum IpType {
2911    /**
2912     * Use statically configured IP settings
2913     * @syscap SystemCapability.Communication.WiFi.STA
2914     * @systemapi Hide this for inner system use.
2915     * @since 9
2916     */
2917    STATIC,
2918
2919    /**
2920     * Use dynamically configured IP settings
2921     * @syscap SystemCapability.Communication.WiFi.STA
2922     * @systemapi Hide this for inner system use.
2923     * @since 9
2924     */
2925    DHCP,
2926
2927    /**
2928     * No IP details are assigned
2929     * @syscap SystemCapability.Communication.WiFi.STA
2930     * @systemapi Hide this for inner system use.
2931     * @since 9
2932     */
2933    UNKNOWN
2934  }
2935
2936  /**
2937   * The state of the supplicant enumeration.
2938   *
2939   * @enum { number }
2940   * @syscap SystemCapability.Communication.WiFi.STA
2941   * @systemapi Hide this for inner system use.
2942   * @since 9
2943   */
2944  export enum SuppState {
2945    /**
2946     * The supplicant is not associated with or is disconnected from the AP.
2947     * @syscap SystemCapability.Communication.WiFi.STA
2948     * @systemapi Hide this for inner system use.
2949     * @since 9
2950     */
2951    DISCONNECTED,
2952
2953    /**
2954     * The network interface is disabled.
2955     * @syscap SystemCapability.Communication.WiFi.STA
2956     * @systemapi Hide this for inner system use.
2957     * @since 9
2958     */
2959    INTERFACE_DISABLED,
2960
2961    /**
2962     * The supplicant is disabled.
2963     * @syscap SystemCapability.Communication.WiFi.STA
2964     * @systemapi Hide this for inner system use.
2965     * @since 9
2966     */
2967    INACTIVE,
2968
2969    /**
2970     * The supplicant is scanning for a Wi-Fi connection.
2971     * @syscap SystemCapability.Communication.WiFi.STA
2972     * @systemapi Hide this for inner system use.
2973     * @since 9
2974     */
2975    SCANNING,
2976
2977    /**
2978     * The supplicant is authenticating with a specified AP.
2979     * @syscap SystemCapability.Communication.WiFi.STA
2980     * @systemapi Hide this for inner system use.
2981     * @since 9
2982     */
2983    AUTHENTICATING,
2984
2985    /**
2986     * The supplicant is associating with a specified AP.
2987     * @syscap SystemCapability.Communication.WiFi.STA
2988     * @systemapi Hide this for inner system use.
2989     * @since 9
2990     */
2991    ASSOCIATING,
2992
2993    /**
2994     * The supplicant is associated with a specified AP.
2995     * @syscap SystemCapability.Communication.WiFi.STA
2996     * @systemapi Hide this for inner system use.
2997     * @since 9
2998     */
2999    ASSOCIATED,
3000
3001    /**
3002     * The four-way handshake is ongoing.
3003     * @syscap SystemCapability.Communication.WiFi.STA
3004     * @systemapi Hide this for inner system use.
3005     * @since 9
3006     */
3007    FOUR_WAY_HANDSHAKE,
3008
3009    /**
3010     * The group handshake is ongoing.
3011     * @syscap SystemCapability.Communication.WiFi.STA
3012     * @systemapi Hide this for inner system use.
3013     * @since 9
3014     */
3015    GROUP_HANDSHAKE,
3016
3017    /**
3018     * All authentication is completed.
3019     * @syscap SystemCapability.Communication.WiFi.STA
3020     * @systemapi Hide this for inner system use.
3021     * @since 9
3022     */
3023    COMPLETED,
3024
3025    /**
3026     * Failed to establish a connection to the supplicant.
3027     * @syscap SystemCapability.Communication.WiFi.STA
3028     * @systemapi Hide this for inner system use.
3029     * @since 9
3030     */
3031    UNINITIALIZED,
3032
3033    /**
3034     * The supplicant is in an unknown or invalid state.
3035     * @syscap SystemCapability.Communication.WiFi.STA
3036     * @systemapi Hide this for inner system use.
3037     * @since 9
3038     */
3039    INVALID
3040  }
3041
3042  /**
3043   * The state of Wi-Fi connection enumeration.
3044   *
3045   * @enum { number }
3046   * @syscap SystemCapability.Communication.WiFi.STA
3047   * @since 9
3048   */
3049  export enum ConnState {
3050    /**
3051     * The device is searching for an available AP.
3052     *
3053     * @syscap SystemCapability.Communication.WiFi.STA
3054     * @since 9
3055     */
3056    SCANNING,
3057
3058    /**
3059     * The Wi-Fi connection is being set up.
3060     *
3061     * @syscap SystemCapability.Communication.WiFi.STA
3062     * @since 9
3063     */
3064    CONNECTING,
3065
3066    /**
3067     * The Wi-Fi connection is being authenticated.
3068     *
3069     * @syscap SystemCapability.Communication.WiFi.STA
3070     * @since 9
3071     */
3072    AUTHENTICATING,
3073
3074    /**
3075     * The IP address of the Wi-Fi connection is being obtained.
3076     *
3077     * @syscap SystemCapability.Communication.WiFi.STA
3078     * @since 9
3079     */
3080    OBTAINING_IPADDR,
3081
3082    /**
3083     * The Wi-Fi connection has been set up.
3084     *
3085     * @syscap SystemCapability.Communication.WiFi.STA
3086     * @since 9
3087     */
3088    CONNECTED,
3089
3090    /**
3091     * The Wi-Fi connection is being torn down.
3092     *
3093     * @syscap SystemCapability.Communication.WiFi.STA
3094     * @since 9
3095     */
3096    DISCONNECTING,
3097
3098    /**
3099     * The Wi-Fi connection has been torn down.
3100     *
3101     * @syscap SystemCapability.Communication.WiFi.STA
3102     * @since 9
3103     */
3104    DISCONNECTED,
3105
3106    /**
3107     * Failed to set up the Wi-Fi connection.
3108     *
3109     * @syscap SystemCapability.Communication.WiFi.STA
3110     * @since 9
3111     */
3112    UNKNOWN
3113  }
3114
3115  /**
3116   * P2P device information.
3117   *
3118   * @typedef WifiP2pDevice
3119   * @syscap SystemCapability.Communication.WiFi.P2P
3120   * @since 9
3121   */
3122  interface WifiP2pDevice {
3123    /**
3124     * Device name
3125     *
3126     * @syscap SystemCapability.Communication.WiFi.P2P
3127     * @since 9
3128     */
3129    deviceName: string;
3130
3131    /**
3132     * Device mac address
3133     *
3134     * @syscap SystemCapability.Communication.WiFi.P2P
3135     * @since 9
3136     */
3137    deviceAddress: string;
3138
3139    /**
3140     * Device mac address type
3141     * @type { ?DeviceAddressType }
3142     * @syscap SystemCapability.Communication.WiFi.P2P
3143     * @since 10
3144     */
3145    deviceAddressType?: DeviceAddressType;
3146
3147    /**
3148     * Primary device type
3149     *
3150     * @syscap SystemCapability.Communication.WiFi.P2P
3151     * @since 9
3152     */
3153    primaryDeviceType: string;
3154
3155    /**
3156     * Device status
3157     *
3158     * @syscap SystemCapability.Communication.WiFi.P2P
3159     * @since 9
3160     */
3161    deviceStatus: P2pDeviceStatus;
3162
3163    /**
3164     * Device group capabilities
3165     *
3166     * @syscap SystemCapability.Communication.WiFi.P2P
3167     * @since 9
3168     */
3169    groupCapabilities: number;
3170  }
3171
3172  /**
3173   * P2P config.
3174   *
3175   * @typedef WifiP2PConfig
3176   * @syscap SystemCapability.Communication.WiFi.P2P
3177   * @since 9
3178   */
3179  interface WifiP2PConfig {
3180    /**
3181     * Device mac address
3182     *
3183     * @syscap SystemCapability.Communication.WiFi.P2P
3184     * @since 9
3185     */
3186    deviceAddress: string;
3187
3188    /**
3189     * Device mac address type
3190     * @type { ?DeviceAddressType }
3191     * @syscap SystemCapability.Communication.WiFi.P2P
3192     * @since 10
3193     */
3194    deviceAddressType?: DeviceAddressType;
3195
3196    /**
3197     * Group network ID. When creating a group, -1 indicates creates a temporary group,
3198     * -2: indicates creates a persistent group
3199     *
3200     * @syscap SystemCapability.Communication.WiFi.P2P
3201     * @since 9
3202     */
3203    netId: number;
3204
3205    /**
3206     * The passphrase of this {@code WifiP2pConfig} instance
3207     *
3208     * @syscap SystemCapability.Communication.WiFi.P2P
3209     * @since 9
3210     */
3211    passphrase: string;
3212
3213    /**
3214     * Group name
3215     * @syscap SystemCapability.Communication.WiFi.P2P
3216     * @since 9
3217     */
3218    groupName: string;
3219
3220    /**
3221     * Group owner band
3222     * @syscap SystemCapability.Communication.WiFi.P2P
3223     * @since 9
3224     */
3225    goBand: GroupOwnerBand;
3226  }
3227
3228  /**
3229   * P2P group information.
3230   *
3231   * @typedef WifiP2pGroupInfo
3232   * @syscap SystemCapability.Communication.WiFi.P2P
3233   * @since 9
3234   */
3235  interface WifiP2pGroupInfo {
3236    /**
3237     * Indicates whether it is group owner
3238     * @syscap SystemCapability.Communication.WiFi.P2P
3239     * @since 9
3240     */
3241    isP2pGo: boolean;
3242
3243    /**
3244     * Group owner information
3245     * @syscap SystemCapability.Communication.WiFi.P2P
3246     * @since 9
3247     */
3248    ownerInfo: WifiP2pDevice;
3249
3250    /**
3251     * The group passphrase
3252     * @syscap SystemCapability.Communication.WiFi.P2P
3253     * @since 9
3254     */
3255    passphrase: string;
3256
3257    /**
3258     * Interface name
3259     * @syscap SystemCapability.Communication.WiFi.P2P
3260     * @since 9
3261     */
3262    interface: string;
3263
3264    /**
3265     * Group name
3266     * @syscap SystemCapability.Communication.WiFi.P2P
3267     * @since 9
3268     */
3269    groupName: string;
3270
3271    /**
3272     * Network ID
3273     * @syscap SystemCapability.Communication.WiFi.P2P
3274     * @since 9
3275     */
3276    networkId: number;
3277
3278    /**
3279     * Frequency
3280     * @syscap SystemCapability.Communication.WiFi.P2P
3281     * @since 9
3282     */
3283    frequency: number;
3284
3285    /**
3286     * Client list
3287     * @syscap SystemCapability.Communication.WiFi.P2P
3288     * @since 9
3289     */
3290    clientDevices: WifiP2pDevice[];
3291
3292    /**
3293     * Group owner IP address
3294     * @syscap SystemCapability.Communication.WiFi.P2P
3295     * @since 9
3296     */
3297    goIpAddress: string;
3298  }
3299
3300  /**
3301   * P2P connection status.
3302   *
3303   * @enum { number }
3304   * @syscap SystemCapability.Communication.WiFi.P2P
3305   * @since 9
3306   */
3307  enum P2pConnectState {
3308    /**
3309     * p2p is disconnected
3310     * @syscap SystemCapability.Communication.WiFi.P2P
3311     * @since 9
3312     */
3313    DISCONNECTED = 0,
3314
3315    /**
3316     * p2p is connected
3317     * @syscap SystemCapability.Communication.WiFi.P2P
3318     * @since 9
3319     */
3320    CONNECTED = 1
3321  }
3322
3323  /**
3324   * P2P linked information.
3325   *
3326   * @typedef WifiP2pLinkedInfo
3327   * @syscap SystemCapability.Communication.WiFi.P2P
3328   * @since 9
3329   */
3330  interface WifiP2pLinkedInfo {
3331    /**
3332     * Connection status
3333     * @syscap SystemCapability.Communication.WiFi.P2P
3334     * @since 9
3335     */
3336    connectState: P2pConnectState;
3337
3338    /**
3339     * Indicates whether it is group owner
3340     * @syscap SystemCapability.Communication.WiFi.P2P
3341     * @since 9
3342     */
3343    isGroupOwner: boolean;
3344
3345    /**
3346     * Group owner address
3347     *
3348     * @syscap SystemCapability.Communication.WiFi.P2P
3349     * @since 9
3350     */
3351    groupOwnerAddr: string;
3352  }
3353
3354  /**
3355   * P2P device status.
3356   *
3357   * @enum { number }
3358   * @syscap SystemCapability.Communication.WiFi.P2P
3359   * @since 9
3360   */
3361  enum P2pDeviceStatus {
3362    /**
3363     * Indicate p2p device is connected.
3364     * @syscap SystemCapability.Communication.WiFi.P2P
3365     * @since 9
3366     */
3367    CONNECTED = 0,
3368
3369    /**
3370     * Indicate p2p device is invited.
3371     * @syscap SystemCapability.Communication.WiFi.P2P
3372     * @since 9
3373     */
3374    INVITED = 1,
3375
3376    /**
3377     * Indicate p2p device is failed.
3378     * @syscap SystemCapability.Communication.WiFi.P2P
3379     * @since 9
3380     */
3381    FAILED = 2,
3382
3383    /**
3384     * Indicate p2p device is available.
3385     * @syscap SystemCapability.Communication.WiFi.P2P
3386     * @since 9
3387     */
3388    AVAILABLE = 3,
3389
3390    /**
3391     * Indicate p2p device is unavailable.
3392     * @syscap SystemCapability.Communication.WiFi.P2P
3393     * @since 9
3394     */
3395    UNAVAILABLE = 4
3396  }
3397
3398  /**
3399   * P2P group owner band.
3400   *
3401   * @enum { number }
3402   * @syscap SystemCapability.Communication.WiFi.P2P
3403   * @since 9
3404   */
3405  enum GroupOwnerBand {
3406  /**
3407   * default band.
3408   * @syscap SystemCapability.Communication.WiFi.P2P
3409   * @since 9
3410   */
3411    GO_BAND_AUTO = 0,
3412
3413  /**
3414   * 2.4G band.
3415   * @syscap SystemCapability.Communication.WiFi.P2P
3416   * @since 9
3417   */
3418    GO_BAND_2GHZ = 1,
3419
3420  /**
3421   * 5G band.
3422   * @syscap SystemCapability.Communication.WiFi.P2P
3423   * @since 9
3424   */
3425    GO_BAND_5GHZ = 2
3426  }
3427}
3428
3429export default wifiManager;
3430