@@ -585,8 +568,8 @@ Connects to the specified network.
...
@@ -585,8 +568,8 @@ Connects to the specified network.
**System API**: This is a system API.
**System API**: This is a system API.
**Required permissions**: ohos.permission.SET_WIFI_INFO, ohos.permission.SET_WIFI_CONFIG, and ohos.permissio.MANAGE_WIFI_CONNECTION (available only to system applications)
**Required permissions**: ohos.permission.SET_WIFI_INFO, ohos.permission.SET_WIFI_CONFIG, and ohos.permission.MANAGE_WIFI_CONNECTION (available only to system applications)
**System capability**:
**System capability**:
SystemCapability.Communication.WiFi.STA
SystemCapability.Communication.WiFi.STA
...
@@ -680,7 +663,7 @@ try {
...
@@ -680,7 +663,7 @@ try {
letrssi=0;
letrssi=0;
letband=0;
letband=0;
letlevel=wifi.getSignalLevel(rssi,band);
letlevel=wifi.getSignalLevel(rssi,band);
console.info("lelvel:"+JSON.stringify(lelvel));
console.info("level:"+JSON.stringify(level));
}catch(error){
}catch(error){
console.error("failed:"+JSON.stringify(error));
console.error("failed:"+JSON.stringify(error));
}
}
...
@@ -1278,10 +1261,10 @@ Disables this hotspot.
...
@@ -1278,10 +1261,10 @@ Disables this hotspot.
**Example**
**Example**
```js
```js
importwififrom'@ohos.wifiManager';
importwififrom'@ohos.wifi';
try{
try{
wifiManager.disableHotspot();
wifi.disableHotspot();
}catch(error){
}catch(error){
console.error("failed:"+JSON.stringify(error));
console.error("failed:"+JSON.stringify(error));
}
}
...
@@ -1644,7 +1627,7 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
...
@@ -1644,7 +1627,7 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
**Example**
**Example**
```js
```js
importwififrom'@ohos.wifiManager';
importwififrom'@ohos.wifi';
wifi.getP2pPeerDevices((err,data)=>{
wifi.getP2pPeerDevices((err,data)=>{
if(err){
if(err){
...
@@ -2043,7 +2026,7 @@ import wifi from '@ohos.wifi';
...
@@ -2043,7 +2026,7 @@ import wifi from '@ohos.wifi';
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.
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**
> **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -26,22 +25,22 @@ Enables WLAN.
...
@@ -26,22 +25,22 @@ Enables WLAN.
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
wifiManager.enableWifi();
wifiManager.enableWifi();
...
@@ -64,22 +63,22 @@ Disables WLAN.
...
@@ -64,22 +63,22 @@ Disables WLAN.
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
wifiManager.disableWifi();
wifiManager.disableWifi();
...
@@ -100,22 +99,22 @@ Checks whether WLAN is enabled.
...
@@ -100,22 +99,22 @@ Checks whether WLAN is enabled.
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.|
| boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letisActivate=wifiManager.isActivate();
letisActivate=wifiManager.isActivate();
...
@@ -137,22 +136,22 @@ Starts a scan for WLAN.
...
@@ -137,22 +136,22 @@ Starts a scan for WLAN.
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
wifiManager.scan();
wifiManager.scan();
...
@@ -173,27 +172,27 @@ Obtains the scan result.
...
@@ -173,27 +172,27 @@ Obtains the scan result.
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| Array<[WifiScanInfo](#wifiscaninfo)> | Returns the hotspots detected.|
| Array<[WifiScanInfo](#wifiscaninfo)> | Returns the hotspots detected.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| Promise<number> | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.|
| Promise<number> | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.|
**Error codes**
**Error codes**
...
@@ -347,13 +346,13 @@ Adds network configuration. This API uses a promise to return the result.
...
@@ -347,13 +346,13 @@ Adds network configuration. This API uses a promise to return the result.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letconfig={
letconfig={
...
@@ -508,23 +507,23 @@ Adds network configuration. This API uses an asynchronous callback to return the
...
@@ -508,23 +507,23 @@ Adds network configuration. This API uses an asynchronous callback to return the
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback<number> | 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.|
| callback | AsyncCallback<number> | 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**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letconfig={
letconfig={
...
@@ -552,27 +551,27 @@ Adds the configuration of a candidate network. This API uses a promise to return
...
@@ -552,27 +551,27 @@ Adds the configuration of a candidate network. This API uses a promise to return
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback<number> | 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.|
| callback | AsyncCallback<number> | 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**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
`````
`````js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letconfig={
letconfig={
...
@@ -643,28 +642,28 @@ Removes the configuration of a candidate network. This API uses a promise to ret
...
@@ -643,28 +642,28 @@ Removes the configuration of a candidate network. This API uses a promise to ret
| networkId | number | Yes| ID of the network configuration to remove.|
| networkId | number | Yes| ID of the network configuration to remove.|
| callback | AsyncCallback<void> | 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.|
| callback | AsyncCallback<void> | 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**
**Error codes**
...
@@ -698,12 +697,12 @@ Removes the configuration of a candidate network. This API uses an asynchronous
...
@@ -698,12 +697,12 @@ Removes the configuration of a candidate network. This API uses an asynchronous
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| networkId | number | Yes| Network configuration ID.|
| networkId | number | Yes| Network configuration ID.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
| 2501001 | Wifi is closed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letnetworkId=0;
letnetworkId=0;
...
@@ -848,15 +847,15 @@ Connects to the specified network. If the device is already connected to a hotsp
...
@@ -848,15 +847,15 @@ Connects to the specified network. If the device is already connected to a hotsp
**System API**: This is a system API.
**System API**: This is a system API.
**Required permissions**: ohos.permission.SET_WIFI_INFO, ohos.permission.SET_WIFI_CONFIG, and ohos.permissio.MANAGE_WIFI_CONNECTION (available only to system applications)
**Required permissions**: ohos.permission.SET_WIFI_INFO, ohos.permission.SET_WIFI_CONFIG, and ohos.permission.MANAGE_WIFI_CONNECTION (available only to system applications)
| rssi | number | Yes| RSSI of the hotspot, in dBm.|
| rssi | number | Yes| RSSI of the hotspot, in dBm.|
| band | number | Yes| Frequency band of the WLAN AP.|
| band | number | Yes| Frequency band of the WLAN AP.|
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| number | Signal level obtained. The value range is [0, 4].|
| number | Signal level obtained. The value range is [0, 4].|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letrssi=0;
letrssi=0;
letband=0;
letband=0;
letlevel=wifiManager.getSignalLevel(rssi,band);
letlevel=wifiManager.getSignalLevel(rssi,band);
console.info("lelvel:" + JSON.stringify(lelvel));
console.info("level:"+JSON.stringify(level));
}catch(error){
}catch(error){
console.error("failed:"+JSON.stringify(error));
console.error("failed:"+JSON.stringify(error));
}
}
...
@@ -975,8 +974,8 @@ Obtains WLAN connection information. This API uses a promise to return the resul
...
@@ -975,8 +974,8 @@ Obtains WLAN connection information. This API uses a promise to return the resul
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<[WifiLinkedInfo](#wifilinkedinfo)> | Promise used to return the WLAN connection information obtained.|
| Promise<[WifiLinkedInfo](#wifilinkedinfo)> | Promise used to return the WLAN connection information obtained.|
**Error codes**
**Error codes**
...
@@ -984,7 +983,7 @@ Obtains WLAN connection information. This API uses a promise to return the resul
...
@@ -984,7 +983,7 @@ Obtains WLAN connection information. This API uses a promise to return the resul
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
| 2501001 | Wifi is closed.|
...
@@ -1000,24 +999,24 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r
...
@@ -1000,24 +999,24 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiLinkedInfo](#wifilinkedinfo)> | 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.|
| callback | AsyncCallback<[WifiLinkedInfo](#wifilinkedinfo)> | 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**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
| 2501001 | Wifi is closed.|
| 2501001 | Wifi is closed.|
**Example**
**Example**
```js
```js
importwififrom'@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
wifi.getLinkedInfo((err,data)=>{
wifiManager.getLinkedInfo((err,data)=>{
if(err){
if(err){
console.error("get linked info error");
console.error("get linked info error");
return;
return;
...
@@ -1025,12 +1024,12 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
...
@@ -1025,12 +1024,12 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2601000 | Operation failed.|
| 2601000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letconfig=wifiManager.getHotspotConfig();
letconfig=wifiManager.getHotspotConfig();
...
@@ -1975,27 +1992,27 @@ Obtains information about the connected stations.
...
@@ -1975,27 +1992,27 @@ Obtains information about the connected stations.
**System API**: This is a system API.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_WIFI_INFO, ohos.permission.LOCATION, ohos.permission.APPROXIMATELY_LOCATION, and ohos.permission.MANAGE_WIFI_HOTSPOT (available only to system applications)
**Required permissions**: ohos.permission.GET_WIFI_INFO, ohos.permission.LOCATION, ohos.permission.APPROXIMATELY_LOCATION, and ohos.permission.MANAGE_WIFI_HOTSPOT (available only to system applications)
@@ -2099,9 +2116,9 @@ Obtains P2P link information. This API uses an asynchronous callback to return t
...
@@ -2099,9 +2116,9 @@ Obtains P2P link information. This API uses an asynchronous callback to return t
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the P2P link information. If **err** is not **0**, an error has occurred.|
| callback | AsyncCallback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the P2P link information. If **err** is not **0**, an error has occurred.|
## wifi.getCurrentP2pGroup<sup>9+</sup>
## wifi.getCurrentP2pGroup<sup>9+</sup>
...
@@ -2116,8 +2133,8 @@ Obtains the current P2P group information. This API uses a promise to return the
...
@@ -2116,8 +2133,8 @@ Obtains the current P2P group information. This API uses a promise to return the
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | Promise used to return the P2P group information obtained.|
| Promise<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | Promise used to return the P2P group information obtained.|
**Error codes**
**Error codes**
...
@@ -2125,7 +2142,7 @@ Obtains the current P2P group information. This API uses a promise to return the
...
@@ -2125,7 +2142,7 @@ Obtains the current P2P group information. This API uses a promise to return the
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
## wifi.getCurrentP2pGroup<sup>9+</sup>
## wifi.getCurrentP2pGroup<sup>9+</sup>
...
@@ -2140,23 +2157,23 @@ Obtains the current P2P group information. This API uses an asynchronous callbac
...
@@ -2140,23 +2157,23 @@ Obtains the current P2P group information. This API uses an asynchronous callbac
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | 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.|
| callback | AsyncCallback<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | 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**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
wifi.getCurrentP2pGroup((err, data) => {
wifiManager.getCurrentP2pGroup((err,data)=>{
if(err){
if(err){
console.error("get current P2P group error");
console.error("get current P2P group error");
return;
return;
...
@@ -2164,7 +2181,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
...
@@ -2164,7 +2181,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
console.info("get current P2P group: "+JSON.stringify(data));
console.info("get current P2P group: "+JSON.stringify(data));
});
});
wifi.getCurrentP2pGroup().then(data => {
wifiManager.getCurrentP2pGroup().then(data=>{
console.info("get current P2P group: "+JSON.stringify(data));
console.info("get current P2P group: "+JSON.stringify(data));
});
});
```
```
...
@@ -2181,16 +2198,16 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r
...
@@ -2181,16 +2198,16 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<[WifiP2pDevice[]](#wifip2pdevice9)> | Promise used to return the peer device list.|
| Promise<[WifiP2pDevice[]](#wifip2pdevice9)> | Promise used to return the peer device list.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
## wifi.getP2pPeerDevices<sup>9+</sup>
## wifi.getP2pPeerDevices<sup>9+</sup>
...
@@ -2205,23 +2222,23 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
...
@@ -2205,23 +2222,23 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiP2pDevice[]](#wifip2pdevice9)> | 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.|
| callback | AsyncCallback<[WifiP2pDevice[]](#wifip2pdevice9)> | 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**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
wifi.getP2pPeerDevices((err, data) => {
wifiManager.getP2pPeerDevices((err,data)=>{
if(err){
if(err){
console.error("get P2P peer devices error");
console.error("get P2P peer devices error");
return;
return;
...
@@ -2229,7 +2246,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
...
@@ -2229,7 +2246,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
@@ -2276,16 +2293,16 @@ Obtains the local device information in the P2P connection. This API uses a prom
...
@@ -2276,16 +2293,16 @@ Obtains the local device information in the P2P connection. This API uses a prom
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<[WifiP2pDevice](#wifip2pdevice9)> | Promise used to return the local device information obtained.|
| Promise<[WifiP2pDevice](#wifip2pdevice9)> | Promise used to return the local device information obtained.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
## wifi.getP2pLocalDevice<sup>9+</sup>
## wifi.getP2pLocalDevice<sup>9+</sup>
...
@@ -2300,17 +2317,19 @@ Obtains the local device information in the P2P connection. This API uses an asy
...
@@ -2300,17 +2317,19 @@ Obtains the local device information in the P2P connection. This API uses an asy
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiP2pDevice](#wifip2pdevice9)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the local device information obtained. If **err** is not **0**, an error has occurred.|
| callback | AsyncCallback<[WifiP2pDevice](#wifip2pdevice9)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the local device information obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
wifiManager.getP2pLocalDevice((err,data)=>{
wifiManager.getP2pLocalDevice((err,data)=>{
if(err){
if(err){
...
@@ -2320,7 +2339,7 @@ Obtains the local device information in the P2P connection. This API uses an asy
...
@@ -2320,7 +2339,7 @@ Obtains the local device information in the P2P connection. This API uses an asy
console.info("get P2P local device: "+JSON.stringify(data));
console.info("get P2P local device: "+JSON.stringify(data));
});
});
wifi.getP2pLocalDevice().then(data => {
wifiManager.getP2pLocalDevice().then(data=>{
console.info("get P2P local device: "+JSON.stringify(data));
console.info("get P2P local device: "+JSON.stringify(data));
});
});
```
```
...
@@ -2337,21 +2356,21 @@ Creates a P2P group.
...
@@ -2337,21 +2356,21 @@ Creates a P2P group.
**Parameters**
**Parameters**
| **Name**| **Type**| Mandatory| **Description**|
| **Name**| **Type**| Mandatory| **Description**|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| Group configuration.|
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| Group configuration.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
letconfig={
letconfig={
...
@@ -2411,12 +2430,12 @@ Removes this P2P group.
...
@@ -2411,12 +2430,12 @@ Removes this P2P group.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
**Example**
**Example**
```
```js
import wifi from '@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
try{
try{
wifiManager.removeP2pGroup();
wifiManager.removeP2pGroup();
...
@@ -2437,25 +2456,25 @@ Sets up a P2P connection.
...
@@ -2437,25 +2456,25 @@ Sets up a P2P connection.
**Parameters**
**Parameters**
| **Name**| **Type**| Mandatory| **Description**|
| **Name**| **Type**| Mandatory| **Description**|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| P2P group configuration.|
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| P2P group configuration.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
@@ -2719,16 +2738,16 @@ Obtains information about all P2P groups. This API uses an asynchronous callback
...
@@ -2719,16 +2738,16 @@ Obtains information about all P2P groups. This API uses an asynchronous callback
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo9)>> | 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.|
| callback | AsyncCallback< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo9)>> | 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**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback<number> | No| Callback for the WLAN state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<number> | 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**
**Error codes**
...
@@ -2826,23 +2845,23 @@ Unregisters the WLAN state change events.
...
@@ -2826,23 +2845,23 @@ Unregisters the WLAN state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2501000 | Operation failed.|
| 2501000 | Operation failed.|
**Example**
**Example**
```js
```js
importwififrom'@ohos.wifi';
importwifiManagerfrom'@ohos.wifiManager';
varrecvPowerNotifyFunc=result=>{
varrecvPowerNotifyFunc=result=>{
console.info("Receive power state change event: "+result);
console.info("Receive power state change event: "+result);
| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback<number> | No| Callback for the WLAN connection state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<number> | 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**
**Error codes**
...
@@ -2899,23 +2918,23 @@ Unregisters the WLAN connection state change events.
...
@@ -2899,23 +2918,23 @@ Unregisters the WLAN connection state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback<number> | No| Callback for the RSSI change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<number> | No| Callback for the RSSI change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Error codes**
**Error codes**
...
@@ -3036,12 +3055,12 @@ Unregisters the RSSI change events.
...
@@ -3036,12 +3055,12 @@ Unregisters the RSSI change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| type | string | Yes| Event type. The value is **hotspotStateChange**.|
| type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback<number> | No| Callback for the hotspot state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<number> | 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**
**Error codes**
...
@@ -3110,12 +3129,12 @@ Unregisters the hotspot state change events.
...
@@ -3110,12 +3129,12 @@ Unregisters the hotspot state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2601000 | Operation failed.|
| 2601000 | Operation failed.|
**Example**
**Example**
```js
```js
importwififrom'@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
varrecvHotspotStateChangeFunc=result=>{
varrecvHotspotStateChangeFunc=result=>{
console.info("Receive hotspot state change event: "+result);
console.info("Receive hotspot state change event: "+result);
...
@@ -3126,7 +3145,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
...
@@ -3126,7 +3145,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
| type | string | Yes| Event type. The value is **p2pStateChange**.|
| type | string | Yes| Event type. The value is **p2pStateChange**.|
| callback | Callback<number> | No| Callback for the P2P state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<number> | 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**
**Error codes**
...
@@ -3185,12 +3204,12 @@ Unregisters the P2P state change events.
...
@@ -3185,12 +3204,12 @@ Unregisters the P2P state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
**Example**
**Example**
```js
```js
importwififrom'@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
varrecvP2pStateChangeFunc=result=>{
varrecvP2pStateChangeFunc=result=>{
console.info("Receive p2p state change event: "+result);
console.info("Receive p2p state change event: "+result);
...
@@ -3201,9 +3220,9 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
...
@@ -3201,9 +3220,9 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | No| Callback for the P2P connection state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | 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**
**Error codes**
...
@@ -3250,12 +3269,12 @@ Unregisters the P2P connection state change events.
...
@@ -3250,12 +3269,12 @@ Unregisters the P2P connection state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback<[WifiP2pDevice](#wifip2pdevice9)> | No| Callback for the P2P device state change. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<[WifiP2pDevice](#wifip2pdevice9)> | 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**
**Error codes**
...
@@ -3315,12 +3334,12 @@ Unregisters the P2P device state change events.
...
@@ -3315,12 +3334,12 @@ Unregisters the P2P device state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback<[WifiP2pDevice[]](#wifip2pdevice9)> | 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.|
| callback | Callback<[WifiP2pDevice[]](#wifip2pdevice9)> | 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**
**Error codes**
...
@@ -3380,12 +3399,12 @@ Unregisters the P2P peer device state change events.
...
@@ -3380,12 +3399,12 @@ Unregisters the P2P peer device state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback<void> | 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.|
| callback | Callback<void> | 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**
**Error codes**
...
@@ -3445,12 +3464,12 @@ Unregisters the P2P persistent group state change events.
...
@@ -3445,12 +3464,12 @@ Unregisters the P2P persistent group state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **ID**| **Error Message**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2801000 | Operation failed.|
| 2801000 | Operation failed.|
**Example**
**Example**
```js
```js
importwififrom'@ohos.wifiManager';
importwifiManagerfrom'@ohos.wifiManager';
varrecvP2pPersistentGroupChangeFunc=result=>{
varrecvP2pPersistentGroupChangeFunc=result=>{
console.info("Receive recv p2p persistent group change event: "+result);
console.info("Receive recv p2p persistent group change event: "+result);
...
@@ -3461,7 +3480,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
...
@@ -3461,7 +3480,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| callback | Callback<number> | 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.|
| callback | Callback<number> | 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**
**Error codes**
...
@@ -3517,12 +3536,12 @@ Unregisters the P2P device discovery state change events.
...
@@ -3517,12 +3536,12 @@ Unregisters the P2P device discovery state change events.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
This **wifiext** module provides WLAN extension interfaces for non-universal products.
This **wifiext** module provides WLAN extension interfaces for non-universal products.
> **NOTE**
> **NOTE**
...
@@ -27,8 +27,8 @@ Enables the WLAN hotspot.
...
@@ -27,8 +27,8 @@ Enables the WLAN hotspot.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2701000 | Operation failed.|
| 2701000 | Operation failed.|
## wifiext.disableHotspot<sup>9+</sup>
## wifiext.disableHotspot<sup>9+</sup>
...
@@ -45,8 +45,8 @@ Disables the WLAN hotspot.
...
@@ -45,8 +45,8 @@ Disables the WLAN hotspot.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2701000 | Operation failed.|
| 2701000 | Operation failed.|
## wifiext.getSupportedPowerMode<sup>9+</sup>
## wifiext.getSupportedPowerMode<sup>9+</sup>
...
@@ -61,19 +61,19 @@ Obtains the supported power modes. This API uses a promise to return the result.
...
@@ -61,19 +61,19 @@ Obtains the supported power modes. This API uses a promise to return the result.
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<Array<[PowerMode](#powermode)>> | Promise used to return the power modes obtained.|
| Promise<Array<[PowerMode](#powermode)>> | Promise used to return the power modes obtained.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2701000 | Operation failed.|
| 2701000 | Operation failed.|
## PowerMode
## PowerMode<sup>9+</sup>
Enumerates the power modes.
Enumerates the power modes.
...
@@ -98,16 +98,16 @@ Obtains the supported power modes. This API uses an asynchronous callback to ret
...
@@ -98,16 +98,16 @@ Obtains the supported power modes. This API uses an asynchronous callback to ret
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<Array<[PowerMode](#powermode)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power modes obtained. If **err** is not **0**, an error has occurred.|
| callback | AsyncCallback<Array<[PowerMode](#powermode)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power modes obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2701000 | Operation failed.|
| 2701000 | Operation failed.|
## wifiext.getPowerMode<sup>9+</sup>
## wifiext.getPowerMode<sup>9+</sup>
...
@@ -122,16 +122,16 @@ Obtains the power mode. This API uses a promise to return the result.
...
@@ -122,16 +122,16 @@ Obtains the power mode. This API uses a promise to return the result.
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<[PowerMode](#powermode)> | Promise used to return the power modes obtained.|
| Promise<[PowerMode](#powermode)> | Promise used to return the power modes obtained.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| **ID**| **Error Message**|
| -------- | -------- |
| -------- | -------- |
| 2701000 | Operation failed.|
| 2701000 | Operation failed.|
## wifiext.getPowerMode<sup>9+</sup>
## wifiext.getPowerMode<sup>9+</sup>
...
@@ -146,21 +146,21 @@ Obtains the power mode. This API uses an asynchronous callback to return the res
...
@@ -146,21 +146,21 @@ Obtains the power mode. This API uses an asynchronous callback to return the res
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[PowerMode](#powermode)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power mode obtained. If **err** is not **0**, an error has occurred.|
| callback | AsyncCallback<[PowerMode](#powermode)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power mode obtained. If **err** is not **0**, an error has occurred.|
**Error codes**
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifiext.disableHotspot
## wifiext.disableHotspot
...
@@ -43,9 +43,9 @@ Disables the WLAN hotspot.
...
@@ -43,9 +43,9 @@ Disables the WLAN hotspot.
**Return value**
**Return value**
| **Type**| **Description**|
| **Type**| **Description**|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifiext.getSupportedPowerModel
## wifiext.getSupportedPowerModel
...
@@ -60,9 +60,9 @@ Obtains the supported power models. This API uses a promise to return the result
...
@@ -60,9 +60,9 @@ Obtains the supported power models. This API uses a promise to return the result
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.|
| Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.|
## PowerModel
## PowerModel
...
@@ -90,9 +90,9 @@ Obtains the supported power models. This API uses an asynchronous callback to re
...
@@ -90,9 +90,9 @@ Obtains the supported power models. This API uses an asynchronous callback to re
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<Array<[PowerModel](#powermodel)>> | 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.|
| callback | AsyncCallback<Array<[PowerModel](#powermodel)>> | 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.|
## wifiext.getPowerModel
## wifiext.getPowerModel
...
@@ -107,9 +107,9 @@ Obtains the power model. This API uses a promise to return the result.
...
@@ -107,9 +107,9 @@ Obtains the power model. This API uses a promise to return the result.
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.|
| Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.|
## wifiext.getPowerModel
## wifiext.getPowerModel
...
@@ -124,16 +124,16 @@ Obtains the power model. This API uses an asynchronous callback to return the re
...
@@ -124,16 +124,16 @@ Obtains the power model. This API uses an asynchronous callback to return the re
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[PowerModel](#powermodel)> | 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.|
| callback | AsyncCallback<[PowerModel](#powermodel)> | 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.|