diff --git a/CODEOWNERS b/CODEOWNERS
index 63dee6787f1bea126047ec423f333ad3de9fe5e9..f395d69420381a4e61268211787acd0cff417ec5 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -243,7 +243,7 @@ zh-cn/application-dev/reference/apis/js-apis-data-preferences.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-data-storage.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-system-storage.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md @ge-yafang
-zh-cn/application-dev/reference/apis/js-apis-settings.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-settings.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-data-resultset.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-document.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-environment.md @qinxiaowang
@@ -261,15 +261,18 @@ zh-cn/application-dev/reference/apis/js-apis-sms.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-net-connection.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-http.md @zengyawen
-zh-cn/application-dev/reference/apis/js-apis-request.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-request.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-socket.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-webSocket.md @zengyawen
-zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-connectedTag.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-nfcTag.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-nfcTech.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-tagSession.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-connectedTag.md @bmeangel
zh-cn/application-dev/reference/apis/js-apis-rpc.md @qinxiaowang
-zh-cn/application-dev/reference/apis/js-apis-wifi.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-wifiext.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-accessibility.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-wifi.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-wifiext.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-accessibility.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-faultLogger.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hiappevent.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hichecker.md @zengyawen
@@ -277,34 +280,34 @@ zh-cn/application-dev/reference/apis/js-apis-hidebug.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hilog.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hitracechain.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hitracemeter.md @zengyawen
-zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-system-time.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @ge-yafang
+zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-system-time.md @bmeangel
+zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @bmeangel
zh-cn/application-dev/reference/apis/js-apis-timer.md @HelloCrease
-zh-cn/application-dev/reference/apis/js-apis-battery-info.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-brightness.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-device-info.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-battery-info.md @qinxiaowang
+zh-cn/application-dev/reference/apis/js-apis-brightness.md @qinxiaowang
+zh-cn/application-dev/reference/apis/js-apis-device-info.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-device-manager.md
zh-cn/application-dev/reference/apis/js-apis-geolocation.md @sun-yue14
zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputdevice.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputeventclient.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md @HelloCrease
-zh-cn/application-dev/reference/apis/js-apis-power.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-runninglock.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-power.md @qinxiaowang
+zh-cn/application-dev/reference/apis/js-apis-runninglock.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-sensor.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-sensor.md @HelloCrease
-zh-cn/application-dev/reference/apis/js-apis-system-parameter.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-thermal.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-system-parameter.md @qinxiaowang
+zh-cn/application-dev/reference/apis/js-apis-thermal.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-update.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-usb.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-vibrator.md @HelloCrease
-zh-cn/application-dev/reference/apis/js-apis-appAccount.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-distributed-account.md @sun-yue14
-zh-cn/application-dev/reference/apis/js-apis-osAccount.md @sun-yue14
+zh-cn/application-dev/reference/apis/js-apis-appAccount.md @zengyawen
+zh-cn/application-dev/reference/apis/js-apis-distributed-account.md @zengyawen
+zh-cn/application-dev/reference/apis/js-apis-osAccount.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-convertxml.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-process.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-uri.md @zengyawen
@@ -344,4 +347,5 @@ zh-cn/application-dev/quick-start/syscap.md @RayShih
zh-cn/application-dev/napi/napi-guidelines.md @RayShih
zh-cn/application-dev/napi/drawing-guidelines.md @ge-yafang
zh-cn/application-dev/napi/rawfile-guidelines.md @HelloCrease
-zh-cn/application-dev/reference/apis/js-apis-buffer.md @zengyawen
\ No newline at end of file
+zh-cn/application-dev/reference/apis/js-apis-buffer.md @zengyawen
+zh-cn/application-dev/reference/js-service-widget-ui @HelloCrease
\ No newline at end of file
diff --git a/README.md b/README.md
index 7e19add93fd8c1818e41387bfd4c8ad34efa2b71..0b1fe4ea284ed5df055c0031d96d3cfb759948a3 100644
--- a/README.md
+++ b/README.md
@@ -22,9 +22,11 @@ This repository stores device and application development documents provided by
- OpenHarmony 3.1 Release. [Learn more](en/release-notes/OpenHarmony-v3.1-release.md)
+ This version is upgraded to OpenHarmony 3.1.1 LTS. [Learn more](en/release-notes/OpenHarmony-v3.1.1-release.md)
+
- OpenHarmony 3.0 LTS. [Learn more](en/release-notes/OpenHarmony-v3.0-LTS.md)
- This version is upgraded to OpenHarmony 3.0.3 LTS. [Learn more](en/release-notes/OpenHarmony-v3.0.3-LTS.md)
+ This version is upgraded to OpenHarmony 3.0.5 LTS. [Learn more](en/release-notes/OpenHarmony-v3.0.5-LTS.md)
- OpenHarmony 2.2 Beta2. [Learn more](en/release-notes/OpenHarmony-v2.2-beta2.md)
@@ -41,10 +43,14 @@ OpenHarmony_v1.x_release: OpenHarmony v1.1.4 LTS. [Learn more](en/release-notes/
Third-party license: [Third-Party Open-Source Software and License Notice](en/contribute/third-party-open-source-software-and-license-notice.md)
-## How to Contribute
+## Contribution
A great open-source project wouldn't be possible without the hard work of many contributors. We'd like to invite anyone from around the world to [participate](en/contribute/how-to-contribute.md) in this exciting journey, and we're grateful for your time, passion, and efforts!
You can evaluate available documents, make simple modifications, provide feedback on document quality, and contribute your original content. For details, see [Documentation Contribution](en/contribute/documentation-contribution.md).
Excellent contributors will be awarded and the contributions will be publicized in the developer community.
+
+- Mail list: docs@openharmony.io
+
+- Zulip group: documentation_sig
\ No newline at end of file
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 70560a93c1dd890bf8b6ff1d9f03d2e778adbfe0..46dd8e3d0fe4ee945af2b5e0154ee0b876850d1a 100755
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -35,14 +35,15 @@ RUN sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/ap
&& pip3 install six --upgrade --ignore-installed six \
&& mkdir -p /home/tools \
&& mkdir -p /home/tools/gn \
- && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz \
+ && wget -P /home/tools https://repo.huaweicloud.com/openharmony/compiler/clang/12.0.1-530132/linux/clang-530132-linux-x86_64.tar.bz2 \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz \
&& wget -P /home/tools https://mirrors.huaweicloud.com/nodejs/v14.15.4/node-v14.15.4-linux-x64.tar.xz \
&& wget -P /home/tools https://hm-verify.obs.cn-north-4.myhuaweicloud.com/qemu-5.2.0.tar.xz \
- && tar -xvf /home/tools/llvm.tar.gz -C /home/tools \
+ && tar -jxvf /home/tools/clang-530132-linux-x86_64.tar.bz2 -C /home/tools \
+ && mv /home/tools/clang-530132 /home/tools/llvm \
&& tar -xvf /home/tools/hc-gen-0.65-linux.tar -C /home/tools \
&& tar -xvf /home/tools/gcc_riscv32-linux-7.3.0.tar.gz -C /home/tools \
&& tar -xvf /home/tools/ninja.1.9.0.tar -C /home/tools \
diff --git a/en/application-dev/ability/fa-serviceability.md b/en/application-dev/ability/fa-serviceability.md
index 75a605c39be73f29e1db8cecf988535c5495ee4a..48270359d9d49f9ea7d7111b021cd8b81da3df82 100644
--- a/en/application-dev/ability/fa-serviceability.md
+++ b/en/application-dev/ability/fa-serviceability.md
@@ -30,7 +30,7 @@ A Service ability is used to run tasks in the background, such as playing music
},
onConnect(want) {
console.log('ServiceAbility OnConnect');
- return null;
+ return new FirstServiceAbilityStub('test');
},
onDisconnect(want) {
console.log('ServiceAbility OnDisConnect');
@@ -113,8 +113,6 @@ let promise = featureAbility.startAbility(
Once created, the Service ability keeps running in the background. The system does not stop or destroy it unless memory resources must be reclaimed.
-
-
### Connecting to a Local Service Ability
If you need to connect a Service ability to a Page ability or to a Service ability in another application, you must first implement the **IAbilityConnection** API for the connection. A Service ability allows other abilities to connect to it through **connectAbility()**.
@@ -124,7 +122,7 @@ You can use either of the following methods to connect to a Service ability:
1. Using the IDL to automatically generate code
- Use OpenHarmony Interface Definition Language (IDL) to automatically generate the corresponding client, server, and **IRemoteObject** code. For details, see [“Development Using TS” in OpenHarmony IDL Specifications and User Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/IDL/idl-guidelines.md#development-using-ts).
+ Use OpenHarmony Interface Definition Language (IDL) to automatically generate the corresponding client, server, and **IRemoteObject** code. For details, see “Development Using TS" in [OpenHarmony IDL Specifications and User Guide](../IDL/idl-guidelines.md).
2. Writing code in the corresponding file
@@ -134,42 +132,37 @@ You can use either of the following methods to connect to a Service ability:
```javascript
import prompt from '@system.prompt'
-
- let mRemote;
- function onConnectCallback(element, remote){
- console.log('onConnectLocalService onConnectDone element: ' + element);
- console.log('onConnectLocalService onConnectDone remote: ' + remote);
- mRemote = remote;
- if (mRemote == null) {
- prompt.showToast({
- message: "onConnectLocalService not connected yet"
- });
- return;
- }
- let option = new rpc.MessageOption();
- let data = new rpc.MessageParcel();
- let reply = new rpc.MessageParcel();
- data.writeInt(1);
- data.writeInt(99);
- mRemote.sendRequest(1, data, reply, option).then((result) => {
- console.log('sendRequest success');
- let msg = reply.readInt();
+
+ var option = {
+ onConnect: function onConnectCallback(element, proxy) {
+ console.log(`onConnectLocalService onConnectDone`)
+ if (proxy === null) {
+ prompt.showToast({
+ message: "Connect service failed"
+ })
+ return
+ }
+ let data = rpc.MessageParcel.create()
+ let reply = rpc.MessageParcel.create()
+ let option = new rpc.MessageOption()
+ data.writeInterfaceToken("connect.test.token")
+ proxy.sendRequest(0, data, reply, option)
prompt.showToast({
- message: "onConnectLocalService connect result: " + msg,
- duration: 3000
- });
- }).catch((e) => {
- console.log('sendRequest error:' + e);
- });
-
- }
-
- function onDisconnectCallback(element){
- console.log('ConnectAbility onDisconnect Callback')
- }
-
- function onFailedCallback(code){
- console.log('ConnectAbility onFailed Callback')
+ message: "Connect service success"
+ })
+ },
+ onDisconnect: function onDisconnectCallback(element) {
+ console.log(`onConnectLocalService onDisconnectDone element:${element}`)
+ prompt.showToast({
+ message: "Disconnect service success"
+ })
+ },
+ onFailed: function onFailedCallback(code) {
+ console.log(`onConnectLocalService onFailed errCode:${code}`)
+ prompt.showToast({
+ message: "Connect local service onFailed"
+ })
+ }
}
```
@@ -196,45 +189,28 @@ You can use either of the following methods to connect to a Service ability:
```javascript
import rpc from "@ohos.rpc";
-
- let mMyStub;
- export default {
- onStart() {
- class MyStub extends rpc.RemoteObject{
- constructor(des) {
- if (typeof des === 'string') {
- super(des);
- }
- return null;
- }
- onRemoteRequest(code, data, reply, option) {
- console.log("ServiceAbility onRemoteRequest called");
- if (code === 1) {
- let op1 = data.readInt();
- let op2 = data.readInt();
- console.log("op1 = " + op1 + ", op2 = " + op2);
- reply.writeInt(op1 + op2);
- } else {
- console.log("ServiceAbility unknown request code");
- }
- return true;
- }
- }
- mMyStub = new MyStub("ServiceAbility-test");
- },
- onCommand(want, startId) {
- console.log('ServiceAbility onCommand');
- },
- onConnect(want) {
- console.log('ServiceAbility OnConnect');
- return mMyStub;
- },
- onDisconnect(want) {
- console.log('ServiceAbility OnDisConnect');
- },
- onStop() {
- console.log('ServiceAbility onStop');
- },
+
+ class FirstServiceAbilityStub extends rpc.RemoteObject {
+ constructor(des: any) {
+ if (typeof des === 'string') {
+ super(des)
+ } else {
+ return
+ }
+ }
+
+ onRemoteRequest(code: number, data: any, reply: any, option: any) {
+ console.log(printLog + ` onRemoteRequest called`)
+ if (code === 1) {
+ let string = data.readString()
+ console.log(printLog + ` string=${string}`)
+ let result = Array.from(string).sort().join('')
+ console.log(printLog + ` result=${result}`)
+ reply.writeString(result)
+ } else {
+ console.log(printLog + ` unknown request code`)
+ }
+ return true;
}
```
@@ -253,40 +229,36 @@ The following code snippet shows how to implement the callbacks:
```ts
import prompt from '@system.prompt'
-let mRemote;
-function onConnectCallback(element, remote){
- console.log('onConnectRemoteService onConnectDone element: ' + element);
- console.log('onConnectRemoteService onConnectDone remote: ' + remote);
- mRemote = remote;
- if (mRemote == null) {
- prompt.showToast({
- message: "onConnectRemoteService not connected yet"
- });
- return;
- }
- let option = new rpc.MessageOption();
- let data = new rpc.MessageParcel();
- let reply = new rpc.MessageParcel();
- data.writeInt(1);
- data.writeInt(99);
- mRemote.sendRequest(1, data, reply, option).then((result) => {
- console.log('sendRequest success');
- let msg = reply.readInt();
+var option = {
+ onConnect: function onConnectCallback(element, proxy) {
+ console.log(`onConnectRemoteService onConnectDone`)
+ if (proxy === null) {
+ prompt.showToast({
+ message: "Connect service failed"
+ })
+ return
+ }
+ let data = rpc.MessageParcel.create()
+ let reply = rpc.MessageParcel.create()
+ let option = new rpc.MessageOption()
+ data.writeInterfaceToken("connect.test.token")
+ proxy.sendRequest(0, data, reply, option)
prompt.showToast({
- message: "onConnectRemoteService connect result: " + msg,
- duration: 3000
- });
- }).catch((e) => {
- console.log('sendRequest error:' + e);
- });
-}
-
-function onDisconnectCallback(element){
- console.log('ConnectRemoteAbility onDisconnect Callback')
-}
-
-function onFailedCallback(code){
- console.log('ConnectRemoteAbility onFailed Callback')
+ message: "Connect service success"
+ })
+ },
+ onDisconnect: function onDisconnectCallback(element) {
+ console.log(`onConnectRemoteService onDisconnectDone element:${element}`)
+ prompt.showToast({
+ message: "Disconnect service success"
+ })
+ },
+ onFailed: function onFailedCallback(code) {
+ console.log(`onConnectRemoteService onFailed errCode:${code}`)
+ prompt.showToast({
+ message: "Connect local service onFailed"
+ })
+ }
}
```
@@ -372,23 +344,25 @@ The following code snippet shows how the Service ability instance returns itself
```ts
import rpc from "@ohos.rpc";
-class FirstServiceAbilityStub extends rpc.RemoteObject{
- constructor(des) {
+class FirstServiceAbilityStub extends rpc.RemoteObject {
+ constructor(des: any) {
if (typeof des === 'string') {
- super(des);
+ super(des)
} else {
- return null;
+ return
}
}
- onRemoteRequest(code, data, reply, option) {
- console.log("ServiceAbility onRemoteRequest called");
+
+ onRemoteRequest(code: number, data: any, reply: any, option: any) {
+ console.log(printLog + ` onRemoteRequest called`)
if (code === 1) {
- let op1 = data.readInt();
- let op2 = data.readInt();
- console.log("op1 = " + op1 + ", op2 = " + op2);
- reply.writeInt(op1 + op2);
+ let string = data.readString()
+ console.log(printLog + ` string=${string}`)
+ let result = Array.from(string).sort().join('')
+ console.log(printLog + ` result=${result}`)
+ reply.writeString(result)
} else {
- console.log("ServiceAbility unknown request code");
+ console.log(printLog + ` unknown request code`)
}
return true;
}
diff --git a/en/application-dev/database/Readme-EN.md b/en/application-dev/database/Readme-EN.md
index 9f7ccd0d08e8683aca6e6c86ddef80f8e0e5aad4..a8aff91550cb265137a89d8718f6232c34e1aa43 100644
--- a/en/application-dev/database/Readme-EN.md
+++ b/en/application-dev/database/Readme-EN.md
@@ -3,12 +3,19 @@
- Distributed Data Service
- [Distributed Data Service Overview](database-mdds-overview.md)
- [Distributed Data Service Development](database-mdds-guidelines.md)
+
- Relational Database
- [RDB Overview](database-relational-overview.md)
- [RDB Development](database-relational-guidelines.md)
+
- Preferences
- [Preferences Overview](database-preference-overview.md)
- [Preferences Development](database-preference-guidelines.md)
+
- Distributed Data Object
- [Distributed Data Object Overview](database-distributedobject-overview.md)
- [Distributed Data Object Development](database-distributedobject-guidelines.md)
+
+- Data Share
+ - [DataShare Overview](database-datashare-overview.md)
+ - [DataShare Development](database-datashare-guidelines.md)
diff --git a/en/application-dev/database/database-datashare-guidelines.md b/en/application-dev/database/database-datashare-guidelines.md
new file mode 100644
index 0000000000000000000000000000000000000000..251c33fbc54aadba8aa07b92f0292ab86f322d70
--- /dev/null
+++ b/en/application-dev/database/database-datashare-guidelines.md
@@ -0,0 +1,191 @@
+# DataShare Development
+The **DataShare** module allows an application to manage its own data and share data with other applications. Currently, data can be shared only between the applications on the same device.
+
+## Available APIs
+
+**Table 1** APIs of the data provider
+
+|API|Description|
+|:------|:------|
+|onCreate?(want: Want, callback: AsyncCallback<void>): void|Called to initialize service logic when the data provider application is created, for example, when a database is created.|
+|insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void|Inserts data into the database.|
+|update?(uri: string, predicates: DataSharePredicates, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void|Updates data in the database.|
+|query?(uri: string, predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<Object>): void|Queries data from the database.|
+|delete?(uri: string, predicates: DataSharePredicates, callback: AsyncCallback<number>): void|Deletes data from the database.|
+
+For more details, see [DataShareExtensionAbility](../reference/apis/js-apis-application-DataShareExtensionAbility.md).
+
+**Table 2** APIs of the data consumer
+
+| API | Description |
+| :----------------------------------------------------------- | :--------------------------------- |
+| createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void | Creates a **DataShareHelper** instance. |
+| insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void | Inserts a single data record into the database. |
+| update(uri: string, predicates: DataSharePredicates, value: ValuesBucket, callback: AsyncCallback<number>): void | Updates data in the database. |
+| query(uri: string, predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<DataShareResultSet>): void | Queries data from the database. |
+| delete(uri: string, predicates: DataSharePredicates, callback: AsyncCallback<number>): void | Deletes one or more data records from the database.|
+
+For more details, see [DataShareHelper](../reference/apis/js-apis-data-dataShare.md).
+
+## When to Use
+
+**DataShare** can be divided into the following:
+
+- Data provider: Implement functions of adding, deleting, modifying, and querying data, and opening files, and share data.
+- Data consumer: Access the data provided by the provider using **DataShareHelper**.
+
+Examples are given below.
+
+### Data Provider Application Development (Only for System Applications)
+
+1. Import the dependencies.
+
+ ```ts
+ import Extension from '@ohos.application.DataShareExtensionAbility'
+ import rdb from '@ohos.data.rdb';
+ import fileIo from '@ohos.fileio'
+ import dataSharePredicates from '@ohos.data.dataSharePredicates'
+ ```
+
+2. Override **DataShareExtensionAbility** APIs based on actual requirements. For example, if the data provider provides only data query, override only the query() API.
+
+3. Implement the data provider services. For example, implement data storage of the data provider by using a database, reading and writing files, or accessing the network.
+
+ ```ts
+ let DB_NAME = "DB00.db";
+ let TBL_NAME = "TBL00";
+ let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ + TBL_NAME
+ + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, isStudent BOOLEAN, Binary BINARY)";
+
+ let rdbStore;
+ let result;
+
+ export default class DataShareExtAbility extends Extension {
+ private rdbStore_;
+
+ // Override the onCreate() API.
+ onCreate(want, callback) {
+ result = this.context.cacheDir + '/datashare.txt'
+ // Create an RDB.
+ rdb.getRdbStore(this.context, {
+ name: DB_NAME
+ }, 1, function (err, data) {
+ rdbStore = data;
+ rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) {
+ console.log('DataShareExtAbility onCreate, executeSql done err:' + JSON.stringify(err));
+ });
+ callback();
+ });
+ }
+
+ // Override the query() API.
+ query(uri, predicates, columns, callback) {
+ if (predicates == null || predicates == undefined) {
+ console.info('invalid predicates');
+ }
+ try {
+ rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) {
+ if (resultSet != undefined) {
+ console.info('resultSet.rowCount: ' + resultSet.rowCount);
+ }
+ if (callback != undefined) {
+ callback(err, resultSet);
+ }
+ });
+ } catch (err) {
+ console.error('error' + err);
+ }
+ }
+ // Override other APIs as required.
+ // ...
+ };
+ ```
+
+4. Define **DataShareExtensionAbility** in **module.json5**.
+
+ | Field| Description |
+ | ------------ | ------------------------------------------------------------ |
+ | "name" | Ability name, corresponding to the **ExtensionAbility** class name derived from **Ability**. |
+ | "type" | Ability type. The value is **dataShare**, indicating the development is based on the **Datashare** template.|
+ | "uri" | URI used for communication. It is the unique identifier for the client to connect to the server. |
+ | "visible" | Whether it is visible to other applications. Communication with other applications is allowed only when the value is **true**.|
+
+ **module.json5 example**
+
+ ```json
+ "extensionAbilities": [
+ {
+ "srcEntrance": "./ets/DataShareExtAbility/DataShareExtAbility.ts",
+ "name": "DataShareExtAbility",
+ "icon": "$media:icon",
+ "description": "$string:description_datashareextability",
+ "type": "dataShare",
+ "uri": "datashare://com.samples.datasharetest.DataShare",
+ "visible": true
+ }
+ ]
+ ```
+
+### Data Consumer Application Development
+
+1. Import basic dependencies.
+
+ ```ts
+ import Ability from '@ohos.application.Ability'
+ import dataShare from '@ohos.data.dataShare'
+ import dataSharePredicates from '@ohos.data.dataSharePredicates'
+ ```
+
+2. Define the URI string for communicating with the data provider.
+
+ ```ts
+ // Different from the URI defined in the module.json5 file, the URI passed in the parameter has an extra slash (/), because there is a DeviceID parameter between the second and the third slash (/).
+ let dseUri = ("datashare:///com.samples.datasharetest.DataShare");
+ ```
+
+2. Create a **DataShareHelper** instance.
+
+ ```ts
+ let dsHelper;
+ let abilityContext;
+ export default class MainAbility extends Ability {
+ onWindowStageCreate(windowStage) {
+ abilityContext = this.context;
+ dataShare.createDataShareHelper(abilityContext, dseUri, (err,data)=>{
+ dsHelper = data;
+ });
+ }
+ }
+ ```
+
+3. Use the APIs provided by **DataShareHelper** to access the services provided by the provider, for example, adding, deleting, modifying, and querying data.
+
+ ```ts
+ // Construct a piece of data.
+ var valuesBucket = {"name": "ZhangSan", "age": 21, "isStudent": false, "Binary": new Uint8Array([1,2,3])};
+ var updateBucket = {"name": "LiSi", "age": 18, "isStudent": true, "Binary": new Uint8Array([1,2,3])};
+ let da = new dataSharePredicates.DataSharePredicates();
+ var valArray =new Array("*");
+ let people = new Array(
+ {"name": "LiSi", "age": 41, "Binary": ar},
+ {"name": "WangWu", "age": 21, "Binary": arr},
+ {"name": "ZhaoLiu", "age": 61, "Binary": arr});
+ // Insert a piece of data.
+ dsHelper.insert(dseUri, valuesBucket, (err,data) => {
+ console.log("dsHelper insert result: " + data);
+ });
+ // Delete the specified data.
+ dsHelper.delete(dseUri, da, (err,data) => {
+ console.log("dsHelper delete result: " + data);
+ });
+ // Update data.
+ dsHelper.update(dseUri, da, updateBucket, (err,data) => {
+ console.log("dsHelper update result: " + data);
+ });
+ // Query data.
+ dsHelper.query(dseUri, da, valArray, (err,data) => {
+ console.log("dsHelper query result: " + data);
+ });
+ ```
+
diff --git a/en/application-dev/database/database-datashare-overview.md b/en/application-dev/database/database-datashare-overview.md
new file mode 100644
index 0000000000000000000000000000000000000000..857e9fa4205cd0545803643af1515da485b83d8a
--- /dev/null
+++ b/en/application-dev/database/database-datashare-overview.md
@@ -0,0 +1,54 @@
+# DataShare Overview
+
+## Introduction
+
+The **DataShare** module allows an application to manage its own data and share data with other applications. Currently, data can be shared only between the applications on the same device.
+
+**DataShare** is used in application scenarios, such as contacts, short message service (SMS), and media gallery. However, not all data, such as accounts and passwords, can be accessed by other applications. Some data, such as SMS messages, can only be queried by other applications. **DataShare** provides a secure data sharing mechanism for applications.
+
+The data provider can directly use the **DataShare** framework to share data with other applications without complex encapsulation. The data consumer only needs to learn and use a set of interfaces because the data access mode does not vary with the data provisioning mode. This greatly reduces the learning time and development difficulty.
+
+## Basic Concepts
+
+
+Before you get started, familiarize yourself with the following concepts:
+
+
+- Data provider
+
+ An application that provides data and implements related services. It is also called a producer or server.
+
+- Data consumer
+
+ An application that accesses the data or services provided by a data provider. It is also called a client.
+
+- Value bucket (**ValuesBucket**)
+
+ One or more data records stored in the form of key-value (KV) pairs. The keys are of the string type. The values can be of the number, string, Boolean, or Unit8Array type.
+
+- Result set
+
+ A collection of query results. Flexible data access modes are provided for users to obtain data.
+
+- Predicate
+
+ Conditions specified for updating, deleting, or querying data in the database.
+
+## Working Principles
+
+**Figure 1** DataShare mechanism
+
+
+
+
+- The **DataShareExtAbility** module, as the data provider, implements data sharing between applications.
+- The **DataShareHelper** module, as the data consumer, provides interfaces for accessing data, including adding, deleting, modifying, and querying data.
+- The data consumer communicates with the data provider using inter-process communication (IPC). The data provider can be implemented through a database or other data storage.
+
+- The **ResultSet** module is implemented through shared memory. Share memory stores the result sets, and interfaces are provided to traverse result sets.
+
+## Constraints
+
+- **DataShare** is subject to the limitations on the database used by the data provider. For example, the supported data models, length of the keys and values, and maximum number of databases that can be accessed at a time by each application vary with the database in use.
+
+- The payloads of **ValuesBucket**, predicates, and result sets are restricted by IPC.
diff --git a/en/application-dev/database/database-relational-guidelines.md b/en/application-dev/database/database-relational-guidelines.md
index b56401dbedca72e76af3b15efdd63883885bf3d6..7f93b1ca5684d4268ca7fe46e35442a776a3b201 100644
--- a/en/application-dev/database/database-relational-guidelines.md
+++ b/en/application-dev/database/database-relational-guidelines.md
@@ -74,6 +74,8 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th
| RdbStore | query(predicates: RdbPredicates, columns?: Array<string>): Promise<ResultSet> | Queries data in the RDB store based on the specified **RdbPredicates** object. This API uses a promise to return the result.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.|
| RdbStore | querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<ResultSet>):void | Queries data in the RDB store using the specified SQL statement. This API uses a callback to return the result.
- **sql**: SQL statement.
- **bindArgs**: arguments in the SQL statement.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
| RdbStore | querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> | Queries data in the RDB store using the specified SQL statement. This API uses a promise to return the result.
- **sql**: SQL statement.
- **bindArgs**: arguments in the SQL statement.|
+ | RdbStore | remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>): void |Queries data from the RDB store of a remote device based on specified conditions. This API uses an asynchronous callback to return the result.
- **device**: network ID of the remote device.
- **table**: name of the table to query.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.
- **callback**: callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
+ | RdbStore | remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array<string>): Promise<ResultSet> | Queries data from the RDB store of a remote device based on specified conditions. This API uses a promise to return the result.
- **device**: network ID of the remote device.
- **table**: name of the table to query.
- **predicates**: conditions for querying data.
- **columns**: columns to query. If this parameter is not specified, the query applies to all columns.|
### Using Predicates
@@ -85,34 +87,34 @@ The RDB provides **RdbPredicates** for you to set database operation conditions.
| -------- | -------- | -------- |
| RdbPredicates |inDevices(devices: Array\): RdbPredicates | Specifies remote devices on the network with RDB stores to be synchronized.
- **devices**: IDs of the remote devices on the network.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
| RdbPredicates |inAllDevices(): RdbPredicates | Connects to all remote devices on the network with RDB stores to be synchronized.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | equalTo(field: string, value: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | notEqualTo(field: string, value: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value not equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | equalTo(field: string, value: ValueType): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **ValueType** and value equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | notEqualTo(field: string, value: ValueType): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **ValueType** and value not equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
| RdbPredicates | beginWrap(): RdbPredicates | Adds a left parenthesis to the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** with a left parenthesis.|
| RdbPredicates | endWrap(): RdbPredicates | Adds a right parenthesis to the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** with a right parenthesis.|
| RdbPredicates | or(): RdbPredicates | Adds the OR condition to the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** with the OR condition.|
| RdbPredicates | and(): RdbPredicates | Adds the AND condition to the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** with the AND condition.|
-| RdbPredicates | contains(field: string, value: string): RdbPredicates | Sets the **RdbPredicates** to match a string containing the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified string.|
-| RdbPredicates | beginsWith(field: string, value: string): RdbPredicates | Sets the **RdbPredicates** to match a string that starts with the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | endsWith(field: string, value: string): RdbPredicates | Sets the **RdbPredicates** to match a string that ends with the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | isNull(field: string): RdbPredicates | Sets the **RdbPredicates** to match the field whose value is null.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | isNotNull(field: string): RdbPredicates | Sets the **RdbPredicates** to match the field whose value is not null.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | like(field: string, value: string): RdbPredicates | Sets the **RdbPredicates** to match a string that is similar to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | glob(field: string, value: string): RdbPredicates | Sets the **RdbPredicates** to match the specified string.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | between(field: string, low: ValueType, high: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value within the specified range.
- **field**: column name in the database table.
- **low**: minimum value that matches the **RdbPredicates**.
- **high**: maximum value that matches the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value out of the specified range.
- **field**: column name in the database table.
- **low**: minimum value that matches the **RdbPredicates**.
- **high**: maximum value that matches the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | greaterThan(field: string, value: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value greater than the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | lessThan(field: string, value: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value less than the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value greater than or equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **ValueType** and value less than or equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | orderByAsc(field: string): RdbPredicates | Sets the **RdbPredicates** to match the column with values sorted in ascending order.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | orderByDesc(field: string): RdbPredicates | Sets the **RdbPredicates** to match the column with values sorted in descending order.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | distinct(): RdbPredicates | Sets the **RdbPredicates** to filter out duplicate records.
- **RdbPredicates**: returns a **RdbPredicates** object that can filter out duplicate records.|
-| RdbPredicates | limitAs(value: number): RdbPredicates | Sets the **RdbPredicates** to specify the maximum number of records.
- **value**: maximum number of records.
- **RdbPredicates**: returns a **RdbPredicates** object that can be used to set the maximum number of records.|
+| RdbPredicates | contains(field: string, value: string): RdbPredicates | Sets an **RdbPredicates** to match a string containing the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified string.|
+| RdbPredicates | beginsWith(field: string, value: string): RdbPredicates | Sets an **RdbPredicates** to match a string that starts with the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | endsWith(field: string, value: string): RdbPredicates | Sets an **RdbPredicates** to match a string that ends with the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | isNull(field: string): RdbPredicates | Sets an **RdbPredicates** to match the field whose value is null.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | isNotNull(field: string): RdbPredicates | Sets an **RdbPredicates** to match the field whose value is not null.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | like(field: string, value: string): RdbPredicates | Sets an **RdbPredicates** to match a string that is similar to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | glob(field: string, value: string): RdbPredicates | Sets an **RdbPredicates** to match the specified string.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | between(field: string, low: ValueType, high: ValueType): RdbPredicates | Sets ta **RdbPredicates** to match the field with data type **ValueType** and value within the specified range.
- **field**: column name in the database table.
- **low**: minimum value that matches the **RdbPredicates**.
- **high**: maximum value that matches the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **ValueType** and value out of the specified range.
- **field**: column name in the database table.
- **low**: minimum value that matches the **RdbPredicates**.
- **high**: maximum value that matches the **RdbPredicates**.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | greaterThan(field: string, value: ValueType): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **ValueType** and value greater than the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | lessThan(field: string, value: ValueType): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **ValueType** and value less than the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **ValueType** and value greater than or equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **ValueType** and value less than or equal to the specified value.
- **field**: column name in the database table.
- **value**: value specified.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | orderByAsc(field: string): RdbPredicates | Sets an **RdbPredicates** to match the column with values sorted in ascending order.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | orderByDesc(field: string): RdbPredicates | Sets an **RdbPredicates** to match the column with values sorted in descending order.
- **field**: column name in the database table.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | distinct(): RdbPredicates | Sets an **RdbPredicates** to filter out duplicate records.
- **RdbPredicates**: returns a **RdbPredicates** object that can filter out duplicate records.|
+| RdbPredicates | limitAs(value: number): RdbPredicates | Sets an **RdbPredicates** to specify the maximum number of records.
- **value**: maximum number of records.
- **RdbPredicates**: returns a **RdbPredicates** object that can be used to set the maximum number of records.|
| RdbPredicates | offsetAs(rowOffset: number): RdbPredicates | Sets the **RdbPredicates** to specify the start position of the returned result.
- **rowOffset**: start position of the returned result. The value is a positive integer.
- **RdbPredicates**: returns a **RdbPredicates** object that specifies the start position of the returned result.|
-| RdbPredicates | groupBy(fields: Array<string>): RdbPredicates | Sets the **RdbPredicates** to group rows that have the same value into summary rows.
- **fields**: names of the columns grouped for querying data.
- **RdbPredicates**: returns a **RdbPredicates** object that groups rows with the same value.|
-| RdbPredicates | indexedBy(indexName: string): RdbPredicates | Sets the **RdbPredicates** to specify the index column.
- **indexName**: name of the index column.
- **RdbPredicates**: returns a **RdbPredicates** object that specifies the index column.|
-| RdbPredicates | in(field: string, value: Array<ValueType>): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **Array<ValueType>** and value within the specified range.
- **field**: column name in the database table.
- **value**: array of **ValueType** to match.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
-| RdbPredicates | notIn(field: string, value: Array<ValueType>): RdbPredicates | Sets the **RdbPredicates** to match the field with data type **Array<ValueType>** and value out of the specified range.
- **field**: column name in the database table.
- **value**: array of **ValueType** to match.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | groupBy(fields: Array<string>): RdbPredicates | Sets an **RdbPredicates** to group rows that have the same value into summary rows.
- **fields**: names of the columns grouped for querying data.
- **RdbPredicates**: returns a **RdbPredicates** object that groups rows with the same value.|
+| RdbPredicates | indexedBy(indexName: string): RdbPredicates | Sets an **RdbPredicates** to specify the index column.
- **indexName**: name of the index column.
- **RdbPredicates**: returns a **RdbPredicates** object that specifies the index column.|
+| RdbPredicates | in(field: string, value: Array<ValueType>): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **Array<ValueType>** and value within the specified range.
- **field**: column name in the database table.
- **value**: array of **ValueType** to match.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
+| RdbPredicates | notIn(field: string, value: Array<ValueType>): RdbPredicates | Sets an **RdbPredicates** to match the field with data type **Array<ValueType>** and value out of the specified range.
- **field**: column name in the database table.
- **value**: array of **ValueType** to match.
- **RdbPredicates**: returns a **RdbPredicates** object that matches the specified field.|
### Using the Result Set
@@ -131,8 +133,8 @@ A result set can be regarded as a row of data in the queried results. It allows
| ResultSet | goToPreviousRow(): boolean | Moves the result set to the previous row.|
| ResultSet | getColumnIndex(columnName: string): number | Obtains the column index based on the specified column name.|
| ResultSet | getColumnName(columnIndex: number): string | Obtains the column name based on the specified column index.|
-| ResultSet | goToFirstRow(): boolean | Checks whether the result set is located in the first row.|
-| ResultSet | goToLastRow(): boolean | Checks whether the result set is located in the last row.|
+| ResultSet | goToFirstRow(): boolean | Moves to the first row of the result set.|
+| ResultSet | goToLastRow(): boolean | Moves to the last row of the result set.|
| ResultSet | getString(columnIndex: number): string | Obtains the value in the specified column of the current row, in a string.|
| ResultSet | getBlob(columnIndex: number): Uint8Array | Obtains the values in the specified column of the current row, in a byte array.|
| ResultSet | getDouble(columnIndex: number): number | Obtains the values in the specified column of the current row, in double.|
@@ -162,7 +164,7 @@ You can obtain the distributed table name for a remote device based on the local
| Class| API| Description|
| -------- | -------- | -------- |
-| RdbStore | obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\): void | Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the database of a remote device is queried. This API uses an asynchronous callback to return the result.
- **device**: remote device.
- **table**: local table name.
- **callback**: callback used to return the result. If the operation is successful, the distributed table name of the remote device will be returned. |
+| RdbStore | obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\): void | Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the database of a remote device is queried. This API uses an asynchronous callback to return the result.
- **device**: remote device.
- **table**: local table name.
- **callback**: callback used to return the result. If the operation is successful, the distributed table name of the remote device will be returned.|
| RdbStore | obtainDistributedTableName(device: string, table: string): Promise\ | Obtains the distributed table name for a remote device based on the local table name. The distributed table name is used to query the RDB store of the remote device. This API uses a promise to return the result.
- **device**: remote device.
- **table**: local table name.|
**Synchronizing Data Between Devices**
@@ -172,7 +174,7 @@ You can obtain the distributed table name for a remote device based on the local
| Class| API| Description|
| -------- | -------- | -------- |
| RdbStore | sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback\>): void | Synchronizes data between devices. This API uses a callback to return the result.
- **mode**: data synchronization mode. **SYNC_MODE_PUSH** means to push data from the local device to a remote device. **SYNC_MODE_PULL** means to pull data from a remote device to the local device.
- **predicates**: data and devices to be synchronized.
- **callback**: callback invoked to return the result. In the result, **string** indicates the device ID, and **number** indicates the synchronization status of each device. The value **0** indicates a success, and other values indicate a failure.|
-| RdbStore | sync(mode: SyncMode, predicates: RdbPredicates): Promise\> | Synchronizes data between devices. This API uses a promise to return the result.
- **mode**: data synchronization mode. **SYNC_MODE_PUSH** means to push data from the local device to a remote device. **SYNC_MODE_PULL** means to pull data from a remote device to the local device.
- **predicates**: data and devices to be synchronized. |
+| RdbStore | sync(mode: SyncMode, predicates: RdbPredicates): Promise\> | Synchronizes data between devices. This API uses a promise to return the result.
- **mode**: data synchronization mode. **SYNC_MODE_PUSH** means to push data from the local device to a remote device. **SYNC_MODE_PULL** means to pull data from a remote device to the local device.
- **predicates**: data and devices to be synchronized.|
**Registering an RDB Store Observer**
@@ -210,6 +212,16 @@ You can obtain the distributed table name for a remote device based on the local
| RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| Restores an RDB store using a backup file. This API uses an asynchronous callback to return the result.
- **srcName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.|
| RdbStore |restore(srcName:string): Promise<void>| Restores an RDB store using a backup file. This API uses a promise to return the result.
- **srcName**: name of the RDB backup file.|
+**Transaction**
+
+Table 15 Transaction APIs
+
+| Class| API| Description|
+| -------- | -------- | -------- |
+| RdbStore |beginTransaction():void| Starts the transaction before executing SQL statements.|
+| RdbStore |commit():void| Commits the executed SQL statements.|
+| RdbStore |rollBack():void| Rolls back the SQL statements that have been executed.|
+
## How to Develop
1. Create an RDB store.
@@ -270,17 +282,17 @@ You can obtain the distributed table name for a remote device based on the local
const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType"))
resultSet.close()
})
- ```
+ ```
4. Set the distributed tables to be synchronized.
(1) Add the following permission to the permission configuration file:
- ```js
+ ```json
"requestPermissions":
- {
- "name": "ohos.permission.DISTRIBUTED_DATASYNC"
- }
+ {
+ "name": "ohos.permission.DISTRIBUTED_DATASYNC"
+ }
```
(2) Obtain the required permissions.
@@ -321,7 +333,7 @@ You can obtain the distributed table name for a remote device based on the local
promise.then((result) => {
console.log('sync done.')
for (let i = 0; i < result.length; i++) {
- console.log('device=' + result[i][0] + ' status=' + result[i][1])
+ console.log('device=' + result[i][0] + 'status=' + result[i][1])
}
}).catch((err) => {
console.log('sync failed')
@@ -339,7 +351,7 @@ You can obtain the distributed table name for a remote device based on the local
```js
function storeObserver(devices) {
for (let i = 0; i < devices.length; i++) {
- console.log('device=' + device[i] + ' data changed')
+ console.log('device=' + device[i] + 'data changed')
}
}
try {
@@ -361,8 +373,34 @@ You can obtain the distributed table name for a remote device based on the local
let tableName = rdbStore.obtainDistributedTableName(deviceId, "test");
let resultSet = rdbStore.querySql("SELECT * FROM " + tableName)
```
-
-8. Back up and restore an RDB store.
+
+8. Query data of a remote device.
+
+
+ (1) Construct a predicate object for querying distributed tables, and specify the remote distributed table name and the remote device.
+
+ (2) Call the resultSet() API to obtain the result.
+
+ The sample code is as follows:
+
+ ```js
+ let rdbPredicate = new data_rdb.RdbPredicates('employee')
+ predicates.greaterThan("id", 0)
+ let promiseQuery = rdbStore.remoteQuery('12345678abcde', 'employee', rdbPredicate)
+ promiseQuery.then((resultSet) => {
+ while (resultSet.goToNextRow()) {
+ let idx = resultSet.getLong(0);
+ let name = resultSet.getString(1);
+ let age = resultSet.getLong(2);
+ console.info(idx + " " + name + " " + age);
+ }
+ resultSet.close();
+ }).catch((err) => {
+ console.info("failed to remoteQuery, err: " + err)
+ })
+ ```
+
+9. Back up and restore an RDB store.
(1) Back up the current RDB store.
@@ -372,23 +410,17 @@ You can obtain the distributed table name for a remote device based on the local
```js
let promiseBackup = rdbStore.backup("dbBackup.db")
- promiseBackup.then(()=>{
+ promiseBackup.then(() => {
console.info('Backup success.')
- }).catch((err)=>{
+ }).catch((err) => {
console.info('Backup failed, err: ' + err)
})
```
```js
let promiseRestore = rdbStore.restore("dbBackup.db")
- promiseRestore.then(()=>{
+ promiseRestore.then(() => {
console.info('Restore success.')
- }).catch((err)=>{
+ }).catch((err) => {
console.info('Restore failed, err: ' + err)
})
```
-
-## Samples
-The following samples are provided for you to better understand the RDB development:
-- [`Rdb`: eTS RDB (API8)](https://gitee.com/openharmony/app_samples/tree/master/data/Rdb)
-- [`DistributedRdb`: eTS Distributed Relational Database (API8)](https://gitee.com/openharmony/app_samples/tree/master/data/DistributedRdb)
-- [Relational Database](https://gitee.com/openharmony/codelabs/tree/master/Data/JSRelationshipData)
diff --git a/en/application-dev/database/figures/en_DataShare.png b/en/application-dev/database/figures/en_DataShare.png
new file mode 100644
index 0000000000000000000000000000000000000000..e0243b935e8cc61d61c5f572a20c66aadc5edbd3
Binary files /dev/null and b/en/application-dev/database/figures/en_DataShare.png differ
diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
index fb107049c515d0ff1961313a9f0bebb39c4e4c9d..01fe1ed68b3eb05341438da3d81270afdc4a92e3 100644
--- a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
+++ b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
@@ -421,13 +421,13 @@ import stats from '@ohos.bundleState';
```javascript
import stats from '@ohos.bundleState'
- //promise
+ // Promise mode
stats.unRegisterGroupCallBack().then(() => {
console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise succeeded.');
}).catch(err => {
console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise failed. because: ' + err.code);
});
- //callback
+ // Asynchronous callback mode
stats.unRegisterGroupCallBack((err) => {
if (err) {
console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack callback failed, because: ' + err.code);
diff --git a/en/application-dev/device/device-location-info.md b/en/application-dev/device/device-location-info.md
index a32decd05ac0ba0d6db06749c18dcd31d3a7645b..c61c9288eecb35ce4235fb00ce91b595b9160b44 100644
--- a/en/application-dev/device/device-location-info.md
+++ b/en/application-dev/device/device-location-info.md
@@ -84,7 +84,7 @@ To learn more about the APIs for obtaining device location information, see [Geo
}
```
- For details about the fields, see [Application Package Structure Configuration File](../quick-start/stage-structure.md).
+ For details about these fields, see [Application Package Structure Configuration File](../quick-start/stage-structure.md).
2. Import the **geolocation** module by which you can implement all APIs related to the basic location capabilities.
diff --git a/en/application-dev/napi/napi-guidelines.md b/en/application-dev/napi/napi-guidelines.md
index e58eed34cccb7dd820e1144a616dfb93a10f4d34..86854eb072b19c7ee359dcb70413ce22580cb8f7 100644
--- a/en/application-dev/napi/napi-guidelines.md
+++ b/en/application-dev/napi/napi-guidelines.md
@@ -14,6 +14,7 @@ You can `import` the native .so that contains the JS processing logic. For examp
* Add **static** to the **nm_register_func** function to prevent symbol conflicts with other .so files.
* The name of the module registration entry, that is, the function decorated by **\_\_attribute\_\_((constructor))**, must be unique.
+
### .so Naming Rules
Each module has a .so file. For example, if the module name is `hello`, name the .so file **libhello.so**. The `nm_modname` field in `napi_module` must be `hello`, which is the same as the module name. The sample code for importing the .so file is `import hello from 'libhello.so'`.
@@ -25,6 +26,10 @@ The Ark engine prevents NAPIs from being called to operate JS objects in non-JS
* The NAPIs can be used only in JS threads.
* **env** is bound to a thread and cannot be used across threads. The JS object created by a NAPI can be used only in the thread, in which the object is created, that is, the JS object is bound to the **env** of the thread.
+### Importing Header Files
+
+Before using NAPI objects and methods, include **napi/native_api.h**. Otherwise, when only the third-party library header file is included, an error will be reporting, indicating that the interface cannot be found.
+
### napi_create_async_work
**napi_create_async_work** has two callbacks:
@@ -635,3 +640,8 @@ export default {
}
}
```
+## Samples
+The following samples are provided for native API development:
+- [`NativeAPI`: NativeAPI (eTS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/Native/NativeAPI)
+- [First Native C++ Application (eTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/NativeTemplateDemo)
+- [Native Component (eTS) (API9) ](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/XComponent)
diff --git a/en/application-dev/notification/common-event.md b/en/application-dev/notification/common-event.md
index 8450f3d8c7f6d0ddfed16215bc8345c2b036c400..d5a6d7bdfbc6dcdd5b94d36e155d4650fc70630c 100644
--- a/en/application-dev/notification/common-event.md
+++ b/en/application-dev/notification/common-event.md
@@ -98,11 +98,11 @@ import commonEvent from '@ohos.commonEvent';
```js
// Publish a common event.
commonEvent.publish("event", (err) => {
- if (err.code) {
- console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err))
- } else {
- console.info("[CommonEvent]Publish1")
- }
+ if (err.code) {
+ console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err))
+ } else {
+ console.info("[CommonEvent]Publish1")
+ }
})
```
@@ -118,8 +118,8 @@ import commonEvent from '@ohos.commonEvent'
```js
// Attributes of a common event.
var options = {
- code: 1, // Result code of the common event
- data: "initial data";// Result data of the common event
+ code: 1, // Result code of the common event
+ data: "initial data",// Result data of the common event
}
```
@@ -128,11 +128,11 @@ var options = {
```js
// Publish a common event.
commonEvent.publish("event", options, (err) => {
- if (err.code) {
- console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err))
- } else {
- console.info("[CommonEvent]Publish2")
- }
+ if (err.code) {
+ console.error("[CommonEvent]PublishCallBack err=" + JSON.stringify(err))
+ } else {
+ console.info("[CommonEvent]Publish2")
+ }
})
```
diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md
index f216c6b08806daa6c5bc87471a3effd749130094..ef0e355c63726bc167dac72801adfdce030827f3 100644
--- a/en/application-dev/reference/apis/js-apis-appAccount.md
+++ b/en/application-dev/reference/apis/js-apis-appAccount.md
@@ -89,7 +89,7 @@ Adds an app account name and additional information (information that can be con
### addAccount
-addAccount(name: string, extraInfo: string): Promise<void>
+addAccount(name: string, extraInfo?: string): Promise<void>
Adds an app account name and additional information (information that can be converted into the string type, such as token) to the **AppAccountManager** service. This API uses a promise to return the result.
@@ -100,7 +100,7 @@ Adds an app account name and additional information (information that can be con
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------------------------------------- |
| name | string | Yes | Name of the app account to add. |
-| extraInfo | string | Yes | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
+| extraInfo | string | No | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
**Return value**
@@ -1696,7 +1696,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
| name | string | Yes | Name of the target app account. |
| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
| labels | Array<string> | Yes | Labels to check. |
-| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. |
**Example**
@@ -1710,7 +1710,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
### checkAccountLabels9+
-checkAccountLabels(name: string, owner: string, labels: Array<string>): Promise<void>
+checkAccountLabels(name: string, owner: string, labels: Array<string>): Promise<boolean>
Checks whether an app account has specific labels. This API uses a promise to return the result.
@@ -1771,7 +1771,7 @@ Selects the accounts accessible to the requester based on the options. This API
### selectAccountsByOptions9+
-selectAccountsByOptions(options: SelectAccountsOptions): Promise<void>
+selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<AppAccountInfo>>
Selects the accounts accessible to the requester based on the options. This API uses a promise to return the result.
@@ -1836,7 +1836,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t
### verifyCredential9+
-verifyCredential(name: string, owner: string, options, callback: AuthenticatorCallback): void;
+verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, callback: AuthenticatorCallback): void;
Verifies the user credential. This API uses an asynchronous callback to return the result.
@@ -1952,11 +1952,11 @@ Defines OAuth token information.
**System capability**: SystemCapability.Account.AppAccount
-| Name | Type | Mandatory | Description |
-| -------- | ------ | ---- | -------- |
-| authType | string | Yes | Authentication type.|
-| token | string | Yes | Value of the token. |
-| account9+ | AppAccountInfo | No | Account information of the token. |
+| Name | Type | Mandatory | Description |
+| -------------------- | -------------- | ----- | ---------------- |
+| authType | string | Yes | Authentication type. |
+| token | string | Yes | Value of the token. |
+| account9+ | AppAccountInfo | No | Account information of the token.|
## AuthenticatorInfo8+
@@ -1978,7 +1978,7 @@ Represents the options for selecting accounts.
| Name | Type | Mandatory | Description |
| --------------- | --------------------------- | ----- | ------------------- |
-| allowedAccounts | Array<[AppAccountInfo](#appAccountinfo)> | No | Allowed accounts. |
+| allowedAccounts | Array<[AppAccountInfo](#appaccountinfo)> | No | Allowed accounts. |
| allowedOwners | Array<string> | No | Allowed account owners.|
| requiredLabels | Array<string> | No | Labels required for the authenticator. |
@@ -2012,21 +2012,21 @@ Enumerates the constants.
**System capability**: SystemCapability.Account.AppAccount
-| Name | Default Value | Description |
-| ----------------------------- | ---------------------- | ------------- |
-| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | Operation of adding an account implicitly. |
-| ACTION_AUTHENTICATE | "authenticate" | Authentication operation. |
-| KEY_NAME | "name" | App account name. |
-| KEY_OWNER | "owner" | Owner of an app account.|
-| KEY_TOKEN | "token" | Token. |
-| KEY_ACTION | "action" | Operation. |
-| KEY_AUTH_TYPE | "authType" | Authentication type. |
-| KEY_SESSION_ID | "sessionId" | Session ID. |
-| KEY_CALLER_PID | "callerPid" | PID of the caller. |
-| KEY_CALLER_UID | "callerUid" | UID of the caller. |
-| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | Bundle name of the caller. |
-| KEY_REQUIRED_LABELS | "requiredLabels" | Required labels. |
-| KEY_BOOLEAN_RESULT | "booleanResult" | Return value of the Boolean type. |
+| Name | Default Value | Description |
+| -------------------------------- | ---------------------- | ----------------------- |
+| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | Operation of adding an account implicitly. |
+| ACTION_AUTHENTICATE | "authenticate" | Authentication operation. |
+| KEY_NAME | "name" | App account name. |
+| KEY_OWNER | "owner" | Owner of an app account.|
+| KEY_TOKEN | "token" | Token. |
+| KEY_ACTION | "action" | Operation. |
+| KEY_AUTH_TYPE | "authType" | Authentication type. |
+| KEY_SESSION_ID | "sessionId" | Session ID. |
+| KEY_CALLER_PID | "callerPid" | PID of the caller. |
+| KEY_CALLER_UID | "callerUid" | UID of the caller. |
+| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | Bundle name of the caller. |
+| KEY_REQUIRED_LABELS9+ | "requiredLabels" | Required labels. |
+| KEY_BOOLEAN_RESULT9+ | "booleanResult" | Return value of the Boolean type. |
## ResultCode8+
@@ -2125,7 +2125,7 @@ Called to redirect a request.
### onRequestContinued9+
-onRequestContinued: () => void
+onRequestContinued?: () => void
Called to continue to process the request.
diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md
index 473c530ac8c4a2af7fc1bd049bdac984d0740429..a518c72880e74ad35cc76e2f0f8c15f92a0b764f 100644
--- a/en/application-dev/reference/apis/js-apis-audio.md
+++ b/en/application-dev/reference/apis/js-apis-audio.md
@@ -2148,11 +2148,10 @@ Subscribes to audio capturer change events.
**System capability**: SystemCapability.Multimedia.Audio.Capturer
**Parameters**
-
| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ------------------------------------------------------------------- ---- |
+| -------- | ------- | --------- | ----------------------------------------------------------------------- |
| type | string | Yes | Event type. The event `'audioCapturerChange'` is triggered when the audio capturer changes. |
-| callback | Callback<[AudioCapturerChangeInfoArray](#audiocapturerchangeinfoarray9)> | Yes | Callback used to return the result. |
+| callback | Callback\<[AudioCapturerChangeInfoArray](#audiocapturerchangeinfoarray9)> | Yes | Callback used to return the result. |
**Example**
```
diff --git a/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md b/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md
index 94182ce2915f60bd6998f512d17288920549d3f8..ae94a539b922fc9aca76dbfe80f3b942171c631c 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md
@@ -18,9 +18,11 @@ The **ApplicationInfo** module provides application information. Unless otherwis
| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
| label | string | Yes | No | Application label. |
-| labelId | string | Yes | No | Application label ID. |
+| labelId(deprecated) | string | Yes | No | Application label ID.
\- **NOTE**: This attribute is deprecated from API version 9. Use **labelIndex** instead. |
+| labelIndex9+ | number | Yes | No | Index of the application label.|
| icon | string | Yes | No | Application icon. |
-| iconId | string | Yes | No | Application icon ID. |
+| iconId(deprecated) | string | Yes | No | Application icon ID.
\- **NOTE**: This attribute is deprecated from API version 9. Use **iconIndex** instead. |
+| iconIndex9+ | number | Yes | No | Index of the application icon.|
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| supportedModes | number | Yes | No | Running modes supported by the application. |
| moduleSourceDirs | Array\ | Yes | No | Relative paths for storing application resources. |
diff --git a/en/application-dev/reference/apis/js-apis-bytrace.md b/en/application-dev/reference/apis/js-apis-bytrace.md
index 72fcfaca8fb39e4345c2392e761b19b364922499..544a4ba0d27e6c39794e063fc63282ba5455bf5e 100644
--- a/en/application-dev/reference/apis/js-apis-bytrace.md
+++ b/en/application-dev/reference/apis/js-apis-bytrace.md
@@ -19,6 +19,10 @@ startTrace(name: string, taskId: number, expectedTime?: number): void
Marks the start of a timeslice trace task.
+> **NOTE**
+>
+> If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For details, see the bytrace.finishTrace example.
+
**System capability**: SystemCapability.Developtools.Bytrace
**Parameters**
@@ -29,9 +33,6 @@ Marks the start of a timeslice trace task.
| taskId | number | Yes| ID of a timeslice trace task.|
| expectedTime | number | No| Expected duration of the trace, in ms.|
-> **NOTE**
->
-> If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For details, see the bytrace.finishTrace example.
**Example**
@@ -47,6 +48,10 @@ finishTrace(name: string, taskId: number): void
Marks the end of a timeslice trace task.
+> **NOTE**
+>
+> To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in **startTrace**.
+
**System capability**: SystemCapability.Developtools.Bytrace
**Parameters**
@@ -56,9 +61,6 @@ Marks the end of a timeslice trace task.
| name | string | Yes| Name of a timeslice trace task.|
| taskId | number | Yes| ID of a timeslice trace task.|
-> **NOTE**
->
-> To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in **startTrace**.
**Example**
@@ -95,7 +97,7 @@ traceByValue(name: string, count: number): void
Defines the variable that indicates the number of timeslice trace tasks.
-**System capability**: SystemCapability.Developtools.Bytrace
+**System capability**: SystemCapability.HiviewDFX.HiTrace
**Parameters**
| Name| Type| Mandatory| Description|
diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md
index bb320e0c8b61e2259aa8c31a6d8efa5866c780fa..381796969cdc260896b9ea4857d0461eebf7d519 100644
--- a/en/application-dev/reference/apis/js-apis-call.md
+++ b/en/application-dev/reference/apis/js-apis-call.md
@@ -44,7 +44,7 @@ call.dial("138xxxxxxxx", (err, data) => {
dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void
-Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result.
+Initiates a call based on the specified options. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
@@ -73,7 +73,7 @@ call.dial("138xxxxxxxx", {
dial\(phoneNumber: string, options?: DialOptions\): Promise
-Initiates a call. You can set call options as needed. This API uses a promise to return the result.
+Initiates a call based on the specified options. This API uses a promise to return the result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
@@ -304,7 +304,7 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\): void
-Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result.
+Checks whether the called number is an emergency number based on the specified phone number options. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
@@ -313,7 +313,7 @@ Checks whether the called number is an emergency number based on the phone numbe
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
-| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option. |
+| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. |
**Example**
@@ -329,7 +329,7 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, value) => {
isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise
-Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result.
+Checks whether the called number is an emergency number based on the specified phone number options. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
@@ -338,7 +338,7 @@ Checks whether the called number is an emergency number based on the phone numbe
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------- |
| phoneNumber | string | Yes | Phone number. |
-| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option. |
+| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. |
**Return value**
@@ -386,7 +386,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\): void
-Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result.
+Formats a phone number based on the specified formatting options. This API uses an asynchronous callback to return the result.
A formatted phone number is a standard numeric string, for example, 555 0100.
@@ -397,7 +397,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
| 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 options, for example, country code. |
| callback | AsyncCallback<string> | Yes | Callback used to return the result. |
**Example**
@@ -415,7 +415,7 @@ call.formatPhoneNumber("138xxxxxxxx",{
formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise
-Formats a phone number based on specified formatting options. This API uses a promise to return the result.
+Formats a phone number based on the specified formatting options. This API uses a promise to return the result.
A formatted phone number is a standard numeric string, for example, 555 0100.
@@ -426,7 +426,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
| 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 options, for example, country code. |
**Return value**
@@ -514,15 +514,2242 @@ promise.then(data => {
});
```
+## call.muteRinger8+
+
+muteRinger\(callback: AsyncCallback\): void
+
+Mutes the ringtone while it is playing. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.muteRinger((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.muteRinger8+
+
+muteRinger\(\): Promise
+
+Mutes the ringtone while it is playing. This API uses a promise to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.muteRinger();
+promise.then(data => {
+ console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.answer7+
+
+answer\(callback: AsyncCallback\): void
+
+Answers a call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.ANSWER_CALL
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.answer((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.answer7+
+
+answer\(callId: number, callback: AsyncCallback\): void
+
+Answers a call based on the specified call ID. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.ANSWER_CALL
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ----------------------------------------------- |
+| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.answer(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.answer7+
+
+answer(callId?: number\): Promise
+
+Answers a call based on the specified call ID. This API uses a promise to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.ANSWER_CALL
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------------------------------------------------ |
+| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.answer(1);
+promise.then(data => {
+ console.log(`answer success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`answer fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.hangup7+
+
+hangup\(callback: AsyncCallback\): void
+
+Ends a call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.hangup((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.hangup7+
+
+hangup\(callId: number, callback: AsyncCallback\): void
+
+Ends a call based on the specified call ID. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ----------------------------------------------- |
+| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.hangup(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.hangup7+
+
+hangup\(callId?: number\): Promise
+
+Ends a call based on the specified call ID. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------------------------------------------------ |
+| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.hangup(1);
+promise.then(data => {
+ console.log(`hangup success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`hangup fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.reject7+
+
+reject\(callback: AsyncCallback\): void
+
+Rejects a call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.reject((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.reject7+
+
+reject\(options: RejectMessageOptions, callback: AsyncCallback\): void
+
+Rejects a call based on the specified options. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------------------------- | ---- | -------------- |
+| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+let rejectMessageOptions={
+ messageContent: "Unknown number blocked"
+}
+call.reject(rejectMessageOptions, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.reject7+
+
+reject(callId: number, callback: AsyncCallback):
+
+Rejects a call based on the specified call ID. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ----------------------------------------------- |
+| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.reject(1);
+promise.then(data => {
+ console.log(`reject success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.reject7+
+
+reject\(callId: number, options: RejectMessageOption, callback: AsyncCallback\): void
+
+Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- |
+| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
+| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+let rejectMessageOptions={
+ messageContent: "Unknown number blocked"
+}
+call.reject(1, rejectMessageOptions, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.reject7+
+
+reject(callId?: number, options?: RejectMessageOptions\): Promise
+
+Rejects a call based on the specified call ID and options. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
+| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
+| options | [RejectMessageOptions](#rejectmessageoptions7) | No | Options for the call rejection message. |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let rejectMessageOptions={
+ messageContent: "Unknown number blocked"
+}
+let promise = call.reject(1, rejectMessageOptions);
+promise.then(data => {
+ console.log(`reject success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.holdCall7+
+
+holdCall\(callId: number, callback: AsyncCallback\): void
+
+Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.holdCall(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.holdCall7+
+
+holdCall\(callId: number\): Promise
+
+Holds a call based on the specified call ID. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.holdCall(1);
+promise.then(data => {
+ console.log(`holdCall success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.unHoldCall7+
+
+unHoldCall\(callId: number, callback: AsyncCallback\): void
+
+Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.unHoldCall(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.unHoldCall7+
+
+unHoldCall\(callId: number\): Promise
+
+Unholds a call based on the specified call ID. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.unHoldCall(1);
+promise.then(data => {
+ console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.switchCall7+
+
+switchCall\(callId: number, callback: AsyncCallback\): void
+
+Switches a call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.switchCall(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.switchCall7+
+
+switchCall\(callId: number\): Promise
+
+Switches a call. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.switchCall(1);
+promise.then(data => {
+ console.log(`switchCall success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.combineConference7+
+
+combineConference\(callId: number, callback: AsyncCallback\): void
+
+Combines two calls into a conference call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.combineConference(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.combineConference7+
+
+combineConference\(callId: number\): Promise
+
+Combines two calls into a conference call. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.combineConference(1);
+promise.then(data => {
+ console.log(`combineConference success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.getMainCallId7+
+
+getMainCallId\(callId: number, callback: AsyncCallback\): void
+
+Obtains the main call ID. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------------- | ---- | ------------------------ |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<number> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.getMainCallId(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.getMainCallId7+
+
+getMainCallId\(callId: number\): Promise
+
+Obtains the main call ID. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.getMainCallId(1);
+promise.then(data => {
+ console.log(`getMainCallId success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getMainCallId fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.getSubCallIdList7+
+
+getSubCallIdList\(callId: number, callback: AsyncCallback\>\): void
+
+Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------ | ---- | ---------------------------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback\> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.getSubCallIdList(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.getSubCallIdList7+
+
+getSubCallIdList\(callId: number\): Promise\>
+
+Obtains the list of subcall IDs. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | ----------------------------------- |
+| Promise<Array> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.getSubCallIdList(1);
+promise.then(data => {
+ console.log(`getSubCallIdList success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getSubCallIdList fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.getCallIdListForConference7+
+
+getCallIdListForConference\(callId: number, callback: AsyncCallback>\): void
+
+Obtains the list of call IDs in a conference. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------- | ---- | -------------------------------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<Array> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.getCallIdListForConference(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.getCallIdListForConference7+
+
+getCallIdListForConference\(callId: number\): Promise\>
+
+Obtains the list of call IDs in a conference. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | --------------------------------------- |
+| Promise<Array> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.getCallIdListForConference(1);
+promise.then(data => {
+ console.log(`getCallIdListForConference success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getCallIdListForConference fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.getCallWaitingStatus7+
+
+getCallWaitingStatus\(slotId: number, callback: AsyncCallback\): void
+
+Obtains the call waiting status. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.|
+
+**Example**
+
+```js
+call.getCallWaitingStatus(0, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.getCallWaitingStatus7+
+
+getCallWaitingStatus\(slotId: number\): Promise
+
+Obtains the call waiting status. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------- | ------------------------------------------------------------ |
+| Promise<[CallWaitingStatus](#callwaitingstatus7)> | Promise used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.|
+
+**Example**
+
+```js
+let promise = call.getCallWaitingStatus(0);
+promise.then(data => {
+ console.log(`getCallWaitingStatus success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getCallWaitingStatus fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.setCallWaiting7+
+
+setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\): void
+
+Sets the call waiting switch. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------------------------------------------ |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| activate | boolean | Yes | Whether to enable call waiting.
- **false**: Disable call waiting.
- **true**: Enable call waiting.|
+| callback | AsyncCallback | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.setCallWaiting(0, true, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.setCallWaiting7+
+
+setCallWaiting\(slotId: number, activate: boolean\): Promise
+
+Sets the call waiting switch. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------- | ---- | ------------------------------------------------------------ |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| activate | boolean | Yes | Whether to enable call waiting.
- **false**: Disable call waiting.
- **true**: Enable call waiting.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.setCallWaiting(0, true);
+promise.then(data => {
+ console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.startDTMF7+
+
+startDTMF\(callId: number, character: string, callback: AsyncCallback\): void
+
+Enables dual-tone multifrequency (DTMF). This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | -------------------- | ---- | ---------- |
+| callId | number | Yes | Call ID. |
+| character | string | Yes | DTMF code. |
+| callback | AsyncCallback | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.startDTMF(1, "0", (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.startDTMF7+
+
+startDTMF\(callId: number, character: string\): Promise
+
+Enables DTMF. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+| character | string | Yes | DTMF code.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ----------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.startDTMF(1, "0");
+promise.then(data => {
+ console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.stopDTMF7+
+
+stopDTMF\(callId: number, callback: AsyncCallback\): void
+
+Stops DTMF. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.stopDTMF(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.stopDTMF7+
+
+stopDTMF\(callId: number\): Promise
+
+Stops DTMF. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.stopDTMF(1);
+promise.then(data => {
+ console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.isInEmergencyCall7+
+
+isInEmergencyCall\(callback: AsyncCallback\): void
+
+Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------- | ---- | ---------- |
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.isInEmergencyCall((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.isInEmergencyCall7+
+
+isInEmergencyCall\(\): Promise
+
+Checks whether a call is an emergency call. This API uses a promise to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Return value**
+
+| Type | Description |
+| ---------------------- | --------------------------- |
+| Promise<boolean> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.isInEmergencyCall();
+promise.then(data => {
+ console.log(`isInEmergencyCall success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`isInEmergencyCall fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.on('callDetailsChange')7+
+
+on\(type: 'callDetailsChange', callback: Callback\): void
+
+Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------- | ---- | -------------------------- |
+| type | string | Yes | Call details change during a call.|
+| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.on('callDetailsChange', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.on('callEventChange')8+
+
+on\(type: 'callEventChange', callback: Callback\): void
+
+Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------ | ---- | -------------------------- |
+| type | string | Yes | Call event change during a call.|
+| callback | Callback<[CallEventOptions](#calleventoptions8)> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.on('callEventChange', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.on('callDisconnectedCause')8+
+
+on\(type: 'callDisconnectedCause', callback: Callback): void
+
+Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------ | ---- | -------------------------- |
+| type | string | Yes | Cause of the call disconnection.|
+| callback | Callback<[DisconnectedDetails](#disconnecteddetails8)> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.on('callDisconnectedCause', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.on('mmiCodeResult')9+
+
+on\(type: 'mmiCodeResult', callback: Callback\): void
+
+Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------------------------------- | ---- | --------------------- |
+| type | string | Yes | Man-machine interface (MMI) code result.|
+| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+isNewCallAllowedcall.on('mmiCodeResult', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.off('callDetailsChange')7+
+
+off\(type: 'callDetailsChange', callback?: Callback\): void
+
+Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------------------------------------------- | ---- | ---------------------------------- |
+| type | string | Yes | Unsubscription from call details changes when a call ends.|
+| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. |
+
+**Example**
+
+```js
+call.off('callDetailsChange', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.off('callEventChange')8+
+
+off\(type: 'callEventChange', callback?: Callback\): void
+
+Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------ | ---- | ---------------------------------- |
+| type | string | Yes | Unsubscription from call event changes when a call ends.|
+| callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. |
+
+**Example**
+
+```js
+call.off('callEventChange', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.off('callDisconnectedCause')8+
+
+off\(type: 'callDisconnectedCause', callback?: Callback\): void
+
+Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------------------------------------- | ---- | -------------------- |
+| type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.|
+| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails8)> | No | Callback used to return the result. |
+
+**Example**
+
+```js
+call.off('callDisconnectedCause', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.off('mmiCodeResult')9+
+
+off\(type: 'mmiCodeResult', callback?: Callback\): void
+
+Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------ | ---- | ----------- |
+| type | 'mmiCodeResult' | Yes | MMI code result.|
+| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. |
+
+**Example**
+
+```js
+call.off('mmiCodeResult', (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.isNewCallAllowed8+
+
+isNewCallAllowed\(callback: AsyncCallback\): void
+
+Checks whether a new call is allowed. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------- | ---- | ---------- |
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.isNewCallAllowed((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.isNewCallAllowed8+
+
+isNewCallAllowed\(\): Promise
+
+Checks whether a new call is allowed. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Return value**
+
+| Type | Description |
+| ---------------------- | --------------------------- |
+| Promise<boolean> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.isNewCallAllowed();
+promise.then(data => {
+ console.log(`isNewCallAllowed success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`isNewCallAllowed fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.separateConference8+
+
+separateConference\(callId: number, callback: AsyncCallback\): void
+
+Separates a conference call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callId | number | Yes | Call ID. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.separateConference(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.separateConference8+
+
+separateConference\(callId: number\): Promise
+
+Separates a conference call. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------- |
+| callId | number | Yes | Call ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.separateConference(1);
+promise.then(data => {
+ console.log(`separateConference success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.getCallRestrictionStatus8+
+
+getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback\): void
+
+Obtains the call restriction status. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. |
+| callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.getCallRestrictionStatus(0, 1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.getCallRestrictionStatus8+
+
+getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise
+
+Obtains the call restriction status. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | -------------------------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. |
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------- | --------------------------- |
+| Promise<[RestrictionStatus](#restrictionstatus8)> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.getCallRestrictionStatus(0, 1);
+promise.then(data => {
+ console.log(`getCallRestrictionStatus success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getCallRestrictionStatus fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.setCallRestriction8+
+
+setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\): void
+
+Sets the call restriction status. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| info | [CallRestrictionInfo](#callrestrictioninfo8) | Yes | Call restriction information. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+let callRestrictionInfo={
+ type: 1,
+ password: "123456",
+ mode: 1
+}
+call.setCallRestriction(0, callRestrictionInfo, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.setCallRestriction8+
+
+setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise
+
+Sets the call restriction status. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | -------------------------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| info | [CallRestrictionInfo](#callrestrictioninfo8) | Yes | Call restriction information. |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let callRestrictionInfo={
+ type: 1,
+ password: "123456",
+ mode: 1
+}
+let promise = call.setCallRestriction(0, callRestrictionInfo);
+promise.then(data => {
+ console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.getCallTransferInfo8+
+
+getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback\): void
+
+Obtains call transfer information. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
+| callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+let callTransferTyp={
+ CallTransferType: 1
+}
+call.getCallTransferInfo(0, callTransferTyp, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.getCallTransferInfo8+
+
+getCallTransferInfo\(slotId: number, type: CallTransferType): Promise
+
+Obtains call transfer information. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | -------------------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------------------------- | --------------------------- |
+| Promise<[CallTransferResult](#calltransferresult8)> | Promise used to return the result.|
+
+**Example**
+
+```js
+let callTransferTyp={
+ CallTransferType: 1
+}
+let promise = call.getCallTransferInfo(0, callTransferTyp);
+promise.then(data => {
+ console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getCallTransferInfo fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.setCallTransfer8+
+
+setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback\): void
+
+Sets call transfer information. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| info | [CallTransferInfo](#calltransferinfo8) | Yes | Call transfer information. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+let callTransferInfo={
+ transferNum: "111",
+ type: 1,
+ settingType: 1
+}
+call.setCallTransfer(0, callTransferInfo, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.setCallTransfer8+
+
+setCallTransfer\(slotId: number, info: CallTransferInfo): Promise
+
+Sets call transfer information. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------------------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| info | [CallTransferInfo](#calltransferinfo8) | Yes | Call transfer information. |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let callTransferInfo={
+ transferNum: "111",
+ type: 1,
+ settingType: 1
+}
+let promise = call.setCallTransfer(0, callTransferInfo);
+promise.then(data => {
+ console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.isRinging8+
+
+isRinging\(callback: AsyncCallback\): void
+
+Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------- | ---- | ---------- |
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.isRinging((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.isRinging8+
+
+isRinging\(\): Promise
+
+Checks whether the ringtone is playing. This API uses a promise to return the result.
+
+This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Return value**
+
+| Type | Description |
+| ---------------------- | --------------------------- |
+| Promise<boolean> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.isRinging();
+promise.then(data => {
+ console.log(`isRinging success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`isRinging fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.setMuted8+
+
+setMuted\(callback: AsyncCallback\): void
+
+Sets call muting. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.setMuted((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.setMuted8+
+
+setMuted\(\): Promise
+
+Sets call muting. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.setMuted();
+promise.then(data => {
+ console.log(`setMuted success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.cancelMuted8+
+
+cancelMuted(callback: AsyncCallback): void
+
+Cancels call muting. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.cancelMuted((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.cancelMuted8+
+
+cancelMuted(): Promise
+
+Cancels call muting. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.cancelMuted();
+promise.then(data => {
+ console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.setAudioDevice8+
+
+setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void
+
+Sets the audio device for a call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------- | ---- | ---------- |
+| device | [AudioDevice](#audiodevice8) | Yes | Audio device.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+call.setAudioDevice(1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.setAudioDevice8+
+
+setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\): void
+
+Sets the audio device for a call based on the specified options. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------ | ---- | -------------- |
+| device | [AudioDevice](#audiodevice8) | Yes | Audio device. |
+| options | [AudioDeviceOptions](#audiodeviceoptions9) | Yes | Audio device parameters.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+let audioDeviceOptions={
+ bluetoothAddress: "IEEE 802-2014"
+}
+call.setAudioDevice(1, bluetoothAddress, (err, value) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.setAudioDevice8+
+
+setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise
+
+Sets the audio device for a call based on the specified options. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------ | ---- | ------------------ |
+| device | [AudioDevice](#audiodevice8) | Yes | Audio device. |
+| options | [AudioDeviceOptions](#audiodeviceoptions9) | No | Audio device parameters.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let audioDeviceOptions={
+ bluetoothAddress: "IEEE 802-2014"
+}
+let promise = call.setAudioDevice(1, audioDeviceOptions);
+promise.then(data => {
+ console.log(`setAudioDevice success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.joinConference8+
+
+joinConference(mainCallId: number, callNumberList: Array, callback: AsyncCallback): void
+
+Joins a conference call. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ------------------------- | ---- | --------------- |
+| mainCallId | number | Yes | Main call ID. |
+| callNumberList | Array | Yes | List of call numbers.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.joinConference(1, "138XXXXXXXX", (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.joinConference8+
+
+joinConference(mainCallId: number, callNumberList: Array): Promise
+
+Joins a conference call. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | -------------- | ---- | --------------- |
+| mainCallId | number | Yes | Main call ID. |
+| callNumberList | Array | Yes | List of call numbers.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.joinConference(1, "138XXXXXXXX");
+promise.then(data => {
+ console.log(`joinConference success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.updateImsCallMode8+
+
+updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback): void
+
+Updates the IMS call mode. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------- | ---- | -------------- |
+| callId | number | Yes | Call ID. |
+| mode | [ImsCallMode](#imscallmode8) | Yes | IMS call mode.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.updateImsCallMode(1, 1, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.updateImsCallMode8+
+
+updateImsCallMode(callId: number, mode: ImsCallMode): Promise
+
+Updates the IMS call mode. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ---------------------------- | ---- | -------------- |
+| callId | number | Yes | Call ID. |
+| mode | [ImsCallMode](#imscallmode8) | Yes | IMS call mode.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.updateImsCallMode(1, 1);
+promise.then(data => {
+ console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.enableImsSwitch8+
+
+enableImsSwitch(slotId: number, callback: AsyncCallback): void
+
+Enables the IMS switch. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.enableImsSwitch(0, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.enableImsSwitch8+
+
+enableImsSwitch(slotId: number): Promise
+
+Enables the IMS switch. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.enableImsSwitch(0);
+promise.then(data => {
+ console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.disableImsSwitch8+
+
+disableImsSwitch(slotId: number, callback: AsyncCallback): void
+
+Disables the IMS switch. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.disableImsSwitch(0, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.disableImsSwitch8+
+
+disableImsSwitch(slotId: number): Promise
+
+Disables the IMS switch. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.disableImsSwitch(0);
+promise.then(data => {
+ console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.isImsSwitchEnabled8+
+
+isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void
+
+Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+call.isImsSwitchEnabled(0, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+## call.isImsSwitchEnabled8+
+
+isImsSwitchEnabled(slotId: number): Promise
+
+Checks whether the IMS switch is enabled. This API uses a promise to return the result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+let promise = call.isImsSwitchEnabled(0);
+promise.then(data => {
+ console.log(`isImsSwitchEnabled success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`isImsSwitchEnabled fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+
## DialOptions
-Provides an option for determining whether a call is a video call.
+Defines the dialup options.
**System capability**: SystemCapability.Telephony.CallManager
-| Name| Type | Mandatory | Description |
-| ------ | ------- | ---- | ------------------------------------------------------------ |
-| extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call|
+| Name | Type | Mandatory| Description |
+| ---------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
+| extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call|
+| accountId | number | No | Account ID. This API is supported since API version 8. It is a system API. |
+| videoState | [VideoStateType](#videostatetype7) | No | Video state type. This API is supported since API version 8. It is a system API. |
+| dialScene | [DialScene](#dialscene8) | No | Dialup scenario. This API is supported since API version 8. It is a system API. |
+| dialType | [DialType](#dialtype8) | No | Dialup type. This API is supported since API version 8. It is a system API. |
## CallState
@@ -539,7 +2766,7 @@ Enumerates call states.
## EmergencyNumberOptions7+
-Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot.
+Defines options for determining whether a number is an emergency number.
**System capability**: SystemCapability.Telephony.CallManager
@@ -549,10 +2776,401 @@ Provides an option for determining whether a number is an emergency number for t
## NumberFormatOptions7+
-Provides an option for number formatting.
+Defines the number formatting options.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. |
+
+## ImsCallMode8+
+
+Enumerates IMS call modes.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ---------------------- | ---- | ------------------ |
+| CALL_MODE_AUDIO_ONLY | 0 | Audio call only. |
+| CALL_MODE_SEND_ONLY | 1 | Sending calls only. |
+| CALL_MODE_RECEIVE_ONLY | 2 | Receiving calls only. |
+| CALL_MODE_SEND_RECEIVE | 3 | Sending and receiving calls.|
+| CALL_MODE_VIDEO_PAUSED | 4 | Pausing video calls. |
+
+## AudioDevice8+
+
+Enumerates audio devices.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| -------------------- | ---- | ------------ |
+| DEVICE_EARPIECE | 0 | Headset device. |
+| DEVICE_SPEAKER | 1 | Speaker device.|
+| DEVICE_WIRED_HEADSET | 2 | Wired headset device.|
+| DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. |
+
+## CallRestrictionType8+
+
+Enumerates call restriction types.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| --------------------------------------------- | ---- | -------------------------- |
+| RESTRICTION_TYPE_ALL_INCOMING | 0 | Barring of all incoming calls. |
+| RESTRICTION_TYPE_ALL_OUTGOING | 1 | Barring of all outgoing calls. |
+| RESTRICTION_TYPE_INTERNATIONAL | 2 | Barring of international calls. |
+| RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME | 3 | Barring of international calls except those in the home country.|
+| RESTRICTION_TYPE_ROAMING_INCOMING | 4 | Barring of incoming roaming calls. |
+| RESTRICTION_TYPE_ALL_CALLS | 5 | Barring of all calls. |
+| RESTRICTION_TYPE_OUTGOING_SERVICES | 6 | Barring of outgoing services. |
+| RESTRICTION_TYPE_INCOMING_SERVICES | 7 | Barring of incoming services. |
+
+## CallTransferInfo8+
+
+Defines the call transfer information.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory| Description |
+| ----------- | ---------------------------------------------------- | ---- | ---------------- |
+| transferNum | string | Yes | Call transfer number. |
+| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
+| settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.|
+
+## CallTransferType8+
+
+Enumerates call transfer types.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| --------------------------- | ---- | ------------ |
+| TRANSFER_TYPE_UNCONDITIONAL | 0 | Call forwarding unconditional. |
+| TRANSFER_TYPE_BUSY | 1 | Call forwarding busy. |
+| TRANSFER_TYPE_NO_REPLY | 2 | Call forwarding on no reply. |
+| TRANSFER_TYPE_NOT_REACHABLE | 3 | Call forwarding on no user not reachable.|
+
+## CallTransferSettingType8+
+
+Enumerates call transfer setting types.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| -------------------------- | ---- | ------------ |
+| CALL_TRANSFER_DISABLE | 0 | Disabling of call transfer.|
+| CALL_TRANSFER_ENABLE | 1 | Enabling of call transfer.|
+| CALL_TRANSFER_REGISTRATION | 3 | Registration of call transfer.|
+| CALL_TRANSFER_ERASURE | 4 | Erasing of call transfer.|
+
+## CallAttributeOptions7+
+
+Defines the call attribute options.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory| Description |
+| --------------- | ---------------------------------------- | ---- | -------------- |
+| accountNumber | string | Yes | Account number. |
+| speakerphoneOn | boolean | Yes | Speakerphone on.|
+| accountId | number | Yes | Account ID. |
+| videoState | [VideoStateType](#videostatetype7) | Yes | Video state type. |
+| startTime | number | Yes | Start time. |
+| isEcc | boolean | Yes | Whether the call is an ECC. |
+| callType | [CallType](#calltype7) | Yes | Call type. |
+| callId | number | Yes | Call ID. |
+| callState | [DetailedCallState](#detailedcallstate7) | Yes | Detailed call state. |
+| conferenceState | [ConferenceState](#conferencestate7) | Yes | Conference state. |
+
+## ConferenceState7+
+
+Enumerates conference states.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ---------------------------- | ---- | -------------- |
+| TEL_CONFERENCE_IDLE | 0 | Idle state. |
+| TEL_CONFERENCE_ACTIVE | 1 | Active state. |
+| TEL_CONFERENCE_DISCONNECTING | 2 | Disconnecting state. |
+| TEL_CONFERENCE_DISCONNECTED | 3 | Disconnected state.|
+
+## CallType7+
+
+Enumerates call types.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ------------- | ---- | ------------ |
+| TYPE_CS | 0 | CS call. |
+| TYPE_IMS | 1 | IMS call. |
+| TYPE_OTT | 2 | OTT call. |
+| TYPE_ERR_CALL | 3 | Error call type.|
+
+## VideoStateType7+
+
+Enumerates video state types.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ---------- | ---- | -------- |
+| TYPE_VOICE | 0 | Voice state.|
+| TYPE_VIDEO | 1 | Video state.|
+
+## DetailedCallState7+
+
+Enumerates detailed call states.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ------------------------- | ---- | -------------- |
+| CALL_STATUS_ACTIVE | 0 | Active state. |
+| CALL_STATUS_HOLDING | 1 | Hold state. |
+| CALL_STATUS_DIALING | 2 | Dialing state. |
+| CALL_STATUS_ALERTING | 3 | Alerting state. |
+| CALL_STATUS_INCOMING | 4 | Incoming state. |
+| CALL_STATUS_WAITING | 5 | Waiting state. |
+| CALL_STATUS_DISCONNECTED | 6 | Disconnected state.|
+| CALL_STATUS_DISCONNECTING | 7 | Disconnecting state. |
+| CALL_STATUS_IDLE | 8 | Idle state. |
+
+## CallRestrictionInfo8+
+
+Defines the call restriction information.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------------------------------- | ---- | ------------ |
+| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type.|
+| password | string | Yes | Password. |
+| mode | [CallRestrictionMode](#callrestrictionmode8) | Yes | Call restriction mode.|
+
+## CallRestrictionMode8+
+
+Enumerates call restriction modes.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ----------------------------- | ---- | ------------ |
+| RESTRICTION_MODE_DEACTIVATION | 0 | Call restriction deactivated.|
+| RESTRICTION_MODE_ACTIVATION | 1 | Call restriction activated.|
+
+## CallEventOptions8+
+
+Defines the call event options.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------ | ---- | -------------- |
+| eventId | [CallAbilityEventId](#callabilityeventid8) | Yes | Call ability event ID.|
+
+## CallAbilityEventId8+
+
+Enumerates call ability event IDs.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ------------------------ | ---- | --------------- |
+| EVENT_DIAL_NO_CARRIER | 1 | No available carrier during dialing. |
+| EVENT_INVALID_FDN_NUMBER | 2 | Invalid FDN.|
+
+## DialScene8+
+
+Enumerates dialup scenarios.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| --------------- | ---- | ------------ |
+| CALL_NORMAL | 0 | Common call. |
+| CALL_PRIVILEGED | 1 | Privileged call. |
+| CALL_EMERGENCY | 2 | Emergency call.|
+
+## DialType8+
+
+Enumerates dialup types.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| -------------------- | ---- | ---------------- |
+| DIAL_CARRIER_TYPE | 0 | Carrier. |
+| DIAL_VOICE_MAIL_TYPE | 1 | Voice mail.|
+| DIAL_OTT_TYPE | 2 | OTT. |
+
+## RejectMessageOptions7+
+
+Defines options for the call rejection message.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory| Description |
+| -------------- | ------ | ---- | -------- |
+| messageContent | string | Yes | Message content.|
+
+## CallTransferResult8+
+
+Defines the call transfer result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name| Type | Mandatory| Description |
+| ------ | ---------------------------------- | ---- | -------- |
+| status | [TransferStatus](#transferstatus8) | Yes | Transfer status.|
+| number | string | Yes | Number. |
+
+## CallWaitingStatus7+
+
+Enumerates call waiting states.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| -------------------- | ---- | ------------ |
+| CALL_WAITING_DISABLE | 0 | Call waiting disabled.|
+| CALL_WAITING_ENABLE | 1 | Call waiting enabled.|
+
+## RestrictionStatus8+
+
+Enumerates call restriction states.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ------------------- | ---- | -------- |
+| RESTRICTION_DISABLE | 0 | Call restriction disabled.|
+| RESTRICTION_ENABLE | 1 | Call restriction enabled.|
+
+## TransferStatus8+
+
+Enumerates call transfer states.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ---------------- | ---- | -------- |
+| TRANSFER_DISABLE | 0 | Call transfer disabled.|
+| TRANSFER_ENABLE | 1 | Call transfer enabled.|
+
+## DisconnectedDetails8+
+
+Enumerates causes of call disconnection.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| --------------------------- | ---- | ---------------------- |
+| UNASSIGNED_NUMBER | 1 | Unallocated number. |
+| NO_ROUTE_TO_DESTINATION | 3 | No route to the destination. |
+| CHANNEL_UNACCEPTABLE | 6 | Unacceptable channel. |
+| OPERATOR_DETERMINED_BARRING | 8 | Operator determined barring (ODB). |
+| NORMAL_CALL_CLEARING | 16 | Normal call clearing. |
+| USER_BUSY | 17 | User busy. |
+| NO_USER_RESPONDING | 18 | No user response. |
+| USER_ALERTING_NO_ANSWER | 19 | Alerting but no answer.|
+| CALL_REJECTED | 21 | Call rejected. |
+| NUMBER_CHANGED | 22 | Number changed. |
+| DESTINATION_OUT_OF_ORDER | 27 | Destination fault. |
+| INVALID_NUMBER_FORMAT | 28 | Invalid number format. |
+| NETWORK_OUT_OF_ORDER | 38 | Network fault. |
+| TEMPORARY_FAILURE | 41 | Temporary fault. |
+| INVALID_PARAMETER | 1025 | Invalid parameter. |
+| SIM_NOT_EXIT | 1026 | SIM card not exit. |
+| SIM_PIN_NEED | 1027 | SIM card PIN required. |
+| CALL_NOT_ALLOW | 1029 | Call not allowed. |
+| SIM_INVALID | 1045 | Invalid SIM card. |
+| UNKNOWN | 1279 | Unknown reason. |
+
+## MmiCodeResults9+
+
+Defines the MMI code result.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory| Description |
+| ------- | -------------------------------- | ---- | --------------- |
+| result | [MmiCodeResult](#mmicoderesult9) | Yes | MMI code result.|
+| message | string | Yes | MMI code message.|
+
+## MmiCodeResult9+
+
+Enumerates MMI code results.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ---------------- | ---- | ------------- |
+| MMI_CODE_SUCCESS | 0 | Success.|
+| MMI_CODE_FAILED | 1 | Failure.|
+
+## AudioDeviceOptions9+
+
+Defines audio device options.
+
+This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory| Description |
+| ---------------- | ------ | ---- | -------- |
+| bluetoothAddress | string | No | Bluetooth address.|
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index 8819011c106586b3099116d0c43b7644e09da8a2..fac4104f5cb135b5c5afa45127cdbd488a9a6225 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -71,86 +71,80 @@ Enumerates the camera statuses.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Value | Description |
-| ------------------------- | ---- | ------------ |
-| CAMERA_STATUS_APPEAR | 0 | The camera exists. |
-| CAMERA_STATUS_DISAPPEAR | 1 | The camera does not exist.|
-| CAMERA_STATUS_AVAILABLE | 2 | The camera is ready. |
-| CAMERA_STATUS_UNAVAILABLE | 3 | The camera is not ready.|
+| Name | Value | Description |
+| ------------------------- | ---- | -------------- |
+| CAMERA_STATUS_APPEAR | 0 | A camera appears.|
+| CAMERA_STATUS_DISAPPEAR | 1 | The camera disappears. |
+| CAMERA_STATUS_AVAILABLE | 2 | The camera is available. |
+| CAMERA_STATUS_UNAVAILABLE | 3 | The camera is unavailable. |
+## Profile
-## CameraPosition
-
-Enumerates the camera positions.
+Defines the camera configuration.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Value | Description |
-| --------------------------- | ---- | ---------------- |
-| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position.|
-| CAMERA_POSITION_BACK | 1 | Rear camera. |
-| CAMERA_POSITION_FRONT | 2 | Front camera. |
+| Name | Type | Read only| Description |
+| ------ | ----------------------------- | ---- | ---------- |
+| format | [CameraFormat](#cameraformat) | Yes | Output format.|
+| size | [Size](#size) | Yes | Resolution. |
-## CameraType
+## FrameRateRange
-Enumerates the camera types.
+ Defines the frame rate range.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Value | Description |
-| ----------------------- | ---- | ---------------- |
-| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type.|
-| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera. |
-| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera. |
-| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera. |
-| CAMERA_TYPE_TRUE_DEPTH | 4 | True depth camera. |
+| Name| Type | Read only| Description |
+| ---- | ------ | ---- | ----------------- |
+| min | number | Yes | Minimum rate, in fps.|
+| max | number | Yes | Maximum rate, in fps.|
+## VideoProfile
-## ConnectionType
-
-Enumerates the camera connection types.
+Defines the video configuration.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Value | Description |
-| ---------------------------- | ---- | ------------- |
-| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera. |
-| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB.|
-| CAMERA_CONNECTION_REMOTE | 2 | Remote camera. |
+| Name | Type | Read only| Description |
+| --------------- | --------------------------------- | ---- | ------ |
+| frameRateRanges | [FrameRateRange](#frameraterange) | Yes | Frame rate range.|
-## Size
+## CameraOutputCapability
-Defines the image size that can be used in previewing, photographing, and video recording.
+Defines the camera output capability.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Type | Readable| Writable| Description |
-| ------ | ------ | ---- | ---- | ------------ |
-| height | string | Yes | Yes | Image height.|
-| width | number | Yes | Yes | Image width.|
+| Name | Type | Read only| Description |
+| ---------------------------- | ------------------------------------------------- | ---- | -------------------------- |
+| previewProfiles | Array<[Profile](#profile)\> | Yes | Supported preview configurations. |
+| photoProfiles | Array<[Profile](#profile)\> | Yes | Supported shooting configurations. |
+| videoProfiles | Array<[VideoProfile](#videoprofile)\> | Yes | Supported video recording configurations. |
+| supportedMetadataObjectTypes | Array<[MetadataObjectType](#metadataobjecttype)\> | Yes | Supported metadata object types.|
## CameraManager
Implements camera management. Before calling any API in **CameraManager**, you must use **getCameraManager** to obtain a **CameraManager** instance.
-### getCameras
+### getSupportedCameras
-getCameras(callback: AsyncCallback\>): void
+getSupportedCameras(callback: AsyncCallback\>): void
-Obtains all cameras supported by the device. This API uses an asynchronous callback to return the array of supported cameras.
+Obtains supported cameras. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------------------------- | ---- | ------------------------------------ |
-| callback | AsyncCallback\> | Yes | Callback used to return the array of supported cameras.|
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------------------------- | ---- | ------------------------------------ |
+| callback | AsyncCallback\> | Yes | Callback used to return the array of supported cameras.|
**Example**
```js
-cameraManager.getCameras((err, cameras) => {
+cameraManager.getSupportedCameras((err, cameras) => {
if (err) {
console.error('Failed to get the cameras. ${err.message}');
return;
@@ -159,1015 +153,986 @@ cameraManager.getCameras((err, cameras) => {
})
```
-### getCameras
+### getSupportedCameras
-getCameras(): Promise\>
+getSupportedCameras(): Promise\>
-Obtains all cameras supported by the device. This API uses a promise to return the array of supported cameras.
+Obtains supported cameras. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Return value**
-| Type | Description |
-| ----------------------------------- | ----------------------------- |
-| Promise\> | Promise used to return the array of supported cameras.|
+| Type | Description |
+| ----------------------------------------------- | ----------------------------- |
+| Promise\> | Promise used to return the array of supported cameras.|
**Example**
```js
-cameraManager.getCameras().then((cameraArray) => {
+cameraManager.getSupportedCameras().then((cameraArray) => {
console.log('Promise returned with an array of supported cameras: ' + cameraArray.length);
})
```
-### createCameraInput
-
-createCameraInput(cameraId: string, callback: AsyncCallback): void
+### getSupportedOutputCapability
-Creates a **CameraInput** instance with the specified camera ID. This API uses an asynchronous callback to return the instance.
+getSupportedOutputCapability(camera:CameraDevice, callback: AsyncCallback): void
-**Required permissions**: ohos.permission.CAMERA
+Obtains the output capability supported by a camera. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------------------- | ---- | ----------------------------------- |
-| cameraId | string | Yes | Camera ID used to create the instance. |
-| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | ---------------------------------- |
+| camera | [CameraDevice](#cameraDevice) | Yes | **CameraDevice** object. |
+| callback | AsyncCallback<[CameraOutputCapability](#cameraoutputcapability)\> | Yes | Callback used to return the output capability.|
**Example**
```js
-cameraManager.createCameraInput(cameraId, (err, cameraInput) => {
+cameraManager.getSupportedOutputCapability(cameraDevice, (err, cameras) => {
if (err) {
- console.error('Failed to create the CameraInput instance. ${err.message}');
+ console.error('Failed to get the cameras. ${err.message}');
return;
}
- console.log('Callback returned with the CameraInput instance.');
+ console.log('Callback returned with an array of supported outputCapability');
})
```
-### createCameraInput
-
-createCameraInput(cameraId: string): Promise
+### getSupportedOutputCapability
-Creates a **CameraInput** instance with the specified camera ID. This API uses a promise to return the instance.
+getSupportedOutputCapability(camera:CameraDevice): Promise
-**Required permissions**: ohos.permission.CAMERA
+Obtains the output capability supported by a camera. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ------ | ---- | ------------ |
-| cameraId | string | Yes | Camera ID used to create the instance.|
+| Name | Type | Mandatory| Description |
+| ------ | ----------------------------- | ---- | ------------------ |
+| camera | [CameraDevice](#cameraDevice) | Yes | **CameraDevice** object.|
**Return value**
-| Type | Description |
-| ------------------------------------- | ---------------------------------------- |
-| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
+| Type | Description |
+| ----------------------------------------------------------- | --------------------------------------------- |
+| Promise<[CameraOutputCapability](#cameraoutputcapability)\> | Promise used to return the output capability.|
+
**Example**
```js
-cameraManager.createCameraInput(cameraId).then((cameraInput) => {
- console.log('Promise returned with the CameraInput instance');
+cameraManager.getSupportedOutputCapability(cameraDevice).then((cameraoutputcapability) => {
+ console.log('Promise returned with an array of supported outputCapability');
})
```
-### createCameraInput
-
-createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void
+### getSupportedMetadataObjectType
-Creates a **CameraInput** instance with the specified camera position and camera type. This API uses an asynchronous callback to return the instance.
+getSupportedMetadataObjectType(callback: AsyncCallback\>): void
-**Required permissions**: ohos.permission.CAMERA
+Obtains the metadata information supported by this camera. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------------------- | ---- | ----------------------------------- |
-| position | [CameraPosition](#cameraposition) | Yes | Camera position. |
-| type | [CameraType](#cameratype) | Yes | Camera type. |
-| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------- |
+| callback | AsyncCallback\> | Yes | Callback used to return the metadata information.|
**Example**
```js
-cameraManager.createCameraInput(camera.CameraPosition.CAMERA_POSITION_BACK, camera.CameraType.CAMERA_TYPE_UNSPECIFIED, (err, cameraInput) => {
+cameraManager.getSupportedMetadataObjectType((err, metadataobject) => {
if (err) {
- console.error('Failed to create the CameraInput instance. ${err.message}');
+ console.error('Failed to get the supported metadataObjectType. ${err.message}');
return;
}
- console.log('Callback returned with the CameraInput instance');
+ console.log('Callback returned with an array of supported metadataObjectType.' );
})
```
-### createCameraInput
-
-createCameraInput(position: CameraPosition, type: CameraType): Promise
+### getSupportedMetadataObjectType
-Creates a **CameraInput** instance with the specified camera position and camera type. This API uses a promise to return the instance.
+getSupportedMetadataObjectType(camera:CameraDevice): Promise
-**Required permissions**: ohos.permission.CAMERA
+Obtains the metadata information supported by this camera. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------- | ---- | ---------- |
-| position | [CameraPosition](#cameraposition) | Yes | Camera position.|
-| type | [CameraType](#cameratype) | Yes | Camera type.|
-
**Return value**
-| Type | Description |
-| ------------------------------------- | ---------------------------------------- |
-| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
+| Type | Description |
+| ------------------------------------------------------- | ----------------------------------------------------- |
+| Promise\> | Promise used to return the metadata information.|
+
**Example**
```js
-cameraManager.createCameraInput(camera.CameraPosition.CAMERA_POSITION_BACK, camera.CameraType.CAMERA_TYPE_UNSPECIFIED).then((cameraInput) => {
- console.log('Promise returned with the CameraInput instance.');
+cameraManager.getSupportedMetadataObjectType().then((metadataobject) => {
+ console.log('Promise returned with an array of supported metadataObjectType.' );
})
```
-### on('cameraStatus')
+### isCameraMuted
-on(type: 'cameraStatus', callback: AsyncCallback): void
+isCameraMuted(callback: AsyncCallback): void
-Listens for camera status changes. This API uses an asynchronous callback to return the camera status changes.
+Checks whether this camera is muted. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| :------- | :---------------------------------------------------- | :--- | :--------------------------------------------------- |
-| type | string | Yes | Type of event to listen for. The value is fixed at **cameraStatus**, indicating the camera status change event.|
-| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change. |
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------- | ---- | ------------------------------------------------- |
+| callback | AsyncCallback | Yes | Callback used to return the result. The value **true** means that the camera is muted, and **false** means the opposite.|
**Example**
```js
-cameraManager.on('cameraStatus', (err, cameraStatusInfo) => {
+cameraManager.isCameraMuted((err, status) => {
if (err) {
- console.error('Failed to get cameraStatus callback. ${err.message}');
+ console.error('Failed to get the cameraMuted status. ${err.message}');
return;
}
- console.log('camera : ' + cameraStatusInfo.camera.cameraId);
- console.log('status: ' + cameraStatusInfo.status);
+ console.log('Callback returned with cameraMuted status');
})
```
-## Camera
+### isCameraMuted
-After **[camera.getCameraManager](#cameragetcameramanager)** is called, a camera instance is returned, with camera-related metadata such as **cameraId**, **cameraPosition**, **cameraType**, and **connectionType**.
+isCameraMuted(): Promise
+
+Checks whether this camera is muted. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Type | Read only| Description |
-| -------------- | --------------------------------- | ---- | -------------- |
-| cameraId | string | Yes | Camera ID. |
-| cameraPosition | [CameraPosition](#cameraposition) | Yes | Camera position. |
-| cameraType | [CameraType](#cameratype) | Yes | Camera type. |
-| connectionType | [ConnectionType](#connectiontype) | Yes | Camera connection type.|
+**Return value**
+
+| Type | Description |
+| ----------------- | --------------------------------------------------- |
+| Promise | Promise used to return the result. The value **true** means that the camera is muted, and **false** means the opposite.|
+
**Example**
```js
-async function getCameraInfo("cameraId") {
- var cameraManager = await camera.getCameraManager(context);
- var cameras = await cameraManager.getCameras();
- var cameraObj = cameras[0];
- var cameraId = cameraObj.cameraId;
- var cameraPosition = cameraObj.cameraPosition;
- var cameraType = cameraObj.cameraType;
- var connectionType = cameraObj.connectionType;
-}
+cameraManager.isCameraMuted().then((status) => {
+ console.log('Promise returned with the status whether camera is muted.');
+})
```
-## CameraStatusInfo
-
-Describes the camera status information.
-
-**System capability**: SystemCapability.Multimedia.Camera.Core
-
-| Name | Type | Description |
-| ------ | ----------------------------- | ---------- |
-| camera | [Camera](#camera) | Camera object.|
-| status | [CameraStatus](#camerastatus) | Camera status.|
-
-
-## CameraInput
+### isCameraMuteSupported
-Implements a **CameraInput** instance. Before calling any API in **CameraInput**, you must create a **CameraInput** instance.
+isCameraMuteSupported(callback: AsyncCallback): void
-### getCameraId
+Checks whether this camera can be muted. This API uses an asynchronous callback to return the result.
-getCameraId(callback: AsyncCallback\): void
+This is a system API.
-Obtains the camera ID based on which this **CameraInput** instance is created. This API uses an asynchronous callback to return the camera ID.
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------- | ---- | -------------------------- |
-| callback | AsyncCallback | Yes | Callback used to return the camera ID.|
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------- | ---- | -------------------------------------------- |
+| callback | AsyncCallback | Yes | Callback used to return the result. The value **true** means that the camera can be muted, and **false** means the opposite.|
**Example**
```js
-cameraInput.getCameraId((err, cameraId) => {
+cameraManager.isCameraMuteSupported((err, status) => {
if (err) {
- console.error('Failed to get the camera ID. ${err.message}');
+ console.error('Failed to get the cameraMuteSupported. ${err.message}');
return;
}
- console.log('Callback returned with the camera ID: ' + cameraId);
+ console.log('Callback returned with the status whether cameraMuteSupported.');
})
```
-### getCameraId
+### isCameraMuteSupported
+
+isCameraMuteSupported(): Promise
+
+Checks whether this camera can be muted. This API uses a promise to return the result.
-getCameraId(): Promise
+This is a system API.
-Obtains the camera ID based on which this **CameraInput** instance is created. This API uses a promise to return the camera ID.
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Return value**
-| Type | Description |
-| ---------------- | ----------------------------- |
-| Promise | Promise used to return the camera ID.|
+| Type | Description |
+| ----------------- | ------------------------------------------------------- |
+| Promise | Promise used to return the result. The value **true** means that the camera can be muted, and **false** means the opposite.|
+
**Example**
```js
-cameraInput.getCameraId().then((cameraId) => {
- console.log('Promise returned with the camera ID:' + cameraId);
+cameraManager.isCameraMuteSupported().then((status) => {
+ console.log('Promise returned with the status whether cameraMuteSupported.');
})
```
+### muteCamera
-### hasFlash
+muteCamera(mute:boolean, callback: AsyncCallback): void
-hasFlash(callback: AsyncCallback): void
+Mutes this camera. This API uses an asynchronous callback to return the result.
-Checks whether the device has flash light. This API uses an asynchronous callback to return the result.
+This is a system API.
+
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------- | ---- | -------------------------------------- |
-| callback | AsyncCallback | Yes | Callback used to return the flash light support status. The value **true** means that the device has flash light.|
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------------------ |
+| mute | boolean | Yes | Whether to mute the camera. The value **true** means to mute the camera, and **false** means the opposite. |
+| callback | AsyncCallback | Yes | Callback used to return the result.|
**Example**
```js
-cameraInput.hasFlash((err, status) => {
+cameraManager.muteCamera(isMuted, (err) => {
if (err) {
- console.error('Failed to check whether the device has flash light. ${err.message}');
+ console.error('Failed to mute the camera. ${err.message}');
return;
}
- console.log('Callback returned with flash light support status: ' + status);
+ console.log('Callback returned with the muteCamera.');
})
```
-### hasFlash
+### muteCamera
-hasFlash(): Promise
+muteCamera(mute:boolean): Promise
-Checks whether the device has flash light. This API uses a promise to return the result.
+Mutes this camera. This API uses a promise to return the result.
+
+This is a system API.
+
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ---- | ------- | ---- | -------------- |
+| mute | boolean | Yes | Whether to mute the camera. The value **true** means to mute the camera, and **false** means the opposite.|
+
**Return value**
-| Type | Description |
-| ----------------- | ------------------------------------------------------- |
-| Promise | Promise used to return the flash light support status. The value **true** means that the device has flash light.|
+| Type | Description |
+| -------------- | --------------------------------------------------- |
+| Promise| Promise used to return the result.|
+
**Example**
-```js
-cameraInput.hasFlash().then((status) => {
- console.log('Promise returned with the flash light support status:' + status);
+```js
+cameraManager.muteCamera(isMuted).then(() => {
+ console.log('Promise returned muteCamera.');
})
```
-### isFlashModeSupported
+### createCameraInput
-isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void
+createCameraInput(camera: CameraDevice, callback: AsyncCallback): void
-Checks whether a specified flash mode is supported. This API uses an asynchronous callback to return the result.
+Creates a **CameraInput** instance with the specified **CameraDevice** object. This API uses an asynchronous callback to return the result.
+
+This is a system API.
+
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| --------- | ----------------------- | ---- | ---------------------------------------- |
-| flashMode | [FlashMode](#flashmode) | Yes | Flash mode. |
-| callback | AsyncCallback | Yes | Callback used to return the flash mode support status. The value **true** means that the specified flash mode is supported.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------- | ---- | ----------------------------------- |
+| camera | [CameraDevice](#cameraDevice) | Yes | **CameraDevice** object. |
+| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
**Example**
```js
-cameraInput.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO, (err, status) => {
+cameraManager.createCameraInput(camera, (err, cameraInput) => {
if (err) {
- console.error('Failed to check whether the flash mode is supported. ${err.message}');
+ console.error('Failed to create the CameraInput instance. ${err.message}');
return;
}
- console.log('Callback returned with the flash mode support status: ' + status);
+ console.log('Callback returned with the CameraInput instance.');
})
```
-### isFlashModeSupported
+### createCameraInput
-isFlashModeSupported(flashMode: FlashMode): Promise
+createCameraInput(camera: CameraDevice): Promise
-Checks whether a specified flash mode is supported. This API uses a promise to return the result.
+Creates a **CameraInput** instance with the specified **CameraDevice** object. This API uses a promise to return the result.
+
+This is a system API.
+
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| --------- | ----------------------- | ---- | ---------------- |
-| flashMode | [FlashMode](#flashmode) | Yes | Flash mode.|
+| Name | Type | Mandatory| Description |
+| ------ | ----------------------------- | ---- | ------------------ |
+| camera | [CameraDevice](#cameraDevice) | Yes | **CameraDevice** object.|
**Return value**
-| Type | Description |
-| ----------------- | ------------------------------------------------------------ |
-| Promise | Promise used to return the flash mode support status. The value **true** means that the specified flash mode is supported.|
+| Type | Description |
+| ------------------------------------- | ---------------------------------------- |
+| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
**Example**
```js
-cameraInput.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO).then((status) => {
- console.log('Promise returned with flash mode support status.' + status);
+cameraManager.createCameraInput(camera).then((cameraInput) => {
+ console.log('Promise returned with the CameraInput instance');
})
```
-### setFlashMode
+### createCameraInput
-setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void
+createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void
-Sets the flash mode. This API uses an asynchronous callback to return the result.
+Creates a **CameraInput** instance with the specified camera position and type. This API uses an asynchronous callback to return the result.
-Before setting the parameters, do the following checks:
+This is a system API.
-1. Use [hasFlash](#hasflash) to check whether the device has flash light.
-2. Use [isFlashModeSupported](#isflashmodesupported) to check whether the device supports a specified flash mode.
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| --------- | ----------------------- | ---- | ------------------------ |
-| flashMode | [FlashMode](#flashmode) | Yes | Flash mode. |
-| callback | AsyncCallback | Yes | Callback used to return the result.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------- | ---- | ----------------------------------- |
+| position | [CameraPosition](#cameraposition) | Yes | Camera position. |
+| type | [CameraType](#cameratype) | Yes | Camera type. |
+| callback | AsyncCallback<[CameraInput](#camerainput)\> | Yes | Callback used to return the **CameraInput** instance.|
**Example**
```js
-cameraInput.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO, (err) => {
+cameraManager.createCameraInput(camera.CameraPosition.CAMERA_POSITION_BACK, camera.CameraType.CAMERA_TYPE_UNSPECIFIED, (err, cameraInput) => {
if (err) {
- console.error('Failed to set the flash mode ${err.message}');
+ console.error('Failed to create the CameraInput instance. ${err.message}');
return;
}
- console.log('Callback returned with the successful execution of setFlashMode.');
+ console.log('Callback returned with the CameraInput instance');
})
```
-### setFlashMode
+### createCameraInput
-setFlashMode(flashMode: FlashMode): Promise
+createCameraInput(position: CameraPosition, type:CameraType ): Promise
-Sets the flash mode. This API uses a promise to return the result.
+Creates a **CameraInput** instance with the specified camera position and type. This API uses a promise to return the result.
-Before setting the parameters, do the following checks:
+This is a system API.
-1. Use [hasFlash](#hasflash) to check whether the device has flash light.
-2. Use [isFlashModeSupported](#isflashmodesupported) to check whether the device supports a specified flash mode.
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| --------- | ----------------------- | ---- | ---------------- |
-| flashMode | [FlashMode](#flashmode) | Yes | Flash mode.|
+| Name | Type | Mandatory| Description |
+| -------- | --------------------------------- | ---- | ---------- |
+| position | [CameraPosition](#cameraposition) | Yes | Camera position.|
+| type | [CameraType](#cameratype) | Yes | Camera type.|
**Return value**
-| Type | Description |
-| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
+| Type | Description |
+| ------------------------------------- | ---------------------------------------- |
+| Promise<[CameraInput](#camerainput)\> | Promise used to return the **CameraInput** instance.|
**Example**
```js
-cameraInput.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO).then(() => {
- console.log('Promise returned with the successful execution of setFlashMode.');
+cameraManager.createCameraInput(camera.CameraPosition.CAMERA_POSITION_BACK, camera.CameraType.CAMERA_TYPE_UNSPECIFIED).then((cameraInput) => {
+ console.log('Promise returned with the CameraInput instance');
})
```
-### getFlashMode
+### createPreviewOutput
-getFlashMode(callback: AsyncCallback): void
+createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void
-Obtains the current flash mode. This API uses an asynchronous callback to return the result.
+Creates a **PreviewOutput** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------------------------------------- |
-| callback | AsyncCallback<[FlashMode](#flashmode)\> | Yes | Callback used to return the current flash mode.|
+| Name | Type | Mandatory| Description |
+| --------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
+| profile | [Profile](#profile) | Yes | Supported preview configurations. |
+| surfaceId | string | Yes | Surface ID, which is obtained from **[XComponent](../arkui-ts/ts-basic-components-xcomponent.md)** or **[ImageReceiver](js-apis-image.md#imagereceiver9)**.|
+| callback | AsyncCallback<[PreviewOutput](#previewoutput)\> | Yes | Callback used to return the **PreviewOutput** instance. |
**Example**
```js
-cameraInput.getFlashMode((err, flashMode) => {
+cameraManager.createPreviewOutput(profile, surfaceId, (err, previewoutput) => {
if (err) {
- console.error('Failed to get the flash mode ${err.message}');
+ console.error('Failed to gcreate previewOutput. ${err.message}');
return;
}
- console.log('Callback returned with current flash mode: ' + flashMode);
+ console.log('Callback returned with previewOutput created.');
})
```
-### getFlashMode
+### createPreviewOutput
-getFlashMode(): Promise
+createPreviewOutput(profile: Profile, surfaceId: string): Promise
-Obtains the current flash mode. This API uses a promise to return the result.
+Creates a **PreviewOutput** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | ------------------- | ---- | ------------------------------------------------------------ |
+| profile | [Profile](#profile) | Yes | Supported preview configurations. |
+| surfaceId | string | Yes | Surface ID, which is obtained from **[XComponent](../arkui-ts/ts-basic-components-xcomponent.md)** or **[ImageReceiver](js-apis-image.md#imagereceiver9)**.|
+
**Return value**
-| Type | Description |
-| --------------------------------- | --------------------------------------- |
-| Promise<[FlashMode](#flashmode)\> | Promise used to return the current flash mode.|
+| Type | Description |
+| ----------------------------------------- | ------------------------------------------ |
+| Promise<[PreviewOutput](#previewoutput)\> | Promise used to return the **PreviewOutput** instance.|
**Example**
```js
-cameraInput.getFlashMode().then((flashMode) => {
- console.log('Promise returned with current flash mode : ' + flashMode);
+cameraManager.createPreviewOutput(profile, survaceId).then((previewoutput) => {
+ console.log('Promise returned with previewOutput created.');
})
```
-### isFocusModeSupported
+### createDeferredPreviewOutput
-isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void
+createDeferredPreviewOutput(profile: Profile, callback: AsyncCallback): void
-Checks whether a specified focus mode is supported. This API uses an asynchronous callback to return the result.
+Creates a **PreviewOutput** instance without a surface ID. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------- | ---- | -------------------------------------- |
-| afMode | [FocusMode](#focusmode) | Yes | Focus mode. |
-| callback | AsyncCallback | Yes | Callback used to return the focus mode support status. The value **true** means that the specified focus mode is supported.|
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------------------- | ---- | ------------------------------------- |
+| profile | [Profile](#profile) | Yes | Supported preview configurations. |
+| callback | AsyncCallback<[PreviewOutput](#previewoutput)\> | Yes | Callback used to return the **PreviewOutput** instance.|
**Example**
```js
-cameraInput.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO, (err, status) => {
+cameraManager.createDeferredPreviewOutput(profile, (err, previewoutput) => {
if (err) {
- console.error('Failed to check whether the focus mode is supported. ${err.message}');
+ console.error('Failed to create deferredPreviewOutput. ${err.message}');
return;
}
- console.log('Callback returned with the focus mode support status: ' + status);
+ console.log('Callback returned with deferredPreviewOutput created.');
})
```
-### isFocusModeSupported
+### createDeferredPreviewOutput
-isFocusModeSupported(afMode: FocusMode): Promise
+createDeferredPreviewOutput(profile: Profile): Promise
-Checks whether a specified focus mode is supported. This API uses a promise to return the result.
+Creates a **PreviewOutput** instance without a surface ID. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| ------ | ----------------------- | ---- | ---------------- |
-| afMode | [FocusMode](#focusmode) | Yes | Focus mode.|
+| Name | Type | Mandatory| Description |
+| ------- | ------------------- | ---- | -------------------- |
+| profile | [Profile](#profile) | Yes | Supported preview configurations.|
**Return value**
-| Type | Description |
-| ----------------- | ----------------------------------------------------------- |
-| Promise | Promise used to return the focus mode support status. The value **true** means that the specified focus mode is supported.|
+| Type | Description |
+| ----------------------------------------- | ------------------------------------------ |
+| Promise<[PreviewOutput](#previewoutput)\> | Promise used to return the **PreviewOutput** instance.|
**Example**
```js
-cameraInput.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO).then((status) => {
- console.log('Promise returned with focus mode support status.' + status);
+cameraManager.createDeferredPreviewOutput(profile).then((previewoutput) => {
+ console.log('Promise returned with DefeerredPreviewOutput created.');
})
```
-### setFocusMode
-
-setFocusMode(afMode: FocusMode, callback: AsyncCallback): void
+### createPhotoOutput
-Sets the focus mode. This API uses an asynchronous callback to return the result.
+createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void
-Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupported)** to check whether the focus mode is supported.
+Creates a **PhotoOutput** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------- | ---- | ------------------------ |
-| afMode | [FocusMode](#focusmode) | Yes | Focus mode. |
-| callback | AsyncCallback | Yes | Callback used to return the result.|
+| Name | Type | Mandatory| Description |
+| --------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
+| profile | [Profile](#profile) | Yes | Supported shooting configurations. |
+| surfaceId | string | Yes | Surface ID, which is obtained from **[ImageReceiver](js-apis-image.md#imagereceiver9)**.|
+| callback | AsyncCallback<[PhotoOutput](#photooutput)\> | Yes | Callback used to return the **PhotoOutput** instance. |
**Example**
```js
-cameraInput.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO, (err) => {
+cameraManager.createPhotoOutput(profile, surfaceId, (err, photooutput) => {
if (err) {
- console.error('Failed to set the focus mode ${err.message}');
+ console.error('Failed to create photoOutput. ${err.message}');
return;
}
- console.log('Callback returned with the successful execution of setFocusMode.');
+ console.log('Callback returned with photoOutput created.');
})
```
-### setFocusMode
-
-setFocusMode(afMode: FocusMode): Promise
+### createPhotoOutput
-Sets the focus mode. This API uses a promise to return the result.
+createPhotoOutput(profile: Profile, surfaceId: string): Promise
-Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupported)** to check whether the focus mode is supported.
+Creates a **PhotoOutput** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| ------ | ----------------------- | ---- | ---------------- |
-| afMode | [FocusMode](#focusmode) | Yes | Focus mode.|
+| Name | Type | Mandatory| Description |
+| --------- | ------------------- | ---- | ------------------------------------------------------------ |
+| profile | [Profile](#profile) | Yes | Supported shooting configurations. |
+| surfaceId | string | Yes | Surface ID, which is obtained from **[ImageReceiver](js-apis-image.md#imagereceiver9)**.|
**Return value**
-| Type | Description |
-| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
+| Type | Description |
+| ------------------------------------- | ---------------------------------------- |
+| Promise<[PhotoOutput](#photooutput)\> | Promise used to return the **PhotoOutput** instance.|
**Example**
```js
-cameraInput.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO).then(() => {
- console.log('Promise returned with the successful execution of setFocusMode.');
+cameraManager.createPhotoOutput(profile, surfaceId).then((photooutput) => {
+ console.log('Promise returned with photoOutput created.');
})
```
-### getFocusMode
+### createVideoOutput
-getFocusMode(callback: AsyncCallback): void
+createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void
-Obtains the current focus mode. This API uses an asynchronous callback to return the result.
+Creates a **VideoOutput** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | -------------------------------------- |
-| callback | AsyncCallback<[FocusMode](#focusmode)\> | Yes | Callback used to return the current focus mode.|
+| Name | Type | Mandatory| Description |
+| --------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
+| profile | [VideoProfile](#videoprofile) | Yes | Supported video recording configurations. |
+| surfaceId | string | Yes | Surface ID, which is obtained from **[VideoRecorder](js-apis-media.md#videorecorder9)**.|
+| callback | AsyncCallback<[VideoOutput](#videooutput)\> | Yes | Callback used to return the **VideoOutput** instance. |
**Example**
```js
-cameraInput.getFocusMode((err, afMode) => {
+cameraManager.createVideoOutput(profile, surfaceId, (err, videooutput) => {
if (err) {
- console.error('Failed to get the focus mode ${err.message}');
+ console.error('Failed to create videoOutput. ${err.message}');
return;
}
- console.log('Callback returned with current focus mode: ' + afMode);
+ console.log('Callback returned with an array of supported outputCapability' );
})
```
-### getFocusMode
+### createVideoOutput
-getFocusMode(): Promise
+createVideoOutput(profile: VideoProfile, surfaceId: string): Promise
-Obtains the current focus mode. This API uses a promise to return the result.
+Creates a **VideoOutput** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | ----------------------------- | ---- | ------------------------------------------------------------ |
+| profile | [VideoProfile](#videoprofile) | Yes | Supported video recording configurations. |
+| surfaceId | string | Yes | Surface ID, which is obtained from **[VideoRecorder](js-apis-media.md#videorecorder9)**.|
+
**Return value**
-| Type | Description |
-| ------------------- | ------------------------------------- |
-| Promise | Promise used to return the current focus mode.|
+| Type | Description |
+| ------------------------------------- | ---------------------------------------- |
+| Promise<[VideoOutput](#videooutput)\> | Promise used to return the **VideoOutput** instance.|
**Example**
```js
-cameraInput.getFocusMode().then((afMode) => {
- console.log('Promise returned with current focus mode : ' + afMode);
+cameraManager.createVideoOutput(profile, surfaceId).then((videooutput) => {
+ console.log('Promise returned with videoOutput created.');
})
```
-### getZoomRatioRange
+### createMetadataOutput
-getZoomRatioRange\(callback: AsyncCallback\>\): void
+createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void
-Obtains the zoom ratio range. This API uses an asynchronous callback to return the result.
+Creates a **MetadataOutput** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------ | ---- | ------------------------ |
-| callback | AsyncCallback\> | Yes | Callback used to return the zoom ratio range.|
+| Name | Type | Mandatory| Description |
+| ------------------- | ------------------------------------------------- | ---- | -------------------------------------- |
+| metadataObjectTypes | Array<[MetadataObjectType](#metadataobjecttype)\> | Yes | Supported metadata object types. |
+| callback | AsyncCallback<[MetadataOutput](#metadataoutput)\> | Yes | Callback used to return the **MetadataOutput** instance.|
**Example**
```js
-cameraInput.getZoomRatioRange((err, zoomRatioRange) => {
+cameraManager.createMetadataOutput(metadataObjectTypes, (err, metadataoutput) => {
if (err) {
- console.error('Failed to get the zoom ratio range. ${err.message}');
+ console.error('Failed to create metadataOutput. ${err.message}');
return;
}
- console.log('Callback returned with zoom ratio range: ' + zoomRatioRange.length);
+ console.log('Callback returned with metadataOutput created.');
})
```
-### getZoomRatioRange
+### createMetadataOutput
-getZoomRatioRange\(\): Promise\>
+createMetadataOutput(metadataObjectTypes: Array): Promise
-Obtains the zoom ratio range. This API uses a promise to return the result.
+Creates a **MetadataOutput** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------------- | ------------------------------------------------- | ---- | ---------------- |
+| metadataObjectTypes | Array<[MetadataObjectType](#metadataobjecttype)\> | Yes | Supported metadata object types.|
+
**Return value**
-| Type | Description |
-| ------------------------ | ------------------------------------------- |
-| Promise\> | Promise used to return the zoom ratio range.|
+| Type | Description |
+| ------------------------------------------- | ------------------------------------------- |
+| Promise<[MetadataOutput](#metadataoutput)\> | Promise used to return the **MetadataOutput** instance.|
**Example**
```js
-cameraInput.getZoomRatioRange().then((zoomRatioRange) => {
- console.log('Promise returned with zoom ratio range: ' + zoomRatioRange.length);
+cameraManager.createMetadataOutput(metadataObjectTypes).then((metadataoutput) => {
+ console.log('Promise returned with metadataOutput created.');
})
```
-### setZoomRatio
+### createCaptureSession
-setZoomRatio(zoomRatio: number, callback: AsyncCallback): void
+createCaptureSession(callback: AsyncCallback): void
-Sets a zoom ratio. This API uses an asynchronous callback to return the result.
+Creates a **CaptureSession** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| --------- | -------------------- | ---- | ------------------------ |
-| zoomRatio | number | Yes | Zoom ratio to set. |
-| callback | AsyncCallback | Yes | Callback used to return the result.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------- | ---- | -------------------------------- |
+| callback | AsyncCallback<[CaptureSession](#capturesession)\> | Yes | Callback used to return the **CaptureSession** instance.|
**Example**
```js
-cameraInput.setZoomRatio(1, (err) => {
+cameraManager.createCaptureSession((err, capturesession) => {
if (err) {
- console.error('Failed to set the zoom ratio value ${err.message}');
+ console.error('Failed to create captureSession. ${err.message}');
return;
}
- console.log('Callback returned with the successful execution of setZoomRatio.');
+ console.log('Callback returned with captureSession created.');
})
```
-### setZoomRatio
+### createCaptureSession
-setZoomRatio(zoomRatio: number): Promise
+createCaptureSession(): Promise
-Sets a zoom ratio. This API uses a promise to return the result.
+Creates a **CaptureSession** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| --------- | ------ | ---- | ------------ |
-| zoomRatio | number | Yes | Zoom ratio to set.|
-
**Return value**
-| Type | Description |
-| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
+| Type | Description |
+| ------------------------------------------- | ------------------------------------------- |
+| Promise<[CaptureSession](#capturesession)\> | Promise used to return the **CaptureSession** instance.|
**Example**
```js
-cameraInput.setZoomRatio(1).then(() => {
- console.log('Promise returned with the successful execution of setZoomRatio.');
+cameraManager.createCaptureSession().then((capturesession) => {
+ console.log('Promise returned with captureSession created.');
})
```
-### getZoomRatio
+### on('cameraStatus')
-getZoomRatio(callback: AsyncCallback): void
+on(type: 'cameraStatus', callback: AsyncCallback): void
-Obtains the current zoom ratio. This API uses an asynchronous callback to return the result.
+Listens for camera status changes. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------- | ---- | ------------------------ |
-| callback | AsyncCallback | Yes | Callback used to return the current zoom ratio.|
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------- |
+| type | string | Yes | Event type. The value is fixed at **cameraStatus**, indicating the camera status change event.|
+| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change. |
**Example**
```js
-cameraInput.getZoomRatio((err, zoomRatio) => {
+cameraManager.on('cameraStatus', (err, cameraStatusInfo) => {
if (err) {
- console.error('Failed to get the zoom ratio ${err.message}');
+ console.error('Failed to get cameraStatus callback. ${err.message}');
return;
}
- console.log('Callback returned with current zoom ratio: ' + zoomRatio);
+ console.log('camera : ' + cameraStatusInfo.camera.cameraId);
+ console.log('status: ' + cameraStatusInfo.status);
})
```
-### getZoomRatio
-
-getZoomRatio(): Promise
-
-Obtains the current zoom ratio. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Multimedia.Camera.Core
-
-**Return value**
-
-| Type | Description |
-| ---------------- | --------------------------- |
-| Promise | Promise used to return the current zoom ratio.|
+### on('cameraMute')
-**Example**
-
-```js
-cameraInput.getZoomRatio().then((zoomRatio) => {
- console.log('Promise returned with current zoom ratio : ' + zoomRatio);
-})
-```
+on(type: 'cameraMute', callback: AsyncCallback): void
-### release
+Listens for camera mute status changes. This API uses an asynchronous callback to return the result.
-release\(callback: AsyncCallback\): void
+This is a system API.
-Releases this **CameraInput** instance. This API uses an asynchronous callback to return the result.
+**Required permissions**: ohos.permission.CAMERA
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | -------------------- | ---- | ------------------------ |
-| callback | AsyncCallback | Yes | Callback used to return the result.|
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------- | ---- | ------------------------------------------------------ |
+| type | string | Yes | Event type. The value is fixed at **cameraMute**, indicating the camera mute status change event.|
+| callback | AsyncCallback | Yes | Callback used to return the camera mute status. |
**Example**
```js
-cameraInput.release((err) => {
+cameraManager.on('cameraMute', (err, status) => {
if (err) {
- console.error('Failed to release the CameraInput instance ${err.message}');
+ console.error('Failed to get cameraMute callback. ${err.message}');
return;
}
- console.log('Callback invoked to indicate that the CameraInput instance is released successfully.');
-});
+ console.log('status: ' + status);
+})
```
-### release
-
-release(): Promise
+## CameraStatusInfo
-Releases this **CameraInput** instance. This API uses a promise to return the result.
+Describes the camera status information.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Return value**
+| Name | Type | Description |
+| ------ | ----------------------------- | ---------- |
+| camera | [CameraDevice](#cameraDevice) | Camera object.|
+| status | [CameraStatus](#camerastatus) | Camera status.|
-| Type | Description |
-| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
+## CameraPosition
-**Example**
+Enumerates the camera positions.
-```js
-cameraInput.release().then(() => {
- console.log('Promise returned to indicate that the CameraInput instance is released successfully.');
-})
-```
+**System capability**: SystemCapability.Multimedia.Camera.Core
-### on('focusStateChange')
+| Name | Value | Description |
+| --------------------------- | ---- | ---------------- |
+| CAMERA_POSITION_UNSPECIFIED | 0 | Unspecified position.|
+| CAMERA_POSITION_BACK | 1 | Rear camera. |
+| CAMERA_POSITION_FRONT | 2 | Front camera. |
-on(type: 'focusStateChange', callback: AsyncCallback): void
+## CameraType
-Listens for focus state changes. This API uses an asynchronous callback to return the focus state changes.
+Enumerates the camera types.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Parameters**
+| Name | Value | Description |
+| ----------------------- | ---- | ------------------ |
+| CAMERA_TYPE_UNSPECIFIED | 0 | Unspecified camera type. |
+| CAMERA_TYPE_WIDE_ANGLE | 1 | Wide camera. |
+| CAMERA_TYPE_ULTRA_WIDE | 2 | Ultra wide camera. |
+| CAMERA_TYPE_TELEPHOTO | 3 | Telephoto camera. |
+| CAMERA_TYPE_TRUE_DEPTH | 4 | Camera with depth of field information.|
-| Name | Type | Mandatory| Description |
-| :------- | :---------------------------------------- | :--- | :------------------------------------------------------- |
-| type | string | Yes | Type of event to listen for. The value is fixed at **focusStateChange**, indicating the focus state change event.|
-| callback | AsyncCallback<[FocusState](#focusstate)\> | Yes | Callback used to return the focus state change. |
+## ConnectionType
-**Example**
+Enumerates the camera connection types.
-```js
-cameraInput.on('focusStateChange', (focusState) => {
- console.log('Focus state : ' + focusState);
-})
-```
+**System capability**: SystemCapability.Multimedia.Camera.Core
-### on('error')
+| Name | Value | Description |
+| ---------------------------- | ---- | ---------------- |
+| CAMERA_CONNECTION_BUILT_IN | 0 | Built-in camera. |
+| CAMERA_CONNECTION_USB_PLUGIN | 1 | Camera connected using USB. |
+| CAMERA_CONNECTION_REMOTE | 2 | Remote camera.|
-on(type: 'error', callback: ErrorCallback): void
+## CameraDevice
-Listens for **CameraInput** errors. This API uses a callback to return the errors.
+Defines the camera device information.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| :------- | :------------------------------- | :--- | :----------------------------------------------- |
-| type | string | Yes | Type of event to listen for. The value is fixed at **error**, indicating the camera input error event.|
-| callback | ErrorCallback<[CameraInputError](#camerainputerror)\> | Yes | Callback used to return the error information. |
+| Name | Type | Read only| Description |
+| -------------- | --------------------------------- | ---- | ---------------- |
+| cameraId | string | Yes | **CameraDevice** object.|
+| cameraPosition | [CameraPosition](#cameraposition) | Yes | Camera position. |
+| cameraType | [CameraType](#cameratype) | Yes | Camera type. |
+| connectionType | [ConnectionType](#connectiontype) | Yes | Camera connection type. |
**Example**
```js
-cameraInput.on('error', (cameraInputError) => {
- console.log('Camera input error code: ' + cameraInputError.code);
-})
+async function getCameraInfo("cameraId") {
+ var cameraManager = await camera.getCameraManager(context);
+ var cameras = await cameraManager.getSupportedCameras();
+ var cameraObj = cameras[0];
+ var cameraId = cameraObj.cameraId;
+ var cameraPosition = cameraObj.cameraPosition;
+ var cameraType = cameraObj.cameraType;
+ var connectionType = cameraObj.connectionType;
+}
```
-## CameraInputErrorCode
-
-Enumerates the **CameraInput** error codes.
-
-**System capability**: SystemCapability.Multimedia.Camera.Core
-
-| Name | Value | Description |
-| ------------- | ---- | ---------- |
-| ERROR_UNKNOWN | -1 | Unknown error.|
-
-## CameraInputError
+## Size
-Defines a **CameraInput** error object.
+Enumerates the camera output capability.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name| Type | Description |
-| ---- | ------------------------------------------- | -------------------------- |
-| code | [CameraInputErrorCode](#camerainputerrorcode) | **CameraInput** error code.|
-
+| Name | Type | Readable| Writable| Description |
+| ------ | ------ | ---- | ---- | ------------------ |
+| height | number | Yes | Yes | Image height, in pixels.|
+| width | number | Yes | Yes | Image width, in pixel.|
-## FlashMode
+## Point
-Enumerates the flash modes.
+Enumerates the point coordinates, which are used for focus and exposure configuration.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Value | Description |
-| ---------------------- | ---- | ------------ |
-| FLASH_MODE_CLOSE | 0 | The flash is off.|
-| FLASH_MODE_OPEN | 1 | The flash is on.|
-| FLASH_MODE_AUTO | 2 | The flash mode is auto, indicating that the flash fires automatically depending on the shooting conditions.|
-| FLASH_MODE_ALWAYS_OPEN | 3 | The flash is steady on.|
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ----------- |
+| x | number | Yes | X coordinate of a point.|
+| y | number | Yes | Y coordinate of a point.|
-## FocusMode
+## CameraFormat
-Enumerates the focus modes.
+Enumerates the camera output format.
**System capability**: SystemCapability.Multimedia.Camera.Core
-| Name | Value | Description |
-| -------------------------- | ---- | ------------------ |
-| FOCUS_MODE_MANUAL | 0 | Manual focus. |
-| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Continuous auto focus.|
-| FOCUS_MODE_AUTO | 2 | Auto focus. |
-| FOCUS_MODE_LOCKED | 3 | Locked focus. |
-
-## FocusState
-
-Enumerates the focus states.
+| Name | Default Value| Description |
+| ------------------------ | ------ | ---------------------- |
+| CAMERA_FORMAT_YUV_420_SP | 1003 | YUV 420 SP image.|
+| CAMERA_FORMAT_JPEG | 2000 | JPEG image. |
-**System capability**: SystemCapability.Multimedia.Camera.Core
+## CameraInput
-| Name | Value | Description |
-| --------------------- | ---- | ------------ |
-| FOCUS_STATE_SCAN | 0 | Scanning. |
-| FOCUS_STATE_FOCUSED | 1 | Focused.|
-| FOCUS_STATE_UNFOCUSED | 2 | Unfocused.|
+Provides camera information used in **[CaptureSession](#capturesession)**.
-## camera.createCaptureSession
+### open
-createCaptureSession\(context: Context, callback: AsyncCallback\): void
+open\(callback: AsyncCallback\): void
-Creates a **CaptureSession** instance. This API uses an asynchronous callback to return the instance.
+Opens this camera. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------------------------- | ---- | -------------------------------------- |
-| context | Context | Yes | Application context. |
-| callback | AsyncCallback<[CaptureSession](#capturesession)\> | Yes | Callback used to return the **CaptureSession** instance.|
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| callback | AsyncCallback | Yes | Callback used to return the result.|
**Example**
```js
-camera.createCaptureSession((context), (err, captureSession) => {
+cameraInput.open((err) => {
if (err) {
- console.error('Failed to create the CaptureSession instance. ${err.message}');
+ console.error('Failed to open the camera. ${err.message}');
return;
}
- console.log('Callback returned with the CaptureSession instance.' + captureSession);
-});
+ console.log('Callback returned with camera opened.');
+})
```
-## camera.createCaptureSession
+### open
-createCaptureSession(context: Context\): Promise;
+open(): Promise
-Creates a **CaptureSession** instance. This API uses a promise to return the instance.
+Opens this camera. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ------- | ------- | ---- | ------------ |
-| context | Context | Yes | Application context.|
-
**Return value**
-| Type | Description |
-| ------------------------------------------- | ----------------------------------------- |
-| Promise<[CaptureSession](#capturesession)\> | Promise used to return the **CaptureSession** instance.|
+| Type | Description |
+| -------------- | --------------------------- |
+| Promise| Promise used to return the result.|
**Example**
```js
-camera.createCaptureSession(context).then((captureSession) => {
- console.log('Promise returned with the CaptureSession instance');
+cameraInput.open().then(() => {
+ console.log('Promise returned with camera opened.');
})
```
-## CaptureSession
-
-Implements session capture.
-
-### beginConfig
+### close
-beginConfig\(callback: AsyncCallback\): void
+close\(callback: AsyncCallback\): void
-Starts configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+Closes this camera. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1180,20 +1145,20 @@ Starts configuration for this **CaptureSession** instance. This API uses an asyn
**Example**
```js
-captureSession.beginConfig((err) => {
+cameraInput.close((err) => {
if (err) {
- console.error('Failed to start the configuration. ${err.message}');
+ console.error('Failed to close the cameras. ${err.message}');
return;
}
- console.log('Callback invoked to indicate the begin config success.');
-});
+ console.log('Callback returned with camera closed.');
+})
```
-### beginConfig
+### close
-beginConfig\(\): Promise
+close(): Promise
-Starts configuration for this **CaptureSession** instance. This API uses a promise to return the result.
+Closes this camera. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1201,22 +1166,21 @@ Starts configuration for this **CaptureSession** instance. This API uses a promi
| Type | Description |
| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
-
+| Promise| Promise used to return the result.|
**Example**
```js
-captureSession.beginConfig().then(() => {
- console.log('Promise returned to indicate the begin config success.');
+cameraInput.close().then(() => {
+ console.log('Promise returned with camera closed.');
})
```
-### commitConfig
+### release
-commitConfig\(callback: AsyncCallback\): void
+release\(callback: AsyncCallback\): void
-Commits the configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+Releases this camera. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1229,20 +1193,20 @@ Commits the configuration for this **CaptureSession** instance. This API uses an
**Example**
```js
-captureSession.commitConfig((err) => {
+cameraInput.release((err) => {
if (err) {
- console.error('Failed to commit the configuration. ${err.message}');
+ console.error('Failed to release the CameraInput instance ${err.message}');
return;
}
- console.log('Callback invoked to indicate the commit config success.');
+ console.log('Callback invoked to indicate that the CameraInput instance is released successfully.');
});
```
-### commitConfig
+### release
-commitConfig\(\): Promise
+release(): Promise
-Commits the configuration for this **CaptureSession** instance. This API uses a promise to return the result.
+Releases this camera. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1250,131 +1214,246 @@ Commits the configuration for this **CaptureSession** instance. This API uses a
| Type | Description |
| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
+| Promise| Promise used to return the result.|
**Example**
```js
-captureSession.commitConfig().then(() => {
- console.log('Promise returned to indicate the commit config success.');
+cameraInput.release().then(() => {
+ console.log('Promise returned to indicate that the CameraInput instance is released successfully.');
})
```
-### addInput
+### on('error')
-addInput\(cameraInput: CameraInput, callback: AsyncCallback\): void
+on(type: 'error', callback: ErrorCallback): void
-Adds a **CameraInput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+Listens for **CameraInput** errors. This API uses a callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| ----------- | --------------------------- | ---- | --------------------------- |
-| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
-| callback | AsyncCallback | Yes | Callback used to return the result. |
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------------------------- | ---- | ------------------------------------------------ |
+| type | string | Yes | Event type. The value is fixed at **error**, indicating the camera input error event.|
+| callback | ErrorCallback<[CameraInputError](#camerainputerror)\> | Yes | Callback used to return the result. |
**Example**
```js
-captureSession.addInput(cameraInput, (err) => {
+cameraInput.on('error', (cameraInputError) => {
+ console.log('Camera input error code: ' + cameraInputError.code);
+})
+```
+
+## CameraInputErrorCode
+
+Enumerates the error codes used for camera input.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name | Value | Description |
+| ------------------------- | ---- | -------------- |
+| ERROR_UNKNOWN | -1 | Unknown error. |
+| ERROR_NO_PERMISSION | 0 | You do not have the required permission. |
+| ERROR_DEVICE_PREEMPTED | 1 | The camera is preempted. |
+| ERROR_DEVICE_DISCONNECTED | 2 | The camera is disconnected.|
+| ERROR_DEVICE_IN_USE | 3 | The camera is in use.|
+| ERROR_DRIVER_ERROR | 4 | Driver error. |
+
+## CameraInputError
+
+Defines an error object used for **[CameraInput](#camerainput)**.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name| Type | Description |
+| ---- | --------------------------------------------- | ----------------------- |
+| code | [CameraInputErrorCode](#camerainputerrorcode) | **CameraInput** error code.|
+
+
+## FlashMode
+
+Enumerates the flash modes.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name | Value | Description |
+| ---------------------- | ---- | ------------ |
+| FLASH_MODE_CLOSE | 0 | The flash is off.|
+| FLASH_MODE_OPEN | 1 | The flash is on.|
+| FLASH_MODE_AUTO | 2 | The flash mode is auto, indicating that the flash fires automatically depending on the shooting conditions.|
+| FLASH_MODE_ALWAYS_OPEN | 3 | The flash is steady on.|
+
+## ExposureMode
+
+Enumerates the exposure modes.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name | Value | Description |
+| ----------------------------- | ---- | -------------- |
+| EXPOSURE_MODE_LOCKED | 0 | Exposure locked.|
+| EXPOSURE_MODE_AUTO | 1 | Auto exposure.|
+| EXPOSURE_MODE_CONTINUOUS_AUTO | 2 | Continuous auto exposure.|
+
+## FocusMode
+
+Enumerates the focus modes.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name | Value | Description |
+| -------------------------- | ---- | -------------- |
+| FOCUS_MODE_MANUAL | 0 | Manual focus. |
+| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Continuous auto focus.|
+| FOCUS_MODE_AUTO | 2 | Auto focus. |
+| FOCUS_MODE_LOCKED | 3 | Focus locked. |
+
+## FocusState
+
+Enumerates the focus states.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name | Value | Description |
+| --------------------- | ---- | ------------ |
+| FOCUS_STATE_SCAN | 0 | Focusing. |
+| FOCUS_STATE_FOCUSED | 1 | Focused. |
+| FOCUS_STATE_UNFOCUSED | 2 | Unfocused.|
+
+## ExposureState
+
+Enumerates the exposure states.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name | Value | Description |
+| ------------------------ | ---- | ---------- |
+| EXPOSURE_STATE_SCAN | 0 | Exposing. |
+| EXPOSURE_STATE_CONVERGED | 1 | Exposure converged.|
+
+## VideoStabilizationMode
+
+Enumerates the video stabilization modes.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+| Name | Value | Description |
+| ------ | ---- | ---------------------------------------------------- |
+| OFF | 0 | Video stabilization is disabled. |
+| LOW | 1 | The basic video stabilization algorithm is used. |
+| MIDDLE | 2 | A video stabilization algorithm with a stabilization effect better than that of the **LOW** type is used. |
+| HIGH | 3 | A video stabilization algorithm with a stabilization effect better than that of the **MIDDLE** type is used.|
+| AUTO | 4 | Automatic video stabilization is used. |
+
+## CaptureSession
+
+Implements a shooting session, which saves all **[CameraInput](#camerainput)** and **[CameraOutput](#cameraoutput)** instances required to run the camera and requests the camera to complete shooting or video recording.
+
+### beginConfig
+
+beginConfig\(callback: AsyncCallback\): void
+
+Starts configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Multimedia.Camera.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| callback | AsyncCallback | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+captureSession.beginConfig((err) => {
if (err) {
- console.error('Failed to add the CameraInput instance. ${err.message}');
+ console.error('Failed to start the configuration. ${err.message}');
return;
}
- console.log('Callback invoked to indicate that the CameraInput instance is added.');
+ console.log('Callback invoked to indicate the begin config success.');
});
```
-### addInput
+### beginConfig
-addInput\(cameraInput: CameraInput\): Promise
+beginConfig\(\): Promise
-Adds a **CameraInput** instance to this **CaptureSession** instance. This API uses a promise to return the result.
+Starts configuration for this **CaptureSession** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ----------- | --------------------------- | ---- | --------------------------- |
-| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
-
**Return value**
| Type | Description |
| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
+| Promise| Promise used to return the result.|
+
**Example**
```js
-captureSession.addInput(cameraInput).then(() => {
- console.log('Promise used to indicate that the CameraInput instance is added.');
+captureSession.beginConfig().then(() => {
+ console.log('Promise returned to indicate the begin config success.');
})
```
-### addOutput
+### commitConfig
-addOutput\(previewOutput: PreviewOutput, callback: AsyncCallback\): void
+commitConfig\(callback: AsyncCallback\): void
-Adds a **PreviewOutput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+Commits the configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| ------------- | ------------------------------- | ---- | ----------------------------- |
-| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.|
-| callback | AsyncCallback | Yes | Callback used to return the result. |
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| callback | AsyncCallback | Yes | Callback used to return the result.|
**Example**
```js
-captureSession.addOutput(previewOutput, (err) => {
+captureSession.commitConfig((err) => {
if (err) {
- console.error('Failed to add the PreviewOutput instance ${err.message}');
+ console.error('Failed to commit the configuration. ${err.message}');
return;
}
- console.log('Callback invoked to indicate that the PreviewOutput instance is added.');
+ console.log('Callback invoked to indicate the commit config success.');
});
```
-### addOutput
+### commitConfig
-addOutput\(previewOutput: PreviewOutput\): Promise
+commitConfig\(\): Promise
-Adds a **PreviewOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result.
+Commits the configuration for this **CaptureSession** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ------------- | ------------------------------- | ---- | ----------------------------- |
-| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.|
-
**Return value**
| Type | Description |
| -------------- | --------------------------- |
-| Promise | Promise used to return the result.|
+| Promise| Promise used to return the result.|
**Example**
```js
-captureSession.addOutput(previewOutput).then(() => {
- console.log('Promise used to indicate that the PreviewOutput instance is added.');
+captureSession.commitConfig().then(() => {
+ console.log('Promise returned to indicate the commit config success.');
})
```
-### addOutput
+### canAddInput
-addOutput\(photoOutput: PhotoOutput, callback: AsyncCallback\): void
+canAddInput(cameraInput: CameraInput, callback: AsyncCallback): void
-Adds a **PhotoOutput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+Checks whether a **[CameraInput](#camerainput)** instance can be added to this **CaptureSession**. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1382,26 +1461,26 @@ Adds a **PhotoOutput** instance to this **CaptureSession** instance. This API us
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
-| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.|
-| callback | AsyncCallback | Yes | Callback used to return the result. |
+| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
+| callback | AsyncCallback | Yes | Callback used to return the result. |
**Example**
```js
-captureSession.addOutput(photoOutput, (err) => {
+captureSession.canAddInput(cameraInput, (err, status) => {
if (err) {
- console.error('Failed to add the PhotoOutput instance ${err.message}');
+ console.error('Can not add cameraInput. ${err.message}');
return;
}
- console.log('Callback invoked to indicate that the PhotoOutput instance is added.');
-});
+ console.log('Callback returned with cameraInput can added.');
+})
```
-### addOutput
+### canAddInput
-addOutput\(photoOutput: PhotoOutput\): Promise
+canAddInput(cameraInput: CameraInput): Promise
-Adds a **PhotoOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result.
+Checks whether a **[CameraInput](#camerainput)** instance can be added to this **CaptureSession**. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1409,27 +1488,27 @@ Adds a **PhotoOutput** instance to this **CaptureSession** instance. This API us
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
-| photoOutput | [PhotoOutput](#photooutput) | Yes | **PhotoOutput** instance to add.|
+| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
**Return value**
-| Type | Description |
-| -------------- | --------------------------- |
-| Promise\ | Promise used to return the result.|
+| Type | Description |
+| ----------------- | --------------------------- |
+| Promise | Promise used to return the result.|
**Example**
```js
-captureSession.addOutput(photoOutput).then(() => {
- console.log('Promise used to indicate that the PhotoOutput instance is added.');
+captureSession.canAddInput(cameraInput).then(() => {
+ console.log('Promise returned with cameraInput can added.');
})
```
-### addOutput
+### addInput
-addOutput\(videoOutput: VideoOutput, callback: AsyncCallback\): void
+addInput\(cameraInput: CameraInput, callback: AsyncCallback\): void
-Adds a **VideoOutput** instance to this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+Adds a **[CameraInput](#camerainput)** instance to this **CaptureSession**. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1437,26 +1516,26 @@ Adds a **VideoOutput** instance to this **CaptureSession** instance. This API us
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
-| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.|
+| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
| callback | AsyncCallback | Yes | Callback used to return the result. |
**Example**
```js
-captureSession.addOutput(videoOutput, (err) => {
+captureSession.addInput(cameraInput, (err) => {
if (err) {
- console.error('Failed to add the VideoOutput instance ${err.message}');
+ console.error('Failed to add the CameraInput instance. ${err.message}');
return;
}
- console.log('Callback invoked to indicate that the VideoOutput instance is added.');
+ console.log('Callback invoked to indicate that the CameraInput instance is added.');
});
```
-### addOutput
+### addInput
-addOutput\(videoOutput: VideoOutput\): Promise
+addInput\(cameraInput: CameraInput\): Promise
-Adds a **VideoOutput** instance to this **CaptureSession** instance. This API uses a promise to return the result.
+Adds a **[CameraInput](#camerainput)** instance to this **CaptureSession**. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1464,19 +1543,19 @@ Adds a **VideoOutput** instance to this **CaptureSession** instance. This API us
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | --------------------------- |
-| videoOutput | [VideoOutput](#videooutput) | Yes | **VideoOutput** instance to add.|
+| cameraInput | [CameraInput](#camerainput) | Yes | **CameraInput** instance to add.|
**Return value**
| Type | Description |
| -------------- | --------------------------- |
-| Promise\ | Promise used to return the result.|
+| Promise| Promise used to return the result.|
**Example**
```js
-captureSession.addOutput(videoOutput).then(() => {
- console.log('Promise used to indicate that the VideoOutput instance is added.');
+captureSession.addInput(cameraInput).then(() => {
+ console.log('Promise used to indicate that the CameraInput instance is added.');
})
```
@@ -1484,7 +1563,7 @@ captureSession.addOutput(videoOutput).then(() => {
removeInput\(cameraInput: CameraInput, callback: AsyncCallback\): void
-Removes a **CameraInput** instance from this **CaptureSession** instance. This API uses an asynchronous callback to return the result.
+Removes a **[CameraInput](#camerainput)** instance from this **CaptureSession**. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1511,7 +1590,7 @@ captureSession.removeInput(cameraInput, (err) => {
removeInput\(cameraInput: CameraInput\): Promise
-Removes a **CameraInput** instance from this **CaptureSession** instance. This API uses a promise to return the result.
+Removes a **[CameraInput](#camerainput)** instance from this **CaptureSession**. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Camera.Core
@@ -1523,9 +1602,9 @@ Removes a **CameraInput** instance from this **CaptureSession** instance. This A
**Return value**
-| Type | Description |
-| -------------- | --------------------------- |
-| Promise\ | Promise used to return the result.|
+| Type | Description |
+| --------------- | --------------------------- |
+| Promise\ | Promise used to return the result.|
**Example**
@@ -1535,174 +1614,172 @@ captureSession.removeInput(cameraInput).then(() => {
})
```
-### removeOutput
+### canAddOutput
-removeOutput\(previewOutput: PreviewOutput, callback: AsyncCallback