提交 0137cfc3 编写于 作者: K king_he 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into 0608-1

......@@ -197,7 +197,7 @@ For details about how to contribute, see [How to Contribute](contribute/how-to-
OpenHarmony complies with Apache License Version 2.0. For details, see the LICENSE in each repository.
OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](contribute/third-party-open-source-software-and-license-notice.md).
OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](https://gitee.com/openharmony/docs/blob/master/en/contribute/third-party-open-source-software-and-license-notice.md).
## Contact Info<a name="section61728335424"></a>
......
......@@ -65,7 +65,7 @@ A Service ability is used to run tasks in the background, such as playing music
### Starting a Service ability
### Starting a Service Ability
The **Ability** class provides the **startAbility()** API for you to start another Service ability by passing a **Want** object.
......@@ -95,7 +95,7 @@ After the preceding code is executed, the **startAbility()** API is called to st
### Stopping a Service ability
### Stopping a Service Ability
Once created, the Service ability keeps running in the background. The system does not stop or destroy it unless memory resources must be reclaimed. You can call **terminateSelf()** on a Service ability to stop it.
......
......@@ -18,13 +18,13 @@ The table below describes the ability call APIs. For details, see [Ability](../r
**Table 1** Ability call APIs
|API|Description|
|:------|:------|
|Promise<Caller> startAbilityByCall(want: Want)|Obtains the caller interface of the specified ability and, if the specified ability is not running, starts the ability in the background.|
|void on(method: string, callback: CalleeCallBack)|Callee.on: callback invoked when the callee registers a method.|
|void off(method: string)|Callee.off: callback invoked when the callee deregisters a method.|
|Promise<void> call(method: string, data: rpc.Sequenceable)|Caller.call: sends agreed sequenceable data to the callee.|
|Promise<rpc.MessageParcel> callWithResult(method: string, data: rpc.Sequenceable)|Caller.callWithResult: sends agreed sequenceable data to the callee and returns the agreed sequenceable data.|
|void release()|Caller.release: releases the caller interface.|
|void onRelease(callback: OnReleaseCallBack)|Caller.onRelease: registers a callback that is invoked when the caller is disconnected.|
|startAbilityByCall(want: Want): Promise<Caller>|Obtains the caller interface of the specified ability and, if the specified ability is not running, starts the ability in the background.|
|on(method: string, callback: CaleeCallBack): void|Callback invoked when the callee registers a method.|
|off(method: string): void|Callback invoked when the callee deregisters a method.|
|call(method: string, data: rpc.Sequenceable): Promise<void>|Sends agreed sequenceable data to the callee.|
|callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>|Sends agreed sequenceable data to the callee and returns the agreed sequenceable data.|
|release(): void|Releases the caller interface.|
|onRelease(callback: OnReleaseCallBack): void|Registers a callback that is invoked when the caller is disconnected.|
## How to Develop
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
......@@ -202,7 +202,7 @@ context.requestPermissionsFromUser(permissions).then((data) => {
```
3. Send agreed sequenceable data.
The sequenceable data can be sent to the callee with or without a return value. The method and sequenceable data must be consistent with those of the callee. The following example describes how to invoke the **Call** API to send data to the callee. The sample code snippet is as follows:
The sequenceable data can be sent to the callee with or without a return value. The method and sequenceable data must be consistent with those of the callee. The following example describes how to invoke the **Call** API to send data to the callee. The sample code snippet is as follows:
```ts
const MSG_SEND_METHOD: string = 'CallSendMsg'
async onButtonCall() {
......@@ -237,7 +237,7 @@ async onButtonCallWithResult(originMsg, backMsg) {
```
4. Release the caller interface.
When the caller interface is no longer required, call the **release** API to release it. The sample code snippet is as follows:
When the caller interface is no longer required, call the **release** API to release it. The sample code snippet is as follows:
```ts
try {
this.caller.release()
......
......@@ -41,7 +41,7 @@ If a service needs to be continued when the application or service module is run
backgroundTaskManager.getRemainingDelayTime(id).then( res => {
console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
}).catch( err => {
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.data);
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.code);
});
```
......@@ -74,7 +74,7 @@ console.info("The actualDelayTime is: " + time);
backgroundTaskManager.getRemainingDelayTime(id).then( res => {
console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
}).catch( err => {
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.data);
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.code);
});
// Cancel the suspension delay.
......@@ -187,7 +187,7 @@ For details about how to use the Service ability in the FA model, see [Service A
If an application does not need to interact with a continuous task in the background, you can use **startAbility()** to start the Service ability. In the **onStart** callback of the Service ability, call **startBackgroundRunning()** to declare that the Service ability needs to run in the background for a long time. After the task execution is complete, call **stopBackgroundRunning()** to release resources.
If an application needs to interact with a continuous task in the background (for example, an application related to music playback), you can use **connectAbility()** to start and connect to the Service ability. After obtaining the proxy of the Service ability, the application can communicate with the Service ability and control the application and cancellation of continuous tasks.
If an application needs to interact with a continuous task in the background (for example, an application related to music playback), you can use **connectAbility()** to start and connect to the Service ability. After obtaining the proxy of the Service ability, the application can communicate with the Service ability and control the request and cancellation of continuous tasks.
```js
import backgroundTaskManager from '@ohos.backgroundTaskManager';
......@@ -284,3 +284,9 @@ export default {
}
};
```
## Samples
The following sample is provided to help you better understand how to develop background task management:
- [<idp:inline class="- topic/inline " val="code" displayname="code" id="code1035211243011" tempcmdid="code1035211243011">BackgroundTaskManager</idp:inline>: Background Task Management (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ResourcesSchedule/BackgroundTaskManager)
......@@ -23,7 +23,7 @@ APIs are provided to access the system language and region information.
### How to Develop
1. Obtain the system language.<br>
Call the **getSystemLanguage** method to obtain the system language (**i18n** is the name of the imported module).
Call the **getSystemLanguage** method to obtain the system language (**i18n** is the name of the imported module).
```
......@@ -31,21 +31,21 @@ APIs are provided to access the system language and region information.
```
2. Obtain the system region.<br>
Call the **getSystemRegion** method to obtain the system region.
Call the **getSystemRegion** method to obtain the system region.
```
var region = i18n.getSystemRegion();
```
3. Obtain the system locale.<br>
Call the **getSystemLocale** method to obtain the system locale.
Call the **getSystemLocale** method to obtain the system locale.
```
var locale = i18n.getSystemLocale();
```
4. Check whether the locale's language is RTL.<br>
Call the **isRTL** method to check whether the locale's language is RTL.
Call the **isRTL** method to check whether the locale's language is RTL.
```
......@@ -53,14 +53,14 @@ APIs are provided to access the system language and region information.
```
5. Check whether the system uses a 24-hour clock.<br>
Call the **is24HourClock** method to check whether the system uses a 24-hour clock.
Call the **is24HourClock** method to check whether the system uses a 24-hour clock.
```
var hourClock = i18n.is24HourClock();
```
6. Obtain the localized display of a language.<br>
Call the **getDisplayLanguage** method to obtain the localized display of a language. **language** indicates the language to be localized, **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
Call the **getDisplayLanguage** method to obtain the localized display of a language. **language** indicates the language to be localized, **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
```
var language = "en";
......@@ -70,7 +70,7 @@ APIs are provided to access the system language and region information.
```
7. Obtain the localized display of a country.<br>
Call the **getDisplayCountry** method to obtain the localized display of a country. **country** indicates the country to be localized, **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
Call the **getDisplayCountry** method to obtain the localized display of a country. **country** indicates the country to be localized, **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
```
var country = "US";
......@@ -106,7 +106,7 @@ APIs are provided to access the system language and region information.
### How to Develop
1. Instantiate a **Calendar** object.<br>
Call the **getCalendar** method to obtain the time zone object of a specific locale and type (**i18n** is the name of the imported module). **type** indicates the valid calendar type, for example, **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic_civil**, **islamic_tbla**, **islamic_umalqura**, **japanese**, and **persian**. If **type** is left unspecified, the default calendar type of the locale is used.
Call the **getCalendar** method to obtain the time zone object of a specific locale and type (**i18n** is the name of the imported module). **type** indicates the valid calendar type, for example, **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic_civil**, **islamic_tbla**, **islamic_umalqura**, **japanese**, and **persian**. If **type** is left unspecified, the default calendar type of the locale is used.
```
......@@ -114,7 +114,7 @@ APIs are provided to access the system language and region information.
```
2. Set the time for the **Calendar** object.<br>
Call the **setTime** method to set the time of the **Calendar** object. This method receives two types of parameters. One is a **Date** object, and the other is a value indicating the number of milliseconds elapsed since January 1, 1970, 00:00:00 GMT.
Call the **setTime** method to set the time of the **Calendar** object. This method receives two types of parameters. One is a **Date** object, and the other is a value indicating the number of milliseconds elapsed since January 1, 1970, 00:00:00 GMT.
```
var date1 = new Date();
......@@ -124,14 +124,14 @@ APIs are provided to access the system language and region information.
```
3. Set the year, month, day, hour, minute, and second for the **Calendar** object.<br>
Call the **set** method to set the year, month, day, hour, minute, and second for the **Calendar** object.
Call the **set** method to set the year, month, day, hour, minute, and second for the **Calendar** object.
```
calendar.set(2021, 12, 21, 6, 0, 0)
```
4. Set and obtain the time zone for the **Calendar** object.<br>
Call the **setTimeZone** and **getTimeZone** methods to set and obtain the time zone for the **Calendar** object. The **setTimeZone** method requires an input string to indicate the time zone to be set.
Call the **setTimeZone** and **getTimeZone** methods to set and obtain the time zone for the **Calendar** object. The **setTimeZone** method requires an input string to indicate the time zone to be set.
```
......@@ -140,7 +140,7 @@ APIs are provided to access the system language and region information.
```
5. Set and obtain the first day of a week for the **Calendar** object.<br>
Call the **setFirstDayOfWeek** and **getFirstDayOfWeek** methods to set and obtain the first day of a week for the **Calendar** object. **setFirstDayOfWeek** must be set to a value indicating the first day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.
Call the **setFirstDayOfWeek** and **getFirstDayOfWeek** methods to set and obtain the first day of a week for the **Calendar** object. **setFirstDayOfWeek** must be set to a value indicating the first day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.
```
......@@ -149,7 +149,7 @@ APIs are provided to access the system language and region information.
```
6. Set and obtain the minimum count of days in the first week for the **Calendar** object.<br>
Call the **setMinimalDaysInFirstWeek** and **getMinimalDaysInFirstWeek** methods to set and obtain the minimum count of days in the first week for the **Calendar** object.
Call the **setMinimalDaysInFirstWeek** and **getMinimalDaysInFirstWeek** methods to set and obtain the minimum count of days in the first week for the **Calendar** object.
```
calendar.setMinimalDaysInFirstWeek(3);
......@@ -157,7 +157,7 @@ APIs are provided to access the system language and region information.
```
7. Obtain the localized display of the **Calendar** object.<br>
Call the **getDisplayName** method to obtain the localized display of the **Calendar** object.
Call the **getDisplayName** method to obtain the localized display of the **Calendar** object.
```
......@@ -165,7 +165,7 @@ APIs are provided to access the system language and region information.
```
8. Check whether a date is a weekend.<br>
Call the **isWeekend** method to determine whether the input date is a weekend.
Call the **isWeekend** method to determine whether the input date is a weekend.
```
......@@ -191,22 +191,22 @@ APIs are provided to access the system language and region information.
### How to Develop
1. Instantiate a **PhoneNumberFormat** object.<br>
Call the **PhoneNumberFormat** constructor to instantiate a **PhoneNumberFormat** object. The country code and formatting options of the phone number need to be passed into this constructor. The formatting options are optional, including a style option. Values of this option include: **E164**, **INTERNATIONAL**, **NATIONAL**, and **RFC3966**.
Call the **PhoneNumberFormat** constructor to instantiate a **PhoneNumberFormat** object. The country code and formatting options of the phone number need to be passed into this constructor. The formatting options are optional, including a style option. Values of this option include: **E164**, **INTERNATIONAL**, **NATIONAL**, and **RFC3966**.
```
var phoneNumberFormat = new i18n.PhoneNubmerFormat("CN", {type: "E164"});
var phoneNumberFormat = new i18n.PhoneNumberFormat("CN", {type: "E164"});
```
2. Check whether the phone number format is correct.
Call the **isValidNumber** method to check whether the format of the input phone number is correct.
Call the **isValidNumber** method to check whether the format of the input phone number is correct.
```
var validNumber = phoneNumberFormat.isValidNumber("15812341234");
```
3. Format a phone number.
Call the **format** method of **PhoneNumberFormat** to format the input phone number.
Call the **format** method of **PhoneNumberFormat** to format the input phone number.
```
var formattedNumber = phoneNumberFormat.format("15812341234");
......@@ -215,12 +215,12 @@ APIs are provided to access the system language and region information.
## Measurement Conversion
An API can be called to implement measurement conversion.
The **unitConvert** API is provided to help you implement measurement conversion.
### Available APIs
| Module | API | Description |
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.i18n | unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string<sup>8+</sup> | Converts one measurement unit (**fromUnit**) into another (**toUnit**) and formats the unit based on the specified locale and style. |
......@@ -259,7 +259,7 @@ An API can be called to implement measurement conversion.
### How to Develop
1. Instantiate an **IndexUtil** object.<br>
Call the **getInstance** method to instantiate an **IndexUtil** object for a specific locale. When the **locale** parameter is empty, instantiate an **IndexUtil** object of the default locale.
Call the **getInstance** method to instantiate an **IndexUtil** object for a specific locale. When the **locale** parameter is empty, instantiate an **IndexUtil** object of the default locale.
```
......@@ -267,21 +267,21 @@ An API can be called to implement measurement conversion.
```
2. Obtain the index list.<br>
Call the **getIndexList** method to obtain the alphabet index list of the current locale.
Call the **getIndexList** method to obtain the alphabet index list of the current locale.
```
var indexList = indexUtil.getIndexList();
```
3. Add an index.<br>
Call the **addLocale** method to add the alphabet index of a new locale to the current index list.
Call the **addLocale** method to add the alphabet index of a new locale to the current index list.
```
indexUtil.addLocale("ar")
```
4. Obtain the index of a string.<br>
Call the **getIndex** method to obtain the alphabet index of a string.
Call the **getIndex** method to obtain the alphabet index of a string.
```
var text = "access index";
......@@ -313,7 +313,7 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
### How to Develop
1. Instantiate a **BreakIterator** object.<br>
Call the **getLineInstance** method to instantiate a **BreakIterator** object.
Call the **getLineInstance** method to instantiate a **BreakIterator** object.
```
......@@ -322,7 +322,7 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
```
2. Set and access the text that requires line breaking.<br>
Call the **setLineBreakText** and **getLineBreakText** methods to set and access the text that requires line breaking.
Call the **setLineBreakText** and **getLineBreakText** methods to set and access the text that requires line breaking.
```
......@@ -332,7 +332,7 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
```
3. Obtain the current position of the **BreakIterator** object.<br>
Call the **current** method to obtain the current position of the **BreakIterator** object in the text being processed.
Call the **current** method to obtain the current position of the **BreakIterator** object in the text being processed.
```
......@@ -340,7 +340,7 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
```
4. Set the position of a **BreakIterator** object.<br>
The following APIs are provided to adjust the **first**, **last**, **next**, **previous**, or **following** position of the **BreakIterator** object in the text to be processed.
The following APIs are provided to adjust the **first**, **last**, **next**, **previous**, or **following** position of the **BreakIterator** object in the text to be processed.
```
......@@ -356,7 +356,7 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
```
5. Determine whether a position is a break point.<br>
Call the **isBoundary** method to determine whether a position is a break point. If yes, **true** is returned and the **BreakIterator** object is moved to this position. If no, **false** is returned and the **BreakIterator** object is moved to a break point after this position.
Call the **isBoundary** method to determine whether a position is a break point. If yes, **true** is returned and the **BreakIterator** object is moved to this position. If no, **false** is returned and the **BreakIterator** object is moved to a break point after this position.
```
......
......@@ -9,7 +9,7 @@ Example of the **resources** directory:
```
resources
|---base // Default directory
|---base // Default sub-directory
| |---element
| | |---string.json
| |---media
......@@ -19,7 +19,7 @@ resources
| | |---string.json
| |---media
| | |---icon.png
|---rawfile // Default directory
|---rawfile // Default sub-directory
```
**Table 1** Categories of the **resources** directory
......
......@@ -276,7 +276,7 @@ Table 12 Internal structure of the distro attribute
| moduleName | Name of the current HAP file. The maximum length is 31 characters. | String | No |
| moduleType | Type of the current HAP file. The value can be **entry** or **feature**. For the HAR type, set this attribute to **har**. | String | No |
| installationFree | Whether the HAP file supports the installation-free feature.<br> **true**: The HAP file supports the installation-free feature and meets installation-free constraints.<br> **false**: The HAP file does not support the installation-free feature.<br> Pay attention to the following:<br> When **entry.hap** is set to **true**, all **feature.hap** fields related to **entry.hap **must be **true**.<br> When **entry.hap** is set to **false**, **feature.hap** related to **entry.hap** can be set to **true** or **false** based on service requirements. | Boolean | No |
| deliveryWithInstall | Whether the HAP file supports the installation with application<br /> true: Support。<br /> false:No Support。 | Boolean | No |
| deliveryWithInstall | Whether the HAP file supports the installation with application.<br /> **true**: The HAP file supports the installation with application.<br /> **false**: The HAP file does not support the installation with application. | Boolean | No |
Example of the **distro** attribute structure:
......
......@@ -493,6 +493,74 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
})
```
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise<BundleInfo>
Obtains information about the bundles contained in a HAP file. This API uses a promise to return the result.
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than 0.|
**Return value**
| Type | Description |
| -------------- | -------------------------------------- |
| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the information about the bundles.|
**Example**
```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags)
.then((data) => {
console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>) : void
Obtains information about the bundles contained in a HAP file. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than 0.|
| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the information about the bundles. |
**Example**
```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
## bundle.getAbilityInfo
getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>
......@@ -1233,7 +1301,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md). |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md).|
**Example**
......@@ -1268,7 +1336,7 @@ SystemCapability.BundleManager.BundleFramework
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md). |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md).|
**Example**
......@@ -1309,7 +1377,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md). |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md).|
**Example**
......@@ -1346,7 +1414,7 @@ SystemCapability.BundleManager.BundleFramework
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| moduleName | string | Yes | Module name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md). |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md).|
**Example**
......@@ -1544,6 +1612,7 @@ Enumerates bundle flags.
| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. |
| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications. |
| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information. |
| GET_BUNDLE_WITH_HASH_VALUE<sup>9+</sup> | 0x00000030 | Obtains the bundle information with the information about hash value. |
## BundleOptions
......
# Ability
> **NOTE**<br>
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -18,11 +18,11 @@ import Ability from '@ohos.application.Ability';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- |
| context | [AbilityContext](js-apis-ability-context.md) | Yes | No | Context of an ability. |
| launchWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters for starting the ability. |
| lastRequestWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters used when the ability was started last time. |
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.|
| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.|
| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.|
## Ability.onCreate
......@@ -35,10 +35,10 @@ Called to initialize the service logic when an ability is created.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Information related to this ability, including the ability name and bundle name. |
| param | AbilityConstant.LaunchParam | Yes | Parameters for starting the ability, and the reason for the last abnormal exit. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.|
| param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
**Example**
......@@ -61,9 +61,9 @@ Called when a **WindowStage** is created for this ability.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes | **WindowStage** information. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example**
......@@ -105,9 +105,9 @@ Called when the **WindowStage** is restored during the migration of this ability
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes | **WindowStage** information. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example**
......@@ -143,7 +143,7 @@ Called when this ability is destroyed to clear resources.
onForeground(): void;
Called when this ability is running in the foreground.
Called when this ability is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
......@@ -162,7 +162,7 @@ Called when this ability is running in the foreground.
onBackground(): void;
Callback when this ability is switched to the background.
Called when this ability is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
......@@ -187,15 +187,15 @@ Called to save data during the ability migration preparation process.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes | **want** parameter. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes| **want** parameter.|
**Return value**
| Type | Description |
| -------- | -------- |
| AbilityConstant.OnContinueResult | Continuation result. |
| Type| Description|
| -------- | -------- |
| AbilityConstant.OnContinueResult | Continuation result.|
**Example**
......@@ -220,9 +220,9 @@ Called when the ability startup mode is set to singleton.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want parameters, such as the ability name and bundle name. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
**Example**
......@@ -245,9 +245,9 @@ Called when the configuration of the environment where the ability is running is
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes | New configuration. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
**Example**
......@@ -275,16 +275,16 @@ Sends sequenceable data to the target ability.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. |
| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
| Type | Description |
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return a response. |
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return a response.|
**Example**
......@@ -345,16 +345,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. |
| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
| Type | Description |
| -------- | -------- |
| Promise&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability. |
| Type| Description|
| -------- | -------- |
| Promise&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability.|
**Example**
......@@ -451,9 +451,9 @@ Registers a callback that is invoked when the Stub on the target ability is disc
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| callback | OnReleaseCallBack | Yes | Callback used for the **onRelease** API. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
**Example**
......@@ -486,7 +486,7 @@ Registers a callback that is invoked when the Stub on the target ability is disc
## Callee
Implements callbacks for caller notification registration and unregistration.
Implements callbacks for caller notification registration and deregistration.
## Callee.on
......@@ -499,10 +499,10 @@ Registers a caller notification callback, which is invoked when the target abili
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| method | string | Yes | Notification message string negotiated between the two abilities. |
| callback | CaleeCallBack | Yes | JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities.|
| callback | CaleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
**Example**
......@@ -546,15 +546,15 @@ Registers a caller notification callback, which is invoked when the target abili
off(method: string): void;
Unregisters a caller notification callback, which is invoked when the target ability registers a function.
Deregisters a caller notification callback, which is invoked when the target ability registers a function.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| method | string | Yes | Registered notification message string. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Registered notification message string.|
**Example**
......@@ -575,9 +575,9 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- |
| (msg: string) | function | Yes | No | Prototype of the listener function interface registered by the caller. |
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.|
## CaleeCallBack
......@@ -586,6 +586,6 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- |
| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes | No | Prototype of the message listener function interface registered by the callee. |
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.|
# AbilityLifecycleCallback
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context.
## AbilityLifecycleCallback.onAbilityCreate
onAbilityCreate(ability: Ability): void;
Called when an ability is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityWindowStageCreate
onAbilityWindowStageCreate(ability: Ability): void;
Called when the window stage of an ability is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityWindowStageDestroy
onAbilityWindowStageDestroy(ability: Ability): void;
Called when the window stage of an ability is destroyed.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityDestroy
onAbilityDestroy(ability: Ability): void;
Called when an ability is destroyed.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityForeground
onAbilityForeground(ability: Ability): void;
Called when an ability is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityBackground
onAbilityBackground(ability: Ability): void;
Called when an ability is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityContinue
onAbilityContinue(ability: Ability): void;
Called when an ability is continued on another device.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
**Example**
```js
import AbilityStage from "@ohos.application.AbilityStage";
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
let AbilityLifecycleCallback = {
onAbilityCreate(ability){
console.log("AbilityLifecycleCallback onAbilityCreate ability:" + JSON.stringify(ability));
},
onAbilityWindowStageCreate(ability){
console.log("AbilityLifecycleCallback onAbilityWindowStageCreate ability:" + JSON.stringify(ability));
},
onAbilityWindowStageDestroy(ability){
console.log("AbilityLifecycleCallback onAbilityWindowStageDestroy ability:" + JSON.stringify(ability));
},
onAbilityDestroy(ability){
console.log("AbilityLifecycleCallback onAbilityDestroy ability:" + JSON.stringify(ability));
},
onAbilityForeground(ability){
console.log("AbilityLifecycleCallback onAbilityForeground ability:" + JSON.stringify(ability));
},
onAbilityBackground(ability){
console.log("AbilityLifecycleCallback onAbilityBackground ability:" + JSON.stringify(ability));
},
onAbilityContinue(ability){
console.log("AbilityLifecycleCallback onAbilityContinue ability:" + JSON.stringify(ability));
}
}
// 1. Obtain applicationContext through the context attribute.
let applicationContext = this.context.getApplicationContext();
// 2. Use applicationContext to register a listener for the ability lifecycle in the application.
let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleid));
}
}
```
# ApplicationContext
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides application-level context and APIs for registering and deregistering the ability lifecycle listener in an application.
## How to Use
Before calling any APIs in **ApplicationContext**, obtain an **ApplicationContext** instance through the **context** instance.
```js
let applicationContext = this.context.getApplicationContext();
```
## ApplicationContext.registerAbilityLifecycleCallback
registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**;
Registers a listener to monitor the ability lifecycle of the application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ------------------------ | -------- | ---- | ------------------------------ |
| [AbilityLifecycleCallback](js-apis-application-abilityLifecycleCallback.md) | callback | Yes | Callback used to return the ID of the registered listener.|
**Return value**
| Type | Description |
| ------ | ------------------------------ |
| number | ID of the registered listener. The ID is incremented by 1 each time the listener is registered. When the ID exceeds 2^63-1, **-1** is returned.|
**Example**
```js
let applicationContext = this.context.getApplicationContext();
console.log("stage applicationContext: " + JSON.stringify(applicationContext));
let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleid));
```
## ApplicationContext.unregisterAbilityLifecycleCallback
unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**;
Deregisters the listener that monitors the ability lifecycle of the application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ------------- | -------- | ---- | -------------------------- |
| callbackId | number | Yes | ID of the listener to deregister.|
| AsyncCallback | callback | Yes | Callback used to return the result. |
**Example**
```js
let applicationContext = this.context.getApplicationContext();
console.log("stage applicationContext: " + JSON.stringify(applicationContext));
applicationContext.unregisterAbilityLifecycleCallback(lifecycleid, (error, data) => {
console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error));
});
```
# MissionInfo
> **NOTE**<br>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import MissionInfo from '@ohos.application.missionInfo'
```
## MissionInfo
Provides the mission information.
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Yes| Mission ID.|
| runningState | number | Yes| Yes| Running state of the mission.|
| lockedState | boolean | Yes| Yes| Locked state of the mission.|
| timestamp | string | Yes| Yes| Latest time when the mission was created or updated.|
| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.|
| label | string | Yes| Yes| Label of the mission.|
| iconPath | string | Yes| Yes| Path of the mission icon.|
| continuable | boolean | Yes| Yes| Whether the mission is continuable.|
# Background Task Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -25,7 +25,7 @@ The default duration of delayed suspension is 180000 when the battery level is h
| Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------ |
| reason | string | Yes | Reason for delayed transition to the suspended state. |
| callback | Callback&lt;void&gt; | Yes | Invoked when a delay is about to time out. Generally, this callback is used to notify the application 6 seconds before the delay times out. |
| callback | Callback&lt;void&gt; | Yes | Invoked when a delay is about to time out. Generally, this callback is used to notify the application 6 seconds before the delay times out.|
**Return value**
| Type | Description |
......@@ -66,10 +66,10 @@ Obtains the remaining duration before the application is suspended. This API use
```js
let id = 1;
backgroundTaskManager.getRemainingDelayTime(id, (err, res) => {
if(err.data === 0) {
console.log('callback => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
if(err) {
console.log('callback => Operation getRemainingDelayTime failed. Cause: ' + err.code);
} else {
console.log('callback => Operation getRemainingDelayTime failed. Cause: ' + err.data);
console.log('callback => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
}
})
```
......@@ -99,7 +99,7 @@ Obtains the remaining duration before the application is suspended. This API use
backgroundTaskManager.getRemainingDelayTime(id).then( res => {
console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
}).catch( err => {
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.data);
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.code);
})
```
......@@ -186,16 +186,16 @@ Requests a continuous task from the system. This API uses a promise to return th
**Parameters**
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------- | ---- | ----------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked.|
**Return value**
| Type | Description |
| Type | Description |
| -------------- | ---------------- |
| Promise\<void> | Promise used to return the result. |
| Promise\<void> | Promise used to return the result.|
**Example**
```js
......@@ -235,10 +235,10 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters**
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| -------- | ----------------------------- | ---- | ---------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```js
......@@ -266,14 +266,14 @@ Requests to cancel a continuous task. This API uses a promise to return the resu
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Parameters**
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| ------- | ----------------------------- | ---- | --------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. |
| context | [Context](js-apis-Context.md) | Yes | Application context.|
**Return value**
| Type | Description |
| Type | Description |
| -------------- | ---------------- |
| Promise\<void> | Promise used to return the result. |
| Promise\<void> | Promise used to return the result.|
**Example**
```js
......
......@@ -35,3 +35,4 @@ Provides the HAP module information.
| mainElementName<sup>9+</sup> | string | Yes | No | Information about the main ability. |
| extensionAbilityInfo<sup>9+</sup> | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Information about the Extension ability.|
| metadata<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. |
| hashValue<sup>9+</sup> | string | Yes | No | The hash value of the module. |
\ No newline at end of file
......@@ -5,7 +5,6 @@ The call module provides call management functions, including making calls, redi
To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange).
>**NOTE**<br>
>
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -27,10 +26,10 @@ Initiates a call. This API uses an asynchronous callback to return the result.
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------- | ---- | --------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure|
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | -------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure |
**Example**
......@@ -53,11 +52,11 @@ Initiates a call. You can set call options as needed. This API uses an asynchron
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | --------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure |
**Example**
......@@ -82,16 +81,16 @@ Initiates a call. You can set call options as needed. This API uses a promise to
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | -------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call.|
| phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. |
**Return value**
| Type | Description |
| ---------------------- | ------------------------------------------------------------ |
| Promise&lt;boolean&gt; | Promise used to return the result.<br>- **true**: success<br>- **false**: failure|
| Type | Description |
| ---------------------- | ---------------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.<br>- **true**: success<br>- **false**: failure |
**Example**
......@@ -116,10 +115,10 @@ Launches the call screen and displays the dialed number. This API uses an asynch
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | ------------------------- | ---- | ------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -140,15 +139,15 @@ Launches the call screen and displays the dialed number. This API uses a promise
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------- |
| phoneNumber | string | Yes | Phone number.|
| phoneNumber | string | Yes | Phone number. |
**Return value**
| Type | Description |
| ------------------- | --------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Promise&lt;void&gt; | Promise used to return the result. |
**Example**
......@@ -171,9 +170,9 @@ Checks whether a call is in progress. This API uses an asynchronous callback to
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Callback used to return the result.<br>- **true**: A call is in progress.<br>- **false**: No call is in progress.|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Callback used to return the result.<br>- **true**: A call is in progress.<br>- **false**: No call is in progress. |
**Example**
......@@ -196,7 +195,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu
| Type | Description |
| ---------------------- | --------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
| Promise&lt;boolean&gt; | Promise used to return the result. |
**Example**
......@@ -220,9 +219,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes | Callback used to return the result.|
| callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -245,7 +244,7 @@ Obtains the call status. This API uses a promise to return the result.
| Type | Description |
| -------------------------------------- | --------------------------------------- |
| Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result.|
| Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result. |
**Example**
......@@ -270,7 +269,7 @@ Checks whether a device supports voice calls.
| Type | Description |
| ------- | ------------------------------------------------------------ |
| boolean | - **true**: The device supports voice calls.<br>- **false**: The device does not support voice calls.|
| boolean | - **true**: The device supports voice calls.<br>- **false**: The device does not support voice calls. |
```js
let result = call.hasVoiceCapability();
......@@ -287,10 +286,10 @@ Checks whether the called number is an emergency number. This API uses an asynch
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number.|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. |
**Example**
......@@ -311,11 +310,11 @@ Checks whether the called number is an emergency number based on the phone numbe
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number.|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. |
**Example**
......@@ -336,16 +335,16 @@ Checks whether the called number is an emergency number based on the phone numbe
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option.|
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option. |
**Return value**
| Type | Description |
| ---------------------- | --------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
| Promise&lt;boolean&gt; | Promise used to return the result. |
**Example**
......@@ -370,10 +369,10 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -395,11 +394,11 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting option, for example, country code. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -424,16 +423,16 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------- | ---- | ---------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting option, for example, country code.|
| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting option, for example, country code. |
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.|
| Promise&lt;string&gt; | Promise used to return the result. |
**Example**
......@@ -460,11 +459,11 @@ The phone number must match the specified country code. For example, for a China
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ----------------------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -491,16 +490,16 @@ All country codes are supported.
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported.|
| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. |
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| Promise&lt;string&gt; | Promise used to return the result.|
| Promise&lt;string&gt; | Promise used to return the result. |
**Example**
......@@ -521,7 +520,7 @@ Provides an option for determining whether a call is a video call.
**System capability**: SystemCapability.Telephony.CallManager
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory | Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call|
......@@ -536,7 +535,7 @@ Enumerates call states.
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. |
| CALL_STATE_IDLE | 0 | No call is in progress. |
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. |
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.|
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. |
## EmergencyNumberOptions<sup>7+</sup>
......@@ -544,7 +543,7 @@ Provides an option for determining whether a number is an emergency number for t
**System capability**: SystemCapability.Telephony.CallManager
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------------- |
| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
......@@ -554,6 +553,6 @@ Provides an option for number formatting.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.|
| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. |
......@@ -465,8 +465,6 @@ selectContact(callback: AsyncCallback&lt;Array&lt;Contact&gt;&gt;): void
Selects a contact. This API uses an asynchronous callback to return the result.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData
......@@ -495,8 +493,6 @@ selectContact(): Promise&lt;Array&lt;Contact&gt;&gt;
Selects a contact. This API uses a promise to return the result.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData
......
......@@ -17,7 +17,7 @@ import dataAbility from '@ohos.data.dataAbility';
createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates
Creates an **RdbPredicates** object based on a **DataAabilityPredicates** object.
Creates an **RdbPredicates** object based on a **DataAbilityPredicates** object.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
......
# DataAbilityHelper Module (JavaScript SDK APIs)
> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE**
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import featureAbility from "@ohos.ability.featureAbility";
```
## Usage
Import the following modules based on the actual situation before using the current module:
```
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataability'
import ohos_data_ability from '@ohos.data.dataAbility'
import ohos_data_rdb from '@ohos.data.rdb'
```
......@@ -499,7 +506,7 @@ const valueBucket = {
"name": "rose",
"age": 22,
"salary": 200.5,
"blobType": u8,
"blobType": "u8",
}
DAHelper.insert(
"dataability:///com.example.DataAbility",
......@@ -541,7 +548,7 @@ const valueBucket = {
"name": "rose1",
"age": 221,
"salary": 20.5,
"blobType": u8,
"blobType": "u8",
}
DAHelper.insert(
"dataability:///com.example.DataAbility",
......@@ -574,9 +581,9 @@ import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": u8,},
{"name": "roe12", "age": 21, "salary": 20.5, "blobType": u8,},
{"name": "roe13", "age": 21, "salary": 20.5, "blobType": u8,})
var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe12", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe13", "age": 21, "salary": 20.5, "blobType": "u8",})
DAHelper.batchInsert(
"dataability:///com.example.DataAbility",
cars,
......@@ -613,9 +620,9 @@ import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": u8,},
{"name": "roe12", "age": 21, "salary": 20.5, "blobType": u8,},
{"name": "roe13", "age": 21, "salary": 20.5, "blobType": u8,})
var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe12", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe13", "age": 21, "salary": 20.5, "blobType": "u8",})
DAHelper.batchInsert(
"dataability:///com.example.DataAbility",
cars
......@@ -682,6 +689,7 @@ Deletes one or more data records from the database. This API uses a promise to r
```js
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
......@@ -723,7 +731,7 @@ const va = {
"name": "roe1",
"age": 21,
"salary": 20.5,
"blobType": u8,
"blobType": "u8",
}
let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.update(
......@@ -769,7 +777,7 @@ const va = {
"name": "roe1",
"age": 21,
"salary": 20.5,
"blobType": u8,
"blobType": "u8",
}
let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.update(
......
# Fault Logger
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -15,12 +15,12 @@ Enumerates the fault types.
**System capability**: SystemCapability.HiviewDFX.Hiview.FaultLogger
| Name | Default Value | Description |
| Name| Default Value| Description|
| -------- | -------- | -------- |
| NO_SPECIFIC | 0 | No specific fault type. |
| CPP_CRASH | 2 | C++ program crash. |
| JS_CRASH | 3 | JS program crash. |
| APP_FREEZE | 4 | Application freezing. |
| NO_SPECIFIC | 0 | No specific fault type.|
| CPP_CRASH | 2 | C++ program crash.|
| JS_CRASH | 3 | JS program crash.|
| APP_FREEZE | 4 | Application freezing.|
## FaultLogInfo
......@@ -30,14 +30,14 @@ Defines the data structure of the fault log information.
| Name| Type| Description|
| -------- | -------- | -------- |
| pid | number | Process ID of the faulty process. |
| uid | number | User ID of the faulty process. |
| type | [FaultType](#faulttype) | Fault type. |
| timestamp | number | Second-level timestamp when the log was generated. |
| reason | string | Reason for the fault. |
| module | string | Module on which the fault occurred. |
| summary | string | Summary of the fault. |
| fullLog | string | Full log text. |
| pid | number | Process ID of the faulty process.|
| uid | number | User ID of the faulty process.|
| type | [FaultType](#faulttype) | Fault type.|
| timestamp | number | Second-level timestamp when the log was generated.|
| reason | string | Reason for the fault.|
| module | string | Module on which the fault occurred.|
| summary | string | Summary of the fault.|
| fullLog | string | Full log text.|
## faultLogger.querySelfFaultLog
......@@ -51,7 +51,7 @@ Obtains the fault information about the current process. This API uses an asynch
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faulttype) | Yes| Fault type. |
| faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
**Example**
......@@ -68,7 +68,7 @@ function queryFaultLogCallback(error, value) {
console.info("Log pid: " + value[i].pid);
console.info("Log uid: " + value[i].uid);
console.info("Log type: " + value[i].type);
console.info("Log ts: " + value[i].ts);
console.info("Log timestamp: " + value[i].timestamp);
console.info("Log reason: " + value[i].reason);
console.info("Log module: " + value[i].module);
console.info("Log summary: " + value[i].summary);
......@@ -91,13 +91,13 @@ Obtains the fault information about the current process. This API uses a promise
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faulttype) | Yes| Fault type. |
| faultType | [FaultType](#faulttype) | Yes| Fault type.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
**Example**
......@@ -112,7 +112,7 @@ async function getLog() {
console.info("Log pid: " + value[i].pid);
console.info("Log uid: " + value[i].uid);
console.info("Log type: " + value[i].type);
console.info("Log ts: " + value[i].ts);
console.info("Log timestamp: " + value[i].timestamp);
console.info("Log reason: " + value[i].reason);
console.info("Log module: " + value[i].module);
console.info("Log summary: " + value[i].summary);
......@@ -120,4 +120,4 @@ async function getLog() {
}
}
}
```
\ No newline at end of file
```
# FormExtension
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> **NOTE**<br/>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides **FormExtension** APIs.
......@@ -46,6 +46,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been
**Example**
```js
import formBindingData from '@ohos.application.formBindingData'
export default class MyFormExtension extends FormExtension {
onCreate(want) {
console.log('FormExtension onCreate, want:' + want.abilityName);
......@@ -100,6 +101,7 @@ Called to notify the widget provider that a widget has been updated. After obtai
**Example**
```js
import formBindingData from '@ohos.application.formBindingData'
export default class MyFormExtension extends FormExtension {
onUpdate(formId) {
console.log('FormExtension onUpdate, formId:' + formId);
......@@ -130,6 +132,7 @@ Called to notify the widget provider of the change of visibility.
**Example**
```js
import formBindingData from '@ohos.application.formBindingData'
export default class MyFormExtension extends FormExtension {
onVisibilityChange(newStatus) {
console.log('FormExtension onVisibilityChange, newStatus:' + newStatus);
......@@ -213,9 +216,35 @@ Called when the configuration of the environment where the ability is running is
**Example**
```js
class MyFormExtension extends MyFormExtension {
class MyFormExtension extends FormExtension {
onConfigurationUpdated(config) {
console.log('onConfigurationUpdated, config:' + JSON.stringify(config));
}
}
```
## FormExtension.onAcquireFormState
onAcquireFormState?(want: Want): formInfo.FormState;
Used by the widget provider to receive the widget state query request. By default, the initial widget state is returned.
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | No| Description of the widget state, including the bundle name, ability name, module name, widget name, and widget dimension.|
**Example**
```js
import fromInfo from '@ohos.application.fromInfo'
class MyFormExtension extends FormExtension {
onAcquireFormState(want) {
console.log('FormExtension onAcquireFormState, want:' + want);
return fromInfo.FormState.UNKNOWN;
}
}
```
# FormHost
> **NOTE**<br/>
> **NOTE**<br>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides APIs related to the widget host.
......@@ -57,15 +57,15 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Parameters**
......@@ -147,16 +147,16 @@ SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ----------- |
| formId | string | Yes | ID of a widget. |
| isReleaseCache | boolean | No | Whether to release the cache.|
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ----------- |
| formId | string | Yes | ID of a widget. |
| isReleaseCache | boolean | No | Whether to release the cache.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -209,15 +209,15 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -270,15 +270,15 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -311,7 +311,7 @@ SystemCapability.Ability.Form
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId, (error, data) => {
if (error.code) {
console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error));
......@@ -337,14 +337,14 @@ SystemCapability.Ability.Form
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId).then(() => {
console.log('formHost notifyVisibleForms success');
}).catch((error) => {
......@@ -372,7 +372,7 @@ SystemCapability.Ability.Form
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId, (error, data) => {
if (error.code) {
console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error));
......@@ -398,14 +398,14 @@ SystemCapability.Ability.Form
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId).then(() => {
console.log('formHost notifyInvisibleForms success');
}).catch((error) => {
......@@ -433,7 +433,7 @@ SystemCapability.Ability.Form
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId, (error, data) => {
if (error.code) {
console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error));
......@@ -459,14 +459,14 @@ SystemCapability.Ability.Form
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId).then(() => {
console.log('formHost enableFormsUpdate success');
}).catch((error) => {
......@@ -494,7 +494,7 @@ SystemCapability.Ability.Form
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId, (error, data) => {
if (error.code) {
console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error));
......@@ -520,14 +520,14 @@ SystemCapability.Ability.Form
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
```js
var formId = "12400633174999288";
var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId).then(() => {
console.log('formHost disableFormsUpdate success');
}).catch((error) => {
......@@ -574,9 +574,9 @@ SystemCapability.Ability.Form
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -591,7 +591,7 @@ SystemCapability.Ability.Form
## getAllFormsInfo
getAllFormsInfo(callback: AsyncCallback&lt;Array&lt;FormInfo&gt;&gt;): void;
getAllFormsInfo(callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by all applications on the device. This API uses an asynchronous callback to return the result.
......@@ -601,9 +601,9 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example**
......@@ -619,7 +619,8 @@ SystemCapability.Ability.Form
## getAllFormsInfo
getAllFormsInfo(): Promise&lt;Array&lt;FormInfo&gt;&gt;;
getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
Obtains the widget information provided by all applications on the device. This API uses a promise to return the result.
......@@ -645,7 +646,8 @@ SystemCapability.Ability.Form
## getFormsInfo
getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;FormInfo&gt;&gt;): void;
getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result.
......@@ -655,10 +657,10 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example**
......@@ -674,7 +676,8 @@ SystemCapability.Ability.Form
## getFormsInfo
getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;FormInfo&gt;&gt;): void;
getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result.
......@@ -684,11 +687,11 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | Yes| Module name.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | Yes| Module name.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example**
......@@ -704,7 +707,8 @@ SystemCapability.Ability.Form
## getFormsInfo
getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;FormInfo&gt;&gt;;
getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
Obtains the widget information provided by a given application on the device. This API uses a promise to return the result.
......@@ -714,10 +718,10 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | No| Module name.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | No| Module name.|
**Return value**
......@@ -767,7 +771,7 @@ SystemCapability.Ability.Form
## deleteInvalidForms
function deleteInvalidForms(formIds: Array&lt;string&gt;): Promise&lt;number&gt;;
deleteInvalidForms(formIds: Array&lt;string&gt;): Promise&lt;number&gt;;
Deletes invalid widgets from the list. This API uses a promise to return the result.
......@@ -800,7 +804,7 @@ SystemCapability.Ability.Form
## acquireFormState
acquireFormState(want: Want, callback: AsyncCallback&lt;FormStateInfo&gt;): void;
acquireFormState(want: Want, callback: AsyncCallback&lt;formInfo.FormStateInfo&gt;): void;
Obtains the widget state. This API uses an asynchronous callback to return the result.
......@@ -819,9 +823,14 @@ SystemCapability.Ability.Form
```js
var want = {
"deviceId": "",
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
"deviceId": "",
"bundleName": "ohos.samples.FormApplication",
"abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
};
formHost.acquireFormState(want, (error, data) => {
if (error.code) {
......@@ -834,7 +843,7 @@ SystemCapability.Ability.Form
## acquireFormState
function acquireFormState(want: Want): Promise&lt;FormStateInfo&gt;;
acquireFormState(want: Want): Promise&lt;formInfo.FormStateInfo&gt;;
Obtains the widget state. This API uses a promise to return the result.
......@@ -858,9 +867,14 @@ SystemCapability.Ability.Form
```js
var want = {
"deviceId": "",
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
"deviceId": "",
"bundleName": "ohos.samples.FormApplication",
"abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
};
formHost.acquireFormState(want).then((data) => {
console.log('formHost acquireFormState, data:' + JSON.stringify(data));
......@@ -962,16 +976,16 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isVisible | boolean | Yes | Whether to be visible.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isVisible | boolean | Yes | Whether to be visible.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -1025,16 +1039,16 @@ SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isEnableUpdate | boolean | Yes | Whether to enable update.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isEnableUpdate | boolean | Yes | Whether to enable update.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......
......@@ -80,7 +80,7 @@ SystemCapability.Ability.Form
## updateForm
updateForm(formId: string, formBindingData: FormBindingData, callback: AsyncCallback&lt;void&gt;): void;
updateForm(formId: string, formBindingData: formBindingData.FormBindingData,callback: AsyncCallback&lt;void&gt;): void;
Updates a widget. This API uses an asynchronous callback to return the result.
......@@ -111,7 +111,7 @@ SystemCapability.Ability.Form
## updateForm
updateForm(formId: string, formBindingData: FormBindingData): Promise&lt;void&gt;;
updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise&lt;void&gt;;
Updates a widget. This API uses a promise to return the result.
......
......@@ -21,15 +21,15 @@ Provides the constants of all rule types.
| Name | Type| Description |
| ---------------------------------- | -------- | ------------------------------------------------------ |
| RULE_CAUTION_PRINT_LOG | bigint | Alarm rule, which is programmed to print a log when an alarm is generated. |
| RULE_CAUTION_TRIGGER_CRASH | bigint | Alarm rule, which is programmed to force the application to exit when an alarm is generated. |
| RULE_THREAD_CHECK_SLOW_PROCESS | bigint | Caution rule, which is programmed to detect whether any time-consuming function is invoked. |
| RULE_CHECK_ABILITY_CONNECTION_LEAK | bigint | Caution rule, which is programmed to detect whether ability leakage has occurred. |
| RULE_CAUTION_PRINT_LOG | bigInt | Alarm rule, which is programmed to print a log when an alarm is generated. |
| RULE_CAUTION_TRIGGER_CRASH | bigInt | Alarm rule, which is programmed to force the application to exit when an alarm is generated. |
| RULE_THREAD_CHECK_SLOW_PROCESS | bigInt | Caution rule, which is programmed to detect whether any time-consuming function is invoked. |
| RULE_CHECK_ABILITY_CONNECTION_LEAK | bigInt | Caution rule, which is programmed to detect whether ability leakage has occurred. |
## hichecker.addRule
addRule(rule: bigint): void
addRule(rule: bigInt): void
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
......@@ -39,7 +39,7 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| rule | bigint | Yes | Rule to be added.|
| rule | bigInt | Yes | Rule to be added.|
**Example**
......@@ -54,7 +54,7 @@ hichecker.addRule(
## hichecker.removeRule
removeRule(rule: bigint): void
removeRule(rule: bigInt): void
Removes one or more rules. The removed rules will become ineffective.
......@@ -64,7 +64,7 @@ Removes one or more rules. The removed rules will become ineffective.
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| rule | bigint | Yes | Rule to be removed.|
| rule | bigInt | Yes | Rule to be removed.|
**Example**
......@@ -79,7 +79,7 @@ hichecker.removeRule(
## hichecker.getRule
getRule(): bigint
getRule(): bigInt
Obtains a collection of thread, process, and alarm rules that have been added.
......@@ -89,7 +89,7 @@ Obtains a collection of thread, process, and alarm rules that have been added.
| Type | Description |
| ------ | ---------------------- |
| bigint | Collection of added rules.|
| bigInt | Collection of added rules.|
**Example**
......@@ -98,12 +98,12 @@ Obtains a collection of thread, process, and alarm rules that have been added.
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
// Obtain the collection of added rules.
hichecker.getRule(); // return 1n;
hichecker.getRule(); // Return 1n.
```
## hichecker.contains
contains(rule: bigint): boolean
contains(rule: bigInt): boolean
Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread.
......@@ -113,13 +113,13 @@ Checks whether the specified rule exists in the collection of added rules. If th
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| rule | bigint | Yes | Rule to be checked.|
| rule | bigInt | Yes | Rule to be checked.|
**Return value**
| Type | Description |
| ------- | ---------------------------------------------------------- |
| boolean | Returns **true** if the rule exists in the collection of added rules; returns **false** otherwise.|
| boolean | Returns **true** if the rule exists in the collection of added rules; returns **false** otherwise. |
**Example**
......@@ -128,6 +128,6 @@ Checks whether the specified rule exists in the collection of added rules. If th
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
// Check whether the added rule exists in the collection of added rules.
hichecker.contains(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // return true;
hichecker.contains(hichecker.RULE_CAUTION_PRINT_LOG); // return false;
hichecker.contains(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // Return true
hichecker.contains(hichecker.RULE_CAUTION_PRINT_LOG); // Return false
```
......@@ -26,15 +26,15 @@ Registers a listener to observe the mission status.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| listener | MissionListener | Yes| Listener to register.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| listener | MissionListener | Yes| Listener to register.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns the unique index of the mission status listener, which is created by the system and allocated when the listener is registered.|
| Type| Description|
| -------- | -------- |
| number | Returns the unique index of the mission status listener, which is created by the system and allocated when the listener is registered.|
**Example**
......@@ -62,10 +62,10 @@ Deregisters a mission status listener. This API uses an asynchronous callback to
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
......@@ -96,15 +96,15 @@ Deregisters a mission status listener. This API uses a promise to return the res
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
......@@ -135,11 +135,11 @@ Obtains the information about a given mission. This API uses an asynchronous cal
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;[MissionInfo](#missioninfo)&gt; | Yes| Callback used to return the mission information obtained.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;[MissionInfo](#missioninfo)&gt; | Yes| Callback used to return the mission information obtained.|
**Example**
......@@ -169,16 +169,16 @@ Obtains the information about a given mission. This API uses a promise to return
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[MissionInfo](#missioninfo)&gt; | Promise used to return the mission information obtained.|
| Type| Description|
| -------- | -------- |
| Promise&lt;[MissionInfo](#missioninfo)&gt; | Promise used to return the mission information obtained.|
**Example**
......@@ -201,11 +201,11 @@ Obtains information about all missions. This API uses an asynchronous callback t
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| numMax | number | Yes| Maximum number of missions whose information can be obtained.|
| callback | AsyncCallback&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Yes| Callback used to return the array of mission information obtained.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| numMax | number | Yes| Maximum number of missions whose information can be obtained.|
| callback | AsyncCallback&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Yes| Callback used to return the array of mission information obtained.|
**Example**
......@@ -230,16 +230,16 @@ Obtains information about all missions. This API uses a promise to return the re
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| numMax | number | Yes| Maximum number of missions whose information can be obtained.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| numMax | number | Yes| Maximum number of missions whose information can be obtained.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Promise used to return the array of mission information obtained.|
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Promise used to return the array of mission information obtained.|
**Example**
......@@ -262,11 +262,11 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Yes| Callback used to return the snapshot information obtained.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Yes| Callback used to return the snapshot information obtained.|
**Example**
......@@ -297,16 +297,16 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Promise used to return the snapshot information obtained.|
| Type| Description|
| -------- | -------- |
| Promise&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Promise used to return the snapshot information obtained.|
**Example**
......@@ -337,10 +337,10 @@ Locks a given mission. This API uses an asynchronous callback to return the resu
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
......@@ -370,15 +370,15 @@ Locks a given mission. This API uses a promise to return the result.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
......@@ -441,15 +441,15 @@ Unlocks a given mission. This API uses a promise to return the result.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
......@@ -483,10 +483,10 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
......@@ -516,15 +516,15 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
......@@ -574,9 +574,9 @@ Clears all unlocked missions. This API uses a promise to return the result.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
......@@ -598,10 +598,10 @@ Switches a given mission to the foreground. This API uses an asynchronous callba
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
......@@ -631,11 +631,11 @@ Switches a given mission to the foreground, with the startup parameters for the
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| options | StartOptions | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| options | StartOptions | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
......@@ -665,16 +665,16 @@ Switches a given mission to the foreground, with the startup parameters for the
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| options | StartOptions | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.|
| options | StartOptions | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
......@@ -700,13 +700,13 @@ Describes the mission information.
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description|
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Yes| Mission ID.|
| runningState | number | Yes| Yes| Running state of the mission.|
| lockedState | boolean | Yes| Yes| Locked state of the mission.|
| timestamp | string | Yes| Yes| Latest time when the mission was created or updated.|
| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.|
| label | string | Yes| Yes| Label of the mission.|
| iconPath | string | Yes| Yes| Path of the mission icon.|
| continuable | boolean | Yes| Yes| Whether the mission is continuable.|
| missionId | number | Yes| Yes| Mission ID.|
| runningState | number | Yes| Yes| Running state of the mission.|
| lockedState | boolean | Yes| Yes| Locked state of the mission.|
| timestamp | string | Yes| Yes| Latest time when the mission was created or updated.|
| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.|
| label | string | Yes| Yes| Label of the mission.|
| iconPath | string | Yes| Yes| Path of the mission icon.|
| continuable | boolean | Yes| Yes| Whether the mission can be continued on another device. |
# ProcessRunningInfo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**<br>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides process running information.
## Modules to Import
```js
import appManager from '@ohos.application.appManager'
```
## Usage
......
# Application Configuration
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.i18n`](js-apis-i18n.md) and [`@ohos.intl`](js-apis-intl.md) instead.
> **NOTE**<br>
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.i18n`](js-apis-i18n.md) and [`@ohos.intl`](js-apis-intl.md) instead.
>
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -17,29 +17,37 @@ import configuration from '@system.configuration';
## configuration.getLocale
getLocale(): &lt;LocaleResponse&gt;
static getLocale(): LocaleResponse
Obtains the current locale of the application, which is the same as the system locale.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite
**Return values**
**Table 1** LocaleResponse
| Name | Type | Description |
| -------- | -------- | -------- |
| language | string | Current&nbsp;language&nbsp;of&nbsp;the&nbsp;application,&nbsp;for&nbsp;example,&nbsp;**zh**. |
| countryOrRegion | string | Country&nbsp;or&nbsp;region,&nbsp;for&nbsp;example,&nbsp;**CN**. |
| dir | string | Text&nbsp;layout&nbsp;direction.&nbsp;Available&nbsp;values&nbsp;are&nbsp;as&nbsp;follows:<br/>-&nbsp;**ltr**:&nbsp;The&nbsp;text&nbsp;direction&nbsp;is&nbsp;from&nbsp;left&nbsp;to&nbsp;right.<br/>-&nbsp;**rtl**:&nbsp;The&nbsp;text&nbsp;direction&nbsp;is&nbsp;from&nbsp;right&nbsp;to&nbsp;left. |
| unicodeSetting<sup>5+</sup> | string | Unicode&nbsp;key&nbsp;set&nbsp;determined&nbsp;by&nbsp;the&nbsp;locale.<br/>For&nbsp;example,&nbsp;**{"nu":"arab"}**&nbsp;indicates&nbsp;that&nbsp;the&nbsp;current&nbsp;locale&nbsp;uses&nbsp;Arabic&nbsp;numerals.<br/>If&nbsp;the&nbsp;current&nbsp;locale&nbsp;does&nbsp;not&nbsp;have&nbsp;a&nbsp;specific&nbsp;key&nbsp;set,&nbsp;an&nbsp;empty&nbsp;set&nbsp;is&nbsp;returned. |
**Return value**
| Type | Description |
| -------------- | ------------- |
| LocaleResponse | Current locale information.|
**Example**
```
export default {
getLocale() {
const localeInfo = configuration.getLocale();
console.info(localeInfo.language);
```
export default {
getLocale() {
const localeInfo = configuration.getLocale();
console.info(localeInfo.language);
}
}
}
```
\ No newline at end of file
```
## LocaleResponse
Defines attributes of the current locale.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ---------------------------------------- |
| language | string | Yes | No | Language, for example, **zh**.|
| countryOrRegion | string | Yes | No | Country or region, for example, **CN** or **US**.|
| dir | string | Yes | No | Text layout direction. The value can be:<br>- **ltr**: from left to right<br>- **rtl**: from right to left|
| unicodeSetting<sup>5+</sup> | string | Yes | No | Unicode language key set determined by the locale. If current locale does not have a specific key set, an empty set is returned.<br>For example, **{"nu":"arab"}** indicates that current locale uses Arabic numerals.|
# System Parameter
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**<br>
>
> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - This is a system API and cannot be called by third-party applications.
......@@ -24,7 +25,7 @@ Obtains the value of the attribute with the specified key.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system attribute.|
| def | string | No| Default Value|
| def | string | No| Default value.|
**Return value**
......@@ -48,7 +49,7 @@ try {
get(key: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the value of the attribute with the specified key. This API uses an asynchronous callback to return the result.
Obtains the value of the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo
......@@ -79,7 +80,7 @@ try {
get(key: string, def: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the value of the attribute with the specified key. This API uses an asynchronous callback to return the result.
Obtains the value of the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo
......@@ -112,7 +113,7 @@ try {
get(key: string, def?: string): Promise&lt;string&gt;
Obtains the value of the attribute with the specified key. This API uses a promise to return the result.
Obtains the value of the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo
......@@ -171,11 +172,11 @@ try {
```
## parameter.set(key: string, value: string, callback: AsyncCallback&lt;void&gt;)
## parameter.set
set(key: string, value: string, callback: AsyncCallback&lt;void&gt;): void
Sets a value for the attribute with the specified key. This API uses an asynchronous callback to return the result.
Sets a value for the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo
......@@ -184,7 +185,7 @@ Sets a value for the attribute with the specified key. This API uses an asynchro
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system attribute.|
| def | string | Yes| Default Value|
| value | string | Yes| System attribute value to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
......@@ -203,11 +204,11 @@ try {
```
## parameter.set(key: string, def?: string)
## parameter.set
set(key: string, def?: string): Promise&lt;string&gt;
set(key: string, value: string): Promise&lt;void&gt;
Sets a value for the attribute with the specified key. This API uses a promise to return the result.
Sets a value for the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo
......@@ -216,13 +217,13 @@ Sets a value for the attribute with the specified key. This API uses a promise t
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system attribute.|
| def | string | No| Default Value|
| value| string | Yes| System attribute value to set.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the execution result.|
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
......
......@@ -3,7 +3,6 @@
>![](public_sys-resources/icon-note.gif) **NOTE:**
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
>Newly added APIs are defined but not implemented in OpenHarmony 3.1 Release. They will be available for use in OpenHarmony 3.1 MR.
You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the [createWebSocket](#websocketcreatewebsocket) API to create a [WebSocket](#websocket) object and then use the [connect](#connect) API to connect to the server. If the connection is successful, the client will receive a callback of the [open](#onopen) event. Then, the client can communicate with the server using the [send](#send) API. When the server sends a message to the client, the client will receive a callback of the [message](#onmessage) event. If the client no longer needs this connection, it can call the [close](#close) API to disconnect from the server. Then, the client will receive a callback of the [close](#onclose) event.
......
......@@ -58,10 +58,10 @@ Describes the properties of the status bar and navigation bar.
| Name | Type| Readable| Writable| Description |
| -------------------------------------- | -------- | ---- | ---- | ------------------------------------------------------------ |
| statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.|
| statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **\#00FF00** or **\#FF00FF00**.|
| isStatusBarLightIcon<sup>7+</sup> | boolean | No | Yes | Whether any icon on the status bar is highlighted. |
| statusBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the status bar. |
| navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.|
| navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **\#00FF00** or **\#FF00FF00**.|
| isNavigationBarLightIcon<sup>7+</sup> | boolean | No | No | Whether any icon on the navigation bar is highlighted. |
| navigationBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the navigation bar. |
......@@ -78,7 +78,7 @@ This is a system API and cannot be called by third-party applications.
| type | [WindowType](#windowtype) | Yes | Yes | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.|
| isEnable | boolean | Yes | Yes | Whether the system bar is displayed. |
| region | [Rect](#rect) | Yes | Yes | Current position and size of the system bar. |
| backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.|
| backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **\#00FF00** or **\#FF00FF00**.|
| contentColor | string | Yes | Yes | Color of the text on the system bar. |
## SystemBarTintState<sup>8+</sup>
......@@ -146,6 +146,7 @@ Describes the window properties.
| focusable<sup>7+</sup> | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. |
| touchable<sup>7+</sup> | boolean | Yes | No | Whether the window is touchable. The default value is **true**. |
| brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness. |
| dimBehindValue<sup>(deprecated)</sup> | number | Yes | Yes | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.<br>This attribute is supported since API version 7 and deprecated since API version 9.<br> |
| isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**. |
| isPrivacyMode<sup>7+</sup> | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**. |
| isRoundCorner<sup>7+</sup> | boolean | Yes | Yes | Whether the window has rounded corners. The default value is **false**. |
......@@ -168,7 +169,7 @@ create(id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): voi
Creates a subwindow. This API uses an asynchronous callback to return the result.
This API is discarded since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead.
This API is deprecated since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
......@@ -201,7 +202,7 @@ create(id: string, type: WindowType): Promise&lt;Window&gt;
Creates a subwindow. This API uses a promise to return the result.
This API is discarded since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead.
This API is deprecated since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
......@@ -370,7 +371,7 @@ getTopWindow(callback: AsyncCallback&lt;Window&gt;): void
Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
This API is discarded since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
This API is deprecated since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
......@@ -400,7 +401,7 @@ getTopWindow(): Promise&lt;Window&gt;
Obtains the top window of the current application. This API uses a promise to return the result.
This API is discarded since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
This API is deprecated since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
......@@ -706,11 +707,11 @@ Moves this window. This API uses an asynchronous callback to return the result.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | --------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example**
......@@ -735,10 +736,10 @@ Moves this window. This API uses a promise to return the result.
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | --------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
**Return value**
......@@ -767,11 +768,11 @@ Changes the size of this window. This API uses an asynchronous callback to retur
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------------- |
| width | number | Yes | New width of the window.|
| height | number | Yes | New height of the window.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------------- |
| width | number | Yes | New width of the window, in px.|
| height | number | Yes | New height of the window, in px.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example**
......@@ -795,10 +796,10 @@ Changes the size of this window. This API uses a promise to return the result.
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- |
| width | number | Yes | New width of the window.|
| height | number | Yes | New height of the window.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------- |
| width | number | Yes | New width of the window, in px.|
| height | number | Yes | New height of the window, in px.|
**Return value**
......@@ -1601,7 +1602,7 @@ Sets this window to the wide or default color gamut mode. This API uses a promis
promise.then((data)=> {
console.info('Succeeded in setting window colorspace. Data: ' + JSON.stringify(data))
}).catch((err)=>{
console.error('Failed to set window colorspacet. Cause: ' + JSON.stringify(err));
console.error('Failed to set window colorspace. Cause: ' + JSON.stringify(err));
});
```
......@@ -1624,10 +1625,10 @@ Obtains the color gamut mode of this window. This API uses an asynchronous callb
```js
windowClass.getColorSpace((err, data) => {
if (err.code) {
console.error('Failed to get window color space. Cause:' + JSON.stringify(err));
console.error('Failed to get window colorspace. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data))
console.info('Succeeded in getting window colorspace. Cause:' + JSON.stringify(data))
})
```
......@@ -1652,7 +1653,7 @@ Obtains the color gamut mode of this window. This API uses a promise to return t
promise.then((data)=> {
console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data))
}).catch((err)=>{
console.error('Failed to set window colorspacet. Cause: ' + JSON.stringify(err));
console.error('Failed to get window colorspace. Cause: ' + JSON.stringify(err));
});
```
......@@ -1668,7 +1669,7 @@ Sets the background color for this window. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.|
| color | string | Yes | Background color to set. The value is a hexadecimal color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example**
......@@ -1696,7 +1697,7 @@ Sets the background color for this window. This API uses a promise to return the
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.|
| color | string | Yes | Background color to set. The value is a hexadecimal color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
**Return value**
......@@ -1776,6 +1777,70 @@ Sets the screen brightness for this window. This API uses a promise to return th
});
```
### setDimBehind<sup>(deprecated)</sup>
setDimBehind(dimBehindValue: number, callback: AsyncCallback&lt;void&gt;): void
Sets the dimness of the window that is not on top. This API uses an asynchronous callback to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------------- | ---- | -------------------------------------------------- |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example**
```js
windowClass.setDimBehind(0.5, (err, data) => {
if (err.code) {
console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the dimness. Data:' + JSON.stringify(data));
});
```
### setDimBehind<sup>(deprecated)</sup>
setDimBehind(dimBehindValue: number): Promise&lt;void&gt;
Sets the dimness of the window that is not on top. This API uses a promise to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | -------------------------------------------------- |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
```js
let promise = windowClass.setDimBehind(0.5);
promise.then((data)=> {
console.info('Succeeded in setting the dimness. Data: ' + JSON.stringify(data))
}).catch((err)=>{
console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
});
```
### setFocusable<sup>7+</sup>
setFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void
......@@ -1864,6 +1929,70 @@ Sets whether to keep the screen always on. This API uses an asynchronous callbac
});
```
### setOutsideTouchable<sup>(deprecated)</sup>
setOutsideTouchable(touchable: boolean, callback: AsyncCallback&lt;void&gt;): void
Sets whether the area outside the subwindow is touchable. This API uses an asynchronous callback to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ---------------- |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example**
```js
windowClass.setOutsideTouchable(true, (err, data) => {
if (err.code) {
console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the area to be touchable. Data: ' + JSON.stringify(data))
})
```
### setOutsideTouchable<sup>(deprecated)</sup>
setOutsideTouchable(touchable: boolean): Promise&lt;void&gt;
Sets whether the area outside the subwindow is touchable. This API uses a promise to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------- | ---- | ---------------- |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.|
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
```js
let promise = windowClass.setOutsideTouchable(true);
promise.then((data)=> {
console.info('Succeeded in setting the area to be touchable. Data: ' + JSON.stringify(data))
}).catch((err)=>{
console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
});
```
### setKeepScreenOn
setKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt;
......
# Work Scheduler
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> **NOTE**<br/>
> The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable.
......@@ -100,7 +100,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return
```
workScheduler.getWorkStatus(50, (err, res) => {
if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data);
console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
} else {
for (let item in res) {
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
......@@ -136,7 +136,7 @@ Obtains the latest task status. This API uses a promise to return the result.
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
}
}).catch((err) => {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data);
console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
})
```
......@@ -151,7 +151,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
| Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application.|
| callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application. |
**Return value**
......@@ -164,7 +164,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
```
workScheduler.obtainAllWorks((err, res) =>{
if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data);
console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
} else {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}
......@@ -182,7 +182,7 @@ Obtains all tasks associated with this application. This API uses a promise to r
| Type | Description |
| -------------------------------------- | ------------------------------ |
| Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application.|
| Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application. |
**Example**
......@@ -190,7 +190,7 @@ Obtains all tasks associated with this application. This API uses a promise to r
workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data);
console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
})
```
......@@ -233,7 +233,7 @@ Checks whether the last execution of the specified task timed out. This API uses
```
workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data);
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
} else {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
}
......@@ -267,7 +267,7 @@ Checks whether the last execution of the specified task timed out. This API uses
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
})
.catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data);
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
});
```
......@@ -291,6 +291,8 @@ Provides detailed information about the task.
| repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. |
| isPersisted | boolean | No | Whether to enable persistent storage for the task. |
| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
| idleWaitTime | number | No | Time to wait in the idle state. |
## NetworkType
Enumerates the network types that can trigger the task.
......@@ -319,7 +321,7 @@ Enumerates the charging types that can trigger the task.
| CHARGING_PLUGGED_WIRELESS | 3 | Wireless charging. |
## BatteryStatus
Enumerates the battery status that can trigger the task.
Enumerates the battery states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
......@@ -330,7 +332,7 @@ Enumerates the battery status that can trigger the task.
| BATTERY_STATUS_LOW_OR_OKAY | 2 | The battery level is restored from low to normal, or a low battery alert is displayed.|
## StorageRequest
Enumerates the storage status that can trigger the task.
Enumerates the storage states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
......
......@@ -101,6 +101,7 @@
- Custom Components
- [Basic Usage](js-components-custom-basic-usage.md)
- [Style Inheritance](js-components-custom-style.md)
- [Custom Events](js-components-custom-events.md)
- [props](js-components-custom-props.md)
- [Event Parameter](js-components-custom-event-parameter.md)
......
# Style Inheritance
> **NOTE**<br/>
> The APIs of this module are supported since API 9. Updates will be marked with a superscript to indicate their earliest API version.
A custom component has the **inherit-class** attribute, which is defined in the following table.
| Name | Type | Default Value| Mandatory| Description |
| ------------ | ------ | ------ | ---- | ------------------------------------------------------ |
| inherit-class | string | - | No | Class styles inherited from the parent component, seperated by spaces.|
To enable a custom component to inherit the styles of its parent component, set the **inherit-calss** attribute for the custom component.
The example below is a code snippet in the HML file of the parent page that references a custom component named **comp**. This component uses the **inherit-class** attribute to inherit the styles of its parent component: **parent-class1** and **parent-class2**.
```html
<!-- xxx.hml -->
<element name='comp' src='../../common/component/comp.hml'></element>
<div class="container">
<comp inherit-class="parent-class1 parent-class2" ></comp>
</div>
```
Code snippet in the CSS file of the parent page:
```html
// xxx.css
.parent-class1 {
background-color:red;
border:2px;
}
.parent-class2 {
background-color:green;
border:2px;
}
```
Code snippet in the HML file of the custom component, where **parent-class1** and **parent-class2** are styles inherited from the parent component:
```html
<!--comp.hml-->
<div class="item">
<text class="parent-class1">Style 1 inherited from the parent component</text>
<text class="parent-class2">Style 2 inherited from the parent component</text>
</div>
```
......@@ -29,11 +29,11 @@ Creates a component that can automatically display the navigation bar, title, an
| Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- |
| title | string \| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Page title. |
| title | string \| [CustomBuilder](../../ui/ts-types.md) | - | Page title. |
| subtitle | string | - | Subtitle of the page. |
| menus | Array&lt;NavigationMenuItem&gt; \| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Menu in the upper right corner of the page. |
| menus | Array&lt;NavigationMenuItem&gt; \| [CustomBuilder](../../ui/ts-types.md) | - | Menu in the upper right corner of the page. |
| titleMode | NavigationTitleMode | NavigationTitleMode.Free | Display mode of the page title bar. |
| toolBar | {<br/>items:[<br/>Object<br/>] }<br/>\| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Content of the toolbar.<br/>**items**: all items on the toolbar. |
| toolBar | {<br/>items:[<br/>Object<br/>] }<br/>\| [CustomBuilder](../../ui/ts-types.md) | - | Content of the toolbar.<br/>**items**: all items on the toolbar. |
| hideToolBar | boolean | false | Whether to hide the toolbar.<br/>**true**: Hide the toolbar.<br/>**false**: Show the toolbar. |
| hideTitleBar | boolean | false | Whether to hide the title bar. |
| hideBackButton | boolean | false | Whether to hide the back button. |
......
......@@ -55,7 +55,7 @@ controller: SearchController = new SearchController()
```
#### caretPosition
creatPosition(value: number): viod
creatPosition(value: number): void
Sets the position of the caret.
......
# Select
> ![](public_sys-resources/icon-note.gif) **NOTE** This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **<Select\>** component provides a drop-down list box that allows users to select among multiple options.
......@@ -20,29 +21,29 @@ Select(options: Array\<SelectOption>\)
| Name| Type| Mandatory| Default Value| Description|
| ------ | ----------------------------------------------- | ---- | ------ | -------------- |
| value | [ResourceStr](../../ui/ts-types.md) | Yes| - | Value of an option in the drop-down list box.|
| icon | [ResourceStr](../../ui/ts-types.md) | No| - | Icon of an option in the drop-down list box.|
| value | [ResourceStr](../../ui/ts-types.md) | Yes | - | Value of an option in the drop-down list box. |
| icon | [ResourceStr](../../ui/ts-types.md) | No | - | Icon of an option in the drop-down list box. |
## Attributes
| Name| Type| Default Value| Description|
| ----------------------- | --------------------------------------------------- | ------ | ----------------------------------------------- |
| selected | number | - | Index of the initial selected option in the drop-down list box. The index of the first option is **0**.|
| value | string | - | Text of the drop-down button.|
| font | [Font](../../ui/ts-types.md) | - | Text font of the drop-down button.|
| fontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the drop-down button.|
| selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of the selected option in the drop-down list box.|
| selectedOptionFont | [Font](../../ui/ts-types.md) | - | Text font of the selected option in the drop-down list box.|
| selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the selected option in the drop-down list box.|
| optionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of an option in the drop-down list box.|
| optionFont | [Font](../../ui/ts-types.md) | - | Text font of an option in the drop-down list box.|
| optionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of an option in the drop-down list box.|
| selected | number | - | Index of the initial selected option in the drop-down list box. The index of the first option is **0**. |
| value | string | - | Text of the drop-down button. |
| font | [Font](../../ui/ts-types.md) | - | Text font of the drop-down button. |
| fontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the drop-down button. |
| selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of the selected option in the drop-down list box. |
| selectedOptionFont | [Font](../../ui/ts-types.md) | - | Text font of the selected option in the drop-down list box. |
| selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the selected option in the drop-down list box. |
| optionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of an option in the drop-down list box. |
| optionFont | [Font](../../ui/ts-types.md) | - | Text font of an option in the drop-down list box. |
| optionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of an option in the drop-down list box. |
## Events
| Name| Description|
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| onSelect(callback: (index: number, value?:string) => void) | Invoked when an option in the drop-down list box is selected. **index** indicates the index of the selected option. **value** indicates the value of the selected option.|
| onSelect(callback: (index: number, value?:string) => void) | Invoked when an option in the drop-down list box is selected. **index** indicates the index of the selected option. **value** indicates the value of the selected option. |
## Example
......
# Slider
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**<br>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -44,12 +44,12 @@ Slider(value:{value?: number, min?: number, max?: number, step?: number, style?:
Touch target configuration is not supported.
| Name | Type | Default Value | Description |
| ------------- | ------- | ------------- | ---------------------------------------- |
| blockColor | Color | - | Color of the slider. |
| trackColor | Color | - | Background color of the slider. |
| selectedColor | Color | - | Color of the slider rail that has been slid. |
| showSteps | boolean | false | Whether to display the current step. |
| Name | Type | Default Value | Description |
| ------------- | ------- | ------------- | -------------------------------------------------------------------- |
| blockColor | Color | - | Color of the slider. |
| trackColor | Color | - | Background color of the slider. |
| selectedColor | Color | - | Color of the slider rail that has been slid. |
| showSteps | boolean | false | Whether to display the current step. |
| showTips | boolean | false | Whether to display a bubble to indicate the percentage when sliding. |
......
# Span
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**<br>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -23,7 +23,7 @@ None
Span(content: string)
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| content | string | Yes | - | Text content. |
......@@ -42,7 +42,7 @@ In addition to the text style attributes, the attributes below are supported.
Among all the universal events, only the click event is supported.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**<br>
> As the **&lt;Span&gt;** component does not have size information, the **target** attribute of the **ClickEvent** object returned by the click event is invalid.
......
# Stepper
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -24,7 +24,7 @@ Stepper(value?: { index?: number })
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| index | number | No | 0 | Index of the **&lt;StepperItem&gt;** that is currently displayed. |
......@@ -36,11 +36,11 @@ None
## Events
| Name | Description |
| Name | Description |
| -------- | -------- |
| onFinish(callback: () =&gt; void) | Triggered when the **nextLabel** of the last **&lt;StepperItem&gt;** in the **&lt;Stepper&gt;** is clicked. |
| onSkip(callback: () =&gt; void) | Triggered when the current **&lt;StepperItem&gt;** is **ItemState.Skip** and the **nextLabel** is clicked. |
| onChange(callback: (prevIndex?: number, index?: number) =&gt; void) | Triggered when the text button on the left or right is clicked to switch between steps.<br/>- **prevIndex**: index of the step page before the switching.<br/>- **index**: index of the step page after the switching, that is, index of the previous or next page. |
| onFinish(callback: () =&gt; void) | Invoked when the **nextLabel** of the last **&lt;StepperItem&gt;** in the **&lt;Stepper&gt;** is clicked. |
| onSkip(callback: () =&gt; void) | Invoked when the current **&lt;StepperItem&gt;** is **ItemState.Skip** and the **nextLabel** is clicked. |
| onChange(callback: (prevIndex?: number, index?: number) =&gt; void) | Invoked when the text button on the left or right is clicked to switch between steps.<br/>- **prevIndex**: index of the step page before the switching.<br/>- **index**: index of the step page after the switching, that is, index of the previous or next page. |
## Example
......
# Text
> **NOTE**<br>
> **NOTE**<br/>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **&lt;Text&gt;** component is used to display a paragraph of textual information.
The **\<Text>** component is used to display a piece of textual information.
## Required Permissions
None
N/A
## Child Components
The **&lt;Text&gt;** component can contain the child component [<Span>](ts-basic-components-span.md).
This component can contain the [\<Span>](ts-basic-components-span.md) child component.
## APIs
......@@ -23,60 +22,70 @@ The **&lt;Text&gt;** component can contain the child component [<Span>](ts-basic
Text(content?: string)
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| content | string | No | '' | Text content, which is the content of the child component **&lt;Span&gt;**. This parameter does not take effect when the child component **&lt;Span&gt;** is contained. |
| content | string | No| '' | Text content. This parameter does not take effect when the child component **\<Span>** is contained.|
## Attributes
| Name | Type | Default Value | Description |
| Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- |
| textAlign | TextAlign | TextAlign.Start | Text alignment mode of multiple lines of text. |
| textOverflow | {overflow: TextOverflow} | {overflow: TextOverflow.Clip} | Display mode when the text is too long. |
| maxLines | number | Infinity | Maximum number of lines in the text. |
| lineHeight | Length | - | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used. |
| decoration | {<br/>type: TextDecorationType,<br/>color?: Color<br/>} | {<br/>type: TextDecorationType.None,<br/>color: Color.Black<br/>} | Style and color of the text decorative line. |
| baselineOffset | Length | - | Offset of the text baseline. |
| textCase | TextCase | TextCase.Normal | Text case. |
| textAlign | TextAlign | TextAlign.Start | Text alignment mode of multiple lines of text.|
| textOverflow | {overflow: TextOverflow} | {overflow: TextOverflow.Clip} | Display mode when the text is too long.<br>**NOTE**<br>Text is truncated at the transition between words. To truncate text in the middle of a word, add **\u200B** between characters. |
| maxLines | number | Infinity | Maximum number of lines in the text.|
| lineHeight | Length | - | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.|
| decoration | {<br>type: TextDecorationType,<br>color?: Color<br>} | {<br>type: TextDecorationType.None,<br>color: Color.Black<br>} | Style and color of the text decorative line.|
| baselineOffset | Length | - | Offset of the text baseline.|
| textCase | TextCase | TextCase.Normal | Text case.|
| copyOption<sup>9+</sup> | boolean\|CopyOption | false | Whether copy and paste is allowed.|
- TextAlign enums
| Name | Description |
| Name| Description|
| -------- | -------- |
| Center | The text is center-aligned. |
| Start | The text is aligned with the direction in which the text is written. |
| End | The text is aligned with the opposite direction in which the text is written. |
| Center | The text is center-aligned.|
| Start | The text is aligned with the direction in which the text is written.|
| End | The text is aligned with the opposite direction in which the text is written.|
- TextOverflow enums
| Name | Description |
| Name| Description|
| -------- | -------- |
| Clip | Extra text is truncated. |
| Ellipsis | The ellipsis (...) is used for extra-long text. |
| None | No truncation or ellipsis is used for extra-long text. |
| Clip | Extra text is truncated.|
| Ellipsis | An ellipsis (...) is used to represent clipped text.|
| None | No truncation or ellipsis is used for extra-long text.|
- TextDecorationType enums
| Name | Description |
| Name| Description|
| -------- | -------- |
| Underline | An underline is used. |
| LineThrough | A strikethrough is used. |
| Overline | An overline is used. |
| None | No decorative line is used. |
| Underline | Line under the text.|
| LineThrough | Line through the text.|
| Overline | Line over the text.|
| None | No decorative lines.|
- TextCase enums
| Name | Description |
| Name | Description |
| --------- | -------------------- |
| Normal | The original case of the text is retained.|
| LowerCase | All letters in the text are in lowercase. |
| UpperCase | All letters in the text are in uppercase. |
- CopyOption<sup>9+</sup> enums
| Name| Description|
| -------- | -------- |
| Normal | The original case of the text is retained. |
| LowerCase | All letters in the text are in lowercase. |
| UpperCase | All letters in the text are in uppercase. |
| InApp | Intra-application copy and paste is allowed.|
| LocalDevice | Intra-device copy and paste is allowed.|
| CrossDevice | Cross-device copy and paste is allowed.|
> **NOTE**<br>
> The **&lt;Text&gt;** component cannot contain both the text and the child component **&lt;Span&gt;**. If both of them exist, only the content in **&lt;Span&gt;** is displayed.
> **NOTE**<br/>
> If the **\<Text>** component contains both the text and the **\<Span>** child component, only the content in **\<Span>** is displayed.
## Example
```
```ts
// xxx.ets
@Entry
@Component
struct TextExample1 {
......@@ -93,7 +102,7 @@ struct TextExample1 {
Text('This is the setting of textOverflow to Clip text content This is the setting of textOverflow to Clip text content.')
.textOverflow({ overflow: TextOverflow.Clip })
.maxLines(1).fontSize(12).border({ width: 1 }).padding(10)
Text('This is set textOverflow to Ellipsis text content This is set textOverflow to Ellipsis text content.')
Text('This is set textOverflow to Ellipsis text content This is set textOverflow to Ellipsis text content.'.split('').join('\u200B'))
.textOverflow({ overflow: TextOverflow.Ellipsis })
.maxLines(1).fontSize(12).border({ width: 1 }).padding(10)
......@@ -114,8 +123,8 @@ struct TextExample1 {
![en-us_image_0000001257138337](figures/en-us_image_0000001257138337.gif)
```
```ts
// xxx.ets
@Entry
@Component
struct TextExample2 {
......
......@@ -103,7 +103,7 @@ scroller.currentOffset(): Object
Obtains the scrolling offset.
- Return values
- Return value
| Type | Description |
| -------- | -------- |
| {<br/>xOffset: number,<br/>yOffset: number<br/>} | **xOffset**: horizontal scrolling offset.<br/>**yOffset**: vertical scrolling offset. |
......
# Interpolation Calculation
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
import curves from '@ohos.curves'
```
......@@ -27,11 +27,11 @@ Implements initialization for the interpolation curve, which is used to create a
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| curve | Curve | No | Linear | Curve object. |
| curve | Curve | No | Linear | Curve object. |
- Return values
- Return value<br>
Curve object.
......@@ -44,12 +44,12 @@ Constructs a step curve object.
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| count | number | Yes | - | Number of steps. Must be a positive integer. |
| end | boolean | No | true | Step change at the start or end point of each interval. Defaults to **true**, indicating that the step change occurs at the end point. |
| count | number | Yes | - | Number of steps. Must be a positive integer. |
| end | boolean | No | true | Step change at the start or end point of each interval. Defaults to **true**, indicating that the step change occurs at the end point. |
- Return values
- Return value<br>
Curve object.
......@@ -62,14 +62,14 @@ Constructs a third-order Bezier curve object. The curve value must be between 0
- Parameters
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| x1 | number | Yes | Horizontal coordinate of the first point on the Bezier curve. |
| y1 | number | Yes | Vertical coordinate of the first point on the Bezier curve. |
| x2 | number | Yes | Horizontal coordinate of the second point on the Bezier curve. |
| y2 | number | Yes | Vertical coordinate of the second point on the Bezier curve. |
| x1 | number | Yes | Horizontal coordinate of the first point on the Bezier curve. |
| y1 | number | Yes | Vertical coordinate of the first point on the Bezier curve. |
| x2 | number | Yes | Horizontal coordinate of the second point on the Bezier curve. |
| y2 | number | Yes | Vertical coordinate of the second point on the Bezier curve. |
- Return values
- Return value<br>
Curve object.
......@@ -82,20 +82,20 @@ Constructs a spring curve object.
- Parameters
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| velocity | number | Yes | Initial velocity. |
| mass | number | Yes | Mass. |
| stiffness | number | Yes | Stiffness. |
| damping | number | Yes | Damping. |
| velocity | number | Yes | Initial velocity. |
| mass | number | Yes | Mass. |
| stiffness | number | Yes | Stiffness. |
| damping | number | Yes | Damping. |
- Return values
- Return value<br>
Curve object.
## Example
```
import Curves from '@ohos.curves'
let curve1 = Curves.init() // Create a default linear interpolation curve.
......@@ -106,13 +106,13 @@ let curve3 = Curves.cubicBezier(0.1, 0.0, 0.1, 1.0) // Create a third-order Bezi
Curve objects can be created only by the preceding APIs.
| API | Description |
| API | Description |
| -------- | -------- |
| interpolate(time: number): number | Calculation function of the interpolation curve. Passing a normalized time parameter to this function returns the current interpolation.<br/>**time**: indicates the current normalized time. The value ranges from 0 to 1.<br/>The curve interpolation corresponding to the normalized time point is returned. |
| interpolate(time: number): number | Calculation function of the interpolation curve. Passing a normalized time parameter to this function returns the current interpolation.<br/>**time**: indicates the current normalized time. The value ranges from 0 to 1.<br/>The curve interpolation corresponding to the normalized time point is returned. |
- Example
```
import Curves from '@ohos.curves'
let curve = Curves.init(Curve.EaseIn) // Create an interpolation curve which is slow and then fast by default.
......@@ -122,7 +122,7 @@ let curve3 = Curves.cubicBezier(0.1, 0.0, 0.1, 1.0) // Create a third-order Bezi
## Example
```
import Curves from '@ohos.curves'
@Entry
......
# Matrix Transformation
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**<br>
> This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -31,30 +31,30 @@ Matrix constructor, which is used to create a 4x4 matrix by using the input para
| -------- | -------- | -------- | -------- | -------- |
| array | Array&lt;number&gt; | Yes | [1, 0, 0, 0,<br/>0, 1, 0, 0,<br/>0, 0, 1, 0,<br/>0, 0, 0, 1] | A number array whose length is 16 (4 x 4). For details, see the parameter description. |
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | 4x4 matrix object created based on the input parameter. |
| Object | 4x4 matrix object created based on the input parameter. |
- Parameter description
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| m00 | number | Yes | Scaling value of the x-axis. Defaults to **1** for the unit matrix. |
| m01 | number | Yes | The second value, which is affected by the rotation of the x, y, and z axes. |
| m02 | number | Yes | The third value, which is affected by the rotation of the x, y, and z axes. |
| m03 | number | Yes | Meaningless. |
| m10 | number | Yes | The fifth value, which is affected by the rotation of the x, y, and z axes. |
| m11 | number | Yes | Scaling value of the y-axis. Defaults to **1** for the unit matrix. |
| m12 | number | Yes | The seventh value, which is affected by the rotation of the x, y, and z axes. |
| m13 | number | Yes | Meaningless. |
| m20 | number | Yes | The ninth value, which is affected by the rotation of the x, y, and z axes. |
| m21 | number | Yes | The tenth value, which is affected by the rotation of the x, y, and z axes. |
| m22 | number | Yes | Scaling value of the z-axis. Defaults to **1** for the unit matrix. |
| m23 | number | Yes | Meaningless. |
| m30 | number | Yes | Translation value of the x-axis, in px. Defaults to **0** for the unit matrix. |
| m31 | number | Yes | Translation value of the y-axis, in px. Defaults to **0** for the unit matrix. |
| m32 | number | Yes | Translation value of the z-axis, in px. Defaults to **0** for the unit matrix. |
| m33 | number | Yes | Valid in homogeneous coordinates, presenting the perspective projection effect. |
| m00 | number | Yes | Scaling value of the x-axis. Defaults to **1** for the unit matrix. |
| m01 | number | Yes | The second value, which is affected by the rotation of the x, y, and z axes. |
| m02 | number | Yes | The third value, which is affected by the rotation of the x, y, and z axes. |
| m03 | number | Yes | Meaningless. |
| m10 | number | Yes | The fifth value, which is affected by the rotation of the x, y, and z axes. |
| m11 | number | Yes | Scaling value of the y-axis. Defaults to **1** for the unit matrix. |
| m12 | number | Yes | The seventh value, which is affected by the rotation of the x, y, and z axes. |
| m13 | number | Yes | Meaningless. |
| m20 | number | Yes | The ninth value, which is affected by the rotation of the x, y, and z axes. |
| m21 | number | Yes | The tenth value, which is affected by the rotation of the x, y, and z axes. |
| m22 | number | Yes | Scaling value of the z-axis. Defaults to **1** for the unit matrix. |
| m23 | number | Yes | Meaningless. |
| m30 | number | Yes | Translation value of the x-axis, in px. Defaults to **0** for the unit matrix. |
| m31 | number | Yes | Translation value of the y-axis, in px. Defaults to **0** for the unit matrix. |
| m32 | number | Yes | Translation value of the z-axis, in px. Defaults to **0** for the unit matrix. |
| m33 | number | Yes | Valid in homogeneous coordinates, presenting the perspective projection effect. |
- Example
......@@ -76,10 +76,10 @@ identity(): Object
Matrix initialization function. Can return a unit matrix object.
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | Unit matrix object. |
| Object | Unit matrix object. |
- Example
......@@ -102,10 +102,10 @@ copy(): Object
Matrix copy function, which is used to copy the current matrix object.
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | Copy object of the current matrix. |
| Object | Copy object of the current matrix. |
- Example
......@@ -147,14 +147,14 @@ Matrix overlay function, which is used to overlay the effects of two matrices to
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| matrix | Matrix4 | Yes | - | Matrix object to be overlaid. |
| matrix | Matrix4 | Yes | - | Matrix object to be overlaid. |
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | Object after matrix overlay. |
| Object | Object after matrix overlay. |
- Example
......@@ -188,10 +188,10 @@ invert(): Object
Matrix inverse function. Can return an inverse matrix of the current matrix object, that is, get an opposite effect.
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | Inverse matrix object of the current matrix. |
| Object | Inverse matrix object of the current matrix. |
- Example
......@@ -212,17 +212,17 @@ Matrix translation function, which is used to add the translation effect to the
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| x | number | No | 0 | Translation distance of the x-axis, in px. |
| y | number | No | 0 | Translation distance of the y-axis, in px. |
| z | number | No | 0 | Translation distance of the z-axis, in px. |
| x | number | No | 0 | Translation distance of the x-axis, in px. |
| y | number | No | 0 | Translation distance of the y-axis, in px. |
| z | number | No | 0 | Translation distance of the z-axis, in px. |
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | Matrix object after the translation effect is added. |
| Object | Matrix object after the translation effect is added. |
- Example
......@@ -254,19 +254,19 @@ Matrix scaling function, which is used to add the scaling effect to the x, y, an
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| x | number | No | 1 | Scaling multiple of the x-axis. |
| y | number | No | 1 | Scaling multiple of the y-axis. |
| z | number | No | 1 | Scaling multiple of the z-axis. |
| centerX | number | No | 0 | X coordinate of the center point. |
| centerY | number | No | 0 | Y coordinate of the center point. |
| x | number | No | 1 | Scaling multiple of the x-axis. |
| y | number | No | 1 | Scaling multiple of the y-axis. |
| z | number | No | 1 | Scaling multiple of the z-axis. |
| centerX | number | No | 0 | X coordinate of the center point. |
| centerY | number | No | 0 | Y coordinate of the center point. |
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | Matrix object after the scaling effect is added. |
| Object | Matrix object after the scaling effect is added. |
- Example
......@@ -298,20 +298,20 @@ Matrix rotation function, which is used to add the rotation effect to the x, y,
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| x | number | No | 1 | X coordinate of the rotation axis vector. |
| y | number | No | 1 | Y coordinate of the rotation axis vector. |
| z | number | No | 1 | Z coordinate of the rotation axis vector. |
| angle | number | No | 0 | Rotation angle. |
| centerX | number | No | 0 | X coordinate of the center point. |
| centerY | number | No | 0 | Y coordinate of the center point. |
| x | number | No | 1 | X coordinate of the rotation axis vector. |
| y | number | No | 1 | Y coordinate of the rotation axis vector. |
| z | number | No | 1 | Z coordinate of the rotation axis vector. |
| angle | number | No | 0 | Rotation angle. |
| centerX | number | No | 0 | X coordinate of the center point. |
| centerY | number | No | 0 | Y coordinate of the center point. |
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Object | Matrix object after the rotation effect is added. |
| Object | Matrix object after the rotation effect is added. |
- Example
......@@ -343,15 +343,15 @@ Matrix point transformation function, which is used to apply the current transfo
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| point | Point | Yes | - | Point to be transformed. |
| point | Point | Yes | - | Point to be transformed. |
- Return values
| Type | Description |
- Return value
| Type | Description |
| -------- | -------- |
| Point | Point object after matrix transformation |
| Point | Point object after matrix transformation |
- Example
......
......@@ -115,7 +115,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.getWorkStatus(50, (err, res) => {
if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data);
console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
} else {
for (let item in res) {
console.info('workschedulerLog getWorkStatuscallback success,' + item + ' is:' + res[item]);
......@@ -131,7 +131,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
}
}).catch((err) => {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data);
console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
})
......@@ -141,7 +141,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.obtainAllWorks((err, res) =>{
if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data);
console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
} else {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}
......@@ -152,7 +152,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data);
console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
})
**Stopping and Clearing Work Scheduler Tasks**
......@@ -166,7 +166,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data);
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
} else {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
}
......@@ -179,6 +179,6 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
})
.catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data);
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
});
})
......@@ -6,34 +6,34 @@
### HDMI
High-definition multimedia interface (HDMI) is an interface for transmitting audio and video data from a source device, such as a DVD player or set-top box (STB), to a sink device, such as a TV or display.
HDMI works in primary/secondary mode and usually has a source and a sink.
HDMI usually has a source and a sink.
The HDMI APIs provide a set of common functions for HDMI transmission, including:
- Opening and closing an HDMI controller
- Starting and stopping HDMI transmission
- Setting audio, video, and High Dynamic Range (HDR) attributes, color depth, and AV mute
- Reading the raw Extended Display Identification Data (EDID) from a sink
- Registering and unregistering a callback for HDMI hot plug detect (HPD).
- Registering and unregistering a callback for HDMI hot plug detect (HPD)
### Basic Concepts
HDMI is an audio and video transmission protocol released by Hitachi, Panasonic, Philips, Silicon Image, Sony, Thomson, and Toshiba. The transmission process complies with the Transition-minimized Differential Signaling (TMDS).
- TMDS is used to transmit audio, video, and various auxiliary data.
- Display data channel (DDC) allows the TX and RX ends to obtain the sending and receiving capabilities. However, the HDMI only needs to unidirectionally obtain the capabilities of the RX end (display).
- Display data channel (DDC) allows the TX and RX ends to obtain the transmitting and receiving capabilities. However, HDMI only needs to unidirectionally obtain the capabilities of the RX end (display).
- Consumer Electronics Control (CEC) enables interaction between the HDMI TX and RX devices.
- Fixed rate link (FRL) allows the maximum TMDS bandwidth to be increased from 18 Gbit/s to 48 Gbit/s.
- High-bandwidth Digital Content Protection (HDCP) prevents copying of digital audio and video content being transmitted across devices.
- Extended Display Identification Data (EDID), usually stored in the display firmware, provides the vendor information, EDID version, maximum image size, color settings, vendor pre-settings, frequency range limit, display name, and serial number.
- EDID, usually stored in the display firmware, provides the vendor information, EDID version, maximum image size, color settings, vendor pre-settings, frequency range limit, display name, and serial number.
### Working Principles
The HDMI source end provides +5 V and GND for DDC and CEC communication. Through the DDC, the source end obtains the sink end parameters, such as the RX capabilities. The CEC is optional. It is used to synchronize the control signals between the source and sink ends to improve user experience. There are four TMDS channels between the HDMI source and sink ends. The TMDS clock channel provides clock signals for TMDS, and the other three channels transmit audio, video, and auxiliary data. HPD is the hot plug detect port. When the sink end is connected, the source end responds by using an interrupt program.
The HDMI source provides +5 V and GND for DDC and CEC communication. Through the DDC, the source obtains the sink parameters, such as the RX capabilities. The CEC provides an optional channel to synchronize control signals between the source and sink for better user experience. There are four TMDS channels between the HDMI source and sink. The TMDS clock channel provides clock signals for TMDS, and the other three channels transmit audio, video, and auxiliary data. HDP is the hot plug detect port. When the sink is connected, the source responds by using an interrupt service routine (ISR).
The figure below shows the HDMI physical connection.
**Figure 1** HDMI physical connection
![](figures/HDMI_physical_connection.png "HDMI_physical_connection")
### Constraints
......@@ -69,15 +69,15 @@ HDMI features high transmission rate, wide transmission bandwidth, high compatib
### How to Develop
The figure below illustrates the process of using an HDMI device.
The figure below illustrates the general HDMI development process.
**Figure 2** Process of using an HDMI device
![](figures/HDMI_usage_flowchart.png "HDMI_usage_flowchart")
**Figure 2** Using HDMI driver APIs
![](figures/using-HDMI-process.png "using-HDMI-process")
#### Opening an HDMI Controller
Before HDMI communication, call **HdmiOpen** to open an HDMI controller.
Before HDMI communication, call **HdmiOpen()** to open an HDMI controller.
```c
DevHandle HdmiOpen(int16_t number);
......@@ -88,11 +88,11 @@ DevHandle HdmiOpen(int16_t number);
| Parameter | Description |
| ---------- | -------------------- |
| number | HDMI controller ID. |
| **Return Value**| **Description** |
| NULL | Failed to open the HDMI controller. |
| **Return Value**| **Description** |
| NULL | The operation failed. |
| Controller handle| Handle of the opened HDMI controller.|
Example: Open controller 0 of the two HDMI controllers (numbered 0 and 1) in the system.
For example, open controller 0 of the two HDMI controllers (numbered 0 and 1) in the system:
```c
DevHandle hdmiHandle = NULL; /* HDMI controller handle /
......@@ -117,7 +117,7 @@ int32_t HdmiRegisterHpdCallbackFunc(DevHandle handle, struct HdmiHpdCallbackInfo
| ---------- | ------------------ |
| handle | HDMI controller handle. |
| callback | Pointer to the callback to be invoked to return the HPD result.|
| **Return Value**| **Description** |
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation failed. |
......@@ -165,7 +165,7 @@ int32_t HdmiReadSinkEdid(DevHandle handle, uint8_t *buffer, uint32_t len);
| handle | HDMI controller handle. |
| buffer | Pointer to the data buffer. |
| len | Data length. |
| **Return Value**| **Description** |
| **Return Value**| **Description** |
| Positive integer | Raw EDID read.|
| Negative number or 0 | Failed to read the EDID. |
......@@ -194,7 +194,7 @@ int32_t HdmiSetAudioAttribute(DevHandle handle, struct HdmiAudioAttr *attr);
| ------ | -------------- |
| handle | HDMI controller handle.|
| attr | Pointer to the audio attributes. |
| **Return Value**| **Description** |
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation failed. |
......@@ -260,7 +260,7 @@ int32_t HdmiSetHdrAttribute(DevHandle handle, struct HdmiHdrAttr *attr);
| Parameter | Description |
| ---------- | -------------- |
| handle | HDMI controller handle.|
| attr | Pinter to the HDR attributes. |
| attr | Pointer to the HDR attributes |
| **Return Value**| **Description**|
| 0 | The operation is successful. |
| Negative value | The operation failed. |
......@@ -295,7 +295,7 @@ int32_t HdmiAvmuteSet(DevHandle handle, bool enable);
| ---------- | ----------------- |
| handle | HDMI controller handle. |
| enable | Whether to enable the AV mute feature.|
| **Return Value**| **Description** |
| **Return Value**| **Description** |
| 0 | The operation is successful. |
| Negative value | The operation failed. |
......@@ -615,4 +615,4 @@ static int32_t TestCaseHdmi(void)
return 0;
}
```
\ No newline at end of file
```
......@@ -8,33 +8,33 @@
- **Symptom**
**Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port.
**Figure 1** Failed to open the serial port
![en-us_image_0000001243481961](figures/en-us_image_0000001243481961.png)
After I click **Burn** and select a serial port, **Error: Opening COMxx: Access denied** is displayed.
**Figure 1** Access denied error
![failed-to-open-the-serial-port](figures/failed-to-open-the-serial-port.png)
- **Possible Causes**
The serial port is in use.
The serial port is in use.
- **Solution**
1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel.
1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel.
**Figure 2** Checking whether the serial port is in use
![en-us_image_0000001243481989](figures/en-us_image_0000001243481989.png)
2. Click the dustbin icon as shown below to disable the terminal using the serial port.
2. Click the dustbin icon as shown below to disable the terminal using the serial port.
**Figure 3** Disabling the terminal using the serial port
![en-us_image_0000001243082093](figures/en-us_image_0000001243082093.png)
3. Click **Burn**, select the serial port, and start burning images again.
3. Click **Burn**, select the serial port, and start burning images again.
**Figure 4** Restarting the burning task
![en-us_image_0000001198322224](figures/en-us_image_0000001198322224.png)
......@@ -42,100 +42,98 @@ The serial port is in use.
- **Symptom**
The burning status is not displayed after clicking **Burn** and selecting a serial port.
The image failed to be burnt over a serial port.
- **Possible Causes**
The IDE is not restarted after the DevEco plug-in is installed.
The DevEco Device Tool plug-in is not restarted after being installed.
- **Solution**
Restart the IDE.
Restart DevEco Device Tool.
### No Command Output Is Displayed
- **Symptom**
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**.
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when I press **Enter**.
- **Possible Cause 1**
The serial port is connected incorrectly.
The serial port is connected incorrectly.
- **Solution**
Change the serial port number.
Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
Change the serial port number.
Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
- **Possible Cause 2**
The U-Boot of the board is damaged.
The U-Boot of the board is damaged.
- **Solution**
Burn the U-Boot.
If the fault persists after you perform the preceding operations, the U-Boot of the board may be damaged. You can burn the U-Boot by performing the following steps:
Burn the U-Boot.
If the fault persists after you perform the preceding operations, the U-Boot of the board may be damaged. In this case, burn the U-Boot by performing the following steps:
1. Obtain the U-Boot file.
> ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
> The U-Boot file of the two boards can be obtained from the following paths, respectively.
>
> Hi3516D V300: **device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin**
>
> Hi3518E V300: **device\hisilicon\hispark_aries\sdk_liteos\uboot\out\boot\u-boot-hi3518ev300.bin**
1. Obtain the U-Boot file.
> ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
> The U-Boot file of the two boards can be obtained from the following paths, respectively.
>
> Hi3516D V300: **device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin**
>
> Hi3518E V300: **device\hisilicon\hispark_aries\sdk_liteos\uboot\out\boot\u-boot-hi3518ev300.bin**
2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB.
Select the U-Boot files of the corresponding development board for burning by referring to [Burning to Hi3516D V300](../quick-start/quickstart-ide-lite-steps-hi3516-burn.md).
2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB.
Select the U-Boot files of the corresponding development board for burning by referring to [Burning to Hi3516D V300](../quick-start/quickstart-ide-lite-steps-hi3516-burn.md).
3. Log in to the serial port after the burning is complete.
3. Log in to the serial port after the burning is complete.
**Figure 5** Information displayed through the serial port after the U-Boot file is burnt
**Figure 5** Information displayed through the serial port after the U-Boot file is burnt
![en-us_image_0000001243484907](figures/en-us_image_0000001243484907.png)
![en-us_image_0000001243484907](figures/en-us_image_0000001243484907.png)
### Windows-based PC Failed to Be Connected to the Board
- **Symptom**
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
**Figure 6** Failed to obtain the file image due to network disconnection
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
**Figure 6** Failed to obtain the file image due to network disconnection
![en-us_image_0000001198322428](figures/en-us_image_0000001198322428.png)
- **Possible Causes**
The board is disconnected from the Windows-based PC.
Windows Firewall does not allow Visual Studio Code to access the network.
- **Solution**
1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**.
The board is disconnected from the Windows-based PC.
**Figure 7** Setting the firewall
Windows Firewall does not allow Visual Studio Code to access the network.
![en-us_image_0000001198162584](figures/en-us_image_0000001198162584.png)
- **Solution**
3. Click **Firewall & network protection**, and on the displayed page, click **Allow an app through the firewall**.
1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**.
**Figure 8** Firewall & network protection
**Figure 7** Setting the firewall
![en-us_image_0000001198162584](figures/en-us_image_0000001198162584.png)
![en-us_image_0000001198323146](figures/en-us_image_0000001198323146.png)
3. Click **Firewall & network protection**. On the displayed page, click **Allow an app through the firewall**.
4. Select Visual Studio Code.
**Figure 8** Firewall & network protection
![en-us_image_0000001198323146](figures/en-us_image_0000001198323146.png)
**Figure 9** Selecting Visual Studio Code
![en-us_image_0000001198003232](figures/en-us_image_0000001198003232.png)
4. Select Visual Studio Code.
5. Select the **Private** and **Public** network access rights for Visual Studio Code.
**Figure 9** Selecting Visual Studio Code
![en-us_image_0000001198003232](figures/en-us_image_0000001198003232.png)
**Figure 10** Allowing Visual Studio Code to access the network
5. Select the **Private** and **Public** network access rights for Visual Studio Code.
![en-us_image_0000001243084579](figures/en-us_image_0000001243084579.png)
\ No newline at end of file
**Figure 10** Allowing Visual Studio Code to access the network
![en-us_image_0000001243084579](figures/en-us_image_0000001243084579.png)
\ No newline at end of file
......@@ -19,13 +19,13 @@ In the Ubuntu environment, perform the following steps to obtain the OpenHarmony
```
Run the following command to install the tools:
```
sudo apt-get install git git-lfs
```
4. Configure user information.
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
......@@ -33,7 +33,7 @@ In the Ubuntu environment, perform the following steps to obtain the OpenHarmony
```
5. Run the following commands to install the **repo** tool:
```
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
chmod a+x /usr/local/bin/repo
......@@ -41,7 +41,7 @@ In the Ubuntu environment, perform the following steps to obtain the OpenHarmony
```
## Obtaining Source Code
## Procedure
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> Download the master code if you want to get quick access to the latest features for your development. Download the release code, which is more stable, if you want to develop commercial functionalities.
......@@ -58,7 +58,7 @@ In the Ubuntu environment, perform the following steps to obtain the OpenHarmony
Method 2: Use the **repo** tool to download the source code over HTTPS.
```
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
......@@ -72,8 +72,8 @@ In the Ubuntu environment, perform the following steps to obtain the OpenHarmony
## Running prebuilts
Go to the root directory of the source code and run the following script to install the compiler and binary tool:
Go to the root directory of the source code and run the following script to install the compiler and binary tool:
```
bash build/prebuilts_download.sh
```
......@@ -18,8 +18,8 @@ Before subscribing to system events, you need to configure HiSysEvent logging. F
| Name| Description |
| -------- | --------- |
|bool HiSysEventManager::AddEventListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener, std::vector&lt;ListenerRule&gt;&amp; rules)|Registers a listener for system events. You can listen for certain events by specifying rules.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </li><li>**rules**: rules for event listening. </li></ul>Return value:<ul><li>**0**: Repeated registration is successful. </li><li>**1**: Initial registration is successful. </li><li>Other values: Registration has failed.</li></ul>|
|bool HiSysEventManager::RemoveListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener)|Removes the listener for system events.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </ul>Return value:<br>None.|
|int32_t HiSysEventManager::AddEventListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener, std::vector&lt;ListenerRule&gt;&amp; rules)|Registers a listener for system events. You can listen for certain events by specifying rules.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </li><li>**rules**: rules for event listening. </li></ul>Return value:<ul><li>**0**: registration is successful. </li><li>Other values: Registration has failed.</li></ul>|
|int32_t HiSysEventManager::RemoveListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener)|Removes the listener for system events.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </ul>Return value:<ul><li>**0**: Cancel registration is successful. </li><li>Other values: Cancel registration has failed.</li></ul>|
**Table 2** Description of ListenerRule
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册