提交 4074086a 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 a773891c
......@@ -5,7 +5,6 @@
- [HTTP Data Request](http-request.md)
- [WebSocket Connection](websocket-connection.md)
- [Socket Connection](socket-connection.md)
- [Network Policy Management](net-policy-management.md)
- [Network Sharing](net-sharing.md)
- [Ethernet Connection](net-ethernet.md)
- [Network Connection Management](net-connection-manager.md)
......
......@@ -344,6 +344,7 @@
- [@ohos.multimodalInput.mouseEvent (Mouse Event)](js-apis-mouseevent.md)
- [@ohos.multimodalInput.pointer (Mouse Pointer)](js-apis-pointer.md)
- [@ohos.multimodalInput.touchEvent (Touch Event)](js-apis-touchevent.md)
- [@ohos.multimodalInput.shortKey (Shortcut Key)](js-apis-shortKey.md)
- [@ohos.power (System Power Management)](js-apis-power.md)
- [@ohos.runningLock (Runninglock)](js-apis-runninglock.md)
- [@ohos.sensor (Sensor)](js-apis-sensor.md)
......
......@@ -46,7 +46,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -85,7 +85,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -116,7 +116,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -153,7 +153,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -191,7 +191,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -222,7 +222,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -257,7 +257,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -288,7 +288,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -323,7 +323,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -354,7 +354,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -389,7 +389,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -420,7 +420,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -455,7 +455,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -492,7 +492,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -530,7 +530,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -563,7 +563,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -594,7 +594,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -625,7 +625,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```js
......@@ -660,7 +660,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```ts
......@@ -691,7 +691,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
| 890001 | Unspported para value. |
| 890001 | param value not valid |
**Example**
```ts
......@@ -1737,6 +1737,35 @@ Obtains the **TimeZone** object corresponding to the specified time zone city ID
let timezone = I18n.TimeZone.getTimezoneFromCity("Shanghai");
```
### getTimezonesByLocation<sup>10+</sup>
static getTimezonesByLocation(longitude: number, latitude: number): Array&lt;TimeZone&gt;
Creates an array of **TimeZone** objects corresponding to the specified longitude and latitude.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ------ |
| longitude | number | Yes | Longitude. The value ranges from **-180** to **179.9**. A positive value is used for east longitude and a negative value is used for west longitude.|
| latitude | number | Yes | Latitude. The value ranges from **-90** to **89.9**. A positive value is used for north latitude and a negative value is used for south latitude.|
**Return value**
| Type | Description |
| -------- | ----------- |
| Array&lt;[TimeZone](#timezone)&gt; | Array of **TimeZone** objects.|
**Example**
```js
let timezoneArray = I18n.TimeZone.getTimezonesByLocation(-118.1, 34.0);
for (var i = 0; i < timezoneArray.length; i++) {
let tzId = timezoneArray[i].getID();
}
```
## Transliterator<sup>9+</sup>
......
# @ohos.intl (Internationalization)
The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402.
The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402.
The [i18n](js-apis-i18n.md) module provides enhanced i18n capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the intl module to provide a complete suite of i18n capabilities.
> **NOTE**
......@@ -68,7 +67,7 @@ Creates a **Locale** object.
| Name | Type | Mandatory | Description |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region. For details about the international standards and combination modes for the language, script, and country or region, see [intl Development](../../internationalization/intl-guidelines.md#setting-locale-information).|
| options<sup>9+</sup> | [LocaleOptions](#localeoptions9) | No | Options for creating the **Locale** object. |
| options | [LocaleOptions](#localeoptions6) | No | Options for creating the **Locale** object. |
**Example**
```js
......@@ -160,9 +159,10 @@ Minimizes information of the **Locale** object. If the script and locale informa
```
## LocaleOptions<sup>9+</sup>
## LocaleOptions<sup>6+</sup>
Represents the locale options.
In API version 9, the attributes in **LocaleOptions** are optional.
**System capability**: SystemCapability.Global.I18n
......@@ -207,7 +207,7 @@ Creates a **DateTimeOptions** object for the specified locale.
| Name | Type | Mandatory | Description |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [DateTimeOptions](#datetimeoptions9) | No | Options for creating a **DateTimeFormat** object. |
| options | [DateTimeOptions](#datetimeoptions6) | No | Options for creating a **DateTimeFormat** object. |
**Example**
```js
......@@ -299,7 +299,7 @@ Obtains the formatting options for **DateTimeFormat** object.
| Type | Description |
| ------------------------------------ | ----------------------------- |
| [DateTimeOptions](#datetimeoptions9) | Formatting options for **DateTimeFormat** objects.|
| [DateTimeOptions](#datetimeoptions6) | Formatting options for **DateTimeFormat** objects.|
**Example**
```js
......@@ -311,9 +311,10 @@ Obtains the formatting options for **DateTimeFormat** object.
```
## DateTimeOptions<sup>9+</sup>
## DateTimeOptions<sup>6+</sup>
Provides the options for the **DateTimeFormat** object.
In API version 9, the attributes in **DateTimeOptions** are optional.
**System capability**: SystemCapability.Global.I18n
......@@ -371,7 +372,7 @@ Creates a **NumberFormat** object for the specified locale.
| Name | Type | Mandatory | Description |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [NumberOptions](#numberoptions9) | No | Options for creating a **NumberFormat** object. |
| options | [NumberOptions](#numberoptions6) | No | Options for creating a **NumberFormat** object. |
**Example**
```js
......@@ -421,7 +422,7 @@ Obtains the options of the **NumberFormat** object.
| Type | Description |
| -------------------------------- | --------------------------- |
| [NumberOptions](#numberoptions9) | Formatting options for **NumberFormat** objects.|
| [NumberOptions](#numberoptions6) | Formatting options for **NumberFormat** objects.|
**Example**
......@@ -434,9 +435,10 @@ Obtains the options of the **NumberFormat** object.
```
## NumberOptions<sup>9+</sup>
## NumberOptions<sup>6+</sup>
Defines the device capability.
In API version 9, the attributes in **NumberOptions** are optional.
**System capability**: SystemCapability.Global.I18n
......@@ -448,7 +450,7 @@ Defines the device capability.
| currencyDisplay | string | Yes | Yes | Currency display mode. The value can be **symbol**, **narrowSymbol**, **code**, or **name**.|
| unit | string | Yes | Yes | Unit name, for example, **meter**, **inch**, or **hectare**. |
| unitDisplay | string | Yes | Yes | Unit display format. The value can be **long**, **short**, or **narrow**.|
| unitUsage | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.|
| unitUsage<sup>8+</sup> | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.|
| signDisplay | string | Yes | Yes | Number sign display format. The value can be **auto**, **never**, **always**, or **expectZero**.|
| compactDisplay | string | Yes | Yes | Compact display format. The value can be **long** or **short**. |
| notation | string | Yes | Yes | Number formatting specification. The value can be **standard**, **scientific**, **engineering**, or **compact**.|
......@@ -494,7 +496,7 @@ Creates a **Collator** object.
| Name | Type | Mandatory | Description |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [CollatorOptions](#collatoroptions9) | No | Options for creating a **Collator** object. |
| options | [CollatorOptions](#collatoroptions8) | No | Options for creating a **Collator** object. |
**Example**
```js
......@@ -545,7 +547,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
| Type | Description |
| ------------------------------------ | ----------------- |
| [CollatorOptions](#collatoroptions9) | Properties of the **Collator** object.|
| [CollatorOptions](#collatoroptions8) | Properties of the **Collator** object.|
**Example**
```js
......@@ -557,9 +559,10 @@ Returns properties reflecting the locale and collation options of a **Collator**
```
## CollatorOptions<sup>9+</sup>
## CollatorOptions<sup>8+</sup>
Represents the properties of a **Collator** object.
In API version 9, the attributes in **CollatorOptions** are optional.
**System capability**: SystemCapability.Global.I18n
......@@ -605,7 +608,7 @@ Creates a **PluralRules** object to obtain the singular-plural type of numbers.
| Name | Type | Mandatory | Description |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [PluralRulesOptions](#pluralrulesoptions9) | No | Options for creating a **PluralRules** object. |
| options | [PluralRulesOptions](#pluralrulesoptions8) | No | Options for creating a **PluralRules** object. |
**Example**
```js
......@@ -648,9 +651,10 @@ Obtains a string that represents the singular-plural type of the specified numbe
```
## PluralRulesOptions<sup>9+</sup>
## PluralRulesOptions<sup>8+</sup>
Represents the properties of a **PluralRules** object.
In API version 9, the attributes in **PluralRulesOptions** are optional.
**System capability**: SystemCapability.Global.I18n
......@@ -696,7 +700,7 @@ Creates a **RelativeTimeFormat** object.
| Name | Type | Mandatory | Description |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | No | Options for creating a **RelativeTimeFormat** object. |
| options | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | No | Options for creating a **RelativeTimeFormat** object. |
**Example**
```js
......@@ -788,9 +792,10 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
```
## RelativeTimeFormatInputOptions<sup>9+</sup>
## RelativeTimeFormatInputOptions<sup>8+</sup>
Represents the properties of a **RelativeTimeFormat** object.
In API version 9, the attributes in **RelativeTimeFormatInputOptions** are optional.
**System capability**: SystemCapability.Global.I18n
......
# @ohos.logLibrary (Log Library)
The **logLibrary** module provides APIs for obtaining various system maintenance and test logs.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs provided by this module are system APIs.
## Modules to Import
```js
import logLibrary from '@ohos.logLibrary';
```
## LogEntry
Defines a **LogEntry** object.
**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| name | string | Yes| No| Log file name. |
| mtime | number | Yes| No | Time of the last modification to the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970.|
| size | number | Yes| No | File size, in bytes.|
## logLibrary.list
list(logType: string): LogEntry[]
Obtains the list of log files of the specified type in synchronous mode. This API accepts objects of the string type as input parameters and returns a list log files of the specified type.
**Required permission**: ohos.permission.READ_HIVIEW_SYSTEM
**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
**Return value**
| Type | Description |
| ------------------- | ------------------------------------------------------------ |
| LogEntry[] | Array of log file objects.|
**Error codes**
For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
| ID| Error Message|
| ------- | ----------------------------------------------------------------- |
| 201 | Permission denied. |
| 202 | Permission denied, non-system app called system api. |
| 401 | Invalid argument.|
**Example**
```js
import logLibrary from '@ohos.logLibrary';
try {
let logObj = logLibrary.list('HILOG');
// do something here.
} catch (error) {
console.error(`error code: ${error.code}, error msg: ${error.message}`);
}
```
## logLibrary.copy
copy(logType: string, logName: string, dest: string): Promise&lt;void&gt;
Copies log files of the specified type to the target application directory. This API uses a promise to return the result.
**Required permission**: ohos.permission.READ_HIVIEW_SYSTEM
**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
**Parameters**
| Name | Type | Mandatory| Description|
| --------- | ----------------------- | ---- | --------------- |
| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
| logName | string | Yes | Log file name.|
| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.<br>If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
**Return value**
| Type | Description |
| ------------------- | ------------------------------------------------------------ |
| Promise&lt;void&gt; | Promise used to return the result. Depending on whether the operation is successful, you can use the **then()** or **catch()** method to process the callback.|
**Error codes**
For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
| ID| Error Message|
| -------- | ---------------------------------------------------------------- |
| 201 | Permission denied. |
| 202 | Permission denied, non-system app called system api. |
| 401 | Invalid argument.|
| 21300001 | Source file does not exists. |
**Example**
```js
import logLibrary from '@ohos.logLibrary';
try {
logLibrary.copy('HILOG', 'hiapplogcat-1.zip', ''
).then(
(val) => {
// do something here.
}
).catch(
(err) => {
// do something here.
}
)
} catch (error) {
console.error(`error code: ${error.code}, error msg: ${error.message}`);
}
```
## logLibrary.copy
copy(logType: string, logName: string, dest: string, callback: AsyncCallback&lt;void&gt;): void
Copies log files of the specified type to the target application directory. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.READ_HIVIEW_SYSTEM
**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
| logName | string | Yes | Log file name.|
| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.<br>If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to process the received return value. The value **0** indicates that the operation is successful, and any other value indicates that the operation has failed.|
**Error codes**
For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
| ID| Error Message|
| ------- | ----------------------------------------------------------------- |
| 201 | Permission denied. |
| 202 | Permission denied, non-system app called system api. |
| 401 | Invalid argument.|
| 21300001 | Source file does not exists. |
**Example**
```js
import logLibrary from '@ohos.logLibrary';
try {
logLibrary.copy('HILOG', 'hiapplogcat-1.zip', 'dir1', (error, val) => {
if (val === undefined) {
// copy failed.
} else {
// copy success.
}
});
} catch (error) {
console.error(`error code: ${error.code}, error msg: ${error.message}`);
}
```
## logLibrary.move
move(logType: string, logName: string, dest: string): Promise&lt;void&gt;
Moves log files of the specified type to the target application directory. This API uses a promise to return the result.
**Required permission**: ohos.permission.WRITE_HIVIEW_SYSTEM
**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
**Parameters**
| Name | Type | Mandatory| Description|
| --------- | ----------------------- | ---- | --------------- |
| logType | string | Yes| Log type, for example, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
| logName | string | Yes | Log file name.|
| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.<br>If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
**Return value**
| Type | Description |
| ------------------- | ------------------------------------------------------------ |
| Promise&lt;void&gt; | Promise used to return the result. Depending on whether the operation is successful, you can use the **then()** or **catch()** method to process the callback.|
**Error codes**
For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
| ID| Error Message|
| -------- | ---------------------------------------------------------------- |
| 201 | Permission denied. |
| 202 | Permission denied, non-system app called system api. |
| 401 | Invalid argument.|
| 21300001 | Source file does not exists. |
**Example**
```js
import logLibrary from '@ohos.logLibrary';
try {
logLibrary.move('FAULTLOG', 'fault_log_test.zip', ''
).then(
(val) => {
// do something here.
}
).catch(
(err) => {
// do something here.
}
)
} catch (error) {
console.error(`error code: ${error.code}, error msg: ${error.message}`);
}
```
## logLibrary.move
move(logType: string, logName: string, dest: string, callback: AsyncCallback&lt;void&gt;): void
Moves log files of the specified type to the target application directory. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.WRITE_HIVIEW_SYSTEM
**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
| logName | string | Yes | Log file name.|
| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.<br>If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to process the received return value. The value **0** indicates that the operation is successful, and any other value indicates that the operation has failed.|
**Error codes**
For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
| ID| Error Message|
| ------- | ----------------------------------------------------------------- |
| 201 | Permission denied. |
| 202 | Permission denied, non-system app called system api. |
| 401 | Invalid argument.|
| 21300001 | Source file does not exists. |
**Example**
```js
import logLibrary from '@ohos.logLibrary';
try {
logLibrary.move('FAULTLOG', 'fault_log_test.zip', 'dir1/dir2', (error, val) => {
if (val === undefined) {
// move failed.
} else {
// move success.
}
});
} catch (error) {
console.error(`error code: ${error.code}, error msg: ${error.message}`);
}
```
## logLibrary.remove
remove(logType: string, logName: string): void
Deletes log files of the specified type in synchronous mode.
**Required permission**: ohos.permission.WRITE_HIVIEW_SYSTEM
**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| logType | string | Yes| Log type, for example, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
| logName | string | Yes | Log file name.|
**Error codes**
For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
| ID| Error Message|
| ------- | ----------------------------------------------------------------- |
| 201 | Permission denied. |
| 202 | Permission denied, non-system app called system api. |
| 401 | Invalid argument.|
| 21300001 | Source file does not exists. |
**Example**
```js
import logLibrary from '@ohos.logLibrary';
try {
logLibrary.remove('FAULTLOG', 'fault_log_test.zip');
} catch (error) {
console.error(`error code: ${error.code}, error msg: ${error.message}`);
}
```
# console (Log Printing)
# console
The **console** module provides basic log printing capabilities and supports log printing by log level.
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).
The **console** module provides a simple debugging console, which is similar to the JavaScript console provided by the browser.
> **NOTE**
>
......@@ -10,9 +8,9 @@ If you want to use more advanced log printing services, for example, filtering l
## console.debug
debug(message: string): void
debug(message: string, ...arguments: any[]): void
Prints debug-level logs.
Prints debugging information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
......@@ -20,14 +18,25 @@ Prints debug-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| message | string | Yes | Text to print.|
| message | string | Yes | Text to be printed.|
| arguments | any | No | Arguments in the message or other information to be printed.|
**Example**
```js
const number = 5;
console.debug('count: %d', number); // Print the debugging information with arguments in the message replaced.
// count: 5
console.debug('count:', number); // Print the message and other information.
// count: 5
console.debug('count:'); // Print the message only.
// count:
```
## console.log
log(message: string): void
log(message: string, ...arguments: any[]): void
Prints debug-level logs.
Prints log information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
......@@ -35,14 +44,25 @@ Prints debug-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| message | string | Yes | Text to print.|
| message | string | Yes | Text to be printed.|
| arguments | any | No |Arguments in the message or other information to be printed.|
**Example**
```js
const number = 5;
console.log('count: %d', number); // Print the log information with arguments in the message replaced.
// count: 5
console.log('count:', number); // Print the message and other information.
// count: 5
console.log('count:'); // Print the message only.
// count:
```
## console.info
info(message: string): void
info(message: string, ...arguments: any[]): void
Prints info-level logs.
Prints log information in formatted output mode. This API is the alias of **console.log ()**.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
......@@ -50,14 +70,25 @@ Prints info-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| message | string | Yes | Text to print.|
| message | string | Yes | Text to be printed.|
| arguments | any | No | Arguments in the message or other information to be printed.|
**Example**
```js
const number = 5;
console.info('count: %d', number); // Print the log information with arguments in the message replaced.
// count: 5
console.info('count:', number); // Print the message and other information.
// count: 5
console.info('count:'); // Print the message only.
// count:
```
## console.warn
warn(message: string): void
warn(message: string, ...arguments: any[]): void
Prints warn-level logs.
Prints warning information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
......@@ -65,14 +96,25 @@ Prints warn-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| message | string | Yes | Text to print.|
| message | string | Yes | Warning information to be printed.|
| arguments | any | No | Arguments in the message or other information to be printed.|
**Example**
```js
const str = "name should be string";
console.warn('warn: %d', str); // Print the warning information with arguments in the message replaced.
// warn: name should be string
console.warn('warn:', str); // Print the message and other information.
// warn: name should be string
console.warn('warn:'); // Print the message only.
// warn:
```
## console.error
error(message: string): void
error(message: string, ...arguments: any[]): void
Prints error-level logs.
Prints error information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
......@@ -80,31 +122,26 @@ Prints error-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| message | string | Yes | Text to print.|
| message | string | Yes | Error information to be printed.|
| arguments | any | No | Arguments in the message or other information to be printed.|
**Example**
```js
const str = "value is not defined";
console.error('error: %d', str); // Print the error information with arguments in the message replaced.
// error: value is not defined
console.error('error:', str); // Print the message and other information.
// error: value is not defined
console.error('error:'); // Print the message only.
// error:
```
export default {
clickConsole(){
var versionCode = 1;
console.info('Hello World. The current version code is ' + versionCode);
console.log(`versionCode: ${versionCode}`);
/ / The following is supported since API version 6: console.log('versionCode:%d.', versionCode);
}
}
```
Switch to the HiLog window at the bottom of HUAWEI DevEco Studio. Specifically, select the current device and process, set the log level to Info, and enter Hello World in the search box. Logs that meet the search criteria are displayed, as shown in the following figure.
![Printing logs](figures/printing-logs.png)
## console.assert<sup>10+</sup>
assert(value?: Object, ...arguments: Object[]): void
If **value** is false, the subsequent content will be printed.
Prints assertion information.
**System capability**: SystemCapability.Utils.Lang
......@@ -112,24 +149,26 @@ If **value** is false, the subsequent content will be printed.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| value | Object | No | Value|
| arguments | Object | No | Prints error messages.|
| value | Object | No | Result value. If **value** is **false** or left blank, the output starting with "Assertion failed" is printed. If **value** is **true**, no information is printed.|
| arguments | Object | No | Other information to be printed when **value** is **false**. If this parameter is left blank, other information is not printed.|
**Example**
```
console.assert(true, 'does nothing');
```js
console.assert(true, 'does nothing'); // Do not print error information as value is true.
console.assert(2% 1 == 0,'does nothing'); // Do not print error information as value is true.
console.assert(false, 'console %s work', 'didn\'t');
// Assertion console:ohos didn't work
// Assertion failed: console didn't work
console.assert();
// Assertion failed
```
## console.count<sup>10+</sup>
count(label?: string): void
Adds a counter by the specified label name to count the number of times **console.count()** is called. The default value is **default**.
Maintains an internal counter. When this counter is invoked, its label name and the corresponding call count are printed.
**System capability**: SystemCapability.Utils.Lang
......@@ -137,10 +176,11 @@ Adds a counter by the specified label name to count the number of times **consol
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| label | string | No | Counter label name.|
| label | string | No | Counter label name. The default value is **default**.|
**Example**
```
```js
console.count()
// default: 1
console.count('default')
......@@ -150,7 +190,7 @@ console.count('abc')
console.count('xyz')
// xyz: 1
console.count('abc')
abc: 2
// abc: 2
console.count()
// default: 3
```
......@@ -159,7 +199,7 @@ console.count()
countReset(label?: string): void
Resets a counter by the specified label name. The default value is **default**.
Resets a counter based on the specified label name.
**System capability**: SystemCapability.Utils.Lang
......@@ -167,10 +207,10 @@ Resets a counter by the specified label name. The default value is **default**.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| label | string | No | Counter label name.|
| label | string | No | Counter label name. The default value is **default**.|
**Example**
```
```js
console.count('abc');
// abc: 1
console.countReset('abc');
......@@ -190,13 +230,24 @@ Prints content of the specified object.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| dir | Object | No | Object whose content needs to be printed.|
| dir | Object | No | Object whose content needs to be printed. If this parameter is left blank, no information is printed.|
**Example**
```js
let a = { foo: { bar: { baz: true } }};
console.dir(a);
// Object: {"foo":{"bar":{"baz":true}}}
console.dir(); // No information is printed.
```
## console.dirxml<sup>10+</sup>
dirxml(...arguments: Object[]): void
Calls **console.log()** and passes the received parameters to it. This API does not produce any content of the XML format.
Displays an interactive tree of the descendant elements of the specified XML element. This API is implemented by calling **console.log()** internally. It does not produce any XML elements. The usage method is the same as that of **console.log()**.
**System capability**: SystemCapability.Utils.Lang
......@@ -204,13 +255,24 @@ Calls **console.log()** and passes the received parameters to it. This API does
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| arguments | Object | No | Information to be printed.|
| arguments | Object | Yes | Information to be printed.|
**Example**
```js
const number = 5;
console.dirxml('count: %d', number);
// count: 5
console.dirxml('count:', number);
// count: 5
console.dirxml('count:');
// count:
```
## console.group<sup>10+</sup>
group(...arguments: Object[]): void
Creates an inline group so that subsequent lines are indented by the value specified by **groupIndentation**.
Increases the indentation of subsequent lines by two spaces.
If the information to be printed is provided, the information is printed without extra indentation.
**System capability**: SystemCapability.Utils.Lang
......@@ -220,11 +282,26 @@ If the information to be printed is provided, the information is printed without
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| arguments | Object | No | Information to be printed.|
**Example**
```js
console.log("outter");
// outter
console.group();
console.log("level 1");
// level 1
console.group("in level1");
// in level1
console.log("level 2");
// level 2
```
## console.groupCollapsed<sup>10+</sup>
groupCollapsed(...arguments: Object[]): void
Creates a collapsed inline group.
Creates a new inline group in collapsed mode. The usage and function of this API are the same as those of **console.group()**.
**System capability**: SystemCapability.Utils.Lang
......@@ -234,14 +311,42 @@ Creates a collapsed inline group.
| ------- | ------ | ---- | ----------- |
| arguments | Object | No | Information to be printed.|
**Example**
```js
console.groupCollapsed("outter");
// outter
console.groupCollapsed();
console.log("level 1");
// level 1
console.groupCollapsed("in level1");
// in level1
console.log("level 2");
// level 2
```
## console.groupEnd<sup>10+</sup>
groupEnd(): void
Exits an inline group so that subsequent lines are not indented by the value specified by **groupIndentation** .
Reduces the indentation of subsequent lines by two spaces.
**System capability**: SystemCapability.Utils.Lang
**Example**
```js
console.log("outter");
// outter
console.group();
console.log("level 1");
// level 1
console.groupEnd();
console.log("outter");
// outter
```
## console.table<sup>10+</sup>
table(tableData?: Object): void
......@@ -254,10 +359,10 @@ Prints data in a table.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| tableData | Object | No | Data to be printed in a table.|
| tableData | Object | No | Data to be printed in a table. If this parameter is left blank, no information is printed.|
**Example**
```
```js
console.table([1, 2, 3]);
// ┌─────────┬────────┐
// │ (index) │ Values │
......@@ -281,7 +386,7 @@ console.table({ a: [1, 2, 3, 4, 5], b: 5, c: { e: 5 } });
time(label?: string): void
Starts a timer to track the duration of an operation. The default value is **default**. You can use **console.timeEnd()** to disable the timer and print the result.
Starts a timer to track the duration of an operation. You can use **console.timeEnd()** to close the timer and print the elapsed time (in ms).
**System capability**: SystemCapability.Utils.Lang
......@@ -289,13 +394,18 @@ Starts a timer to track the duration of an operation. The default value is **def
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| label | string | No | Timer label.|
| label | string | No | Timer label. The default value is **default**.|
**Example**
```js
console.time('abc');
```
## console.timeEnd<sup>10+</sup>
timeEnd(label?: string): void
Stops the timer started by **console.time()** and prints the result. The default value is **default**.
Stops the timer started by calling **console.time()** and prints the elapsed time (in ms).
**System capability**: SystemCapability.Utils.Lang
......@@ -303,10 +413,10 @@ Stops the timer started by **console.time()** and prints the result. The default
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| label | string | No | Timer label.|
| label | string | No | Timer label. The default value is **default**.|
**Example**
```
```js
console.time('abc');
console.timeEnd('abc');
// abc: 225.438ms
......@@ -316,7 +426,7 @@ console.timeEnd('abc');
timeLog(label?: string, ...arguments: Object[]): void
Prints the elapsed time and other logs for the timer started by **console.time()**.
Prints the elapsed time and other data parameters for the timer started by **console.time()**.
**System capability**: SystemCapability.Utils.Lang
......@@ -324,14 +434,13 @@ Prints the elapsed time and other logs for the timer started by **console.time()
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| label | string | No | Timer label.|
| label | string | No | Timer label. The default value is **default**.|
| arguments | Object | No | Logs to be printed.|
**Example**
```
```js
console.time('timer1');
const value = aaa (); // Return 17.
console.timeLog('timer1', value);
console.timeLog('timer1', 17);
// timer1: 365.227ms 17
console.timeEnd('timer1');
// timer1: 513.22ms
......@@ -349,10 +458,14 @@ Creates a stack trace.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| arguments | Object | No | Logs to be printed.|
| arguments | Object | No | Logs to be printed. If this parameter is left blank, only stack information is printed.|
**Example**
```
```js
console.trace();
// Trace:
// xxxxxxxxxx (current stack information)
console.trace("Show the trace");
// Trace: Show the trace
// xxxxxxxxxx (current stack information)
```
......@@ -45,9 +45,9 @@ During RPC or IPC, the sender can use the **write()** method provided by **Messa
### create
static create(): MessageSequence
static create(): MessageSequence
Creates a **MessageSequence** object. This API is a static method.
Creates a **MessageSequence** object. This API is a static method.
**System capability**: SystemCapability.Communication.IPC.Core
......@@ -6821,8 +6821,8 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
}
let deathRecipient = new MyDeathRecipient();
try {
proxy.registerDeathRecippient(deathRecipient, 0);
proxy.unregisterDeathRecippient(deathRecipient, 0);
proxy.registerDeathRecipient(deathRecipient, 0);
proxy.unregisterDeathRecipient(deathRecipient, 0);
} catch(error) {
console.info("proxy register deathRecipient fail, errorCode " + error.code);
console.info("proxy register deathRecipient fail, errorMessage " + error.message);
......@@ -6893,7 +6893,7 @@ Removes the callback used to receive death notifications of the remote object.
}
}
let deathRecipient = new MyDeathRecipient();
proxy.addDeathRecippient(deathRecipient, 0);
proxy.addDeathRecipient(deathRecipient, 0);
proxy.removeDeathRecipient(deathRecipient, 0);
```
......
# @ohos.multimodalInput.shortKey (Shortcut Key)
The **shortKey** module provides APIs to set the delay for starting an ability using a shortcut key. For example, you can set the delay to 3 seconds so that a screenshot is taken when you press and hold the shortcut key for 3 seconds.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs provided by this module are system APIs.
## Modules to Import
```
import shortKey from '@ohos.multimodalInput.shortKey';
```
## shortKey.setKeyDownDuration
setKeyDownDuration(businessId: string, delay: number, callback: AsyncCallback&lt;void&gt;): void
Sets the delay for starting an ability using the shortcut key. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.ShortKey
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------- | ---- | ------------------------------------------------------------ |
| businessId | string | Yes | Unique service ID registered on the multimodal side. It corresponds to **businessId** in the **ability_launch_config.json** file.|
| delay | number | Yes | Delay for starting an ability using the shortcut key, in ms.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
```
try {
shortKey.setKeyDownDuration("screenshot", 500, (error) => {
if (error) {
console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Set key down duration success`);
});
} catch (error) {
console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## shortKey.setKeyDownDuration
setKeyDownDuration(businessId: string, delay: number): Promise&lt;void&gt;
Sets the delay for starting an ability using the shortcut key. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.ShortKey
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ------------------------------------------------------------ |
| businessId | string | Yes | Unique service ID registered on the multimodal side. It corresponds to **businessId** in the **ability_launch_config.json** file.|
| delay | number | Yes | Delay for starting an ability using the shortcut key, in ms.|
**Return value**
| Parameters | Description |
| ------------- | ------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```
try {
shortKey.setKeyDownDuration("screenshot", 500).then(() => {
console.log(`Set key down duration success`);
});
} catch (error) {
console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -27,7 +27,7 @@ Obtains the current charging state and battery level.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [GetStatusOptions](#getstatusoptions) | No| Object that contains the API calling result.|
| options | [GetStatusOptions](#getstatusoptions) | No| Object that contains the API calling result. This parameter is optional and is left blank by default.|
**Example**
......@@ -50,9 +50,9 @@ Object that contains the API calling result.
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ |
| success | (data: [BatteryResponse](#batteryresponse)) => void | No | Called when API call is successful. **data** is a return value of the [BatteryResponse](#batteryresponse) type.|
| fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when API call is complete. |
| success | (data: [BatteryResponse](#batteryresponse)) => void | No | Called when an API call is successful. **data** is a return value of the [BatteryResponse](#batteryresponse) type.|
| fail | (data: string, code: number) => void | No | Called when an API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when an API call is complete. |
## BatteryResponse
......
......@@ -28,7 +28,7 @@ Obtains the current screen brightness.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [GetBrightnessOptions](#getbrightnessoptions) | No | Options for obtaining the screen brightness.|
| options | [GetBrightnessOptions](#getbrightnessoptions) | No | Options for obtaining the screen brightness. This parameter is optional and is left blank by default.|
**Example**
......@@ -56,7 +56,7 @@ Sets the screen brightness.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [SetBrightnessOptions](#setbrightnessoptions) | No | Options for setting the screen brightness.|
| options | [SetBrightnessOptions](#setbrightnessoptions) | No | Options for setting the screen brightness. This parameter is optional and is left blank by default.|
**Example**
......@@ -85,7 +85,7 @@ Obtains the screen brightness adjustment mode.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [GetBrightnessModeOptions](#getbrightnessmodeoptions) | No| Options for obtaining the screen brightness mode.|
| options | [GetBrightnessModeOptions](#getbrightnessmodeoptions) | No| Options for obtaining the screen brightness mode. This parameter is optional and is left blank by default.|
**Example**
......@@ -112,7 +112,7 @@ Sets the screen brightness adjustment mode.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [SetBrightnessModeOptions](#setbrightnessmodeoptions) | No | Options for setting the screen brightness mode.|
| options | [SetBrightnessModeOptions](#setbrightnessmodeoptions) | No | Options for setting the screen brightness mode. This parameter is optional and is left blank by default.|
**Example**
......@@ -143,7 +143,7 @@ Sets whether to always keep the screen on. Call this API in **onShow()**.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [SetKeepScreenOnOptions](#setkeepscreenonoptions) | No| Options for setting the screen to be steady on.|
| options | [SetKeepScreenOnOptions](#setkeepscreenonoptions) | No| Options for setting the screen to be steady on. This parameter is optional and is left blank by default.|
**Example**
......@@ -166,9 +166,9 @@ Defines the options for obtaining the screen brightness.
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| success | (data: [BrightnessResponse](#brightnessresponse)) => void | No | Called when API call is successful. **data** is a return value of the [BrightnessResponse](#brightnessresponse) type.|
| fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when the API call is complete. |
| success | (data: [BrightnessResponse](#brightnessresponse)) => void | No | Called when an API call is successful. **data** is a return value of the [BrightnessResponse](#brightnessresponse) type.|
| fail | (data: string, code: number) => void | No | Called when an API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when an API call is complete. |
## SetBrightnessOptions
......@@ -178,10 +178,10 @@ Defines the options for setting the screen brightness.
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ |
| value | number | Yes | Screen brightness. The value is an integer ranging from **1** to **255**.<br>-&nbsp;If the value is less than or equal to **0**, value **1** will be used.<br>-&nbsp;If the value is greater than **255**, value **255** will be used.<br>-&nbsp;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 | Callback upon a successful API call. |
| fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when the API call 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 an API call is successful. |
| fail | (data: string, code: number) => void | No | Called when an API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when an API call is complete. |
## BrightnessResponse
......@@ -201,9 +201,9 @@ Defines the options for obtaining the screen brightness mode.
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| success | (data: [BrightnessModeResponse](#brightnessmoderesponse)) => void | No | Called when API call is successful. **data** is a return value of the [BrightnessModeResponse](#brightnessmoderesponse) type.|
| fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when the API call is complete. |
| success | (data: [BrightnessModeResponse](#brightnessmoderesponse)) => void | No | Called when an API call is successful. **data** is a return value of the [BrightnessModeResponse](#brightnessmoderesponse) type.|
| fail | (data: string, code: number) => void | No | Called when an API call has failed. **data** indicates the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when an API call is complete. |
## SetBrightnessModeOptions
......@@ -214,9 +214,9 @@ Defines the options for setting the screen brightness mode.
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------ |
| mode | number | Yes | The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.|
| success | () => void | No | Callback upon a successful API call. |
| fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code.|
| complete | () => void | No | Called when the API call is complete. |
| success | () => void | No | Called when an API call is successful. |
| fail | (data: string, code: number) => void | No | Called when an API call has failed. **data** indicates the error information, and **code** indicates the error code.|
| complete | () => void | No | Called when an API call is complete. |
## BrightnessModeResponse
......@@ -237,6 +237,6 @@ Defines the options for setting the screen to be steady on.
| Name | Type | Mandatory| Description |
| ------------ | ------------------------------------ | ---- | ------------------------------------------------------ |
| keepScreenOn | boolean | Yes | The value **true** means to keep the screen steady on, and the value **false** indicates the opposite. |
| success | () => void | No | Callback upon a successful API call. |
| fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code.|
| complete | () => void | No | Called when the API call is complete. |
| success | () => void | No | Called when an API call is successful. |
| fail | (data: string, code: number) => void | No | Called when an API call has failed. **data** indicates the error information, and **code** indicates the error code.|
| complete | () => void | No | Called when an API call is complete. |
# @ohos.thermal (Thermal Management)
The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
This module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
> **NOTE**
>
......@@ -90,7 +90,7 @@ Obtains the current thermal level.
**System capability:** SystemCapability.PowerManager.ThermalManager
**Return value**
**Return value**:
| Type | Description |
| ------------ | ------------ |
......@@ -173,7 +173,7 @@ Obtains the current thermal level.
**System capability:** SystemCapability.PowerManager.ThermalManager
**Return value**
**Return value**:
| Type | Description |
| ------------ | ------ |
......
......@@ -55,7 +55,6 @@
- [Network Connection Management Error Codes](errorcode-net-connection.md)
- [Ethernet Connection Error Codes](errorcode-net-ethernet.md)
- [Network Sharing Error Codes](errorcode-net-sharing.md)
- [Policy Management Error Codes](errorcode-net-policy.md)
- [mDNS Error Codes](errorcode-net-mdns.md)
- Connectivity
- [Bluetooth Error Codes](errorcode-bluetoothManager.md)
......
......@@ -26,7 +26,7 @@ Check whether the parameter type is correct.
**Error Message**
Unspported option value.
param value not valid
**Description**
......
# Log Library Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 21300001 Specified File Not Exist
**Error Message**
The specified file does not exist.
**Description**
When the **copy**, **move**, or **delete** API is called to perform file operations, the file with the specified name does not exist in the specified type of logs.
**Possible Cause**
1. The input file name is incorrect.
2. The file with the input file name does not exist.
**Procedure**
Check whether the input file name is correct.
# Policy Management Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 2100001 Invalid Parameter Value
**Error Message**
Invalid parameter value.
**Description**
Invalid parameter value
**Cause**
The input parameter value is not within the valid value range.
**Procedure**
Check whether the input parameter value is within the valid value range.
## 2100002 Service Connection Failure
**Error Message**
Operation failed. Cannot connect to service.
**Description**
This error code is reported if a service connection failure occurs.
**Cause**
The service is abnormal.
**Procedure**
Check whether system services are running properly.
## 2100003 System Internal Error
**Error Message**
System internal error.
**Description**
This error code is reported if a system internal error occurs.
**Cause**
1. The memory is abnormal.
2. A null pointer is present.
**Procedure**
1. Check whether the memory space is sufficient. If not, clear the memory and try again.
2. Check whether the system is normal. If not, try again later or restart the device.
......@@ -4,7 +4,7 @@
### Introduction
By default, OpenHarmony provides the power mode feature, which offers the following options: normal mode, performance mode, power-saving mode, and ultra power-saving mode. However, the power mode configuration varies according to hardware specifications of different products. To address this issue, OpenHarmony provides the power mode customization function, allowing you to customize power modes depending on your hardware specifications.
By default, OpenHarmony provides the power mode feature, which offers the following options: normal mode, performance mode, power-saving mode, and super power-saving mode. However, the power mode configuration varies according to hardware specifications of different products. To address this issue, OpenHarmony provides the power mode customization function, allowing you to customize power modes depending on your hardware specifications.
### Basic Concepts
......@@ -16,7 +16,7 @@ OpenHarmony supports the following four power modes, each of which corresponds t
- Power-saving mode: power mode that emphasizes on power saving, such as decreasing the system brightness, reducing the screen-off time, and shortening the time for entering sleep mode.
- Ultra power-saving mode: power mode that emphasizes on ultimate power saving, such as greatly decreasing the system brightness, greatly reducing the screen-off time, and greatly shortening the time for entering sleep mode.
- Super power-saving mode: power mode that emphasizes on ultimate power saving, such as greatly decreasing the system brightness, greatly reducing the screen-off time, and greatly shortening the time for entering sleep mode.
### Constraints
......@@ -59,7 +59,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
| Normal mode| 600 |
| Power-saving mode| 601 |
| Performance mode| 602 |
| Ultra power-saving mode| 603 |
| Super power-saving mode| 603 |
The **switch** node is used to configure items of the power mode.
......@@ -243,9 +243,9 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
4. Turn on the screen. If the screen turns off after 30 seconds, the setting of the auto sleep time is successful.
5. Set the power mode to the ultra power-saving mode, and verify the setting.
5. Set the power mode to the super power-saving mode, and verify the setting.
1. Set the power mode to the ultra power-saving mode.
1. Set the power mode to the super power-saving mode.
```shell
power-shell setmode 603
......@@ -278,8 +278,6 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
## Reference
During development, you can refer to the [default power mode configuration](https://gitee.com/openharmony/powermgr_power_manager/tree/master/services/native/profile):
[Default configuration](https://gitee.com/openharmony/powermgr_power_manager/blob/master/services/native/profile/power_mode_config.xml)
During development, you can refer to the [default power mode configuration](https://gitee.com/openharmony/powermgr_power_manager/blob/master/services/native/profile/power_mode_config.xml):
Packing path: `/system/etc/power_config/power_mode_config.xml`
......@@ -52,7 +52,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
| name="current" | Charging current control | event | - **1**: event sending enabled<br>-**0**: event sending disabled| int | 0 or 1|
| name="voltage" | Charging voltage control (charging voltage during fast charging and slow charging)| protocol | Supported charging protocols: fast charging (supercharge) and slow charging (buck)| string | sc or buck|
| name="voltage" | Charging voltage control | event | - **1**: event sending enabled<br>-**0**: event sending disabled| int | 0 or 1|
| name="process_ctrl" | Process control (survival status of foreground and background processes)| event | - **1**: event sending enabled<br>-**0**: event sending disabled| int | 0 or 1|
| name="process_ctrl" | Process control (survival status of foreground and background processes)| event | - **1**: event sending enabled<br>-**0**: event sending disabled<br>If this parameter is not set, the value is defaulted to **0**.| int | 0 or 1|
| name="shut_down" | Shutdown control (device shutdown)| event | - **1**: event sending enabled<br>-**0**: event sending disabled| int | 0 or 1|
| name="thermallevel" | Thermal level control (thermal level reporting)| event | - **1**: event sending enabled<br>-**0**: event sending disabled| int | 0 or 1|
| name="popup" | Pop-up window control (pop-up window display)| N/A| N/A| N/A| N/A|
......@@ -67,7 +67,7 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
<item name="volume" uid="2001,2002"/>
<item name="current" protocol="sc,buck" event="1"/>
<item name="voltage" protocol="sc,buck" event="1"/>
<item name="process_ctrl" param="32,64,128,256" event=""/>
<item name="process_ctrl" event=""/>
<item name="shut_down" event="0"/>
<item name="thermallevel" event="0"/>
<item name="popup"/>
......@@ -143,13 +143,14 @@ The following uses [DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/ma
name: volume uid: 2001,2002 strict: 0 enableEvent: 0
name: current protocol: sc,buck strict: 0 enableEvent: 1
name: voltage protocol: sc,buck strict: 0 enableEvent: 1
name: process_ctrl params: 32,64,128,256 strict: 0 enableEvent: 0
name: process_ctrl strict: 0 enableEvent: 0
name: shut_down strict: 0 enableEvent: 0
name: thermallevel strict: 0 enableEvent: 0
name: popup strict: 0 enableEvent: 0
```
## Reference
During development, you can refer to the [default thermal control configuration](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml).
Packing path: `/vendor/etc/thermal_config/hdf`
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册