@@ -585,8 +568,8 @@ Connects to the specified network.
**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**:
SystemCapability.Communication.WiFi.STA
...
...
@@ -680,7 +663,7 @@ try {
letrssi=0;
letband=0;
letlevel=wifi.getSignalLevel(rssi,band);
console.info("lelvel:"+JSON.stringify(lelvel));
console.info("level:"+JSON.stringify(level));
}catch(error){
console.error("failed:"+JSON.stringify(error));
}
...
...
@@ -1278,10 +1261,10 @@ Disables this hotspot.
**Example**
```js
importwififrom'@ohos.wifiManager';
importwififrom'@ohos.wifi';
try{
wifiManager.disableHotspot();
wifi.disableHotspot();
}catch(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
**Example**
```js
importwififrom'@ohos.wifiManager';
importwififrom'@ohos.wifi';
wifi.getP2pPeerDevices((err,data)=>{
if(err){
...
...
@@ -2043,7 +2026,7 @@ import wifi from '@ohos.wifi';
This **wifiext** module provides WLAN extension interfaces for non-universal products.
> **NOTE**
...
...
@@ -27,8 +27,8 @@ Enables the WLAN hotspot.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| **ID**| **Error Message**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.disableHotspot<sup>9+</sup>
...
...
@@ -45,8 +45,8 @@ Disables the WLAN hotspot.
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| **ID**| **Error Message**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getSupportedPowerMode<sup>9+</sup>
...
...
@@ -61,19 +61,19 @@ Obtains the supported power modes. This API uses a promise to return the result.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<Array<[PowerMode](#powermode)>> | Promise used to return the power modes obtained.|
| Type| Description|
| -------- | -------- |
| Promise<Array<[PowerMode](#powermode)>> | Promise used to return the power modes obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| **ID**| **Error Message**|
| -------- | -------- |
| 2701000 | Operation failed.|
## PowerMode
## PowerMode<sup>9+</sup>
Enumerates the power modes.
...
...
@@ -98,16 +98,16 @@ Obtains the supported power modes. This API uses an asynchronous callback to ret
**Parameters**
| 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.|
| 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.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| **ID**| **Error Message**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getPowerMode<sup>9+</sup>
...
...
@@ -122,16 +122,16 @@ Obtains the power mode. This API uses a promise to return the result.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<[PowerMode](#powermode)> | Promise used to return the power modes obtained.|
| Type| Description|
| -------- | -------- |
| Promise<[PowerMode](#powermode)> | Promise used to return the power modes obtained.|
**Error codes**
For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
| **Type**| **Description**|
| -------- | -------- |
| **ID**| **Error Message**|
| -------- | -------- |
| 2701000 | Operation failed.|
## wifiext.getPowerMode<sup>9+</sup>
...
...
@@ -146,21 +146,21 @@ Obtains the power mode. This API uses an asynchronous callback to return the res
**Parameters**
| 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.|
| 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.|
**Error codes**
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.|
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifiext.disableHotspot
...
...
@@ -43,9 +43,9 @@ Disables the WLAN hotspot.
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifiext.getSupportedPowerModel
...
...
@@ -60,9 +60,9 @@ Obtains the supported power models. This API uses a promise to return the result
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.|
| Type| Description|
| -------- | -------- |
| Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.|
## PowerModel
...
...
@@ -90,9 +90,9 @@ Obtains the supported power models. This API uses an asynchronous callback to re
**Parameters**
| 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.|
| 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.|
## wifiext.getPowerModel
...
...
@@ -107,9 +107,9 @@ Obtains the power model. This API uses a promise to return the result.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.|
| Type| Description|
| -------- | -------- |
| Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.|
## wifiext.getPowerModel
...
...
@@ -124,16 +124,16 @@ Obtains the power model. This API uses an asynchronous callback to return the re
**Parameters**
| 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.|
| 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.|