提交 8432b467 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 caa12d24
# WLAN
# @ohos.wifiManager (WLAN)
The **WLAN** module provides basic wireless local area network (WLAN) functions, peer-to-peer (P2P) functions, and WLAN message notification services. It allows applications to communicate with other devices over WLAN.
> **NOTE**
......@@ -30,6 +30,14 @@ Enables WLAN.
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.disableWifi<sup>9+</sup>
......@@ -49,6 +57,13 @@ Disables WLAN.
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.isWifiActive<sup>9+</sup>
......@@ -66,6 +81,13 @@ Checks whether WLAN is enabled.
| -------- | -------- |
| boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.scan<sup>9+</sup>
......@@ -83,6 +105,13 @@ Starts a scan for WLAN.
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getScanResults<sup>9+</sup>
......@@ -100,6 +129,13 @@ Obtains the scan result. This API uses a promise to return the result.
| -------- | -------- |
| Promise&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&nbsp;&gt; | Promise used to return the detected hotspots.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getScanResults<sup>9+</sup>
......@@ -117,6 +153,14 @@ Obtains the scan result. This API uses an asynchronous callback to return the re
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the detected hotspots. Otherwise, **err** is a non-zero value and **data** is empty.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
**Example**
```js
import wifi from '@ohos.wifi';
......@@ -250,6 +294,13 @@ Obtains the scan result. This API returns the result synchronously.
| -------- | -------- |
| &nbsp;Array&lt;[WifiScanInfo](#wifiscaninfo)&gt; | Scan result obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.addDeviceConfig<sup>9+</sup>
......@@ -275,6 +326,14 @@ Adds network configuration. This API uses a promise to return the result.
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## WifiDeviceConfig<sup>9+</sup>
Represents the WLAN configuration.
......@@ -417,6 +476,13 @@ Adds network configuration. This API uses an asynchronous callback to return the
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.addCandidateConfig<sup>9+</sup>
......@@ -440,6 +506,13 @@ Adds the configuration of a candidate network. This API uses a promise to return
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the network configuration ID.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.addCandidateConfig<sup>9+</sup>
......@@ -458,6 +531,13 @@ Adds the configuration of a candidate network. This API uses an asynchronous cal
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeCandidateConfig<sup>9+</sup>
......@@ -481,6 +561,13 @@ Removes the configuration of a candidate network. This API uses a promise to ret
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeCandidateConfig<sup>9+</sup>
......@@ -499,6 +586,13 @@ Removes the configuration of a candidate network. This API uses an asynchronous
| networkId | number | Yes| ID of the network configuration to remove.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getCandidateConfigs<sup>9+</sup>
......@@ -516,6 +610,13 @@ Obtains candidate network configuration.
| -------- | -------- |
| &nbsp;Array&lt;[WifiDeviceConfig](#wifideviceconfig)&gt; | Candidate network configuration obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.connectToCandidateConfig<sup>9+</sup>
......@@ -533,6 +634,14 @@ Connects to a candidate network.
| -------- | -------- | -------- | -------- |
| networkId | number | Yes| ID of the candidate network configuration.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.connectToNetwork<sup>9+</sup>
......@@ -552,12 +661,14 @@ Connects to the specified network.
| -------- | -------- | -------- | -------- |
| networkId | number | Yes| Network configuration ID.|
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.connectToDevice<sup>9+</sup>
......@@ -578,12 +689,14 @@ Connects to the specified network.
| -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration.|
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.disconnect<sup>9+</sup>
......@@ -598,12 +711,13 @@ Disconnects the network.
**System capability**:
SystemCapability.Communication.WiFi.STA
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getSignalLevel<sup>9+</sup>
......@@ -628,6 +742,13 @@ Obtains the WLAN signal level.
| -------- | -------- |
| number | Signal level obtained. The value range is [0, 4].|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getLinkedInfo<sup>9+</sup>
......@@ -645,6 +766,14 @@ Obtains WLAN connection information. This API uses a promise to return the resul
| -------- | -------- |
| Promise&lt;[WifiLinkedInfo](#wifilinkedinfo)&gt; | Promise used to return the WLAN connection information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.getLinkedInfo<sup>9+</sup>
......@@ -662,6 +791,15 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiLinkedInfo](#wifilinkedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the WLAN connection information obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
**Example**
```js
import wifi from '@ohos.wifi';
......@@ -766,6 +904,13 @@ Checks whether the WLAN is connected.
| -------- | -------- |
| boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getSupportedFeatures<sup>9+</sup>
......@@ -794,12 +939,19 @@ Obtains the features supported by this device.
| 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature|
| 0x0008 | Wi-Fi Direct|
| 0x0010 | SoftAP|
| 0x0040 | Wi-Fi AWare|
| 0x0040 | Wi-Fi Aware|
| 0x8000 | WLAN AP/STA concurrency|
| 0x8000000 | WPA3 Personal (WPA-3 SAE)|
| 0x10000000 | WPA3-Enterprise Suite B |
| 0x20000000 | Enhanced open feature|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2401000 | Operation failed.|
## wifi.isFeatureSupported<sup>9+</sup>
......@@ -824,6 +976,13 @@ Checks whether the device supports the specified WLAN feature.
| -------- | -------- |
| boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2401000 | Operation failed.|
## wifi.getDeviceMacAddress<sup>9+</sup>
......@@ -843,6 +1002,13 @@ Obtains the device MAC address.
| -------- | -------- |
| string[] | MAC address obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.getIpInfo<sup>9+</sup>
......@@ -860,6 +1026,13 @@ Obtains IP information.
| -------- | -------- |
| [IpInfo](#ipinfo9) | IP information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## IpInfo<sup>9+</sup>
......@@ -894,6 +1067,13 @@ Obtains the country code.
| -------- | -------- |
| string | Country code obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2401000 | Operation failed.|
## wifi.reassociate<sup>9+</sup>
......@@ -907,12 +1087,14 @@ Re-associates with the network.
**System capability**: SystemCapability.Communication.WiFi.STA
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.reconnect<sup>9+</sup>
......@@ -926,12 +1108,14 @@ Reconnects to the network.
**System capability**: SystemCapability.Communication.WiFi.STA
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
## wifi.getDeviceConfigs<sup>9+</sup>
......@@ -951,6 +1135,13 @@ Obtains network configuration.
| -------- | -------- |
| &nbsp;Array&lt;[WifiDeviceConfig](#wifideviceconfig)&gt; | Array of network configuration obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.updateNetwork<sup>9+</sup>
......@@ -968,7 +1159,7 @@ Updates network configuration.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| New WLAN configuration.|
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| New WLAN configuration.|
**Return value**
......@@ -976,6 +1167,13 @@ Updates network configuration.
| -------- | -------- |
| number | ID of the updated network configuration. The value **-1** indicates that the operation has failed.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.disableNetwork<sup>9+</sup>
......@@ -995,12 +1193,13 @@ Disables network configuration.
| -------- | -------- | -------- | -------- |
| netId | number | Yes| ID of the network configuration to disable.|
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeAllNetwork<sup>9+</sup>
......@@ -1014,12 +1213,13 @@ Removes the configuration of all networks.
**System capability**: SystemCapability.Communication.WiFi.STA
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.removeDevice<sup>9+</sup>
......@@ -1039,12 +1239,13 @@ Removes the specified network configuration.
| -------- | -------- | -------- | -------- |
| id | number | Yes| ID of the network configuration to remove.|
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.enableHotspot<sup>9+</sup>
......@@ -1058,12 +1259,13 @@ Enables this hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Core
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.disableHotspot<sup>9+</sup>
......@@ -1077,12 +1279,13 @@ Disables this hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Core
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.isHotspotDualBandSupported<sup>9+</sup>
......@@ -1100,8 +1303,15 @@ Checks whether the hotspot supports dual band.
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
| boolean | Returns **true** if the hotspot supports dual band; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.isHotspotActive<sup>9+</sup>
......@@ -1121,6 +1331,13 @@ Checks whether this hotspot is active.
| -------- | -------- |
| boolean | Returns **true** if the hotspot is active; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.setHotspotConfig<sup>9+</sup>
......@@ -1140,12 +1357,13 @@ Sets hotspot configuration.
| -------- | -------- | -------- | -------- |
| config | [HotspotConfig](#hotspotconfig9) | Yes| Hotspot configuration to set.|
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## HotspotConfig<sup>9+</sup>
......@@ -1168,7 +1386,7 @@ Represents the hotspot configuration.
getHotspotConfig(): HotspotConfig
obtains hotspot configuration.
Obtains hotspot configuration.
**System API**: This is a system API.
......@@ -1182,6 +1400,13 @@ obtains hotspot configuration.
| -------- | -------- |
| [HotspotConfig](#hotspotconfig9) | Hotspot configuration obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.getStations<sup>9+</sup>
......@@ -1201,6 +1426,13 @@ Obtains information about the connected stations.
| -------- | -------- |
| &nbsp;Array&lt;[StationInfo](#stationinfo9)&gt; | Connected stations obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## StationInfo<sup>9+</sup>
......@@ -1233,7 +1465,13 @@ Obtains P2P link information. This API uses a promise to return the result.
| -------- | -------- |
| Promise&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | Promise used to return the P2P link information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2pLinkedInfo<sup>9+</sup>
......@@ -1293,6 +1531,13 @@ Obtains the current P2P group information. This API uses a promise to return the
| -------- | -------- |
| Promise&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt; | Promise used to return the P2P group information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getCurrentGroup<sup>9+</sup>
......@@ -1310,6 +1555,13 @@ Obtains the current P2P group information. This API uses an asynchronous callbac
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pPeerDevices<sup>9+</sup>
......@@ -1327,6 +1579,13 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r
| -------- | -------- |
| Promise&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Promise used to return the peer device list.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pPeerDevices<sup>9+</sup>
......@@ -1344,6 +1603,13 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the peer device list obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2pDevice<sup>9+</sup>
......@@ -1391,6 +1657,13 @@ Obtains the local device information in the P2P connection. This API uses a prom
| -------- | -------- |
| Promise&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | Promise used to return the local device information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pLocalDevice<sup>9+</sup>
......@@ -1425,12 +1698,13 @@ Creates a P2P group.
| -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| Group configuration.|
**Return value**
**Error codes**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2PConfig<sup>9+</sup>
......@@ -1470,12 +1744,13 @@ Removes this P2P group.
**System capability**: SystemCapability.Communication.WiFi.P2P
**Return value**
**Error codes**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.p2pConnect<sup>9+</sup>
......@@ -1494,12 +1769,13 @@ Sets up a P2P connection.
| -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| P2P group configuration.|
**Return value**
**Error codes**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
**Example**
```js
......@@ -1578,12 +1854,13 @@ Cancels this P2P connection.
**System capability**: SystemCapability.Communication.WiFi.P2P
**Return value**
**Error codes**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.startDiscoverDevices<sup>9+</sup>
......@@ -1595,12 +1872,13 @@ Starts to discover devices.
**System capability**: SystemCapability.Communication.WiFi.P2P
**Return value**
**Error codes**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.stopDiscoverDevices<sup>9+</sup>
......@@ -1612,12 +1890,13 @@ Stops discovering devices.
**System capability**: SystemCapability.Communication.WiFi.P2P
**Return value**
**Error codes**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.deletePersistentGroup<sup>9+</sup>
......@@ -1638,12 +1917,13 @@ Deletes a persistent group.
| -------- | -------- | -------- | -------- |
| netId | number | Yes| ID of the group to delete.|
**Return value**
**Error codes**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.getP2pGroups<sup>9+</sup>
......@@ -1663,6 +1943,13 @@ Obtains information about all P2P groups. This API uses a promise to return the
| -------- | -------- |
| Promise&lt;&nbsp;Array&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt;&nbsp;&gt; | Promise used to return the group information obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## WifiP2pGroupInfo<sup>9+</sup>
......@@ -1701,6 +1988,13 @@ Obtains information about all P2P groups. This API uses an asynchronous callback
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;&nbsp;Array&lt;[WifiP2pGroupInfo](#wifip2pgroupinfo9)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.setDeviceName<sup>9+</sup>
......@@ -1720,12 +2014,13 @@ Sets the device name.
| -------- | -------- | -------- | -------- |
| devName | string | Yes| Device name to set.|
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('wifiStateChange')<sup>9+</sup>
......@@ -1744,6 +2039,14 @@ Registers the WLAN state change events.
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the WLAN state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
**WLAN states**
| **Value**| **Description**|
......@@ -1769,7 +2072,15 @@ Unregisters the WLAN state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
**Example**
```js
......@@ -1811,6 +2122,13 @@ Registers the WLAN connection state change events.
| 0 | Disconnected.|
| 1 | Connected.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.off('wifiConnectionChange')<sup>9+</sup>
......@@ -1827,8 +2145,15 @@ Unregisters the WLAN connection state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN connection state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.on('wifiScanStateChange')<sup>9+</sup>
......@@ -1854,6 +2179,13 @@ Registers the WLAN scan state change events.
| 0 | Scan failed.|
| 1 | Scan successful.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.off('wifiScanStateChange')<sup>9+</sup>
......@@ -1870,8 +2202,15 @@ Unregisters the WLAN scan state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiScanStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN scan state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;number&gt; | No| Callback for the WLAN scan state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.on('wifiRssiChange')<sup>9+</sup>
......@@ -1890,6 +2229,13 @@ Registers the RSSI change events.
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the RSSI, in dBm.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.off('wifiRssiChange')<sup>9+</sup>
......@@ -1906,8 +2252,15 @@ Unregisters the RSSI change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the RSSI. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;number&gt; | No| Callback for the RSSI change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2501000 | Operation failed.|
## wifi.on('hotspotStateChange')<sup>9+</sup>
......@@ -1935,6 +2288,13 @@ Registers the hotspot state change events.
| 2 | Activating|
| 3 | Deactivating|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.off('hotspotStateChange')<sup>9+</sup>
......@@ -1951,8 +2311,15 @@ Unregisters the hotspot state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;number&gt; | No| Callback for the hotspot state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2601000 | Operation failed.|
## wifi.on('p2pStateChange')<sup>9+</sup>
......@@ -1981,6 +2348,14 @@ Registers the P2P state change events.
| 4 | Closing|
| 5 | Closed|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pStateChange')<sup>9+</sup>
off(type: "p2pStateChange", callback?: Callback&lt;number&gt;): void
......@@ -1996,8 +2371,15 @@ Unregisters the P2P state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pStateChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;number&gt; | No| Callback for the P2P state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pConnectionChange')<sup>9+</sup>
......@@ -2016,6 +2398,13 @@ Registers the P2P connection state change events.
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | Yes| Callback invoked to return the P2P connection state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pConnectionChange')<sup>9+</sup>
......@@ -2032,8 +2421,15 @@ Unregisters the P2P connection state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | No| Callback for the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;[WifiP2pLinkedInfo](#wifip2plinkedinfo9)&gt; | No| Callback for the P2P connection state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pDeviceChange')<sup>9+</sup>
......@@ -2052,6 +2448,13 @@ Registers the P2P device state change events.
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the P2P device state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pDeviceChange')<sup>9+</sup>
......@@ -2068,8 +2471,15 @@ Unregisters the P2P device state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | No| Callback for the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;[WifiP2pDevice](#wifip2pdevice9)&gt; | No| Callback for the P2P device state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pPeerDeviceChange')<sup>9+</sup>
......@@ -2088,6 +2498,13 @@ Registers the P2P peer device state change events.
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | Yes| Callback invoked to return the P2P peer device state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pPeerDeviceChange')<sup>9+</sup>
......@@ -2104,8 +2521,15 @@ Unregisters the P2P peer device state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | No| Callback for the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;[WifiP2pDevice[]](#wifip2pdevice9)&gt; | No| Callback for the P2P peer device state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pPersistentGroupChange')<sup>9+</sup>
......@@ -2124,6 +2548,13 @@ Registers the P2P persistent group state change events.
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback&lt;void&gt; | Yes| Callback invoked to return the P2P persistent group state.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pPersistentGroupChange')<sup>9+</sup>
......@@ -2140,8 +2571,15 @@ Unregisters the P2P persistent group state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback&lt;void&gt; | No| Callback for the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;void&gt; | No| Callback for the P2P persistent group state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.on('p2pDiscoveryChange')<sup>9+</sup>
......@@ -2167,6 +2605,13 @@ Registers the P2P device discovery state change events.
| 0 | Initial state.|
| 1 | Discovered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
## wifi.off('p2pDiscoveryChange')<sup>9+</sup>
......@@ -2183,4 +2628,12 @@ Unregisters the P2P device discovery state change events.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| callback | Callback&lt;number&gt; | No| Callback for the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback&lt;number&gt; | No| Callback for the P2P device discovery state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2801000 | Operation failed.|
# WLAN Extension Interface
# @ohos.wifiManagerExt (WLAN Extension Interface)
This **wifiext** module provides WLAN extension interfaces for non-universal products.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The APIs described in this document are used only for non-universal products, such as routers.
......@@ -23,12 +22,13 @@ Enables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.disableHotspot
......@@ -40,12 +40,13 @@ Disables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
**Error codes**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getSupportedPowerModel
......@@ -59,10 +60,17 @@ Obtains the supported power models. This API uses a promise to return the result
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Promise used to return the power models obtained.|
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Promise used to return the power models obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## PowerModel
......@@ -89,10 +97,17 @@ Obtains the supported power models. This API uses an asynchronous callback to re
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is 0 and **data** is the power models obtained. If **err** is not **0**, an error has occurred.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power models obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getPowerModel
......@@ -106,10 +121,17 @@ Obtains the power model. This API uses a promise to return the result.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[PowerModel](#powermodel)&gt; | Promise used to return the power model obtained.|
| Type| Description|
| -------- | -------- |
| Promise&lt;[PowerModel](#powermodel)&gt; | Promise used to return the power models obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getPowerModel
......@@ -123,16 +145,23 @@ Obtains the power model. This API uses an asynchronous callback to return the re
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.setPowerModel
setPowerModel(model: PowerModel) : boolean;
Sets the power model.
Sets the power model.
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
......@@ -140,12 +169,14 @@ Sets the power model.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| model | [PowerModel](#powermodel) | Yes| Power model to set.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| model | [PowerModel](#powermodel) | Yes| Power model to set.|
**Return value**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| -------- | -------- |
| 2701000 | Operation failed.|
......@@ -34,6 +34,8 @@
- Security
- [Ability Access Control Error Codes](errorcode-access-token.md)
- [HUKS Error Codes](errorcode-huks.md)
- [Crypto Framework Error Codes](errorcode-crypto-framework.md)
- [Certificate Error Codes](errorcode-cert.md)
- [User Authentication Error Codes](errorcode-useriam.md)
- Data Management
- [RDB Error Codes](errorcode-data-rdb.md)
......@@ -48,6 +50,7 @@
- Connectivity
- [NFC Error Codes](errorcode-nfc.md)
- [RPC Error Codes](errorcode-rpc.md)
- [Wi-Fi Error Codes](errorcode-wifi.md)
- Basic Features
- [Accessibility Error Codes](errorcode-accessibility.md)
- [FaultLogger Error Codes](errorcode-faultlogger.md)
......
# Wi-Fi Error Codes
## 2401000 STA Internal Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs an operation related to the station (STA).
**Possible Causes**
1. Communication between the Wi-Fi service and the STA failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the Wi-Fi function again.
2. If the error persists, restart the device.
## 2501000 STA Internal Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a STA-related operation.
**Possible Causes**
1. Communication between the Wi-Fi service and the STA failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the Wi-Fi function again.
2. If the error persists, restart the device.
## 2501001 STA Disabled
**Error Message**
Wifi is closed.
**Description**
The Wi-Fi STA function is disabled.
**Possible Causes**
The Wi-Fi function is disabled.
**Solution**
Enable the Wi-Fi function.
## 2601000 Hotspot Module Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a hotspot-related operation.
**Possible Causes**
1. Communication between the Wi-Fi service and the hotspot failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the hotspot again.
2. If the error persists, restart the device.
## 2701000 AP Extension Module Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a hotspot-related operation.
**Possible Causes**
1. Communication between the Wi-Fi service and the hotspot failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the hotspot again.
2. If the error persists, restart the device.
## 2801000 P2P Module Error
**Error Message**
Operation failed.
**Description**
An error occurs when the Wi-Fi service performs a P2P-related operation.
**Possible Causes**
1. Communication with the Wi-Fi service failed.
2. The Wi-Fi chip communication is abnormal.
3. An unknown error has occurred.
**Solution**
1. Disable and then enable the Wi-Fi function again.
2. If the error persists, restart the device.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册