@@ -8,8 +8,6 @@ The **DataStorage** module provides applications with data processing capability
...
@@ -8,8 +8,6 @@ The **DataStorage** module provides applications with data processing capability
> - 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.
>
>
> - The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md).
> - The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md).
>
> - The APIs of this module can be used only in the FA model.
## Modules to Import
## Modules to Import
...
@@ -188,7 +186,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
...
@@ -188,7 +186,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
@@ -267,7 +267,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -267,7 +267,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
| 12100001 | The tokenID is 0, permissionName is longer than 256 bytes, or the count value is invalid. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
...
@@ -315,7 +315,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -315,7 +315,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
| 12100001 | The tokenID is 0, permissionName is longer than 256 bytes, or the count value is invalid. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
...
@@ -370,7 +370,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -370,7 +370,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
| 12100001 | The tokenID is 0, permissionName is longer than 256 bytes, or the count value is invalid. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is not used with |
| 12100004 | The interface is not used with |
...
@@ -418,7 +418,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -418,7 +418,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
| 12100001 | The tokenID is 0, permissionName is longer than 256 bytes, or the count value is invalid. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100002 | The specified tokenID does not exist or refer to an application process. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is not used with |
| 12100004 | The interface is not used with |
...
@@ -551,8 +551,8 @@ Represents the request for querying permission usage records.
...
@@ -551,8 +551,8 @@ Represents the request for querying permission usage records.
| tokenId | number | No | Token ID of the application (invoker).<br>By default, all applications are queried. |
| tokenId | number | No | Token ID of the application (invoker).<br>By default, all applications are queried. |
| isRemote | boolean | No | Whether to query the permission usage records of the remote device.<br>The default value is **false**, which means the permission usage records of the local device are queried by default.|
| isRemote | boolean | No | Whether to query the permission usage records of the remote device.<br>The default value is **false**, which means the permission usage records of the local device are queried by default.|
| deviceId | string | No | ID of the device hosting the target application.<br>The default value is the local device ID. |
| deviceId | string | No | ID of the device hosting the target application.<br>The default value is the local device ID. |
| bundleName | string | No | Bundle name of the target application.<br>By default, all applications are queried.|
| bundleName | string | No | Bundle name of the target application.<br>By default, all applications are queried.|
| permissionNames | Array<Permissions> | No | Permissions to query.<br>By default, the usage records of all permissions are queried. |
| permissionNames | Array<Permissions> | No | Permissions to query.<br>By default, the usage records of all permissions are queried. |
| beginTime | number | No | Start time of the query, in ms.<br>The default value is **0**, which means the start time is not set.|
| beginTime | number | No | Start time of the query, in ms.<br>The default value is **0**, which means the start time is not set.|
@@ -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';
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).