| hasRight(deviceName: string): boolean | Checks whether the user, for example, the application or system, has the device access permissions. The value **true** is returned if the user has the device access permissions; the value **false** is returned otherwise. |
| requestRight(deviceName: string): Promise\<boolean> | Requests the temporary permission for a given application to access the USB device. |
| connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device information returned by **getDevices()**. |
| connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device information returned by `getDevices()`. |
| getDevices(): Array<Readonly\<USBDevice>> | Obtains the USB device list. |
| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | Sets the USB device configuration. |
| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
...
...
@@ -113,7 +113,7 @@ You can set a USB device as a host to connect to a device for data transfer. The
Claim the corresponding interface from deviceList.
interface1 must be one present in the device configuration.
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The Brightness module provides an API for setting the screen brightness.
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -23,7 +23,7 @@ Marks the start of a timeslice trace task.
>
> If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For details, see the bytrace.finishTrace example.
The HiLog subsystem allows your applications or services to output logs based on the specified type, level, and format string. Such logs help you learn the running status of applications and better debug programs.
The HiLog module allows your applications or services to output logs based on the specified type, level, and format string. Such logs help you learn the running status of applications and better debug programs.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -23,8 +23,8 @@ Checks whether logs are printable based on the specified service domain, log tag
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.You can define the value as required.|
| tag | string | Yes | Log tag in the string format.You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.<br/>You can define the value as required.|
| tag | string | Yes | Log tag in the string format.<br/>You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| DEBUG | 3 | Log level used to record more detailed process information than INFO logs to help developers analyze service processes and locate faults.|
| INFO | 4 | Log level used to record key service process nodes and exceptions that occur during service running,<br>for example, no network signal or login failure.<br>These logs should be recorded by the dominant module in the service to avoid repeated logging conducted by multiple invoked modules or low-level functions.|
| INFO | 4 | Log level used to record key service process nodes and exceptions that occur during service running,for example, no network signal or login failure.<br>These logs should be recorded by the dominant module in the service to avoid repeated logging conducted by multiple invoked modules or low-level functions.|
| WARN | 5 | Log level used to record severe, unexpected faults that have little impact on users and can be rectified by the programs themselves or through simple operations.|
| ERROR | 6 | Log level used to record program or functional errors that affect the normal running or use of the functionality and can be fixed at a high cost, for example, by resetting data.|
| FATAL | 7 | Log level used to record program or functionality crashes that cannot be rectified. |
...
...
@@ -67,8 +67,8 @@ DEBUG logs are not recorded in official versions by default. They are available
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.You can define the value as required.|
| tag | string | Yes | Log tag in the string format.You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.<br/>You can define the value as required.|
| tag | string | Yes | Log tag in the string format.<br/>You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| format | string | Yes | Format string used to output logs in a specified format. It can contain several parameters, where the parameter type and privacy identifier are mandatory.<br>Parameters labeled **{public}** are public data and are displayed in plaintext; parameters labeled **{private}** (default value) are private data and are filtered by **<private>**.|
| args | any[] | Yes | Variable-length parameter list corresponding to the format string. The number and type of parameters must map to the identifier in the format string.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.You can define the value as required.|
| tag | string | Yes | Log tag in the string format.You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.<br/>You can define the value as required.|
| tag | string | Yes | Log tag in the string format.<br/>You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| format | string | Yes | Format string used to output logs in a specified format. It can contain several parameters, where the parameter type and privacy identifier are mandatory.<br>Parameters labeled **{public}** are public data and are displayed in plaintext; parameters labeled **{private}** (default value) are private data and are filtered by **<private>**.|
| args | any[] | Yes | Variable-length parameter list corresponding to the format string. The number and type of parameters must map to the identifier in the format string.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.You can define the value as required.|
| tag | string | Yes | Log tag in the string format.You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.<br/>You can define the value as required.|
| tag | string | Yes | Log tag in the string format.<br/>You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| format | string | Yes | Format string used to output logs in a specified format. It can contain several parameters, where the parameter type and privacy identifier are mandatory.<br>Parameters labeled **{public}** are public data and are displayed in plaintext; parameters labeled **{private}** (default value) are private data and are filtered by **<private>**.|
| args | any[] | Yes | Variable-length parameter list corresponding to the format string. The number and type of parameters must map to the identifier in the format string.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.You can define the value as required.|
| tag | string | Yes | Log tag in the string format.You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.<br/>You can define the value as required.|
| tag | string | Yes | Log tag in the string format.<br/>You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| format | string | Yes | Format string used to output logs in a specified format. It can contain several parameters, where the parameter type and privacy identifier are mandatory.<br>Parameters labeled **{public}** are public data and are displayed in plaintext; parameters labeled **{private}** (default value) are private data and are filtered by **<private>**.|
| args | any[] | Yes | Variable-length parameter list corresponding to the format string. The number and type of parameters must map to the identifier in the format string.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.You can define the value as required.|
| tag | string | Yes | Log tag in the string format.You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.<br/>You can define the value as required.|
| tag | string | Yes | Log tag in the string format.<br/>You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| format | string | Yes | Format string used to output logs in a specified format. It can contain several parameters, where the parameter type and privacy identifier are mandatory.<br>Parameters labeled **{public}** are public data and are displayed in plaintext; parameters labeled **{private}** (default value) are private data and are filtered by **<private>**.|
| args | any[] | Yes | Variable-length parameter list corresponding to the format string. The number and type of parameters must map to the identifier in the format string.|
This module provides the functions of tracing service processes and monitoring the system performance. It provides the data needed for hiTraceMeter to carry out performance analysis.
The Performance Tracing module provides the functions of tracing service processes and monitoring the system performance. It provides the data needed for hiTraceMeter to carry out performance analysis.
> 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.
...
...
@@ -17,7 +18,7 @@ import hiTraceMeter from '@ohos.hiTraceMeter';
startTrace(name: string, taskId: number): void
Starts a trace task.**expectedTime** is an optional parameter, which specifies the expected duration of the trace.
Starts a trace task.
If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**.
> The APIs of this module are no longer maintained since API version 7. You are advised to use ['@ohos.hilog](js-apis-hilog.md)' instead.
The Log module provides basic log printing capabilities and supports log printing by log level.
## console.debug
debug(message: string): void
If you want to use more advanced log printing services, for example, filtering logs by the specified ID, you are advised to use [`@ohos.hilog`](js-apis-hilog.md).
Prints debug logs.
- Parameters
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| message | string | Yes | Text to print.|
> **NOTE**
>
> The initial APIs of this module are supported since API version 3. 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 7. It is recommended that you use [`@ohos.batteryInfo`](js-apis-battery-info.md) instead.
> **NOTE**
> - The APIs of this module are no longer maintained since API version 6. You are advised to use [`@ohos.batteryInfo`](js-apis-battery-info.md).
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -22,20 +22,13 @@ Obtains the current charging state and battery level.
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.brightness`](js-apis-brightness.md) instead.
> **NOTE**
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.brightness`](js-apis-brightness.md).
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -24,22 +24,23 @@ Obtains the current screen brightness.
**Parameters**
| Name | Type | Mandatory | Description |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | No | Called when the execution is successful. |
| fail | Function | No | Called when the operation fails. |
| complete | Function | No | Called when the execution is complete |
| success | (data: [BrightnessResponse](#brightnessresponse)) => void | No| Called when API call is successful.|
| fail | (data: string, code: number) => void | No| Called when API call has failed.|
| complete | () => void | No| Called when API call is complete.|
The following values will be returned when the operation is successful.
**Return value of success()**
| Name | Type | Description |
| Name| Type| Description|
| -------- | -------- | -------- |
| value | number | Screen brightness, which ranges from 1 to 255. |
| value | number | Screen brightness. The value is an integer ranging from **1** to **255**.|
**Example**
```js
exportdefault{
```js
exportdefault{
getValue(){
brightness.getValue({
success:function(data){
...
...
@@ -50,8 +51,8 @@ export default {
},
});
},
}
```
}
```
## brightness.setValue
...
...
@@ -64,17 +65,17 @@ Sets the screen brightness.
**Parameters**
| Name | Type | Mandatory | Description |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | number | Yes | Screen brightness. The value is an integer ranging from 1 to 255.<br/>- If the value is less than or equal to **0**, value **1** will be used.<br/>- If the value is greater than **255**, value **255** will be used.<br/>- If the value contains decimals, the integral part of the value will be used. For example, if value **8.1** is set, value **8** will be used. |
| success | Function | No | Called when the execution is successful. |
| fail | Function | No | Called when the operation fails. |
| complete | Function | No | Called when the execution is complete. |
| value | number | Yes| Screen brightness. The value is an integer ranging from **1** to **255**.<br>- If the value is less than or equal to **0**, value **1** will be used.<br>- If the value is greater than **255**, value **255** will be used.<br>- If the value contains decimals, the integral part of the value will be used. For example, if value **8.1** is set, value **8** will be used.|
| success | () => void | No| Called when API call is successful.|
| fail | (data: string, code: number) => void | No| Called when API call has failed.|
| complete | () => void | No| Called when API call is complete.|
**Example**
```js
exportdefault{
```js
exportdefault{
setValue(){
brightness.setValue({
value:100,
...
...
@@ -86,8 +87,8 @@ export default {
},
});
},
}
```
}
```
## brightness.getMode
...
...
@@ -100,22 +101,22 @@ Obtains the screen brightness adjustment mode.
**Parameters**
| Name | Type | Mandatory | Description |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | No | Called when the execution is successful. |
| fail | Function | No | Called when the operation fails. |
| complete | Function | No | Called when the execution is complete |
| success | (data: [BrightnessModeResponse](#brightnessmoderesponse)) => void | No| Called when API call is successful.|
| fail | (data: string, code: number) => void | No| Called when API call has failed.|
| complete | () => void | No| Called when API call is complete.|
The following values will be returned when the operation is successful.
**Return value of success()**
| Name | Type | Description |
| Name| Type| Description|
| -------- | -------- | -------- |
| mode | number | The value can be **0** or **1**.<br/>- **0**: The screen brightness is manually adjusted.<br/>- **1**: The screen brightness is automatically adjusted. |
| mode | number | The value can be **0** or **1**.<br>- **0**: manual adjustment<br>- **1**: automatic adjustment|
**Example**
```js
exportdefault{
```js
exportdefault{
getMode(){
brightness.getMode({
success:function(data){
...
...
@@ -126,8 +127,8 @@ export default {
},
});
},
}
```
}
```
## brightness.setMode
...
...
@@ -139,18 +140,17 @@ Sets the screen brightness adjustment mode.