From 55d678d6fc07f1b70982750fb593e0a9cd2f7bfe Mon Sep 17 00:00:00 2001 From: shawn_he Date: Thu, 13 Jul 2023 17:48:12 +0800 Subject: [PATCH] update docs Signed-off-by: shawn_he --- en/application-dev/dfx/Readme-EN.md | 1 + .../dfx/hitracemeter-native-guidelines.md | 52 ++ .../apis/js-apis-resource-manager.md | 484 ++++++++++++++++++ .../reference/apis/js-apis-usbManager.md | 100 +++- .../errorcodes/errorcode-resource-manager.md | 86 +++- .../reference/errorcodes/errorcode-usb.md | 18 + .../subsystems/subsys-thermal_log.md | 14 +- 7 files changed, 729 insertions(+), 26 deletions(-) create mode 100644 en/application-dev/dfx/hitracemeter-native-guidelines.md diff --git a/en/application-dev/dfx/Readme-EN.md b/en/application-dev/dfx/Readme-EN.md index b5990650c6..977812697f 100644 --- a/en/application-dev/dfx/Readme-EN.md +++ b/en/application-dev/dfx/Readme-EN.md @@ -4,6 +4,7 @@ - [Development of Performance Tracing](hitracemeter-guidelines.md) - [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md) - [HiLog Development (Native)](hilog-guidelines.md) +- [Development of Performance Tracing (Native)](hitracemeter-native-guidelines.md) - Error Management - [Development of Error Manager](errormanager-guidelines.md) - [Development of Application Recovery](apprecovery-guidelines.md) diff --git a/en/application-dev/dfx/hitracemeter-native-guidelines.md b/en/application-dev/dfx/hitracemeter-native-guidelines.md new file mode 100644 index 0000000000..bb0274f7c4 --- /dev/null +++ b/en/application-dev/dfx/hitracemeter-native-guidelines.md @@ -0,0 +1,52 @@ +# Development of Performance Tracing (Native) + +## Introduction + +hiTraceMeter provides APIs for system performance tracing. You can call the APIs provided by the hiTraceMeter module in your own service logic to effectively track service processes and check the system performance. +> **NOTE** + +> - This development guide is applicable only when you use Native APIs for application development. For details about APIs, see [API Reference](../reference/native-apis/_hitrace.md). +> - For details about how to use ArkTS APIs for application development, see [Development Guidelines](hitracemeter-guidelines.md) and [API Reference](../reference/apis/js-apis-hitracemeter.md). + +## Available APIs + +| API| Description| +| -------- | -------- | +| void OH_HiTrace_StartTrace(const char* name) | Starts a synchronous time slice trace.| +| void OH_HiTrace_FinishTrace() | Ends a synchronous time slice trace.| +| void OH_HiTrace_StartAsyncTrace(const char* name, int32_t taskId) | Starts an asynchronous time slice trace.| +| void OH_HiTrace_FinishAsyncTrace(const char* name, int32_t taskId) | Ends an asynchronous time slice trace.| +| void OH_HiTrace_CountTrace(const char* name, int64_t count) | Performs an integer trace.| + +**Parameter Description** + +| Name| Type| Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| name | string | No | Name of the variable.| +| taskId | number | No | ID used to indicate the association of APIs in a trace. If multiple traces with the same name need to be performed at the same time or a trace needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**.| +| count | number | No | Value of the variable. | + +## Development Example + +1. Add the link of **libhitrace_ndk.z.so** to **CMakeLists.txt**. + ``` + target_link_libraries(entry PUBLIC libhitrace_ndk.z.so) + ``` +2. Reference the **hitrace** header file in the source file. + ```c++ + #include "hitrace/trace.h" + ``` +3. Open the hdc shell and run the **hitrace --trace_begin app** command to enable the trace function. + ```shell + capturing trace... + ``` +4. Perform a performance trace. The following uses asynchronous trace as an example. + ```c++ + OH_HiTrace_StartAsyncTrace("hitraceTest", 123); + OH_HiTrace_FinishAsyncTrace("hitraceTest", 123); + ``` +5. Run the **hitrace --trace_dump | grep hitraceTest** command to view the trace result. + ```shell + <...>-2477 (-------) [001] .... 396.427165: tracing_mark_write: S|2477|H:hitraceTest 123 + <...>-2477 (-------) [001] .... 396.427196: tracing_mark_write: F|2477|H:hitraceTest 123 + ``` diff --git a/en/application-dev/reference/apis/js-apis-resource-manager.md b/en/application-dev/reference/apis/js-apis-resource-manager.md index a1b9871727..0b991202ad 100644 --- a/en/application-dev/reference/apis/js-apis-resource-manager.md +++ b/en/application-dev/reference/apis/js-apis-resource-manager.md @@ -151,6 +151,45 @@ Obtains the **ResourceManager** object of an application based on the specified ``` +## resourceManager.getSystemResourceManager10+ + +getSystemResourceManager(): ResourceManager + +Obtains a **ResourceManager** object. + +**System capability**: SystemCapability.Global.ResourceManager + +**Return value** + +| Type | Description | +| ---------------------------------------- | ------------------ | +| Resourcemanager | **ResourceManager** object.| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001009 | If application can't access system resource. | + +**Example** + ```js +import resourceManager from '@ohos.resourceManager'; + +try { + let systemResourceManager = resourceManager.getSystemResourceManager(); + systemResourceManager.getStringValue($r('sys.string.ohos_lab_vibrate').id).then(value => { + let str = value; + }).catch(error => { + console.log("systemResourceManager getStringValue promise error is " + error); + }); +} catch (error) { + console.error(`systemResourceManager getStringValue failed, error code: ${error.code}, message: ${error.message}.`) +} + ``` + + ## Direction Enumerates the screen directions. @@ -3249,6 +3288,451 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getColor10+ + +getColor(resId: number, callback: AsyncCallback<number>): void; + +Obtains the color value corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | --------------- | +| resId | number | Yes | Resource ID. | +| callback | AsyncCallback<number> | Yes | Asynchronous callback used to return the result.| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the module resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | + +**Example (stage)** + ```ts + try { + this.context.resourceManager.getColor($r('app.color.test').id, (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let str = value; + } + }); + } catch (error) { + console.error(`callback getColor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColor10+ + +getColor(resId: number): Promise<number> + +Obtains the color value corresponding to the specified resource ID. This API uses a promise to return the result. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ----- | +| resId | number | Yes | Resource ID.| + +**Return value** + +| Type | Description | +| --------------------- | ----------- | +| Promise<number> | Color value corresponding to the resource ID (decimal).| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + try { + this.context.resourceManager.getColor($r('app.color.test').id).then(value => { + let str = value; + }).catch(error => { + console.log("getColor promise error is " + error); + }); + } catch (error) { + console.error(`promise getColor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColor10+ + +getColor(resource: Resource, callback: AsyncCallback<number>): void; + +Obtains the color value corresponding to the specified resource object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | --------------- | +| resource | [Resource](#resource9) | Yes | Resource object. | +| callback | AsyncCallback<number> | Yes | Asynchronous callback used to return the result.| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.color.test').id + }; + try { + this.context.resourceManager.getColor(resource, (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let str = value; + } + }); + } catch (error) { + console.error(`callback getColor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColor10+ + +getColor(resource: Resource): Promise<number>; + +Obtains the color value corresponding to the specified resource object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ---- | +| resource | [Resource](#resource9) | Yes | Resource object.| + +**Return value** + +| Type | Description | +| --------------------- | ---------------- | +| Promise<number> | Color value corresponding to the resource object (decimal).| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.color.test').id + }; + try { + this.context.resourceManager.getColor(resource).then(value => { + let str = value; + }).catch(error => { + console.log("getColor promise error is " + error); + }); + } catch (error) { + console.error(`callback getColor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColorByName10+ + +getColorByName(resName: string, callback: AsyncCallback<number>): void + +Obtains the color value corresponding to the specified resource name. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | --------------- | +| resName | string | Yes | Resource name. | +| callback | AsyncCallback<number> | Yes | Asynchronous callback used to return the result.| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + try { + this.context.resourceManager.getColorByName("test", (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let string = value; + } + }); + } catch (error) { + console.error(`callback getColorByName failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColorByName10+ + +getStringByName(resName: string): Promise<number> + +Obtains the color value corresponding to the specified resource name. This API uses a promise to return the result. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------ | ---- | ---- | +| resName | string | Yes | Resource name.| + +**Return value** + +| Type | Description | +| --------------------- | ---------- | +| Promise<number> | Color value corresponding to the resource name (decimal).| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + try { + this.context.resourceManager.getColorByName("test").then(value => { + let string = value; + }).catch(error => { + console.log("getColorByName promise error is " + error); + }); + } catch (error) { + console.error(`promise getColorByName failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColorSync10+ + +getColorSync(resId: number) : number; + +Obtains the color value corresponding to the specified resource ID. The API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ----- | +| resId | number | Yes | Resource ID.| + +**Return value** + +| Type | Description | +| ------ | ----------- | +| number | Color value corresponding to the resource ID (decimal).| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + try { + this.context.resourceManager.getColorSync($r('app.color.test').id); + } catch (error) { + console.error(`getColorSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColorSync10+ + +getColorSync(resource: Resource): number + +Obtains the color value corresponding to the specified resource object. The API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ---- | +| resource | [Resource](#resource9) | Yes | Resource object.| + +**Return value** + +| Type | Description | +| ------ | ---------------- | +| number | Color value corresponding to the resource object (decimal).| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.color.test').id + }; + try { + this.context.resourceManager.getColorSync(resource); + } catch (error) { + console.error(`getColorSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getColorByNameSync10+ + +getColorByNameSync(resName: string) : number; + +Obtains the color value corresponding to the specified resource name. The API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------ | ---- | ---- | +| resName | string | Yes | Resource name.| + +**Return value** + +| Type | Description | +| ------ | ---------- | +| number | Color value corresponding to the resource name (decimal).| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | +| 9001006 | If the resource re-ref too much. | + +**Example** + ```ts + try { + this.context.resourceManager.getColorByNameSync("test"); + } catch (error) { + console.error(`getColorByNameSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### addResource10+ + +addResource(path: string) : void; + +Loads resources from the specified path. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ---- | +| path | string | Yes | Resource path.| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001010 | If the overlay path is invalid. | + +**Example** + ```ts + let path = getContext().bundleCodeDir + "/library1-default-signed.hsp"; + try { + this.context.resourceManager.addResource(path); + } catch (error) { + console.error(`addResource failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### removeResource10+ + +removeResource(path: string) : void; + +Removes the resources loaded from the specified path to restore the original resources. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ---- | +| path | string | Yes | Resource path.| + +**Error codes** + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001010 | If the overlay path is invalid. | + +**Example** + ```ts + let path = getContext().bundleCodeDir + "/library1-default-signed.hsp"; + try { + this.resmgr.removeResource(path); + } catch (error) { + console.error(`removeResource failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + ### getString(deprecated) getString(resId: number, callback: AsyncCallback<string>): void diff --git a/en/application-dev/reference/apis/js-apis-usbManager.md b/en/application-dev/reference/apis/js-apis-usbManager.md index ac6de75dd0..204318356f 100644 --- a/en/application-dev/reference/apis/js-apis-usbManager.md +++ b/en/application-dev/reference/apis/js-apis-usbManager.md @@ -152,7 +152,7 @@ Checks whether the user, for example, the application or system, has the device **Example** ```js -let devicesName="1-1"; +let devicesName = "1-1"; let bool = usb.hasRight(devicesName); console.log(`${bool}`); ``` @@ -180,7 +180,7 @@ Requests the temporary permission for the application to access a USB device. Th **Example** ```js -let devicesName="1-1"; +let devicesName = "1-1"; usb.requestRight(devicesName).then((ret) => { console.log(`requestRight = ${ret}`); }); @@ -209,7 +209,7 @@ Removes the permission for the application to access a USB device. **Example** ```js -let devicesName= "1-1"; +let devicesName = "1-1"; if (usb.removeRight(devicesName)) { console.log(`Succeed in removing right`); } @@ -277,6 +277,15 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +let device = devicesList[0]; +usb.requestRight(device.name); +let devicepipe = usb.connectDevice(device); +let interfaces = device.configs[0].interfaces[0]; let ret = usb.claimInterface(devicepipe, interfaces); console.log(`claimInterface = ${ret}`); ``` @@ -307,7 +316,17 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c **Example** ```js -let ret = usb.releaseInterface(devicepipe, interfaces); +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +let device = devicesList[0]; +usb.requestRight(device.name); +let devicepipe = usb.connectDevice(device); +let interfaces = device.configs[0].interfaces[0]; +let ret = usb.claimInterface(devicepipe, interfaces); +ret = usb.releaseInterface(devicepipe, interfaces); console.log(`releaseInterface = ${ret}`); ``` @@ -337,6 +356,15 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +let device = devicesList[0]; +usb.requestRight(device.name); +let devicepipe = usb.connectDevice(device); +let config = device.configs[0]; let ret = usb.setConfiguration(devicepipe, config); console.log(`setConfiguration = ${ret}`); ``` @@ -367,7 +395,17 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js -let ret = usb.setInterface(devicepipe, interfaces); +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +let device = devicesList[0]; +usb.requestRight(device.name); +let devicepipe = usb.connectDevice(device); +let interfaces = device.configs[0].interfaces[0]; +let ret = usb.claimInterface(devicepipe, interfaces); +ret = usb.setInterface(devicepipe, interfaces); console.log(`setInterface = ${ret}`); ``` @@ -396,6 +434,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +usb.requestRight(devicesList[0].name); +let devicepipe = usb.connectDevice(devicesList[0]); let ret = usb.getRawDescriptor(devicepipe); ``` @@ -424,6 +469,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +usb.requestRight(devicesList[0].name); +let devicepipe = usb.connectDevice(devicesList[0]); let ret = usb.getFileDescriptor(devicepipe); ``` @@ -462,6 +514,14 @@ let param = { index: 0, data: null }; + +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +usb.requestRight(devicesList[0].name); +let devicepipe = usb.connectDevice(devicesList[0]); usb.controlTransfer(devicepipe, param).then((ret) => { console.log(`controlTransfer = ${ret}`); }) @@ -498,8 +558,21 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi // Call usb.getDevices to obtain a data set. Then, obtain a USB device and its access permission. // Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device. // Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer. +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +let device = devicesList[0]; +usb.requestRight(device.name); + +let devicepipe = usb.connectDevice(device); +let interfaces = device.configs[0].interfaces[0]; +let endpoint = device.configs[0].interfaces[0].endpoints[0]; +let ret = usb.claimInterface(devicepipe, interfaces); +let buffer = new Uint8Array(128); usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${ret}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -528,6 +601,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js +let devicesList = usb.getDevices(); +if (devicesList.length == 0) { + console.log(`device list is empty`); +} + +usb.requestRight(devicesList[0].name); +let devicepipe = usb.connectDevice(devicesList[0]); let ret = usb.closePipe(devicepipe); console.log(`closePipe = ${ret}`); ``` @@ -606,6 +686,14 @@ Sets the current USB function list in Device mode. | ------ | ------------------------------ | ---- | ----------------- | | funcs | [FunctionType](#functiontype) | Yes | USB function list in numeric mask format.| +**Error codes** + +For details about the error codes, see [USB Error Codes](../errorcodes/errorcode-usb.md). + +| ID| Error Message | +| -------- | ---------------------------------------------------- | +| 14400002 | Permission denied.The HDC is disabled by the system. | + **Return value** | Type | Description | diff --git a/en/application-dev/reference/errorcodes/errorcode-resource-manager.md b/en/application-dev/reference/errorcodes/errorcode-resource-manager.md index d22ffb059b..0087cce7e7 100644 --- a/en/application-dev/reference/errorcodes/errorcode-resource-manager.md +++ b/en/application-dev/reference/errorcodes/errorcode-resource-manager.md @@ -12,15 +12,15 @@ The resId invalid. **Description** -This error code is reported if the specified resource ID meets the type requirement but the resource ID does not exist. +This error code is reported if the specified resId meets the type requirement but the **resId** does not exist. **Possible Causes** -The specified resource ID does not exist. +The specified **resId** does not exist. **Solution** -Check whether the specified resource ID exists. +Check whether the specified **resId** exists. ## 9001002 Matching Resource Not Found Based on the Specified Resource ID @@ -30,17 +30,17 @@ The resource not found by resId. **Description** -This error code is reported if the specified resource ID meets the type requirement but no resource is found based on the resource ID. +This error code is reported if the specified **resId** meets the type requirement but no resource is found based on the **resId**. **Possible Causes** -1. The specified resource ID is incorrect. +1. The specified **resId** is incorrect. 2. Resource parsing is incorrect. **Solution** -Check whether the specified resource ID is correct. +Check whether the specified **resId** is correct. ## 9001003 Invalid Resource Name @@ -50,15 +50,15 @@ The resName invalid. **Description** -This error code is reported if the specified resource name meets the type requirement but the resource name does not exist. +This error code is reported if the specified **resName** meets the type requirement but the **resName** does not exist. **Possible Causes** -The specified resource name does not exist. +The specified **resName** does not exist. **Solution** -Check whether the specified resource name is correct. +Check whether the specified **resName** is correct. ## 9001004 Matching Resource Not Found Based on the Specified Resource Name @@ -68,17 +68,17 @@ The resource not found by resName. **Description** -This error code is reported if the specified resource ID meets the type requirement but no resource is found based on the resource ID. +This error code is reported if the specified resId meets the type requirement but no resource is found based on the **resId**. **Possible Causes** -1. The specified resource name is incorrect. +1. The specified **resName** is incorrect. 2. Resource parsing is incorrect. **Solution** -Check whether the specified resource name is correct. +Check whether the specified **resName** is correct. ## 9001005 Invalid Relative Path @@ -115,3 +115,65 @@ Resources are referenced cyclically. **Solution** Check the reference of resource $, and remove the cyclic reference, if any. + +## 9001007 Failed to Format the Resource Obtained Based on resId + +**Error Message** + +The resource obtained by resId formatting error. + +**Description** + +This error code is reported in the case of a failure to format the string resource obtained based on **resId**. + +**Possible Causes** + +1. The parameter type is not supported. + +2. The numbers of parameters and placeholders are inconsistent. + +3. The parameter does not match the placeholder type. + +**Solution** + +Check whether the number and type of **args** parameters are the same as those of placeholders. + +## 9001008 Failed to Format the Resource Obtained Based on resName + +**Error Message** + +The resource obtained by resName formatting error. + +**Description** + +This error code is reported in the case of a failure to format the string resource obtained based on **resName**. + +**Possible Causes** + +1. The parameter type is not supported. + +2. The numbers of parameters and placeholders are inconsistent. + +3. The parameter does not match the placeholder type. + +**Solution** + +Check whether the number and type of **args** parameters are the same as those of placeholders. + +## 9001009 Failed to Obtain a ResourceManager Object + +**Error Message** + +Get system resource manager failed. + +**Description** + +This error code is reported in the case of a failure to obtain a ResourceManager object. + +**Possible Causes** + +System resources are not loaded to the sandbox path of the application process. + +**Solution** + +Check whether the application process contains the sandbox path of system resources. diff --git a/en/application-dev/reference/errorcodes/errorcode-usb.md b/en/application-dev/reference/errorcodes/errorcode-usb.md index a29c15a13d..f60d87274b 100644 --- a/en/application-dev/reference/errorcodes/errorcode-usb.md +++ b/en/application-dev/reference/errorcodes/errorcode-usb.md @@ -21,3 +21,21 @@ The permission to access the USB device is not granted. **Solution** Call **requestRight** to request for the permission to access the USB device. + +## 14400002 HDC Disabled + +**Error Message** + +Permission denied.The HDC is disabled by the system. + +**Description** + +This error code is reported if HDC is disabled by the system. + +**Possible Causes** + +The USB debugging permission is not available. + +**Solution** + +Apply for the USB debugging permission. diff --git a/en/device-dev/subsystems/subsys-thermal_log.md b/en/device-dev/subsystems/subsys-thermal_log.md index 2e889e833a..a9b9b5f7ae 100644 --- a/en/device-dev/subsystems/subsys-thermal_log.md +++ b/en/device-dev/subsystems/subsys-thermal_log.md @@ -26,7 +26,7 @@ For details about the requirements on the Linux environment, see [Quick Start](. The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568) as an example to illustrate thermal log customization. -1. Create the `thermal` folder in the product directory [/vendor/hihope/rk3568](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568). +1. Create the thermal folder in the product directory [/vendor/hihope/rk3568](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568). 2. Create a target folder by referring to the [default thermal log configuration folder](https://gitee.com/openharmony/drivers_peripheral/tree/master/thermal/interfaces/hdi_service/profile), and install it in `//vendor/hihope/rk3568/thermal`. The content is as follows: @@ -50,8 +50,6 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma | Configuration Item| Description| Data Type| Value Range| | -------- | -------- | -------- | -------- | - | interval | Interval for recording temperature tracing logs, in ms.| int | >0 | - | width | Width of the temperature tracing log, in characters.| int | >0 | | outpath | Path for storing temperature tracing logs.| string | N/A| **Table 2** Description of the node configuration @@ -63,7 +61,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma | value | path | Path for obtaining the thermal zone temperature.| ```shell - + <value path="sys/class/thermal/thermal_zone0/temp"/> @@ -86,10 +84,10 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma thermal.para.dac: ```text - persist.thermal.log.="power_host:power_host:600" # Configure access permissions. + persist.thermal.log.="power_host:power_host:500" # Configure access permissions. ``` -6. Write the `BUILD.gn` file by referring to the [BUILD.gn](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/interfaces/hdi_service/profile/BUILD.gn) file in the default thermal log configuration folder to pack the `thermal_hdi_config.xml` file to the `//vendor/etc/thermal_config/hdf` directory. The configuration is as follows: +6. Write the `BUILD.gn` file by referring to the [BUILD.gn](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/interfaces/hdi_service/profile/BUILD.gn) file in the default thermal log configuration folder to pack the thermal_hdi_config.xml file to the `//vendor/etc/thermal_config/hdf` directory. The configuration is as follows: ```shell import("//build/ohos.gni") @@ -97,7 +95,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma ohos_prebuilt_etc("thermal_hdf_config") { source = "thermal_hdi_config.xml" relative_install_dir = "thermal_config/hdf" - install_images = [ chipset_base_dir ] # Required configuration for installing the thermal_hdi_config.xml file in the vendor directory. + install_images = [ chipset_base_dir ] # Required configuration for installing the thermal_service_config.xml file in the vendor directory. part_name = "product_rk3568" # Set part_name to product_rk3568 for subsequent build. You can change it as required. } ``` @@ -151,7 +149,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma "subsystem": "product_hihope" } ``` - In the preceding code, `//vendor/hihope/rk3568/thermal/` is the folder path, `profile` and `etc` are folder names, and `thermal_hdf_config` and `param_files` are the build targets. + In the preceding code, //vendor/hihope/rk3568/thermal/ is the folder path, profile and etc are folder names, and thermal_hdf_config and param_files are the build targets. 9. Build the customized version by referring to [Quick Start](../quick-start/quickstart-overview.md). -- GitLab