diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md
index 522a2d8e0de1280a26f0d416348aa665fd5062f6..ab82a4abae17e667670a2587b4016eee669abd26 100644
--- a/en/application-dev/application-models/Readme-EN.md
+++ b/en/application-dev/application-models/Readme-EN.md
@@ -21,6 +21,7 @@
- [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md)
- [InputMethodExtensionAbility](inputmethodextentionability.md)
- [WindowExtensionAbility (for System Applications Only)](windowextensionability.md)
+ - [DriverExtensionAbility](driverextensionability.md)
- Service Widget Development in Stage Model
- [Service Widget Overview](service-widget-overview.md)
- Developing an ArkTS Widget
@@ -43,6 +44,7 @@
- Widget Data Interaction
- [Widget Data Interaction Overview](arkts-ui-widget-interaction-overview.md)
- [Configuring a Widget to Update Periodically](arkts-ui-widget-update-by-time.md)
+ - [Updating Widget Content Through a Proxy](arkts-ui-widget-update-by-proxy.md)
- [Updating Local and Online Images in the Widget](arkts-ui-widget-image-update.md)
- [Updating Widget Content by State](arkts-ui-widget-update-by-status.md)
- [Updating Widget Content by Widget Host (for System Applications Only)](arkts-ui-widget-content-update.md)
@@ -62,7 +64,6 @@
- [Cross-Device Migration (for System Applications Only)](hop-cross-device-migration.md)
- [Multi-device Collaboration (for System Applications Only)](hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](subscribe-system-environment-variable-changes.md)
- - [Setting Atomic Services to Support Sharing](atomic-services-support-sharing.md)
- Process Model
- [Process Model Overview](process-model-stage.md)
- Common Events
diff --git a/en/application-dev/application-models/atomic-services-support-sharing.md b/en/application-dev/application-models/atomic-services-support-sharing.md
deleted file mode 100644
index ba99573b28c4e25ef5ed2c8ca472e559a00f4713..0000000000000000000000000000000000000000
--- a/en/application-dev/application-models/atomic-services-support-sharing.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Setting Atomic Services to Support Sharing
-## How to Develop
-
-1. An application calls [UIAbility.onShare()](../reference/apis/js-apis-app-ability-uiAbility.md#onshare), a lifecycle callback provided by the UIAbility component, to set the data to share. In this lifecycle callback, **ohos.extra.param.key.contentTitle** indicates the title of the content to share in the sharing box, **ohos.extra.param.key.shareAbstract** provides an abstract description of the content, and **ohos.extra.param.key.shareUrl** indicates the online address of the service. You need to set these three items as objects, with the key set to **title**, **abstract**, and **url**, respectively.
-
- ```ts
- import AbilityConstant from '@ohos.app.ability.AbilityConstant';
- class MyUIAbility extends UIAbility {
- onShare(wantParams) {
- console.log('onShare');
- wantParams['ohos.extra.param.key.contentTitle'] = {title: "OA"};
- wantParams['ohos.extra.param.key.shareAbstract'] = {abstract: "communication for company employee"};
- wantParams['ohos.extra.param.key.shareUrl'] = {url: "oa.example.com"};
- }
- }
- ```
-
-2. A system dialog box calls [abilityManager.acquireShareData()](../reference/apis/js-apis-app-ability-abilityManager.md#acquiresharedata) to obtain data shared through atomic service sharing. Specifically, the system finds the UIAbility based on the mission ID and calls the **OnShare()** lifecycle of the UIAbility to obtain the shared data.
-
- ```ts
- import abilityManager from '@ohos.app.ability.abilityManager';
- try {
- abilityManager.acquireShareData(1, (err, wantParam) => {
- if (err) {
- console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`);
- } else {
- console.log(`acquireShareData success, data: ${JSON.stringify(wantParam)}`);
- }
- });
- } catch (paramError) {
- console.error(`error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}`);
- }
- ```
diff --git a/en/application-dev/napi/Readme-EN.md b/en/application-dev/napi/Readme-EN.md
index ad566d55f740fd7ada74fe22b95e0f1824271c2d..43049f368af41f388e6c618f3375d6a72c88d897 100644
--- a/en/application-dev/napi/Readme-EN.md
+++ b/en/application-dev/napi/Readme-EN.md
@@ -1,11 +1,20 @@
# Native APIs
- [Using Native APIs in Application Projects](napi-guidelines.md)
-- [Drawing Development](drawing-guidelines.md)
-- [Raw File Development](rawfile-guidelines.md)
-- [Native Window Development](native-window-guidelines.md)
-- [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md)
-- [Using MindSpore Lite for Offline Model Conversion and Inference](mindspore-lite-offline-model-guidelines.md)
-- [Connecting the Neural Network Runtime to an AI Inference Framework](neural-network-runtime-guidelines.md)
-- [Purgeable Memory Development](purgeable-memory-guidelines.md)
-- [USB DDK Development](usb-ddk-guidelines.md)
\ No newline at end of file
+- Graphics
+ - [Drawing Development](drawing-guidelines.md)
+ - [NativeBuffer Development](native-buffer-guidelines.md)
+ - [NativeImage Development](native-image-guidelines.md)
+ - [NativeVsync Development](native-vsync-guidelines.md)
+ - [NativeWindow Development](native-window-guidelines.md)
+ - [Vulkan Development](vulkan-guidelines.md)
+- Resource Management
+ - [Raw File Development](rawfile-guidelines.md)
+- AI
+ - [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md)
+ - [Using MindSpore Lite for Offline Model Conversion and Inference](mindspore-lite-offline-model-guidelines.md)
+ - [Connecting the Neural Network Runtime to an AI Inference Framework](neural-network-runtime-guidelines.md)
+- Memory Management
+ - [Purgeable Memory Development](purgeable-memory-guidelines.md)
+- Device Management
+ - [USB DDK Development](usb-ddk-guidelines.md)
diff --git a/en/application-dev/quick-start/arkts/introduction-to-arkts.md b/en/application-dev/quick-start/introduction-to-arkts.md
similarity index 99%
rename from en/application-dev/quick-start/arkts/introduction-to-arkts.md
rename to en/application-dev/quick-start/introduction-to-arkts.md
index 79a3067e39ffbb4cf4a8addd6e89bf39d0a6d110..88a0cb306220caf5f5ebcb0fea8eaf0c9db6f674 100644
--- a/en/application-dev/quick-start/arkts/introduction-to-arkts.md
+++ b/en/application-dev/quick-start/introduction-to-arkts.md
@@ -1674,7 +1674,7 @@ between the GUI components.
The following example provides a complete ArkUI-based application as an
illustration of GUI programming capabilities. For more details about ArkUI
features, please refer to the ArkUI
-[tutorial](../arkts-get-started.md).
+[tutorial](arkts-get-started.md).
```typescript
// ViewModel classes ---------------------------
diff --git a/en/application-dev/quick-start/arkts/typescript-to-arkts-migration-guide.md b/en/application-dev/quick-start/typescript-to-arkts-migration-guide.md
similarity index 100%
rename from en/application-dev/quick-start/arkts/typescript-to-arkts-migration-guide.md
rename to en/application-dev/quick-start/typescript-to-arkts-migration-guide.md
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index ebd765ee860491b9d070acc72252c43319509b5d..cc95f18bea02638e473d14ac31d585b12a9ca45a 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -8,6 +8,7 @@
- [@ohos.app.ability.AbilityConstant (AbilityConstant)](js-apis-app-ability-abilityConstant.md)
- [@ohos.app.ability.abilityLifecycleCallback (AbilityLifecycleCallback)](js-apis-app-ability-abilityLifecycleCallback.md)
- [@ohos.app.ability.AbilityStage (AbilityStage)](js-apis-app-ability-abilityStage.md)
+ - [@ohos.app.ability.ApplicationStateChangeCallback (ApplicationStateChangeCallback)](js-apis-app-ability-applicationStateChangeCallback.md)
- [@ohos.app.ability.common (Context)](js-apis-app-ability-common.md)
- [@ohos.app.ability.contextConstant (ContextConstant)](js-apis-app-ability-contextConstant.md)
- [@ohos.app.ability.EnvironmentCallback (EnvironmentCallback)](js-apis-app-ability-environmentCallback.md)
@@ -151,8 +152,19 @@
- [Common Events of the Bundle Management Subsystem](common_event/commonEvent-bundleManager.md)
- [Common Events of the Notification Service](common_event/commonEvent-ans.md)
- [Common Events of the Resource Scheduler Subsystem](common_event/commonEvent-resourceschedule.md)
+ - [Common Events of the Window Management Subsystem](common_event/commonEvent-window.md)
+ - [Common Events of the Network Management Subsystem](common_event/commonEvent-netmanager.md)
+ - [Common Events of the SMS Application](common_event/commonEvent-mms.md)
- [Common Events of the Telephony Subsystem](common_event/commonEvent-telephony.md)
+ - [Common Events of the Power Management Subsystem](common_event/commonEvent-powermgr.md)
+ - [Common Events of the NFC Subsystem](common_event/commonEvent-nfc.md)
+ - [Common Events of the Wi-Fi Subsystem](common_event/commonEvent-wifi.md)
- [Common Events of the USB Subsystem](common_event/commonEvent-usb.md)
+ - [Common Events of the File Management Subsystem](common_event/commonEvent-filemanagement.md)
+ - [Common Events of the Theme Framework - Lock Screen](common_event/commonEvent-screenlock.md)
+ - [Common Events of the Time and Time Zone Subsystem](common_event/commonEvent-time.md)
+ - [Common Events of the Account Subsystem](common_event/commonEvent-account.md)
+
- Bundle Management
- [@ohos.bundle.appControl (appControl)](js-apis-appControl.md)
- [@ohos.bundle.bundleManager (bundleManager)](js-apis-bundleManager.md)
@@ -186,7 +198,10 @@
- UI Page
- [@ohos.animator (Animator)](js-apis-animator.md)
- [@ohos.arkui.componentSnapshot (Component Snapshot)](js-apis-arkui-componentSnapshot.md)
+ - [@ohos.arkui.dragController (DragController)](js-apis-arkui-dragController.md)
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](js-apis-arkui-drawableDescriptor.md)
+ - [@ohos.arkui.inspector (Layout Callback)](js-apis-arkui-inspector.md)
+ - [@ohos.arkui.UIContext (UIContext)](js-apis-arkui-UIContext.md)
- [@ohos.curves (Interpolation Calculation)](js-apis-curve.md)
- [@ohos.font (Custom Font Registration)](js-apis-font.md)
- [@ohos.matrix4 (Matrix Transformation)](js-apis-matrix4.md)
@@ -208,6 +223,7 @@
- webgl
- [WebGL](js-apis-webgl.md)
- [WebGL2](js-apis-webgl2.md)
+
- Multimedia
- [@ohos.multimedia.audio (Audio Management)](js-apis-audio.md)
- [@ohos.multimedia.avsession (AVSession Management)](js-apis-avsession.md)
@@ -267,6 +283,7 @@
- [@ohos.file.fileuri (File URI)](js-apis-file-fileuri.md)
- [@ohos.file.fs (File Management)](js-apis-file-fs.md)
- [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md)
+ - [@ohos.file.photoAccessHelper (Album Management)](js-apis-photoAccessHelper.md)
- [@ohos.file.picker (File Picker)](js-apis-file-picker.md)
- [@ohos.file.securityLabel (Data Label)](js-apis-file-securityLabel.md)
- [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md)
@@ -275,6 +292,9 @@
- [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md)
- [@ohos.fileshare (File Sharing)](js-apis-fileShare.md)
+- AI
+ - [@ohos.ai.mindSporeLite (Inference)](js-apis-mindSporeLite.md)
+
- Telephony Service
- [@ohos.contact (Contacts)](js-apis-contact.md)
- [@ohos.telephony.call (Call)](js-apis-call.md)
@@ -288,6 +308,7 @@
- [@ohos.net.connection (Network Connection Management)](js-apis-net-connection.md)
- [@ohos.net.ethernet (Ethernet Connection Management)](js-apis-net-ethernet.md)
- [@ohos.net.http (Data Request)](js-apis-http.md)
+ - [@ohos.net.policy (Network Policy Management)](js-apis-net-policy.md)
- [@ohos.net.mdns (mDNS Management)](js-apis-net-mdns.md)
- [@ohos.net.sharing (Network Sharing)](js-apis-net-sharing.md)
- [@ohos.net.socket (Socket Connection)](js-apis-socket.md)
@@ -296,14 +317,24 @@
- [@ohos.request (Upload and Download)](js-apis-request.md)
- Connectivity
+ - [@ohos.bluetooth.a2dp (Bluetooth a2dp Module)(Recommended)](js-apis-bluetooth-a2dp.md)
+ - [@ohos.bluetooth.access (Bluetooth access Module)(Recommended)](js-apis-bluetooth-access.md)
+ - [@ohos.bluetooth.baseProfile (Bluetooth baseProfile Module)(Recommended)](js-apis-bluetooth-baseProfile.md)
+ - [@ohos.bluetooth.ble (Bluetooth ble Module)(Recommended)](js-apis-bluetooth-ble.md)
+ - [@ohos.bluetooth.connection (Bluetooth connection Module)(Recommended)](js-apis-bluetooth-connection.md)
+ - [@ohos.bluetooth.constant (Bluetooth constant Module)(Recommended)](js-apis-bluetooth-constant.md)
+ - [@ohos.bluetooth.hfp (Bluetooth hfp Module)(Recommended)](js-apis-bluetooth-hfp.md)
+ - [@ohos.bluetooth.hid (Bluetooth hid Module)(Recommended)(js-apis-bluetooth-hid.md)
+ - [@ohos.bluetooth.pan (Bluetooth pan Module)(Recommended)](js-apis-bluetooth-pan.md)
+ - [@ohos.bluetooth.socket (Bluetooth socket Module)(Recommended)](js-apis-bluetooth-socket.md)
- [@ohos.bluetooth (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetooth.md)
- - [@ohos.bluetoothManager (Bluetooth) (Recommended)](js-apis-bluetoothManager.md)
+ - [@ohos.bluetoothManager (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetoothManager.md)
- [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md)
- [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md)
- [@ohos.nfc.controller (Standard NFC)](js-apis-nfcController.md)
- [@ohos.nfc.tag (Standard NFC Tags)](js-apis-nfcTag.md)
- [@ohos.rpc (RPC)](js-apis-rpc.md)
- - [@ohos.secureElement (SE Channel Management)](js-apis-secureElement.md)
+ - [@ohos.secureElement (SE Management)](js-apis-secureElement.md)
- [@ohos.wifiManager (WLAN) (Recommended)](js-apis-wifiManager.md)
- [@ohos.wifiManagerExt (WLAN Extension) (Recommended)](js-apis-wifiManagerExt.md)
- [@ohos.wifi (WLAN) (To Be Deprecated Soon)](js-apis-wifi.md)
@@ -318,6 +349,7 @@
- [@ohos.accessibility.GesturePath (Gesture Path)](js-apis-accessibility-GesturePath.md)
- [@ohos.accessibility.GesturePoint (Gesture Point)](js-apis-accessibility-GesturePoint.md)
- [@ohos.application.AccessibilityExtensionAbility (AccessibilityExtensionAbility)](js-apis-application-accessibilityExtensionAbility.md)
+ - [@ohos.base (Public Callback Information)](js-apis-base.md)
- [@ohos.faultLogger (FaultLogger)](js-apis-faultLogger.md)
- [@ohos.hichecker (HiChecker)](js-apis-hichecker.md)
- [@ohos.hidebug (HiDebug)](js-apis-hidebug.md)
@@ -337,6 +369,7 @@
- [@ohos.systemDateTime (System Time and Time Zone)](js-apis-system-date-time.md)
- [@ohos.systemTimer (System Timer)](js-apis-system-timer.md)
- [@ohos.wallpaper (Wallpaper)](js-apis-wallpaper.md)
+ - [@ohos.WallpaperExtensionAbility (WallpaperExtensionAbility)](js-apis-WallpaperExtensionAbility.md)
- [@ohos.web.webview (Webview)](js-apis-webview.md)
- [Console](js-apis-logs.md)
- [Timer](js-apis-timer.md)
@@ -345,6 +378,7 @@
- [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md)
- Device Management
+ - [@ohos.app.ability.DriverExtensionAbility (DriverExtensionAbility)](js-apis-app-ability-driverExtensionAbility.md)
- [@ohos.batteryInfo (Battery Information)](js-apis-battery-info.md)
- [@ohos.batteryStatistics (Battery Statistics)](js-apis-batteryStatistics.md)
- [@ohos.brightness (Screen Brightness)](js-apis-brightness.md)
@@ -356,6 +390,7 @@
- [@ohos.distributedHardware.deviceManager (Device Management)](js-apis-device-manager.md)
- [@ohos.driver.deviceManager (Peripheral Management)](js-apis-driver-deviceManager.md)
- [@ohos.geoLocationManager (Geolocation Manager)](js-apis-geoLocationManager.md)
+ - [@ohos.multimodalInput.gestureEvent (Gesture Input Event)](js-apis-multimodalinput-gestureevent.md)
- [@ohos.multimodalInput.inputConsumer (Input Consumer)](js-apis-inputconsumer.md)
- [@ohos.multimodalInput.inputDevice (Input Device)](js-apis-inputdevice.md)
- [@ohos.multimodalInput.inputDeviceCooperate (Screen Hopping) (To Be Deprecated Soon)](js-apis-cooperate.md)
@@ -380,10 +415,12 @@
- [@ohos.update (Update)](js-apis-update.md)
- [@ohos.usbManager (USB Manager)](js-apis-usbManager.md)
- [@ohos.vibrator (Vibrator)](js-apis-vibrator.md)
+ - application
+ - [DriverExtensionContext](js-apis-inner-application-driverExtensionContext.md)
- Account Management
- [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md)
- - [@ohos.account.appAccount.AuthorizationExtensionAbility (App Account AuthorizationExtensionAbility)](js-apis-appAccount-authorizationExtensionAbility.md)
+ - [@ohos.account.appAccount.AuthorizationExtensionAbility (App AuthorizationExtensionAbility)](js-apis-appAccount-authorizationExtensionAbility.md)
- [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md)
- [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md)
@@ -391,6 +428,7 @@
- [@ohos.configPolicy (Configuration Policy)](js-apis-configPolicy.md)
- Enterprise Device Management
+ - [Enterprise Device Management Overview (for System Applications Only)](enterpriseDeviceManagement-overview.md)
- [@ohos.enterprise.accountManager(Account Management)](js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (Enterprise Device Management)](js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.applicationManager (Application Management)](js-apis-enterprise-applicationManager.md)
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-a2dp.md b/en/application-dev/reference/apis/js-apis-bluetooth-a2dp.md
new file mode 100644
index 0000000000000000000000000000000000000000..ee1d29a240b2d718744ac1935196ae118116fab4
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-a2dp.md
@@ -0,0 +1,184 @@
+# @ohos.bluetooth.a2dp (Bluetooth A2DP Module)
+
+The **a2dp** module provides APIs for using the Bluetooth Advanced Audio Distribution Profile (A2DP), which defines how to stream high quality audio from one device to another over a Bluetooth connection.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+```
+
+
+## a2dp.createA2dpSrcProfile
+
+createA2dpSrcProfile(): A2dpSourceProfile
+
+Creates an **A2dpSrcProfile** instance.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | ---------- |
+| A2dpSourceProfile | **A2dpSrcProfile** instance created.|
+
+**Example**
+
+```js
+try {
+ let a2dpProfile = a2dp.createA2dpSrcProfile();
+ console.info('a2dp success');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## A2dpSourceProfile
+
+Provides APIs for using the A2DP. Before using any API of **A2dpSourceProfile**, you need to create an instance of this class by using **createA2dpSrcProfile()**.
+
+
+### connect
+
+connect(deviceId: string): void
+
+Connects to an A2DP device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the device to connect. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ a2dpSrc.connect('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### disconnect
+
+disconnect(deviceId: string): void
+
+Disconnects from an A2DP device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the device to disconnect. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### getPlayingState
+
+getPlayingState(deviceId: string): PlayingState
+
+Obtains the playing state of a device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| device | string | Yes | Address of the remote device.|
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | ---------- |
+| [PlayingState](#PlayingState) | Playing state of the remote device obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+## PlayingState
+
+Enumerates the A2DP playing states.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ----------------- | ------ | ------- |
+| STATE_NOT_PLAYING | 0x0000 | Not playing. |
+| STATE_PLAYING | 0x0001 | Playing.|
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-access.md b/en/application-dev/reference/apis/js-apis-bluetooth-access.md
new file mode 100644
index 0000000000000000000000000000000000000000..fbbfd0a64400ab98a13d0d6cef0c50e7387562b5
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-access.md
@@ -0,0 +1,206 @@
+# @ohos.bluetooth.access (Bluetooth Access Module)
+
+The **access** module provides APIs for enabling and disabling Bluetooth and obtaining the Bluetooth status.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+## Modules to Import
+
+```js
+import access from '@ohos.bluetooth.access';
+```
+
+
+## access.enableBluetooth
+
+enableBluetooth(): void
+
+Enables Bluetooth.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message |
+| -------- | ------------------ |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ access.enableBluetooth();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## access.disableBluetooth
+
+disableBluetooth(): void
+
+Disables Bluetooth.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+|ID | Error Message |
+| -------- | ------------------ |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ access.disableBluetooth();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## access.getState
+
+getState(): BluetoothState
+
+Obtains the Bluetooth state.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| --------------------------------- | ---------------- |
+| [BluetoothState](#bluetoothstate) | Bluetooth state obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+|ID | Error Message |
+| -------- | ------------------ |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let state = access.getState();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## access.on('stateChange')
+
+on(type: "stateChange", callback: Callback<BluetoothState>): void
+
+Subscribes to Bluetooth state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------------------------------------------------- | ----- | ---------------------------------------------------------- |
+| type | string | Yes | Event type. The value is **stateChange**, which indicates a Bluetooth state change event. |
+| callback | Callback<[BluetoothState](#bluetoothstate)> | Yes | Callback invoked to return the Bluetooth state. You need to implement this callback.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+|ID | Error Message |
+| -------- | ------------------ |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('bluetooth state = '+ JSON.stringify(data));
+}
+try {
+ access.on('stateChange', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## access.off('stateChange')
+
+off(type: "stateChange", callback?: Callback<BluetoothState>): void
+
+Unsubscribes from Bluetooth state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **stateChange**, which indicates a Bluetooth state change event. |
+| callback | Callback<[BluetoothState](#bluetoothstate)> | No | Callback for the Bluetooth state change event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('bluetooth state = '+ JSON.stringify(data));
+}
+try {
+ access.on('stateChange', onReceiveEvent);
+ access.off('stateChange', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## BluetoothState
+
+Enumerates the Bluetooth states.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| --------------------- | ---- | ------------------ |
+| STATE_OFF | 0 | Bluetooth is turned off. |
+| STATE_TURNING_ON | 1 | Bluetooth is being turned on. |
+| STATE_ON | 2 | Bluetooth is turned on. |
+| STATE_TURNING_OFF | 3 | Bluetooth is being turned off. |
+| STATE_BLE_TURNING_ON | 4 | The LE-only mode is being turned on for Bluetooth.|
+| STATE_BLE_ON | 5 | Bluetooth is in LE-only mode. |
+| STATE_BLE_TURNING_OFF | 6 | The LE-only mode is being turned off for Bluetooth.|
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-baseProfile.md b/en/application-dev/reference/apis/js-apis-bluetooth-baseProfile.md
new file mode 100644
index 0000000000000000000000000000000000000000..74789b23af6367fa6f549d20ac49abe1e7a1c938
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-baseProfile.md
@@ -0,0 +1,388 @@
+# @ohos.bluetooth.baseProfile (Bluetooth baseProfile Module)
+
+The **baseProfile** module provides APIs for using basic Bluetooth profiles.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import baseProfile from '@ohos.bluetooth.baseProfile';
+```
+
+
+## ConnectionStrategy
+
+Enumerates the profile connection strategies.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| -------------------------------- | ------ | --------------- |
+| CONNECTION_STRATEGY_UNSUPPORTED | 0 | Default connection strategy to use when the device is not paired.
This is a system API.|
+| CONNECTION_STRATEGY_ALLOWED | 1 | Connection strategy to use when the device is allowed to accept or initiate pairing.
This is a system API.|
+| CONNECTION_STRATEGY_FORBIDDEN | 2 | Connection strategy to use when the device is not allowed to accept or initiate pairing.
This is a system API. |
+
+
+## StateChangeParam
+
+Represents the profile state change parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable| Writable| Description |
+| -------- | ----------------------------- | ---- | ---- | ------------------------------- |
+| deviceId | string | Yes | No | Address of the Bluetooth device. |
+| state | ProfileConnectionState | Yes | No | Profile connection state of the device.|
+
+
+## baseProfile.setConnectionStrategy
+
+setConnectionStrategy(deviceId: string, strategy: ConnectionStrategy, callback: AsyncCallback<void>): void
+
+Sets the profile connection strategy for this device. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
+| strategy | [ConnectionStrategy](#connectionstrategy) | Yes |Profile connection strategy to set.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ let setRet = a2dpSrc.setConnectionStrategy('XX:XX:XX:XX:XX:XX', 0, (err, data) => {
+ console.info('setConnectionStrategy, err: ' + JSON.stringify(err) + ', data: ' + JSON.stringify(data));
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+## baseProfile.setConnectionStrategy
+
+setConnectionStrategy(deviceId: string, strategy: ConnectionStrategy): Promise<void>
+
+Sets the profile connection strategy for this device. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
+| strategy | [ConnectionStrategy](#connectionstrategy) | Yes |Profile connection strategy to set.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ let setRet = a2dpSrc.setConnectionStrategy('XX:XX:XX:XX:XX:XX', 1).then((data) => {
+ console.info('setConnectionStrategy');
+ }, (err) => {
+ console.error('setConnectionStrategy errCode: ' + err.code + ', errMessage: ' + err.message);
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+## baseProfile.getConnectionStrategy
+
+getConnectionStrategy(deviceId: string, callback: AsyncCallback<ConnectionStrategy>): void
+
+Obtains the profile connection strategy. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
+| callback | AsyncCallback<[ConnectionStrategy](#connectionstrategy)> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ let setRet = a2dpSrc.getConnectionStrategy('XX:XX:XX:XX:XX:XX', 0, (err, data) => {
+ console.info('getConnectionStrategy, err: ' + JSON.stringify(err) + ', data: ' + JSON.stringify(data));
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+## baseProfile.getConnectionStrategy
+
+getConnectionStrategy(deviceId: string): Promise<ConnectionStrategy>
+
+Obtains the profile connection strategy. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<[ConnectionStrategy](#connectionstrategy)> | Promise used to return the profile connection strategy obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ let setRet = a2dpSrc.getConnectionStrategy('XX:XX:XX:XX:XX:XX', 1).then((data) => {
+ console.info('getConnectionStrategy');
+ }, (error) => {
+ console.error('getConnectionStrategy errCode: ' + err.code + ', errMessage: ' + err.message);
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## baseProfile.getConnectedDevices
+
+getConnectedDevices(): Array<string>
+
+Obtains the connected devices.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------- |
+| Array<string> | Addresses of the connected devices.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ let retArray = a2dpSrc.getConnectedDevices();
+} catch (err) {
+ console.error("errCode:" + err.code + ",errMessage:" + err.message);
+}
+```
+
+
+## baseProfile.getConnectionState
+
+getConnectionState(deviceId: string): ProfileConnectionState
+
+Obtains the profile connection state of a device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the remote device.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------- | ----------------------- |
+| [ProfileConnectionState](js-apis-bluetooth-constant.md#profileconnectionstate) | Profile connection state obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ let ret = a2dpSrc.getConnectionState('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## baseProfile.on('connectionStateChange')
+
+on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void
+
+Subscribes to profile connection state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **connectionStateChange**, which indicates a profile connection state change event.|
+| callback | Callback<[StateChangeParam](#statechangeparam)> | Yes | Callback invoked to return the profile connection state change. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ function onReceiveEvent(data) {
+ console.info('a2dp state = '+ JSON.stringify(data));
+ }
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ a2dpSrc.on('connectionStateChange', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## baseProfile.off('connectionStateChange')
+
+off(type: 'connectionStateChange', callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
+
+Unsubscribes from profile connection state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **connectionStateChange**, which indicates a profile connection state change event.|
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the profile connection state change. |
+
+**Example**
+
+```js
+import a2dp from '@ohos.bluetooth.a2dp';
+try {
+ function onReceiveEvent(data) {
+ console.info('a2dp state = '+ JSON.stringify(data));
+ }
+ let a2dpSrc = a2dp.createA2dpSrcProfile();
+ a2dpSrc.on('connectionStateChange', onReceiveEvent);
+ a2dpSrc.off('connectionStateChange', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-ble.md b/en/application-dev/reference/apis/js-apis-bluetooth-ble.md
new file mode 100644
index 0000000000000000000000000000000000000000..4036451fc4941e9b047de860c4172bfa48076138
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-ble.md
@@ -0,0 +1,2539 @@
+# @ohos.bluetooth.ble (Bluetooth BLE Module)
+
+The **ble** module provides APIs for accessing the Bluetooth personal area network.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import ble from '@ohos.bluetooth.ble';
+```
+
+
+## ble.createGattServer
+
+createGattServer(): GattServer
+
+Creates a **GattServer** instance.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | ---------- |
+| GattServer | **GattServer** instance created.|
+
+**Example**
+
+```js
+let gattServer = ble.createGattServer();
+console.info('gatt success');
+```
+
+
+## ble.createGattClientDevice
+
+createGattClientDevice(deviceId: string): GattClientDevice
+
+Creates a **GattClientDevice** instance.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ------------------------------------ |
+| deviceId | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------- | ------------------------------------ |
+| [GattClientDevice](#gattclientdevice) | **GattClientDevice** instance created. Before using an API of the client, you must create a **GattClientDevice** instance.|
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## ble.getConnectedBLEDevices
+
+getConnectedBLEDevices(): Array<string>
+
+Obtains the Bluetooth Low Energy (BLE) devices connected to this device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------- |
+| Array<string> | Addresses of the BLE devices connected to this device.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let result = ble.getConnectedBLEDevices();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## ble.startBLEScan
+
+startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void
+
+Starts a BLE scan.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------- | -------------------------------------- | ---- | ----------------------------------- |
+| filters | Array<[ScanFilter](#scanfilter)> | Yes | Criteria for filtering the scan result. Set this parameter to **null** if you do not want to filter the scan result.|
+| options | [ScanOptions](#scanoptions) | No | Scan options. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('BLE scan device find result = '+ JSON.stringify(data));
+}
+try {
+ ble.on("BLEDeviceFind", onReceiveEvent);
+ ble.startBLEScan(
+ [{
+ deviceId:"XX:XX:XX:XX:XX:XX",
+ name:"test",
+ serviceUuid:"00001888-0000-1000-8000-00805f9b34fb"
+ }],
+ {
+ interval: 500,
+ dutyMode: ble.ScanDuty.SCAN_MODE_LOW_POWER,
+ matchMode: ble.MatchMode.MATCH_MODE_AGGRESSIVE,
+ }
+ );
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## ble.stopBLEScan
+
+stopBLEScan(): void
+
+Stops the BLE scan.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ ble.stopBLEScan();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## ble.startAdvertising
+
+startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void
+
+Starts BLE advertising.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------------------------------------- | ---- | -------------- |
+| setting | [AdvertiseSetting](#advertisesetting) | Yes | Settings related to BLE advertising. |
+| advData | [AdvertiseData](#advertisedata) | Yes | Content of the BLE advertisement packet. |
+| advResponse | [AdvertiseData](#advertisedata) | No | Response to the BLE scan request.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let manufactureValueBuffer = new Uint8Array(4);
+manufactureValueBuffer[0] = 1;
+manufactureValueBuffer[1] = 2;
+manufactureValueBuffer[2] = 3;
+manufactureValueBuffer[3] = 4;
+
+let serviceValueBuffer = new Uint8Array(4);
+serviceValueBuffer[0] = 4;
+serviceValueBuffer[1] = 6;
+serviceValueBuffer[2] = 7;
+serviceValueBuffer[3] = 8;
+console.info('manufactureValueBuffer = '+ JSON.stringify(manufactureValueBuffer));
+console.info('serviceValueBuffer = '+ JSON.stringify(serviceValueBuffer));
+try {
+ ble.startAdvertising({
+ interval:150,
+ txPower:0,
+ connectable:true,
+ },{
+ serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"],
+ manufactureData:[{
+ manufactureId:4567,
+ manufactureValue:manufactureValueBuffer.buffer
+ }],
+ serviceData:[{
+ serviceUuid:"00001888-0000-1000-8000-00805f9b34fb",
+ serviceValue:serviceValueBuffer.buffer
+ }],
+ },{
+ serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"],
+ manufactureData:[{
+ manufactureId:1789,
+ manufactureValue:manufactureValueBuffer.buffer
+ }],
+ serviceData:[{
+ serviceUuid:"00001889-0000-1000-8000-00805f9b34fb",
+ serviceValue:serviceValueBuffer.buffer
+ }],
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## ble.stopAdvertising
+
+stopAdvertising(): void
+
+Stops BLE advertising.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ ble.stopAdvertising();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## ble.on('BLEDeviceFind')
+
+on(type: 'BLEDeviceFind', callback: Callback<Array<ScanResult>>): void
+
+Subscribes to BLE device discovery events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ----------------------------------- |
+| type | string | Yes | Event type. The value is **BLEDeviceFind**, which indicates an event of discovering a BLE device. |
+| callback | Callback<Array<[ScanResult](#scanresult)>> | Yes | Callback invoked to return the discovered devices. You need to implement this callback.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('bluetooth device find = '+ JSON.stringify(data));
+}
+try {
+ ble.on('BLEDeviceFind', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## ble.off('BLEDeviceFind')
+
+off(type: 'BLEDeviceFind', callback?: Callback<Array<ScanResult>>): void
+
+Unsubscribes from BLE device discovery events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **BLEDeviceFind**, which indicates an event of discovering a BLE device. |
+| callback | Callback<Array<[ScanResult](#scanresult)>> | No | Callback for the **BLEDeviceFind** event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('bluetooth device find = '+ JSON.stringify(data));
+}
+try {
+ ble.on('BLEDeviceFind', onReceiveEvent);
+ ble.off('BLEDeviceFind', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## GattServer
+
+Implements the Generic Attribute Profile (GATT) server. Before using an API of this class, you need to create a **GattServer** instance using **createGattServer()**.
+
+
+### addService
+
+addService(service: GattService): void
+
+Adds a service to this GATT server.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------- | --------------------------- | ---- | ------------------------ |
+| service | [GattService](#gattservice) | Yes | Service to add. Settings related to BLE advertising.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// Create descriptors.
+let descriptors = [];
+let arrayBuffer = new ArrayBuffer(8);
+let descV = new Uint8Array(arrayBuffer);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+descriptors[0] = descriptor;
+
+// Create characteristics.
+let characteristics = [];
+let arrayBufferC = new ArrayBuffer(8);
+let cccV = new Uint8Array(arrayBufferC);
+cccV[0] = 1;
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
+let characteristicN = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
+characteristics[0] = characteristic;
+
+// Create a gattService instance.
+let gattService = {serviceUuid:'00001810-0000-1000-8000-00805F9B34FB', isPrimary: true, characteristics:characteristics, includeServices:[]};
+
+try {
+ gattServer.addService(gattService);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### removeService
+
+removeService(serviceUuid: string): void
+
+Removes a service from this GATT server.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | ---------------------------------------- |
+| serviceUuid | string | Yes | Universally unique identifier (UUID) of the service to remove, for example, **00001810-0000-1000-8000-00805F9B34FB**.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let server = ble.createGattServer();
+try {
+ server.removeService('00001810-0000-1000-8000-00805F9B34FB');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### close
+
+close(): void
+
+Closes this GATT server to unregister it from the protocol stack. The closed [GattServer](#gattserver) instance will no longer be used.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let server = ble.createGattServer();
+try {
+ server.close();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### notifyCharacteristicChanged
+
+notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic, callback: AsyncCallback<void>): void
+
+Notifies a connected client device when a characteristic value changes. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------------- | ---------------------------------------- | ---- | --------------------------------------- |
+| deviceId | string | Yes | Address of the client that receives the notifications, for example, XX:XX:XX:XX:XX:XX.|
+| notifyCharacteristic | [NotifyCharacteristic](#notifycharacteristic) | Yes | New characteristic value. |
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let arrayBufferC = new ArrayBuffer(8);
+let notifyCharacter = {
+ "serviceUuid": '00001810-0000-1000-8000-00805F9B34FB',
+ "characteristicUuid": '00001820-0000-1000-8000-00805F9B34FB',
+ "characteristicValue": arrayBufferC,
+ "confirm": true,
+};
+try {
+ gattServer.notifyCharacteristicChanged('XX:XX:XX:XX:XX:XX', notifyCharacter, (err) => {
+ if (err) {
+ console.info('notifyCharacteristicChanged callback failed');
+ } else {
+ console.info('notifyCharacteristicChanged callback successful');
+ }
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### notifyCharacteristicChanged
+
+notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): Promise<void>
+
+Notifies a connected client device when a characteristic value changes. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------------- | ---------------------------------------- | ---- | --------------------------------------- |
+| deviceId | string | Yes | Address of the client that receives the notifications, for example, XX:XX:XX:XX:XX:XX.|
+| notifyCharacteristic | [NotifyCharacteristic](#notifycharacteristic) | Yes | New characteristic value. |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let arrayBufferC = new ArrayBuffer(8);
+let notifyCharacter = {
+ "serviceUuid": '00001810-0000-1000-8000-00805F9B34FB',
+ "characteristicUuid": '00001820-0000-1000-8000-00805F9B34FB',
+ "characteristicValue": arrayBufferC,
+ "confirm": true,
+};
+try {
+ gattServer.notifyCharacteristicChanged('XX:XX:XX:XX:XX:XX', notifyCharacter).then(() => {
+ console.info('notifyCharacteristicChanged promise successfull');
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### sendResponse
+
+sendResponse(serverResponse: ServerResponse): void
+
+Sends a response to a read or write request from the GATT client.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------- | ---- | --------------- |
+| serverResponse | [ServerResponse](#serverresponse) | Yes | Response returned by the GATT server.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+/* send response */
+let arrayBufferCCC = new ArrayBuffer(8);
+let cccValue = new Uint8Array(arrayBufferCCC);
+cccValue[0] = 1123;
+let serverResponse = {
+ 'deviceId': 'XX:XX:XX:XX:XX:XX',
+ 'transId': 0,
+ 'status': 0,
+ 'offset': 0,
+ 'value': arrayBufferCCC,
+};
+try {
+ gattServer.sendResponse(serverResponse);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### on('characteristicRead')
+
+on(type: 'characteristicRead', callback: Callback<CharacteristicReadRequest>): void
+
+Subscribes to characteristic read request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------------- |
+| type | string | Yes | Event type. The value is **characteristicRead**, which indicates a characteristic read request event.|
+| callback | Callback<[CharacteristicReadRequest](#characteristicreadrequest)> | Yes | Callback invoked to return a characteristic read request event from the GATT client. |
+
+**Example**
+
+```js
+let arrayBufferCCC = new ArrayBuffer(8);
+let cccValue = new Uint8Array(arrayBufferCCC);
+cccValue[0] = 1123;
+function ReadCharacteristicReq(CharacteristicReadRequest) {
+ let deviceId = CharacteristicReadRequest.deviceId;
+ let transId = CharacteristicReadRequest.transId;
+ let offset = CharacteristicReadRequest.offset;
+ let characteristicUuid = CharacteristicReadRequest.characteristicUuid;
+
+ let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferCCC};
+
+ try {
+ gattServer.sendResponse(serverResponse);
+ } catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+ }
+}
+gattServer.on('characteristicRead', ReadCharacteristicReq);
+```
+
+
+### off('characteristicRead')
+
+off(type: 'characteristicRead', callback?: Callback<CharacteristicReadRequest>): void
+
+Unsubscribes from characteristic read request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **characteristicRead**, which indicates a characteristic read request event. |
+| callback | Callback<[CharacteristicReadRequest](#characteristicreadrequest)> | No | Callback for the characteristic read request event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+gattServer.off('characteristicRead');
+```
+
+
+### on('characteristicWrite')
+
+on(type: 'characteristicWrite', callback: Callback<CharacteristicWriteRequest>): void
+
+Subscribes to characteristic write request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | -------------------------------------- |
+| type | string | Yes | Event type. The value **characteristicWrite** indicates a characteristic write request event.|
+| callback | Callback<[CharacteristicWriteRequest](#characteristicwriterequest)> | Yes | Callback invoked to return a characteristic write request from the GATT client. |
+
+**Example**
+
+```js
+let arrayBufferCCC = new ArrayBuffer(8);
+let cccValue = new Uint8Array(arrayBufferCCC);
+function WriteCharacteristicReq(CharacteristicWriteRequest) {
+ let deviceId = CharacteristicWriteRequest.deviceId;
+ let transId = CharacteristicWriteRequest.transId;
+ let offset = CharacteristicWriteRequest.offset;
+ let isPrepared = CharacteristicWriteRequest.isPrepared;
+ let needRsp = CharacteristicWriteRequest.needRsp;
+ let value = new Uint8Array(CharacteristicWriteRequest.value);
+ let characteristicUuid = CharacteristicWriteRequest.characteristicUuid;
+
+ cccValue[0] = value[0];
+ let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferCCC};
+
+ try {
+ gattServer.sendResponse(serverResponse);
+ } catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+ }
+}
+gattServer.on('characteristicWrite', WriteCharacteristicReq);
+```
+
+
+### off('characteristicWrite')
+
+off(type: 'characteristicWrite', callback?: Callback<CharacteristicWriteRequest>): void
+
+Unsubscribes from characteristic write request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **characteristicWrite**, which indicates a characteristic write request event. |
+| callback | Callback<[CharacteristicWriteRequest](#characteristicwriterequest)> | No | Callback for the characteristic write request event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+gattServer.off('characteristicWrite');
+```
+
+
+### on('descriptorRead')
+
+on(type: 'descriptorRead', callback: Callback<DescriptorReadRequest>): void
+
+Subscribes to descriptor read request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------------------------------- |
+| type | string | Yes | Event type. The value is **descriptorRead**, which indicates a descriptor read request event.|
+| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | Yes | Callback invoked to return a descriptor read request event from the GATT client. |
+
+**Example**
+
+```js
+let arrayBufferDesc = new ArrayBuffer(8);
+let descValue = new Uint8Array(arrayBufferDesc);
+descValue[0] = 1101;
+function ReadDescriptorReq(DescriptorReadRequest) {
+ let deviceId = DescriptorReadRequest.deviceId;
+ let transId = DescriptorReadRequest.transId;
+ let offset = DescriptorReadRequest.offset;
+ let descriptorUuid = DescriptorReadRequest.descriptorUuid;
+
+ let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferDesc};
+
+ try {
+ gattServer.sendResponse(serverResponse);
+ } catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+ }
+}
+gattServer.on('descriptorRead', ReadDescriptorReq);
+```
+
+
+### off('descriptorRead')
+
+off(type: 'descriptorRead', callback?: Callback<DescriptorReadRequest>): void
+
+Unsubscribes from descriptor read request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **descriptorRead**, which indicates a descriptor read request event. |
+| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | No | Callback for the descriptor read request event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+gattServer.off('descriptorRead');
+```
+
+
+### on('descriptorWrite')
+
+on(type: 'descriptorWrite', callback: Callback<DescriptorWriteRequest>): void
+
+Subscribes to descriptor write request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------- |
+| type | string | Yes | Event type. The value is **descriptorWrite**, which indicates a descriptor write request event.|
+| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | Yes | Callback invoked to return a descriptor write request from the GATT client. |
+
+**Example**
+
+```js
+let arrayBufferDesc = new ArrayBuffer(8);
+let descValue = new Uint8Array(arrayBufferDesc);
+function WriteDescriptorReq(DescriptorWriteRequest) {
+ let deviceId = DescriptorWriteRequest.deviceId;
+ let transId = DescriptorWriteRequest.transId;
+ let offset = DescriptorWriteRequest.offset;
+ let isPrepared = DescriptorWriteRequest.isPrepared;
+ let needRsp = DescriptorWriteRequest.needRsp;
+ let value = new Uint8Array(DescriptorWriteRequest.value);
+ let descriptorUuid = DescriptorWriteRequest.descriptorUuid;
+
+ descValue[0] = value[0];
+ let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferDesc};
+
+ try {
+ gattServer.sendResponse(serverResponse);
+ } catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+ }
+}
+gattServer.on('descriptorRead', WriteDescriptorReq);
+```
+
+
+### off('descriptorWrite')
+
+off(type: 'descriptorWrite', callback?: Callback<DescriptorWriteRequest>): void
+
+Unsubscribes from descriptor write request events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **descriptorWrite**, which indicates a descriptor write request event. |
+| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | No | Callback for the descriptor write request event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+gattServer.off('descriptorWrite');
+```
+
+
+### on('connectionStateChange')
+
+on(type: 'connectionStateChange', callback: Callback<BLEConnectionChangeState>): void
+
+Subscribes to BLE connection state change events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **connectionStateChange**, which indicates a BLE connection state change event.|
+| callback | Callback<[BLEConnectionChangeState](#bleconnectionchangestate)> | Yes | Callback invoked to return the BLE connection state. |
+
+**Example**
+
+```js
+function Connected(BLEConnectionChangeState) {
+ let deviceId = BLEConnectionChangeState.deviceId;
+ let status = BLEConnectionChangeState.state;
+}
+gattServer.on('connectionStateChange', Connected);
+```
+
+
+### off('connectionStateChange')
+
+off(type: 'connectionStateChange', callback?: Callback<BLEConnectionChangeState>): void
+
+Unsubscribes from BLE connection state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **connectionStateChange**, which indicates a BLE connection state change event.|
+| callback | Callback<[BLEConnectionChangeState](#bleconnectionchangestate)> | No | Callback for the BLE connection state change event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+gattServer.off('connectionStateChange');
+```
+
+
+## GattClientDevice
+
+Implements the GATT client. Before using an API of this class, you must create a **GattClientDevice** instance using **createGattClientDevice(deviceId: string)**.
+
+
+### connect
+
+connect(): void
+
+Connects to the remote BLE device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.connect();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### disconnect
+
+disconnect(): void
+
+Disconnects from the remote BLE device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.disconnect();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### close
+
+close(): void
+
+Closes this GATT client to unregister it from the protocol stack. The closed [GattClientDevice](#gattclientdevice) instance will no longer be used.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.close();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### getDeviceName
+
+getDeviceName(callback: AsyncCallback<string>): void
+
+Obtains the name of the remote BLE device. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------------- | ---- | ------------------------------- |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the remote BLE device name obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// callback
+try {
+ let gattClient = ble.createGattClientDevice("XX:XX:XX:XX:XX:XX");
+ gattClient.connect();
+ let deviceName = gattClient.getDeviceName((err, data)=> {
+ console.info('device name err ' + JSON.stringify(err));
+ console.info('device name' + JSON.stringify(data));
+ })
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### getDeviceName
+
+getDeviceName(): Promise<string>
+
+Obtains the name of the remote BLE device. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| --------------------- | ---------------------------------- |
+| Promise<string> | Promise used to return the remote BLE device name.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// promise
+try {
+ let gattClient = ble.createGattClientDevice("XX:XX:XX:XX:XX:XX");
+ gattClient.connect();
+ let deviceName = gattClient.getDeviceName().then((data) => {
+ console.info('device name' + JSON.stringify(data));
+ })
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### getServices
+
+getServices(callback: AsyncCallback<Array<GattService>>): void
+
+Obtains all services of the remote BLE device. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------ |
+| callback | AsyncCallback<Array<[GattService](#gattservice)>> | Yes | Callback invoked to return the services obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// Callback
+function getServices(code, gattServices) {
+ if (code.code == 0) {
+ let services = gattServices;
+ console.log('bluetooth code is ' + code.code);
+ console.log('bluetooth services size is ', services.length);
+
+ for (let i = 0; i < services.length; i++) {
+ console.log('bluetooth serviceUuid is ' + services[i].serviceUuid);
+ }
+ }
+}
+
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.connect();
+ device.getServices(getServices);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### getServices
+
+getServices(): Promise<Array<GattService>>
+
+Obtains all services of the remote BLE device. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | --------------------------- |
+| Promise<Array<[GattService](#gattservice)>> | Promise used to return the services obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// Promise
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.connect();
+ device.getServices().then(result => {
+ console.info('getServices successfully:' + JSON.stringify(result));
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### readCharacteristicValue
+
+readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void
+
+Reads the characteristic value of the specific service of the remote BLE device. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ---------------------------------------- | ---- | ----------------------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Characteristic value to read. |
+| callback | AsyncCallback<[BLECharacteristic](#blecharacteristic)> | Yes | Callback invoked to return the characteristic value read.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901000 | Read forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function readCcc(code, BLECharacteristic) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth characteristic uuid: ' + BLECharacteristic.characteristicUuid);
+ let value = new Uint8Array(BLECharacteristic.characteristicValue);
+ console.log('bluetooth characteristic value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]);
+}
+
+let descriptors = [];
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc};
+descriptors[0] = descriptor;
+
+let bufferCCC = new ArrayBuffer(8);
+let cccV = new Uint8Array(bufferCCC);
+cccV[0] = 1;
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+characteristicValue: bufferCCC, descriptors:descriptors};
+
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.readCharacteristicValue(characteristic, readCcc);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### readCharacteristicValue
+
+readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic>
+
+Reads the characteristic value of the specific service of the remote BLE device. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------------- | ---- | -------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Characteristic value to read.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | -------------------------- |
+| Promise<[BLECharacteristic](#blecharacteristic)> | Promise used to return the characteristic value read.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901000 | Read forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let descriptors = [];
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc};
+descriptors[0] = descriptor;
+
+let bufferCCC = new ArrayBuffer(8);
+let cccV = new Uint8Array(bufferCCC);
+cccV[0] = 1;
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+characteristicValue: bufferCCC, descriptors:descriptors};
+
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.readCharacteristicValue(characteristic);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### readDescriptorValue
+
+readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void
+
+Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------- | ---------------------------------------- | ---- | ----------------------- |
+| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read. |
+| callback | AsyncCallback<[BLEDescriptor](#bledescriptor)> | Yes | Callback invoked to return the descriptor read.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901000 | Read forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function readDesc(code, BLEDescriptor) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth descriptor uuid: ' + BLEDescriptor.descriptorUuid);
+ let value = new Uint8Array(BLEDescriptor.descriptorValue);
+ console.log('bluetooth descriptor value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]);
+}
+
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 11;
+let descriptor = {
+ serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB',
+ descriptorValue: bufferDesc
+};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.readDescriptorValue(descriptor, readDesc);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### readDescriptorValue
+
+readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor>
+
+Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------- | ------------------------------- | ---- | -------- |
+| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | -------------------------- |
+| Promise<[BLEDescriptor](#bledescriptor)> | Promise used to return the descriptor read.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901000 | Read forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 11;
+let descriptor = {
+ serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB',
+ descriptorValue: bufferDesc
+};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.readDescriptorValue(descriptor);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### writeCharacteristicValue
+
+writeCharacteristicValue(characteristic: BLECharacteristic, writeType: GattWriteType, callback: AsyncCallback<void>): void
+
+Writes a characteristic value to the remote BLE device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------------- | ---- | ------------------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Binary value and other parameters of the BLE device characteristic.|
+| writeType | GattWriteType | Yes | Write type of the Bluetooth device characteristic value.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the write operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901001 | Write forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let descriptors = [];
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc};
+descriptors[0] = descriptor;
+
+let bufferCCC = new ArrayBuffer(8);
+let cccV = new Uint8Array(bufferCCC);
+cccV[0] = 1;
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ characteristicValue: bufferCCC, descriptors:descriptors};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.writeCharacteristicValue(characteristic);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### writeCharacteristicValue
+
+writeCharacteristicValue(characteristic: BLECharacteristic, writeType: GattWriteType): Promise<void>
+
+Writes a characteristic value to the remote BLE device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------------- | ---- | ------------------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Binary value and other parameters of the BLE device characteristic.|
+| writeType | GattWriteType | Yes | Write type of the Bluetooth device characteristic value.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | -------------------------- |
+| Promise<void> | Promise used to return the descriptor read.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901001 | Write forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let descriptors = [];
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc};
+descriptors[0] = descriptor;
+
+let bufferCCC = new ArrayBuffer(8);
+let cccV = new Uint8Array(bufferCCC);
+cccV[0] = 1;
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ characteristicValue: bufferCCC, descriptors:descriptors};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.writeCharacteristicValue(characteristic);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### writeDescriptorValue
+
+writeDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<void>): void
+
+Writes binary data to the specific descriptor of the remote BLE device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------- | ------------------------------- | ---- | ------------------ |
+| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Binary value and other parameters of the BLE device descriptor.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the write operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901001 | Write forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 22;
+let descriptor = {
+ serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB',
+ descriptorValue: bufferDesc
+};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.writeDescriptorValue(descriptor);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### writeDescriptorValue
+
+writeDescriptorValue(descriptor: BLEDescriptor): Promise<void>
+
+Writes binary data to the specific descriptor of the remote BLE device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------- | ------------------------------- | ---- | ------------------ |
+| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Binary value and other parameters of the BLE device descriptor.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | -------------------------- |
+| Promise<void> | Promise used to return the descriptor read.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2901001 | Write forbidden. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let bufferDesc = new ArrayBuffer(8);
+let descV = new Uint8Array(bufferDesc);
+descV[0] = 22;
+let descriptor = {
+ serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB',
+ descriptorValue: bufferDesc
+};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.writeDescriptorValue(descriptor);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### getRssiValue
+
+getRssiValue(callback: AsyncCallback<number>): void
+
+Obtains the RSSI of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect).
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------------- | ---- | ------------------------------ |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the RSSI, in dBm.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// callback
+try {
+ let gattClient = ble.createGattClientDevice("XX:XX:XX:XX:XX:XX");
+ gattClient.connect();
+ let rssi = gattClient.getRssiValue((err, data)=> {
+ console.info('rssi err ' + JSON.stringify(err));
+ console.info('rssi value' + JSON.stringify(data));
+ })
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### getRssiValue
+
+getRssiValue(): Promise<number>
+
+Obtains the RSSI of the remote BLE device. This API uses a promise to return the result. It can be used only after a connection is set up by calling [connect](#connect).
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| --------------------- | --------------------------------- |
+| Promise<number> | Promise used to return the RSSI, in dBm.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// promise
+try {
+ let gattClient = ble.createGattClientDevice("XX:XX:XX:XX:XX:XX");
+ let rssi = gattClient.getRssiValue().then((data) => {
+ console.info('rssi' + JSON.stringify(data));
+ })
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### setBLEMtuSize
+
+setBLEMtuSize(mtu: number): void
+
+Sets the maximum transmission unit (MTU) that can be transmitted between the GATT client and its remote BLE device. This API can be used only after a connection is set up by calling [connect](#connect).
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | -------------- |
+| mtu | number | Yes | MTU to set, which ranges from 22 to 512 bytes.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.setBLEMtuSize(128);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### setCharacteristicChangeNotification
+
+setCharacteristicChangeNotification(characteristic: BLECharacteristic, enable: boolean, callback: AsyncCallback<void>): void
+
+Sets the function of notifying the GATT client when the characteristic value of the remote BLE device changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------------- | ---- | ----------------------------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | BLE characteristic to listen for. |
+| enable | boolean | Yes | Whether to enable the notify function. The value **true** means to enable the notify function, and the value **false** means the opposite.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// Create descriptors.
+let descriptors = [];
+let arrayBuffer = new ArrayBuffer(8);
+let descV = new Uint8Array(arrayBuffer);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+descriptors[0] = descriptor;
+let arrayBufferC = new ArrayBuffer(8);
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.setCharacteristicChangeNotification(characteristic, false);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+
+```
+
+
+### setCharacteristicChangeNotification
+
+setCharacteristicChangeNotification(characteristic: BLECharacteristic, enable: boolean): Promise<void>
+
+Sets the function of notifying the GATT client when the characteristic value of the remote BLE device changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------------- | ---- | ----------------------------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | BLE characteristic to listen for. |
+| enable | boolean | Yes | Whether to enable the notify function. The value **true** means to enable the notify function, and the value **false** means the opposite.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | -------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// Create descriptors.
+let descriptors = [];
+let arrayBuffer = new ArrayBuffer(8);
+let descV = new Uint8Array(arrayBuffer);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+descriptors[0] = descriptor;
+let arrayBufferC = new ArrayBuffer(8);
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.setCharacteristicChangeNotification(characteristic, false);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+
+```
+
+
+### setCharacteristicChangeIndication
+
+setCharacteristicChangeIndication(characteristic: BLECharacteristic, enable: boolean, callback: AsyncCallback<void>): void
+
+Sets the function of notifying the GATT client when the characteristic value of the remote BLE device changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------------- | ---- | ----------------------------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | BLE characteristic to listen for. |
+| enable | boolean | Yes | Whether to enable the notify function. The value **true** means to enable the notify function, and the value **false** means the opposite.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | -------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// Create descriptors.
+let descriptors = [];
+let arrayBuffer = new ArrayBuffer(8);
+let descV = new Uint8Array(arrayBuffer);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+descriptors[0] = descriptor;
+let arrayBufferC = new ArrayBuffer(8);
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.setCharacteristicChangeIndication(characteristic, false);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+
+```
+
+
+### setCharacteristicChangeIndication
+
+setCharacteristicChangeIndication(characteristic: BLECharacteristic, enable: boolean): Promise<void>
+
+Sets the function of notifying the GATT client when the characteristic value of the remote BLE device changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------------------- | ---- | ----------------------------- |
+| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | BLE characteristic to listen for. |
+| enable | boolean | Yes | Whether to enable the notify function. The value **true** means to enable the notify function, and the value **false** means the opposite.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | -------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+// Create descriptors.
+let descriptors = [];
+let arrayBuffer = new ArrayBuffer(8);
+let descV = new Uint8Array(arrayBuffer);
+descV[0] = 11;
+let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+descriptors[0] = descriptor;
+let arrayBufferC = new ArrayBuffer(8);
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.setCharacteristicChangeIndication(characteristic, false);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+
+```
+
+
+### on('BLECharacteristicChange')
+
+on(type: 'BLECharacteristicChange', callback: Callback<BLECharacteristic>): void
+
+Subscribes to BLE characteristic changes. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** method is called.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.|
+| callback | Callback<[BLECharacteristic](#blecharacteristic)> | Yes | Callback invoked to return the characteristic value changes. |
+
+**Example**
+
+```js
+function CharacteristicChange(CharacteristicChangeReq) {
+ let serviceUuid = CharacteristicChangeReq.serviceUuid;
+ let characteristicUuid = CharacteristicChangeReq.characteristicUuid;
+ let value = new Uint8Array(CharacteristicChangeReq.characteristicValue);
+}
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.on('BLECharacteristicChange', CharacteristicChange);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### off('BLECharacteristicChange')
+
+off(type: 'BLECharacteristicChange', callback?: Callback<BLECharacteristic>): void
+
+Unsubscribes from BLE characteristic change events.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.|
+| callback | Callback<[BLECharacteristic](#blecharacteristic)> | No | Callback for the characteristic value change event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.off('BLECharacteristicChange');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### on('BLEConnectionStateChange')
+
+on(type: 'BLEConnectionStateChange', callback: Callback<BLEConnectionChangeState>): void
+
+Subscribes to BLE connection state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.|
+| callback | Callback<[BLEConnectionChangeState](#bleconnectionchangestate)> | Yes | Callback invoked to return the BLE connection state. |
+
+**Example**
+
+```js
+function ConnectStateChanged(state) {
+ console.log('bluetooth connect state changed');
+ let connectState = state.state;
+}
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.on('BLEConnectionStateChange', ConnectStateChanged);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### off('BLEConnectionStateChange')
+
+off(type: 'BLEConnectionStateChange', callback?: Callback<BLEConnectionChangeState>): void
+
+Unsubscribes from BLE connection state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.|
+| callback | Callback<[BLEConnectionChangeState](#bleconnectionchangestate)> | No | Callback for the BLE connection state change event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.off('BLEConnectionStateChange');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### on('BLEMtuChange')
+
+on(type: 'BLEMtuChange', callback: Callback<number>): void
+
+Subscribes to MTU status changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **BLEMtuChange**, which indicates a MTU status change event.|
+| callback | Callback<number> | Yes | Callback invoked to return the MTU status, which can be connected or disconnected.|
+
+**Example**
+
+```js
+try {
+ let gattClient = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ gattClient.on('BLEMtuChange', (mtu) => {
+ console.info('BLEMtuChange, mtu: ' + mtu);
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### off('BLEMtuChange')
+
+off(type: 'BLEMtuChange', callback?: Callback<number>): void
+
+Unsubscribes from MTU status changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **BLEMtuChange**, which indicates a MTU status change event.|
+| callback | Callback<number> | No | Callback for MTU status changes. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Example**
+
+```js
+try {
+ let device = ble.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+ device.off('BLEMtuChange');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## GattService
+
+Defines the GATT service API parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
+| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+| isPrimary | boolean | Yes | Yes | Whether the service is a primary service. The value **true** means a primary service. |
+| characteristics | Array<[BLECharacteristic](#blecharacteristic)> | Yes | Yes | List of characteristics of the service. |
+| includeServices | Array<[GattService](#gattservice)> | Yes | Yes | Services on which the service depends. |
+
+
+## BLECharacteristic
+
+Defines the characteristic API parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
+| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
+| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. |
+| descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes | Yes | List of descriptors of the characteristic. |
+| properties | [GattProperties](#gattproperties) | Yes | Yes | Properties of the characteristic. |
+
+
+## BLEDescriptor
+
+Defines the BLE descriptor.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------------ | ----------- | ---- | ---- | ---------------------------------------- |
+| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
+| descriptorUuid | string | Yes | Yes | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.|
+| descriptorValue | ArrayBuffer | Yes | Yes | Binary value of the descriptor. |
+
+
+## NotifyCharacteristic
+
+Defines the parameters in the notifications sent when the server characteristic value changes.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------------- | ----------- | ---- | ---- | ---------------------------------------- |
+| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
+| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. |
+| confirm | boolean | Yes | Yes | Whether the notification needs to be confirmed by the remote end. For a notification, set it to **true**. In this case, the remote end must confirm the receipt of the notification. For an indication, set it to **false**. In this case, the remote end does not need to confirm the receipt of the notification.|
+
+
+## CharacteristicReadRequest
+
+Defines the parameters of the **CharacteristicReadReq** event received by the server.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------------ | ------ | ---- | ---- | ---------------------------------------- |
+| deviceId | string | Yes | No | Address of the remote device that sends the **CharacteristicReadReq** event, for example, XX:XX:XX:XX:XX:XX.|
+| transId | number | Yes | No | Transmission ID of the read request. The response returned by the server must use the same transmission ID. |
+| offset | number | Yes | No | Position from which the characteristic value is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.|
+| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
+| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+
+
+## CharacteristicWriteRequest
+
+Defines the parameters of the **CharacteristicWriteReq** event received by the server.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------------ | ------ | ---- | ---- | ---------------------------------------- |
+| deviceId | string | Yes | No | Address of the remote device that sends the **CharacteristicWriteReq** event, for example, XX:XX:XX:XX:XX:XX.|
+| transId | number | Yes | No | Transmission ID of the write request. The response returned by the server must use the same transmission ID. |
+| offset | number | Yes | No | Start position for writing the characteristic value. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.|
+| isPrepared | boolean | Yes | No | Whether the write request is executed immediately.|
+| needRsp | boolean | Yes | No | Whether to send a response to the GATT client.|
+| value | ArrayBuffer | Yes | No | Binary value of the descriptor to write.|
+| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
+| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+
+
+## DescriptorReadRequest
+
+Defines the parameters of the **DescriptorReadReq** event received by the server.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------------ | ------ | ---- | ---- | ---------------------------------------- |
+| deviceId | string | Yes | No | Address of the remote device that sends a **DescriptorReadReq** event, for example, XX:XX:XX:XX:XX:XX.|
+| transId | number | Yes | No | Transmission ID of the read request. The response returned by the server must use the same transmission ID. |
+| offset | number | Yes | No | Position from which the descriptor is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.|
+| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.|
+| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
+| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+
+
+## DescriptorWriteRequest
+
+Defines the parameters of the **DescriptorWriteReq** event received by the server.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------------ | ----------- | ---- | ---- | ---------------------------------------- |
+| deviceId | string | Yes | No | Address of the remote device that sends a **DescriptorWriteReq** event, for example, XX:XX:XX:XX:XX:XX.|
+| transId | number | Yes | No | Transmission ID of the write request. The response returned by the server must use the same transmission ID. |
+| offset | number | Yes | No | Start position for writing the descriptor. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.|
+| isPrepared | boolean | Yes | No | Whether the write request is executed immediately. |
+| needRsp | boolean | Yes | No | Whether to send a response to the GATT client. |
+| value | ArrayBuffer | Yes | No | Binary value of the descriptor to write. |
+| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.|
+| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
+| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+
+
+## ServerResponse
+
+Defines the parameters of the server's response to the GATT client's read/write request.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| -------- | ----------- | ---- | ---- | -------------------------------------- |
+| deviceId | string | Yes | No | Address of the remote device, for example, XX:XX:XX:XX:XX:XX. |
+| transId | number | Yes | No | Transmission ID of the request. The value must be the same as the ID carried in the read/write request received. |
+| status | number | Yes | No | Response state. Set this parameter to **0**, which indicates a normal response. |
+| offset | number | Yes | No | Start read/write position. The value must be the same as the offset carried in the read/write request.|
+| value | ArrayBuffer | Yes | No | Binary data in the response. |
+
+
+## BLEConnectionChangeState
+
+Defines the parameters of **BLEConnectChangedState**.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable| Writable| Description |
+| -------- | ------------------------------------------------- | ---- | ---- | --------------------------------------------- |
+| deviceId | string | Yes | No | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+| state | [ProfileConnectionState](js-apis-bluetooth-constant.md#profileconnectionstate) | Yes | Yes | BLE connection state. |
+
+
+## ScanResult
+
+Defines the scan result.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| -------- | ----------- | ---- | ---- | ---------------------------------- |
+| deviceId | string | Yes | No | Address of the scanned device, for example, XX:XX:XX:XX:XX:XX.|
+| rssi | number | Yes | No | RSSI of the device. |
+| data | ArrayBuffer | Yes | No | Advertisement packets sent by the device. |
+| deviceName | string | Yes | No | Name of the device detected. |
+| connectable | boolean | Yes | No | Whether the discovered device is connectable. |
+
+
+## AdvertiseSetting
+
+Defines the BLE advertising parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ----------- | ------- | ---- | ---- | ---------------------------------------- |
+| interval | number | Yes | Yes | Interval for BLE advertising. The minimum value is **32** slots (20 ms). The maximum value is **16384** slots. The default value is **1600** slots (1s).|
+| txPower | number | Yes | Yes | Transmit power, in dBm. The value range is -127 to 1. The default value is **-7**. |
+| connectable | boolean | Yes | Yes | Whether the advertisement is connectable. The default value is **true**. |
+
+
+## AdvertiseData
+
+Defines the content of a BLE advertisement packet.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| --------------- | ---------------------------------------- | ---- | ---- | --------------------------- |
+| serviceUuids | Array<string> | Yes | Yes | List of service UUIDs to broadcast.|
+| manufactureData | Array<[ManufactureData](#manufacturedata)> | Yes | Yes | List of manufacturers to broadcast. |
+| serviceData | Array<[ServiceData](#servicedata)> | Yes | Yes | List of service data to broadcast. |
+| includeDeviceName | boolean | Yes | Yes | Whether the device name is contained. This parameter is optional. |
+
+
+## ManufactureData
+
+Defines the content of a BLE advertisement packet.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ---------------- | ------------------- | ---- | ---- | ------------------ |
+| manufactureId | number | Yes | Yes | Manufacturer ID allocated by the Bluetooth SIG.|
+| manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. |
+
+
+## ServiceData
+
+Defines the service data contained in an advertisement packet.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------------ | ----------- | ---- | ---- | ---------- |
+| serviceUuid | string | Yes | Yes | Service UUID.|
+| serviceValue | ArrayBuffer | Yes | Yes | Service data. |
+
+
+## ScanFilter
+
+Defines the scan filter parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable| Writable| Description |
+| ---------------------------------------- | ----------- | ---- | ---- | ------------------------------------------------------------ |
+| deviceId | string | Yes | Yes | Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX. |
+| name | string | Yes | Yes | Name of the BLE device to filter. |
+| serviceUuid | string | Yes | Yes | Service UUID of the device to filter, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+| serviceUuidMask | string | Yes | Yes | Service UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.|
+| serviceSolicitationUuid | string | Yes | Yes | Service solicitation UUID of the device to filter, for example, **00001888-0000-1000-8000-00805F9B34FB**.|
+| serviceSolicitationUuidMask | string | Yes | Yes | Service solicitation UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.|
+| serviceData | ArrayBuffer | Yes | Yes | Service data of the device to filter, for example, **[0x90, 0x00, 0xF1, 0xF2]**.|
+| serviceDataMask | ArrayBuffer | Yes | Yes | Service data mask of the device to filter, for example, **[0xFF,0xFF,0xFF,0xFF]**.|
+| manufactureId | number | Yes | Yes | Manufacturer ID of the device to filter, for example, **0x0006**. |
+| manufactureData | ArrayBuffer | Yes | Yes | Manufacturer data of the device to filter, for example, **[0x1F,0x2F,0x3F]**.|
+| manufactureDataMask | ArrayBuffer | Yes | Yes | Manufacturer data mask of the device to filter, for example, **[0xFF, 0xFF, 0xFF]**.|
+
+
+## ScanOptions
+
+Defines the scan configuration parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| --------- | ----------------------- | ---- | ---- | -------------------------------------- |
+| interval | number | Yes | Yes | Delay in reporting the scan result. The default value is **0**. |
+| dutyMode | [ScanDuty](#scanduty) | Yes | Yes | Scan duty. The default value is SCAN_MODE_LOW_POWER. |
+| matchMode | [MatchMode](#matchmode) | Yes | Yes | Hardware filtering match mode. The default value is **MATCH_MODE_AGGRESSIVE**.|
+
+
+## GattProperties
+
+Defines the properties of a GATT characteristic.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ |---- | ----------- |
+| write | boolean | Yes | Permits writes of the characteristic value (with a response).|
+| writeNoResponse | boolean | Yes | Permits writes of the characteristic value (without a response).|
+| read | boolean | Yes | Permits reads of the characteristic value.|
+| notify | boolean | Yes | Permits notifications of the characteristic value.|
+| indicate | boolean | Yes | Permits notifications of the characteristic value without acknowledgement.|
+
+
+## GattWriteType
+
+Enumerates the GATT write types.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ------------------------------------| ------ | --------------- |
+| WRITE | 1 | Write a characteristic value with a response from the peer device. |
+| WRITE_NO_RESPONSE | 2 | Write characteristic value without a response from the peer device. |
+
+
+## ScanDuty
+
+Enumerates the scan duties.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| --------------------- | ---- | ------------ |
+| SCAN_MODE_LOW_POWER | 0 | Low-power mode, which is the default value.|
+| SCAN_MODE_BALANCED | 1 | Balanced mode. |
+| SCAN_MODE_LOW_LATENCY | 2 | Low-latency mode. |
+
+
+## MatchMode
+
+Enumerates the hardware match modes of BLE scan filters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| --------------------- | ---- | ---------------------------------------- |
+| MATCH_MODE_AGGRESSIVE | 1 | Hardware reports the scan result with a lower threshold of signal strength and few number of matches in a duration. This is the default value.|
+| MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings. |
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-connection.md b/en/application-dev/reference/apis/js-apis-bluetooth-connection.md
new file mode 100644
index 0000000000000000000000000000000000000000..72f54a63f95bbd51029b191ff697f3aeea55577c
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-connection.md
@@ -0,0 +1,1397 @@
+# @ohos.bluetooth.connection (Bluetooth connection Module)
+
+The **connection** module provides APIs for operating and managing Bluetooth.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import connection from '@ohos.bluetooth.connection';
+```
+
+
+## connection.pairDevice
+
+pairDevice(deviceId: string, callback: AsyncCallback<void>): void
+
+Pairs a Bluetooth device. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the pairing is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ // The address can be scanned.
+ connection.pairDevice('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.pairDevice
+
+pairDevice(deviceId: string): Promise<void>
+
+Pairs a Bluetooth device. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ // The address can be scanned.
+ connection.pairDevice('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.pairCredibleDevice
+
+pairCredibleDevice(deviceId: string, transport: BluetoothTransport, callback: AsyncCallback<void>): void
+
+Pairs a trusted device whose address is obtained in a non-Bluetooth scan mode (such as using NFC). This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX.|
+| transport | [BluetoothTransport](#bluetoothtransport) | Yes | Device type, for example, a classic Bluetooth device or a Bluetooth low energy (BLE) device.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.pairCredibleDevice('68:13:24:79:4C:8C', 1, err => {
+ if (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+ return;
+ }
+ console.info('pairCredibleDevice, err: ' + JSON.stringify(err));
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.pairCredibleDevice
+
+pairCredibleDevice(deviceId: string, transport: BluetoothTransport): Promise<void>
+
+Pairs a trusted device whose address is obtained in a non-Bluetooth scan mode (such as using NFC). This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX.|
+| transport | [BluetoothTransport](#bluetoothtransport) | Yes | Device type, for example, a classic Bluetooth device or a BLE device.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------- | ------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.pairCredibleDevice('68:13:24:79:4C:8C', 0).then(() => {
+ console.info('PairCredibleDevice');
+ }, err => {
+ console.error('PairCredibleDevice:errCode' + err.code + ', errMessage: ' + err.message);
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.cancelPairedDevice
+
+cancelPairedDevice(deviceId: string, callback: AsyncCallback<void>): void
+
+Cancels a paired device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ------------------------------------- |
+| deviceId | string | Yes | Address of the device to cancel, for example, XX:XX:XX:XX:XX:XX.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.cancelPairedDevice('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.cancelPairedDevice
+
+cancelPairedDevice(deviceId: string): Promise<void>
+
+Cancels a paired device. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ------------------------------------- |
+| deviceId | string | Yes | Address of the device to cancel, for example, XX:XX:XX:XX:XX:XX.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.cancelPairedDevice('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.cancelPairingDevice
+
+cancelPairingDevice(deviceId: string, callback: AsyncCallback<void>): void
+
+Cancels the pairing of a device. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ------------------------------------- |
+| deviceId | string | Yes | Address of the device to cancel, for example, XX:XX:XX:XX:XX:XX.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.cancelPairingDevice('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.cancelPairingDevice
+
+cancelPairingDevice(deviceId: string): Promise<void>
+
+Cancels the pairing of a device. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ------------------------------------- |
+| deviceId | string | Yes | Address of the device to cancel, for example, XX:XX:XX:XX:XX:XX.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.cancelPairingDevice('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getRemoteDeviceName
+
+getRemoteDeviceName(deviceId: string): string
+
+Obtains the name of a remote Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | --------------------------------- |
+| deviceId | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ------------- |
+| string | Device name (a string) obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let remoteDeviceName = connection.getRemoteDeviceName('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getRemoteDeviceClass
+
+getRemoteDeviceClass(deviceId: string): DeviceClass
+
+Obtains the class of a remote Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | --------------------------------- |
+| deviceId | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+
+**Return value**
+
+| Type | Description |
+| --------------------------- | -------- |
+| [DeviceClass](#deviceclass) | Class of the remote device obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let remoteDeviceClass = connection.getRemoteDeviceClass('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getLocalName
+
+getLocalName(): string
+
+Obtains the name of the local Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ------ | --------- |
+| string | Name of the local Bluetooth device obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let localName = connection.getLocalName();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getPairedDevices
+
+getPairedDevices(): Array<string>
+
+Obtains the paired devices.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Array<string> | Addresses of the paired Bluetooth devices obtained. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let devices = connection.getPairedDevices();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getProfileConnectionState
+
+getProfileConnectionState(profileId?: ProfileId): ProfileConnectionState
+
+Obtains the connection state of the specified profile.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| --------- | --------- | ---- | ------------------------------------- |
+| ProfileId | [profileId](js-apis-bluetooth-constant.md#profileid) | No | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------- | ------------------- |
+| [ProfileConnectionState](js-apis-bluetooth-constant.md#profileconnectionstate) | Profile connection state obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+import constant from '@ohos.bluetooth.constant';
+try {
+ let result = connection.getProfileConnectionState(constant.ProfileId.PROFILE_A2DP_SOURCE);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.setDevicePairingConfirmation
+
+setDevicePairingConfirmation(deviceId: string, accept: boolean): void
+
+Sets the device pairing confirmation.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------- | ---- | -------------------------------- |
+| deviceId | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+| accept | boolean | Yes | Whether to accept the pairing request. The value **true** means to accept the pairing request, and the value **false** means the opposite. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+
+try {
+ // Subscribe to the pinRequired event and configure the pairing confirmation after receiving a pairing request from the remote device.
+ function onReceivePinRequiredEvent(data) { // data is the input parameter for the pairing request.
+ console.info('pin required = '+ JSON.stringify(data));
+ connection.setDevicePairingConfirmation(data.deviceId, true);
+ }
+ connection.on('pinRequired', onReceivePinRequiredEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.setDevicePinCode
+
+setDevicePinCode(deviceId: string, code: string, callback: AsyncCallback<void>): void
+
+Sets the PIN for the device when [PinType](#pintype) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------- | ---- | -------------------------------- |
+| deviceId | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+| code | string | Yes | PIN to set. |
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+//callback
+try {
+ connection.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => {
+ console.info('setDevicePinCode,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data));
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.setDevicePinCode
+
+setDevicePinCode(deviceId: string, code: string): Promise<void>
+
+Sets the PIN for the device when [PinType](#pintype) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------- | ---- | -------------------------------- |
+| deviceId | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+| code | string | Yes | PIN to set. |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+//promise
+try {
+ connection.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => {
+ console.info('setDevicePinCode');
+ }, error => {
+ console.info('setDevicePinCode: errCode:' + error.code + ',errMessage' + error.message);
+ })
+
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.setLocalName
+
+setLocalName(name: string): void
+
+Sets the name of the local Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | --------------------- |
+| name | string | Yes | Bluetooth device name to set. It cannot exceed 248 bytes.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.setLocalName('device_name');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.setBluetoothScanMode
+
+setBluetoothScanMode(mode: ScanMode, duration: number): void
+
+Sets the Bluetooth scan mode so that the device can be discovered by a remote device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------- | ---- | ---------------------------- |
+| mode | [ScanMode](#scanmode) | Yes | Bluetooth scan mode to set. |
+| duration | number | Yes | Duration (in ms) in which the device can be discovered. The value **0** indicates unlimited time.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ // The device can be discovered and connected only when the discoverable and connectable mode is used.
+ connection.setBluetoothScanMode(connection.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 100);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getBluetoothScanMode
+
+getBluetoothScanMode(): ScanMode
+
+Obtains the Bluetooth scan mode.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| --------------------- | ------- |
+| [ScanMode](#scanmode) | Bluetooth scan mode obtained. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let scanMode = connection.getBluetoothScanMode();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.startBluetoothDiscovery
+
+startBluetoothDiscovery(): void
+
+Starts discovery of Bluetooth devices.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let deviceId;
+function onReceiveEvent(data) {
+ deviceId = data;
+}
+try {
+ connection.on('bluetoothDeviceFind', onReceiveEvent);
+ connection.startBluetoothDiscovery();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.stopBluetoothDiscovery
+
+stopBluetoothDiscovery(): void
+
+Stops discovery of Bluetooth devices.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.stopBluetoothDiscovery();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getLocalProfileUuids
+
+getLocalProfileUuids(callback: AsyncCallback<Array<ProfileUuids>>): void
+
+Obtains the profile UUIDs of the local device. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| callback | AsyncCallback<Array<[ProfileUuids](js-apis-bluetooth-constant.md#profileuuids)>> | Yes | Callback invoked to return the profile UUIDs obtained. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.getLocalProfileUuids('XX:XX:XX:XX:XX:XX', (err, data) => {
+ console.info('getLocalProfileUuids, err: ' + JSON.stringify(err) + ', data: ' + JSON.stringify(data));
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getLocalProfileUuids
+
+getLocalProfileUuids(): Promise<Array<ProfileUuids>>
+
+Obtains the profile UUIDs of the local device. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<Array<[ProfileUuids](js-apis-bluetooth-constant.md#profileuuids)>> | Promise used to return the profile UUIDs obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.getLocalProfileUuids('XX:XX:XX:XX:XX:XX').then(() => {
+ console.info('getLocalProfileUuids');
+ }, err => {
+ console.error('getLocalProfileUuids: errCode' + err.code + ', errMessage: ' + err.message);
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.getRemoteProfileUuids
+
+getRemoteProfileUuids(deviceId: string, callback: AsyncCallback<Array<ProfileUuids>>): void
+
+Obtains the profile UUIDs of a remote Bluetooth device. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX.|
+| callback | AsyncCallback<Array<[ProfileUuids](js-apis-bluetooth-constant.md#profileuuids)>> | Yes | Callback invoked to return the profile UUIDs obtained. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.getRemoteProfileUuids('XX:XX:XX:XX:XX:XX', (err, data) => {
+ console.info('getRemoteProfileUuids, err: ' + JSON.stringify(err) + ', data: ' + JSON.stringify(data));
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+
+```
+
+
+## connection.getRemoteProfileUuids
+
+getRemoteProfileUuids(deviceId: string): Promise<Array<ProfileUuids>>
+
+Obtains the profile UUIDs of a remote Bluetooth device. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------------------- |
+| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------- |
+| Promise<Array<[ProfileUuids](js-apis-bluetooth-constant.md#profileuuids)>> | Promise used to return the profile UUIDs obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ connection.getRemoteProfileUuids('XX:XX:XX:XX:XX:XX').then(() => {
+ console.info('getRemoteProfileUuids');
+ }, err => {
+ console.error('getRemoteProfileUuids: errCode' + err.code + ', errMessage: ' + err.message);
+ });
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.on('bluetoothDeviceFind')
+
+on(type: 'bluetoothDeviceFind', callback: Callback<Array<string>>): void
+
+Subscribes to the discovery of a Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------------------- | ---- | -------------------------------------- |
+| type | string | Yes | Event type. The value is **bluetoothDeviceFind**, which indicates an event of discovering a Bluetooth device.|
+| callback | Callback<Array<string>> | Yes | Callback invoked to return the discovered devices. You need to implement this callback. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) { // data is a set of Bluetooth device addresses.
+ console.info('bluetooth device find = '+ JSON.stringify(data));
+}
+try {
+ connection.on('bluetoothDeviceFind', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.off('bluetoothDeviceFind')
+
+off(type: 'bluetoothDeviceFind', callback?: Callback<Array<string>>): void
+
+Unsubscribes from the discovery of a Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **bluetoothDeviceFind**, which indicates an event of discovering a Bluetooth device. |
+| callback | Callback<Array<string>> | No | Callback for the **bluetoothDeviceFind** event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('bluetooth device find = '+ JSON.stringify(data));
+}
+try {
+ connection.on('bluetoothDeviceFind', onReceiveEvent);
+ connection.off('bluetoothDeviceFind', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.on('bondStateChange')
+
+on(type: 'bondStateChange', callback: Callback<BondStateParam>): void
+
+Subscribes to Bluetooth pairing state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------------ |
+| type | string | Yes | Event type. The value is **bondStateChange**, which indicates a Bluetooth pairing state change event.|
+| callback | Callback<[BondStateParam](#BondStateParam)> | Yes | Callback invoked to return the pairing state. You need to implement this callback. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) { // data, as the input parameter of the callback, indicates the pairing state.
+ console.info('pair state = '+ JSON.stringify(data));
+}
+try {
+ connection.on('bondStateChange', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.off('bondStateChange')
+
+off(type: 'bondStateChange', callback?: Callback<BondStateParam>): void
+
+Unsubscribes from Bluetooth pairing state changes.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **bondStateChange**, which indicates a Bluetooth pairing state change event. |
+| callback | Callback<[BondStateParam](#BondStateParam)> | No | Callback for the change of the Bluetooth pairing state. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('bond state = '+ JSON.stringify(data));
+}
+try {
+ connection.on('bondStateChange', onReceiveEvent);
+ connection.off('bondStateChange', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.on('pinRequired')
+
+on(type: 'pinRequired', callback: Callback<PinRequiredParam>): void
+
+Subscribes to the pairing request events of the remote Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | -------------------------------- |
+| type | string | Yes | Event type. The value **pinRequired** indicates a pairing request event. |
+| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | Yes | Callback invoked to return the pairing request. You need to implement this callback.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) { // data is the pairing request parameter.
+ console.info('pin required = '+ JSON.stringify(data));
+}
+try {
+ connection.on('pinRequired', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## connection.off('pinRequired')
+
+off(type: 'pinRequired', callback?: Callback<PinRequiredParam>): void
+
+Unsubscribes from the pairing request events of the remote Bluetooth device.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value **pinRequired** indicates a pairing request event. |
+| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | No | Callback for the Bluetooth pairing request event. The input parameter is the pairing request parameter. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+function onReceiveEvent(data) {
+ console.info('pin required = '+ JSON.stringify(data));
+}
+try {
+ connection.on('pinRequired', onReceiveEvent);
+ connection.off('pinRequired', onReceiveEvent);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## BondStateParam
+
+Represents the pairing state parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| -------- | ------ | ---- | ---- | ----------- |
+| deviceId | string | Yes | No | ID of the device to pair.|
+| state | BondState | Yes | No | State of the device.|
+
+
+## PinRequiredParam
+
+Represents the pairing request parameters.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| -------- | ------ | ---- | ---- | ----------- |
+| deviceId | string | Yes | No | ID of the device to pair.|
+| pinCode | string | Yes | No | Key for the device pairing. |
+| pinType | [PinType](#pintype) | Yes | No | Type of the device to pair.
This is a system API. |
+
+
+## DeviceClass
+
+Represents the class of a Bluetooth device.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| --------------- | ----------------------------------- | ---- | ---- | ---------------- |
+| majorClass | [MajorClass](js-apis-bluetooth-constant.md#majorclass) | Yes | No | Major class of the Bluetooth device. |
+| majorMinorClass | [MajorMinorClass](js-apis-bluetooth-constant.md#majorminorclass) | Yes | No | Major and minor classes of the Bluetooth device.|
+| classOfDevice | number | Yes | No | Class of the device. |
+
+
+## BluetoothTransport
+
+Enumerates the device types.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| -------------------------------- | ------ | --------------- |
+| TRANSPORT_BR_EDR | 0 | Classic Bluetooth (BR/EDR) device, which is the default value. |
+| TRANSPORT_LE | 1 | BLE device. |
+
+
+## ScanMode
+
+Enumerates the scan modes.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ---------------------------------------- | ---- | --------------- |
+| SCAN_MODE_NONE | 0 | No scan mode. |
+| SCAN_MODE_CONNECTABLE | 1 | Connectable mode. |
+| SCAN_MODE_GENERAL_DISCOVERABLE | 2 | General discoverable mode. |
+| SCAN_MODE_LIMITED_DISCOVERABLE | 3 | Limited discoverable mode. |
+| SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | General connectable and discoverable mode.|
+| SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | Limited connectable and discoverable mode.|
+
+
+## BondState
+
+Enumerates the pairing states.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ------------------ | ---- | ------ |
+| BOND_STATE_INVALID | 0 | Invalid pairing.|
+| BOND_STATE_BONDING | 1 | Pairing. |
+| BOND_STATE_BONDED | 2 | Paired. |
+
+
+## PinType
+
+Enumerates the Bluetooth pairing types.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| -------------------------------- | ------ | --------------- |
+| PIN_TYPE_ENTER_PIN_CODE | 0 | The user needs to enter the PIN displayed on the peer device.
This is a system API.|
+| PIN_TYPE_ENTER_PASSKEY | 1 | The user needs to enter the PASSKEY displayed on the peer device.
This is a system API. |
+| PIN_TYPE_CONFIRM_PASSKEY | 2 | The user needs to confirm the PASSKEY displayed on the local device.
This is a system API. |
+| PIN_TYPE_NO_PASSKEY_CONSENT | 3 | There is no PASSKEY, and the user needs to accept or reject the pairing request.
This is a system API. |
+| PIN_TYPE_NOTIFY_PASSKEY | 4 | The user needs to enter the PASSKEY displayed on the local device on the peer device.
This is a system API. |
+| PIN_TYPE_DISPLAY_PIN_CODE | 5 | The user needs to enter the PIN displayed on the peer device for Bluetooth 2.0 devices.
This is a system API. |
+| PIN_TYPE_OOB_CONSENT | 6 | The user needs to accept or reject the out of band (OOB) pairing request.
This is a system API. |
+| PIN_TYPE_PIN_16_DIGITS | 7 | The user needs to enter the 16-digit PIN displayed on the peer device.
This is a system API. |
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-constant.md b/en/application-dev/reference/apis/js-apis-bluetooth-constant.md
new file mode 100644
index 0000000000000000000000000000000000000000..a8456d7218b5266619cc58871f1b5d438a54c7c7
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-constant.md
@@ -0,0 +1,181 @@
+# @ohos.bluetooth.constant (Bluetooth constant Module)
+
+The **constant** module provides definitions of the constants used in Bluetooth.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import constant from '@ohos.bluetooth.constant';
+```
+
+## ProfileId
+
+Enumerates profiles.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| -------------------------------- | ------ | --------------- |
+| PROFILE_A2DP_SOURCE | 1 | Advanced Audio Distribution Profile (A2DP).|
+| PROFILE_HANDSFREE_AUDIO_GATEWAY | 4 | Hands-Free Profile (HFP). |
+| PROFILE_HID_HOST | 6 | Human Interface Device (HID) profile. |
+| PROFILE_PAN_NETWORK | 7 | Bluetooth personal area network (PAN) profile. |
+
+
+## ProfileUuids
+
+Enumerates profile UUIDs.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ------------------------------------| ------ | --------------- |
+| PROFILE_UUID_HFP_AG | '0000111F-0000-1000-8000-00805F9B34FB' | UUID of the HFPAG Profile.
This is a system API.|
+| PROFILE_UUID_HFP_HF | '0000111E-0000-1000-8000-00805F9B34FB' | UUID of the HFPHF Profile.
This is a system API. |
+| PROFILE_UUID_HSP_AG | '00001112-0000-1000-8000-00805F9B34FB' | UUID of the HSPAG Profile.
This is a system API. |
+| PROFILE_UUID_HSP_HS | '00001108-0000-1000-8000-00805F9B34FB' | UUID of the HSPHS Profile.
This is a system API. |
+| PROFILE_UUID_A2DP_SRC | '0000110A-0000-1000-8000-00805F9B34FB' | Indicates the UID of the A2DPSRC Profile.
This is a system API. |
+| PROFILE_UUID_A2DP_SINK | '0000110B-0000-1000-8000-00805F9B34FB' | UUID of the A2DPSINK Profile.
This is a system API. |
+| PROFILE_UUID_AVRCP_CT | '0000110E-0000-1000-8000-00805F9B34FB' | UUID of the AVRCPCT Profile.
This is a system API. |
+| PROFILE_UUID_AVRCP_TG | '0000110C-0000-1000-8000-00805F9B34FB' | UUID of the AVRCPTG Profile.
This is a system API. |
+| PROFILE_UUID_HID | '00001124-0000-1000-8000-00805F9B34FB' | UUID of the HID Profile.
This is a system API. |
+| PROFILE_UUID_HOGP | '00001812-0000-1000-8000-00805F9B34FB' | UUID of the HOGP Profile.
This is a system API. |
+
+
+## ProfileConnectionState
+
+Enumerates the profile connection states.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ------------------- | ---- | -------------- |
+| STATE_DISCONNECTED | 0 | Disconnected. |
+| STATE_CONNECTING | 1 | Connecting.|
+| STATE_CONNECTED | 2 | Connected. |
+| STATE_DISCONNECTING | 3 | Disconnecting.|
+
+
+## MajorClass
+
+Enumerates the major classes of Bluetooth devices.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ------------------- | ------ | ---------- |
+| MAJOR_MISC | 0x0000 | Miscellaneous device. |
+| MAJOR_COMPUTER | 0x0100 | Computer. |
+| MAJOR_PHONE | 0x0200 | Mobile phone. |
+| MAJOR_NETWORKING | 0x0300 | Network device. |
+| MAJOR_AUDIO_VIDEO | 0x0400 | Audio or video device.|
+| MAJOR_PERIPHERAL | 0x0500 | Peripheral device. |
+| MAJOR_IMAGING | 0x0600 | Imaging device. |
+| MAJOR_WEARABLE | 0x0700 | Wearable device. |
+| MAJOR_TOY | 0x0800 | Toy. |
+| MAJOR_HEALTH | 0x0900 | Health device. |
+| MAJOR_UNCATEGORIZED | 0x1F00 | Unclassified device. |
+
+
+## MajorMinorClass
+
+Enumerates the major and minor classes of Bluetooth devices.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ---------------------------------------- | ------ | --------------- |
+| COMPUTER_UNCATEGORIZED | 0x0100 | Unclassified computer. |
+| COMPUTER_DESKTOP | 0x0104 | Desktop computer. |
+| COMPUTER_SERVER | 0x0108 | Server. |
+| COMPUTER_LAPTOP | 0x010C | Laptop. |
+| COMPUTER_HANDHELD_PC_PDA | 0x0110 | Hand-held computer. |
+| COMPUTER_PALM_SIZE_PC_PDA | 0x0114 | Palmtop computer. |
+| COMPUTER_WEARABLE | 0x0118 | Wearable computer. |
+| COMPUTER_TABLET | 0x011C | Tablet. |
+| PHONE_UNCATEGORIZED | 0x0200 | Unclassified mobile phone. |
+| PHONE_CELLULAR | 0x0204 | Portable phone. |
+| PHONE_CORDLESS | 0x0208 | Cordless phone. |
+| PHONE_SMART | 0x020C | Smartphone. |
+| PHONE_MODEM_OR_GATEWAY | 0x0210 | Modem or gateway phone.|
+| PHONE_ISDN | 0x0214 | ISDN phone. |
+| NETWORK_FULLY_AVAILABLE | 0x0300 | Device with network fully available. |
+| NETWORK_1_TO_17_UTILIZED | 0x0320 | Device used on network 1 to 17. |
+| NETWORK_17_TO_33_UTILIZED | 0x0340 | Device used on network 17 to 33. |
+| NETWORK_33_TO_50_UTILIZED | 0x0360 | Device used on network 33 to 50. |
+| NETWORK_60_TO_67_UTILIZED | 0x0380 | Device used on network 60 to 67. |
+| NETWORK_67_TO_83_UTILIZED | 0x03A0 | Device used on network 67 to 83. |
+| NETWORK_83_TO_99_UTILIZED | 0x03C0 | Device used on network 83 to 99. |
+| NETWORK_NO_SERVICE | 0x03E0 | Device without network service |
+| AUDIO_VIDEO_UNCATEGORIZED | 0x0400 | Unclassified audio or video device. |
+| AUDIO_VIDEO_WEARABLE_HEADSET | 0x0404 | Wearable audio or video headset. |
+| AUDIO_VIDEO_HANDSFREE | 0x0408 | Hands-free audio or video device. |
+| AUDIO_VIDEO_MICROPHONE | 0x0410 | Audio or video microphone. |
+| AUDIO_VIDEO_LOUDSPEAKER | 0x0414 | Audio or video loudspeaker. |
+| AUDIO_VIDEO_HEADPHONES | 0x0418 | Audio or video headphones. |
+| AUDIO_VIDEO_PORTABLE_AUDIO | 0x041C | Portable audio or video device. |
+| AUDIO_VIDEO_CAR_AUDIO | 0x0420 | In-vehicle audio or video device. |
+| AUDIO_VIDEO_SET_TOP_BOX | 0x0424 | Audio or video STB device. |
+| AUDIO_VIDEO_HIFI_AUDIO | 0x0428 | High-fidelity speaker device. |
+| AUDIO_VIDEO_VCR | 0x042C | Video cassette recording (VCR) device. |
+| AUDIO_VIDEO_VIDEO_CAMERA | 0x0430 | Camera. |
+| AUDIO_VIDEO_CAMCORDER | 0x0434 | Camcorder |
+| AUDIO_VIDEO_VIDEO_MONITOR | 0x0438 | Audio or video monitor. |
+| AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER | 0x043C | Video display or loudspeaker. |
+| AUDIO_VIDEO_VIDEO_CONFERENCING | 0x0440 | Video conferencing device. |
+| AUDIO_VIDEO_VIDEO_GAMING_TOY | 0x0448 | Audio or video gaming toy. |
+| PERIPHERAL_NON_KEYBOARD_NON_POINTING | 0x0500 | Non-keyboard or non-pointing peripheral device. |
+| PERIPHERAL_KEYBOARD | 0x0540 | Keyboard device. |
+| PERIPHERAL_POINTING_DEVICE | 0x0580 | Pointing peripheral device. |
+| PERIPHERAL_KEYBOARD_POINTING | 0x05C0 | Keyboard pointing device. |
+| PERIPHERAL_UNCATEGORIZED | 0x0500 | Unclassified peripheral device. |
+| PERIPHERAL_JOYSTICK | 0x0504 | Peripheral joystick. |
+| PERIPHERAL_GAMEPAD | 0x0508 | Peripheral game pad |
+| PERIPHERAL_REMOTE_CONTROL | 0x05C0 | Peripheral remote control device |
+| PERIPHERAL_SENSING_DEVICE | 0x0510 | Peripheral sensing device. |
+| PERIPHERAL_DIGITIZER_TABLET | 0x0514 | Peripheral digitizer tablet.|
+| PERIPHERAL_CARD_READER | 0x0518 | Peripheral card reader. |
+| PERIPHERAL_DIGITAL_PEN | 0x051C | Peripheral digital pen. |
+| PERIPHERAL_SCANNER_RFID | 0x0520 | Peripheral RFID scanner. |
+| PERIPHERAL_GESTURAL_INPUT | 0x0522 | Gesture input device. |
+| IMAGING_UNCATEGORIZED | 0x0600 | Unclassified imaging device. |
+| IMAGING_DISPLAY | 0x0610 | Imaging display device. |
+| IMAGING_CAMERA | 0x0620 | Imaging camera device. |
+| IMAGING_SCANNER | 0x0640 | Imaging scanner. |
+| IMAGING_PRINTER | 0x0680 | Imaging printer. |
+| WEARABLE_UNCATEGORIZED | 0x0700 | Unclassified wearable device. |
+| WEARABLE_WRIST_WATCH | 0x0704 | Smart watch. |
+| WEARABLE_PAGER | 0x0708 | Wearable pager. |
+| WEARABLE_JACKET | 0x070C | Smart jacket. |
+| WEARABLE_HELMET | 0x0710 | Wearable helmet. |
+| WEARABLE_GLASSES | 0x0714 | Wearable glasses. |
+| TOY_UNCATEGORIZED | 0x0800 | Unclassified toy. |
+| TOY_ROBOT | 0x0804 | Toy robot. |
+| TOY_VEHICLE | 0x0808 | Toy vehicle. |
+| TOY_DOLL_ACTION_FIGURE | 0x080C | Humanoid toy doll. |
+| TOY_CONTROLLER | 0x0810 | Toy controller. |
+| TOY_GAME | 0x0814 | Toy gaming device. |
+| HEALTH_UNCATEGORIZED | 0x0900 | Unclassified health devices. |
+| HEALTH_BLOOD_PRESSURE | 0x0904 | Blood pressure device. |
+| HEALTH_THERMOMETER | 0x0908 | Thermometer |
+| HEALTH_WEIGHING | 0x090C | Body scale. |
+| HEALTH_GLUCOSE | 0x0910 | Blood glucose monitor. |
+| HEALTH_PULSE_OXIMETER | 0x0914 | Pulse oximeter. |
+| HEALTH_PULSE_RATE | 0x0918 | Heart rate monitor. |
+| HEALTH_DATA_DISPLAY | 0x091C | Health data display. |
+| HEALTH_STEP_COUNTER | 0x0920 | Step counter. |
+| HEALTH_BODY_COMPOSITION_ANALYZER | 0x0924 | Body composition analyzer. |
+| HEALTH_PEAK_FLOW_MONITOR | 0x0928 | Hygrometer. |
+| HEALTH_MEDICATION_MONITOR | 0x092C | Medication monitor. |
+| HEALTH_KNEE_PROSTHESIS | 0x0930 | Prosthetic knee. |
+| HEALTH_ANKLE_PROSTHESIS | 0x0934 | Prosthetic ankle. |
+| HEALTH_GENERIC_HEALTH_MANAGER | 0x0938 | Generic health management device. |
+| HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | Personal mobility device. |
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-hfp.md b/en/application-dev/reference/apis/js-apis-bluetooth-hfp.md
new file mode 100644
index 0000000000000000000000000000000000000000..c9163681742e3dd19cf114518c742b0ff3d26c00
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-hfp.md
@@ -0,0 +1,128 @@
+# @ohos.bluetooth.hfp (Bluetooth hfp Module)
+
+The **hfp** module provides APIs for using the Bluetooth Hands-Free Profile (HFP).
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import hfp from '@ohos.bluetooth.hfp';
+```
+
+
+## hfp.createHfpAgProfile
+
+createHfpAgProfile(): HandsFreeAudioGatewayProfile
+
+Creates an **HfpAgProfile** instance.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | ---------- |
+| HandsFreeAudioGatewayProfile | **HfpAgProfile** instance created.|
+
+**Example**
+
+```js
+try {
+ let hfpAgProfile = hfp.createHfpAgProfile();
+ console.info('hfpAg success');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## HandsFreeAudioGatewayProfile
+
+Before using any API of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using **createHfpAgProfile()**.
+
+
+### connect
+
+connect(deviceId: string): void
+
+Connects to a hands-free device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the remote device.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let hfpAg = hfp.createHfpAgProfile();
+ hfpAg.connect('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### disconnect
+
+disconnect(deviceId: string): void
+
+Disconnects from a hands-free device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the remote device.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let hfpAg = hfp.createHfpAgProfile();
+ hfpAg.disconnect('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-hid.md b/en/application-dev/reference/apis/js-apis-bluetooth-hid.md
new file mode 100644
index 0000000000000000000000000000000000000000..a4449a7d63088b3398bb42596e5499c72a1dad3e
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-hid.md
@@ -0,0 +1,128 @@
+# @ohos.bluetooth.hid (Bluetooth hid Module)
+
+The **hid** module provides APIs for using the Bluetooth Human Interface Device Profile (HID).
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import hid from '@ohos.bluetooth.hid';
+```
+
+
+## hid.createHidHostProfile
+
+createHidHostProfile(): HidHostProfile
+
+Creates a **HidHostProfile** instance.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | ---------- |
+| HidHostProfile | **HidHostProfile** instance created.|
+
+**Example**
+
+```js
+try {
+ let hidHostProfile = hid.createHidHostProfile();
+ console.info('hidHost success');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## HidHostProfile
+
+Before using any API of **HidHostProfile**, you need to create an instance of this class by using **createHidHostProfile()**.
+
+
+### connect
+
+connect(deviceId: string): void
+
+Connects to the HidHost service of a device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the remote device.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let hidHostProfile = hid.createHidHostProfile();
+ hidHostProfile.connect('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### disconnect
+
+disconnect(deviceId: string): void
+
+Disconnects from the HidHost service of a device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the remote device.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let hidHostProfile = hid.createHidHostProfile();
+ hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-pan.md b/en/application-dev/reference/apis/js-apis-bluetooth-pan.md
new file mode 100644
index 0000000000000000000000000000000000000000..b74dbdcbd5e656fc29d2042625b8d1113790488c
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-pan.md
@@ -0,0 +1,158 @@
+# @ohos.bluetooth.pan (Bluetooth pan Module)
+
+The **pan** module provides APIs for accessing the Bluetooth personal area network (PAN).
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import pan from '@ohos.bluetooth.pan';
+```
+
+
+## pan.createPanProfile
+
+createPanProfile(): PanProfile
+
+Creates a **PanProfile** instance.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| ----------------------------- | ---------- |
+| PanProfile | **PanProfile** instance created.|
+
+**Example**
+
+```js
+try {
+ let panProfile = pan.createPanProfile();
+ console.info('pan success');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## PanProfile
+
+Before using any API of **PanProfile**, you need to create an instance of this class by using **createPanProfile()**.
+
+
+### disconnect
+
+disconnect(deviceId: string): void
+
+Disconnects from the PAN service of a device.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| deviceId | string | Yes | Address of the remote device.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let panProfile = pan.createPanProfile();
+ panProfile.disconnect('XX:XX:XX:XX:XX:XX');
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### setTethering
+
+setTethering(enable: boolean): void
+
+Sets Bluetooth tethering, which shares a mobile connection.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------- |
+| value | boolean | Yes | Whether to set tethering over a Bluetooth PAN.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+try {
+ let panProfile = pan.createPanProfile();
+ panProfile.setTethering(false);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+### isTetheringOn
+
+isTetheringOn(): boolean
+
+Checks whether Bluetooth tethering is activated.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Return value**
+
+| Type | Description |
+| --------------------- | --------------------------------- |
+| boolean | Returns **true** if tethering is available over a Bluetooth PAN; returns **false** otherwise.|
+
+**Example**
+
+```js
+try {
+ let panProfile = pan.createPanProfile();
+ let ret = panProfile.isTetheringOn();
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth-socket.md b/en/application-dev/reference/apis/js-apis-bluetooth-socket.md
new file mode 100644
index 0000000000000000000000000000000000000000..8ec8977df385665edc64231cd7aea4b62dafd35e
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bluetooth-socket.md
@@ -0,0 +1,410 @@
+# @ohos.bluetooth.socket (Bluetooth socket Module)
+
+The **socket** module provides APIs for operating and managing Bluetooth sockets.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
+
+## Modules to Import
+
+```js
+import socket from '@ohos.bluetooth.socket';
+```
+
+## socket.sppListen
+
+sppListen(name: string, options: SppOptions, callback: AsyncCallback<number>): void
+
+Creates a Serial Port Profile (SPP) listening socket for the server.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------------- | ---- | ----------------------- |
+| name | string | Yes | Name of the service. |
+| option | [SppOptions](#sppoptions) | Yes | SPP listening configuration. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the server socket ID.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let serverNumber = -1;
+function serverSocket(code, number) {
+ console.log('bluetooth error code: ' + code.code);
+ if (code.code == 0) {
+ console.log('bluetooth serverSocket Number: ' + number);
+ serverNumber = number;
+ }
+}
+
+let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: false, type: 0};
+try {
+ socket.sppListen('server1', sppOption, serverSocket);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## socket.sppAccept
+
+sppAccept(serverSocket: number, callback: AsyncCallback<number>): void
+
+Accepts a connection request from the client over a socket of the server.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------------ | --------------------------- | ---- | ----------------------- |
+| serverSocket | number | Yes | Server socket ID. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the client socket ID.|
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let serverNumber = -1;
+function serverSocket(code, number) {
+ console.log('bluetooth error code: ' + code.code);
+ if (code.code == 0) {
+ console.log('bluetooth serverSocket Number: ' + number);
+ serverNumber = number;
+ }
+}
+let clientNumber = -1;
+function acceptClientSocket(code, number) {
+ console.log('bluetooth error code: ' + code.code);
+ if (code.code == 0) {
+ console.log('bluetooth clientSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the server.
+ clientNumber = number;
+ }
+}
+try {
+ socket.sppAccept(serverNumber, acceptClientSocket);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## socket.sppConnect
+
+sppConnect(deviceId: string, options: SppOptions, callback: AsyncCallback<number>): void
+
+Initiates an SPP connection to a remote device from the client.
+
+**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------------- | ---- | ------------------------------ |
+| deviceId | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
+| option | [SppOptions](#sppoptions) | Yes | SSP listensing configuration for the connection. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the client socket ID. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
+let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: false, type: 0};
+try {
+ socket.sppConnect('XX:XX:XX:XX:XX:XX', sppOption, clientSocket);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## socket.sppCloseServerSocket
+
+sppCloseServerSocket(socket: number): void
+
+Closes an SPP listening socket of the server.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | --------------- |
+| socket | number | Yes | Server socket ID, which is obtained by **sppListen()**. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let serverNumber = -1;
+function serverSocket(code, number) {
+ console.log('bluetooth error code: ' + code.code);
+ if (code.code == 0) {
+ console.log('bluetooth serverSocket Number: ' + number);
+ serverNumber = number;
+ }
+}
+try {
+ socket.sppCloseServerSocket(serverNumber);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## socket.sppCloseClientSocket
+
+sppCloseClientSocket(socket: number): void
+
+Closes an SPP listening socket of the client.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------------- |
+| socket | number | Yes | Client socket ID, which is obtained by **sppAccept()** or **sppConnect**(). |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
+try {
+ socket.sppCloseClientSocket(clientNumber);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## socket.sppWrite
+
+sppWrite(clientSocket: number, data: ArrayBuffer): void
+
+Writes data to the remote device through a socket.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------------ | ----------- | ---- | ------------- |
+| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept()** or **sppConnect**(). |
+| data | ArrayBuffer | Yes | Data to write. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2901054 | IO error. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
+let arrayBuffer = new ArrayBuffer(8);
+let data = new Uint8Array(arrayBuffer);
+data[0] = 123;
+try {
+ socket.sppWrite(clientNumber, arrayBuffer);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## socket.on('sppRead')
+
+on(type: 'sppRead', clientSocket: number, callback: Callback<ArrayBuffer>): void
+
+Subscribes to SPP read request events.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------------ | --------------------------- | ---- | -------------------------- |
+| type | string | Yes | Event type. The value is **sppRead**, which indicates an SPP read request event. |
+| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept()** or **sppConnect()**. |
+| callback | Callback<ArrayBuffer> | Yes | Callback invoked to return the data read. |
+
+**Error codes**
+
+For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------- |
+|2901054 | IO error. |
+|2900099 | Operation failed. |
+
+**Example**
+
+```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
+function dataRead(dataBuffer) {
+ let data = new Uint8Array(dataBuffer);
+ console.log('bluetooth data is: ' + data[0]);
+}
+try {
+ socket.on('sppRead', clientNumber, dataRead);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## socket.off('sppRead')
+
+off(type: 'sppRead', clientSocket: number, callback?: Callback<ArrayBuffer>): void
+
+Unsubscribes from SPP read request events.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------------ | --------------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value is **sppRead**, which indicates an SPP read request event. |
+| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept()** or **sppConnect()**. |
+| callback | Callback<ArrayBuffer> | No | Callback for the SPP read request event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**. |
+
+**Example**
+
+```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
+try {
+ socket.off('sppRead', clientNumber);
+} catch (err) {
+ console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
+}
+```
+
+
+## SppOptions
+
+Defines the SPP configuration.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Type | Readable | Writable | Description |
+| ------ | ------------------- | ---- | ---- | ----------- |
+| uuid | string | Yes | Yes | UUID of the SPP.|
+| secure | boolean | Yes | Yes | Whether it is a secure channel. |
+| type | [SppType](#SppType) | Yes | Yes | Type of the SPP link. |
+
+
+## SppType
+
+Enumerates the SPP link types.
+
+**System capability**: SystemCapability.Communication.Bluetooth.Core
+
+| Name | Value | Description |
+| ---------- | ---- | ------------- |
+| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link. |
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md
index f22961f16809055e3ab560afb78750e42030aec3..7bd21aac353ac966f7d8f3b96c1b5ef8783dcfe8 100644
--- a/en/application-dev/reference/apis/js-apis-bluetooth.md
+++ b/en/application-dev/reference/apis/js-apis-bluetooth.md
@@ -3,9 +3,8 @@
The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
> **NOTE**
->
-> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-> - The APIs provided by this module are no longer maintained since API version 9. You are advised to use [bluetoothManager](js-apis-bluetoothManager.md).
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [bluetoothManager](js-apis-bluetoothManager.md).
@@ -215,7 +214,7 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX");
getProfileConnState(profileId: ProfileId): ProfileConnectionState
-Obtains the connection status of a specified profile.
+Obtains the connection status of the specified profile.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate).
@@ -664,7 +663,7 @@ bluetooth.off('pinRequired', onReceiveEvent);
on(type: "bondStateChange", callback: Callback<BondStateParam>): void
-Subscribes to the Bluetooth pairing state change events.
+Subscribes to the Bluetooth pairing state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.on('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageronbondstatechange).
@@ -698,7 +697,7 @@ bluetooth.on('bondStateChange', onReceiveEvent);
off(type: "bondStateChange", callback?: Callback<BondStateParam>): void
-Unsubscribes from the Bluetooth pairing state change events.
+Unsubscribes from the Bluetooth pairing state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.off('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffbondstatechange).
@@ -733,7 +732,7 @@ bluetooth.off('bondStateChange', onReceiveEvent);
on(type: "stateChange", callback: Callback<BluetoothState>): void
-Subscribes to the Bluetooth connection state change events.
+Subscribes to the Bluetooth connection state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.on('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageronstatechange).
@@ -767,7 +766,7 @@ bluetooth.on('stateChange', onReceiveEvent);
off(type: "stateChange", callback?: Callback<BluetoothState>): void
-Unsubscribes from the Bluetooth connection state change events.
+Unsubscribes from the Bluetooth connection state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.off('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffstatechange).
@@ -1145,7 +1144,7 @@ let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
## bluetooth.BLE
-### bluetooth.BLE.createGattServer(deprecated)
+### createGattServer(deprecated)
createGattServer(): GattServer
@@ -1169,7 +1168,7 @@ let gattServer = bluetooth.BLE.createGattServer();
```
-### bluetooth.BLE.createGattClientDevice(deprecated)
+### createGattClientDevice(deprecated)
createGattClientDevice(deviceId: string): GattClientDevice
@@ -1199,7 +1198,7 @@ let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX');
```
-### bluetooth.BLE.getConnectedBLEDevices(deprecated)
+### getConnectedBLEDevices(deprecated)
getConnectedBLEDevices(): Array<string>
@@ -1225,7 +1224,7 @@ let result = bluetooth.BLE.getConnectedBLEDevices();
```
-### bluetooth.BLE.startBLEScan(deprecated)
+### startBLEScan(deprecated)
startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void
@@ -1271,7 +1270,7 @@ bluetooth.BLE.startBLEScan(
```
-### bluetooth.BLE.stopBLEScan(deprecated)
+### stopBLEScan(deprecated)
stopBLEScan(): void
@@ -1295,7 +1294,7 @@ bluetooth.BLE.stopBLEScan();
```
-### bluetooth.BLE.on('BLEDeviceFind')(deprecated)
+### on('BLEDeviceFind')(deprecated)
on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void
@@ -1329,7 +1328,7 @@ bluetooth.BLE.on('BLEDeviceFind', onReceiveEvent);
```
-### bluetooth.BLE.off('BLEDeviceFind')(deprecated)
+### off('BLEDeviceFind')(deprecated)
off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void
@@ -1502,7 +1501,7 @@ let ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX');
on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void
-Subscribes to the A2DP connection state change events.
+Subscribes to the A2DP connection state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.A2dpSourceProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange).
@@ -1535,7 +1534,7 @@ a2dpSrc.on('connectionStateChange', onReceiveEvent);
off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
-Unsubscribes from the A2DP connection state change events.
+Unsubscribes from the A2DP connection state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.A2dpSourceProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange).
@@ -1673,7 +1672,7 @@ let ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX');
on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void
-Subscribes to the HFP connection state change events.
+Subscribes to the HFP connection state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.HandsFreeAudioGatewayProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange-1).
@@ -1707,7 +1706,7 @@ hfpAg.on('connectionStateChange', onReceiveEvent);
off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
-Unsubscribes from the HFP connection state change events.
+Unsubscribes from the HFP connection state changes.
> **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.HandsFreeAudioGatewayProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange-1).
@@ -2394,7 +2393,7 @@ gattServer.off("descriptorWrite");
on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void
-Subscribes to the BLE connection state change events.
+Subscribes to the BLE connection state changes.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('connectStateChange')](js-apis-bluetoothManager.md#onconnectstatechange).
@@ -2431,7 +2430,7 @@ gattServer.on("connectStateChange", Connected);
off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void
-Unsubscribes from the BLE connection state change events.
+Unsubscribes from the BLE connection state changes.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.off('connectStateChange')](js-apis-bluetoothManager.md#offconnectstatechange).
@@ -2995,7 +2994,7 @@ device.setNotifyCharacteristicChanged(characteristic, false);
on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void
-Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** method is called.
+Subscribes to the BLE characteristic changes. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** method is called.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.on('BLECharacteristicChange')](js-apis-bluetoothManager.md#onblecharacteristicchange).
@@ -3032,7 +3031,7 @@ device.on('BLECharacteristicChange', CharacteristicChange);
off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void
-Unsubscribes from the BLE characteristic change events.
+Unsubscribes from the BLE characteristic changes.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.off('BLECharacteristicChange')](js-apis-bluetoothManager.md#offblecharacteristicchange).
@@ -3064,7 +3063,7 @@ device.off('BLECharacteristicChange');
on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void
-Subscribes to the BLE connection state change events.
+Subscribes to the BLE connection state changes.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.on('BLEConnectionStateChange')](js-apis-bluetoothManager.md#onbleconnectionstatechange).
@@ -3100,7 +3099,7 @@ device.on('BLEConnectionStateChange', ConnectStateChanged);
off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void
-Unsubscribes from the BLE connection state change events.
+Unsubscribes from the BLE connection state changes.
> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.off('BLEConnectionStateChange')](js-apis-bluetoothManager.md#offbleconnectionstatechange).
diff --git a/en/application-dev/reference/apis/js-apis-bluetoothManager.md b/en/application-dev/reference/apis/js-apis-bluetoothManager.md
index cbbbfe87b558ec6a9c43d7e70ebd513c1454c1f9..b6b353fee524e2abef7c3f74bcb6d4993571a920 100644
--- a/en/application-dev/reference/apis/js-apis-bluetoothManager.md
+++ b/en/application-dev/reference/apis/js-apis-bluetoothManager.md
@@ -15,12 +15,15 @@ import bluetoothManager from '@ohos.bluetoothManager';
```
-## bluetoothManager.enableBluetooth
+## bluetoothManager.enableBluetooth(deprecated)
enableBluetooth(): void
Enables Bluetooth.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [access.enableBluetooth](js-apis-bluetooth-access.md#accessenablebluetooth).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -45,12 +48,15 @@ try {
```
-## bluetoothManager.disableBluetooth
+## bluetoothManager.disableBluetooth(deprecated)
disableBluetooth(): void
Disables Bluetooth.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [access.disableBluetooth](js-apis-bluetooth-access.md#accessdisablebluetooth).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -75,12 +81,15 @@ try {
```
-## bluetoothManager.getLocalName
+## bluetoothManager.getLocalName(deprecated)
getLocalName(): string
Obtains the name of the local Bluetooth device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.getLocalName](js-apis-bluetooth-connection.md#connectiongetlocalname).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -111,12 +120,15 @@ try {
```
-## bluetoothManager.getState
+## bluetoothManager.getState(deprecated)
getState(): BluetoothState
Obtains the Bluetooth state.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [access.getState](js-apis-bluetooth-access.md#accessgetstate).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -147,12 +159,15 @@ try {
```
-## bluetoothManager.getBtConnectionState
+## bluetoothManager.getBtConnectionState(deprecated)
getBtConnectionState(): ProfileConnectionState
Obtains the local profile connection status.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.getProfileConnectionState](js-apis-bluetooth-connection.md#connectiongetprofileconnectionstate).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -184,12 +199,15 @@ try {
```
-## bluetoothManager.setLocalName
+## bluetoothManager.setLocalName(deprecated)
setLocalName(name: string): void
Sets the name of the local Bluetooth device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.setLocalName](js-apis-bluetooth-connection.md#connectionsetlocalname).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -221,12 +239,15 @@ try {
```
-## bluetoothManager.pairDevice
+## bluetoothManager.pairDevice(deprecated)
pairDevice(deviceId: string): void
Initiates Bluetooth pairing.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.pairDevice](js-apis-bluetooth-connection.md#connectionpairdevice).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -259,109 +280,15 @@ try {
```
-## bluetoothManager.pairCredibleDevice10+
-
-pairCredibleDevice(deviceId: string, transport: BluetoothTransport, callback: AsyncCallback<void>): void
-
-Pairs a trusted remote device whose address is obtained in a non-Bluetooth scan mode (such as using NFC).
-
-**System API**: This is a system API.
-
-**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
-
-**System capability**: SystemCapability.Communication.Bluetooth.Core
-
-**Parameters**
-
-| Name | Type | Mandatory | Description |
-| -------- | ------ | ---- | ----------------------------------- |
-| deviceId | string | Yes | Address of the remote device to pair, for example, XX:XX:XX:XX:XX:XX.|
-| transport | [BluetoothTransport](#bluetoothtransport10) | Yes | Device type, for example, a classic Bluetooth device or a Bluetooth low energy (BLE) device.|
-| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
-
-**Error codes**
-
-For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
-
-| ID| Error Message|
-| -------- | ---------------------------- |
-|2900001 | Service stopped. |
-|2900003 | Bluetooth switch is off. |
-|2900099 | Operation failed. |
-
-**Example**
-
-```js
-try {
- bluetoothManager.pairCredibleDevice("68:13:24:79:4C:8C", 1, err => {
- if (err) {
- console.error("errCode:" + err.code + ",errMessage:" + err.message);
- return;
- }
- console.info("pairCredibleDevice,err:" + JSON.stringify(err));
- });
-} catch (err) {
- console.error("errCode:" + err.code + ",errMessage:" + err.message);
-}
-```
-
-
-## bluetoothManager.pairCredibleDevice10+
-
-pairCredibleDevice(deviceId: string, transport: BluetoothTransport): Promise<void>
-
-Pairs a trusted remote device whose address is obtained in a non-Bluetooth scan mode (such as using NFC).
-
-**System API**: This is a system API.
-
-**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
-
-**System capability**: SystemCapability.Communication.Bluetooth.Core
-
-**Parameters**
-
-| Name | Type | Mandatory | Description |
-| -------- | ------ | ---- | ----------------------------------- |
-| deviceId | string | Yes | Address of the remote device to pair, for example, XX:XX:XX:XX:XX:XX.|
-| transport | [BluetoothTransport](#bluetoothtransport10) | Yes | Device type, for example, a classic Bluetooth device or a BLE device.|
-
-**Return value**
-
-| Type | Description |
-| ------------------------------------------------- | ------------------- |
-| Promise<void> | Promise used to return the result.|
-
-**Error codes**
-
-For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
-
-| ID| Error Message|
-| -------- | ---------------------------- |
-|2900001 | Service stopped. |
-|2900003 | Bluetooth switch is off. |
-|2900099 | Operation failed. |
-
-**Example**
-
-```js
-try {
- bluetoothManager.pairCredibleDevice("68:13:24:79:4C:8C", 0).then(() => {
- console.info("PairCredibleDevice");
- }, err => {
- console.error("PairCredibleDevice:errCode" + err.code + ",errMessage:" + err.message);
- });
-} catch (err) {
- console.error("errCode:" + err.code + ",errMessage:" + err.message);
-}
-```
-
-
-## bluetoothManager.getProfileConnectionState
+## bluetoothManager.getProfileConnectionState(deprecated)
getProfileConnectionState(profileId: ProfileId): ProfileConnectionState
Obtains the connection status of the specified profile.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.getProfileConnectionState](js-apis-bluetooth-connection.md#connectiongetprofileconnectionstate).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -400,12 +327,15 @@ try {
```
-## bluetoothManager.cancelPairedDevice
+## bluetoothManager.cancelPairedDevice(deprecated)
cancelPairedDevice(deviceId: string): void
Cancels a paired remote device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.cancelPairedDevice](js-apis-bluetooth-connection.md#connectioncancelpaireddevice).
+
**System API**: This is a system API.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
@@ -439,12 +369,15 @@ try {
```
-## bluetoothManager.getRemoteDeviceName
+## bluetoothManager.getRemoteDeviceName(deprecated)
getRemoteDeviceName(deviceId: string): string
Obtains the name of the remote Bluetooth device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.getRemoteDeviceName](js-apis-bluetooth-connection.md#connectiongetremotedevicename).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -482,12 +415,15 @@ try {
```
-## bluetoothManager.getRemoteDeviceClass
+## bluetoothManager.getRemoteDeviceClass(deprecated)
getRemoteDeviceClass(deviceId: string): DeviceClass
Obtains the class of the remote Bluetooth device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.getRemoteDeviceClass](js-apis-bluetooth-connection.md#connectiongetremotedeviceclass).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -525,12 +461,15 @@ try {
```
-## bluetoothManager.getPairedDevices
+## bluetoothManager.getPairedDevices(deprecated)
getPairedDevices(): Array<string>
Obtains the paired devices.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.getPairedDevices](js-apis-bluetooth-connection.md#connectiongetpaireddevices).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -562,12 +501,15 @@ try {
```
-## bluetoothManager.setBluetoothScanMode
+## bluetoothManager.setBluetoothScanMode(deprecated)
setBluetoothScanMode(mode: ScanMode, duration: number): void
Sets the Bluetooth scan mode so that the device can be discovered by a remote device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.setBluetoothScanMode](js-apis-bluetooth-connection.md#connectionsetbluetoothscanmode).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -601,12 +543,15 @@ try {
```
-## bluetoothManager.getBluetoothScanMode
+## bluetoothManager.getBluetoothScanMode(deprecated)
getBluetoothScanMode(): ScanMode
Obtains the Bluetooth scan mode.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.getBluetoothScanMode](js-apis-bluetooth-connection.md#connectiongetbluetoothscanmode).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -638,12 +583,15 @@ try {
```
-## bluetoothManager.startBluetoothDiscovery
+## bluetoothManager.startBluetoothDiscovery(deprecated)
startBluetoothDiscovery(): void
Starts Bluetooth scan to discover remote devices.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.startBluetoothDiscovery](js-apis-bluetooth-connection.md#connectionstartbluetoothdiscovery).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -674,12 +622,15 @@ try {
```
-## bluetoothManager.stopBluetoothDiscovery
+## bluetoothManager.stopBluetoothDiscovery(deprecated)
stopBluetoothDiscovery(): void
Stops Bluetooth scan.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.stopBluetoothDiscovery](js-apis-bluetooth-connection.md#connectionstopbluetoothdiscovery).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -705,12 +656,15 @@ try {
```
-## bluetoothManager.setDevicePairingConfirmation
+## bluetoothManager.setDevicePairingConfirmation(deprecated)
setDevicePairingConfirmation(device: string, accept: boolean): void
Sets the device pairing confirmation.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.setDevicePairingConfirmation](js-apis-bluetooth-connection.md#connectionsetdevicepairingconfirmation).
+
**Required permissions**: ohos.permission.MANAGE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -749,104 +703,15 @@ try {
```
-## bluetoothManager.setDevicePinCode10+
-
-setDevicePinCode(device: string, code: string, callback: AsyncCallback<void>): void
-
-Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**.
-
-**Required permissions**: ohos.permission.MANAGE_BLUETOOTH
-
-**System capability**: SystemCapability.Communication.Bluetooth.Core
-
-**Parameters**
-
-| Name | Type | Mandatory | Description |
-| ------ | ------- | ---- | -------------------------------- |
-| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
-| code | string | Yes | PIN to set. |
-| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
-
-**Error codes**
-
-For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
-
-| ID| Error Message|
-| -------- | ---------------------------- |
-|2900001 | Service stopped. |
-|2900003 | Bluetooth switch is off. |
-|2900099 | Operation failed. |
-
-**Example**
-
-```js
-//callback
-try {
- bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => {
- console.info('setDevicePinCode,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data));
- });
-} catch (err) {
- console.error("errCode:" + err.code + ",errMessage:" + err.message);
-}
-```
-
-
-## bluetoothManager.setDevicePinCode10+
-
-setDevicePinCode(device: string, code: string): Promise<void>
-
-Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.MANAGE_BLUETOOTH
-
-**System capability**: SystemCapability.Communication.Bluetooth.Core
-
-**Parameters**
-
-| Name | Type | Mandatory | Description |
-| ------ | ------- | ---- | -------------------------------- |
-| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.|
-| code | string | Yes | PIN to set. |
-
-**Return value**
-
-| Type | Description |
-| ------------------- | ------------- |
-| Promise<void> | Promise used to return the result.|
-
-**Error codes**
-
-For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
-
-| ID| Error Message|
-| -------- | ---------------------------- |
-|2900001 | Service stopped. |
-|2900003 | Bluetooth switch is off. |
-|2900099 | Operation failed. |
-
-**Example**
-
-```js
-//promise
-try {
- bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => {
- console.info('setDevicePinCode');
- }, error => {
- console.info('setDevicePinCode: errCode:' + error.code + ',errMessage' + error.message);
- })
-
-} catch (err) {
- console.error("errCode:" + err.code + ",errMessage:" + err.message);
-}
-```
-
-
-## bluetoothManager.on('bluetoothDeviceFind')
+## bluetoothManager.on('bluetoothDeviceFind')(deprecated)
on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void
Subscribes to the Bluetooth device discovery events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.on('bluetoothDeviceFind')](js-apis-bluetooth-connection.md#connectiononbluetoothdevicefind).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -880,12 +745,15 @@ try {
```
-## bluetoothManager.off('bluetoothDeviceFind')
+## bluetoothManager.off('bluetoothDeviceFind')(deprecated)
off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void
Unsubscribes from the Bluetooth device discovery events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.off('bluetoothDeviceFind')](js-apis-bluetooth-connection.md#connectionoffbluetoothdevicefind).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -920,12 +788,15 @@ try {
```
-## bluetoothManager.on('pinRequired')
+## bluetoothManager.on('pinRequired')(deprecated)
on(type: "pinRequired", callback: Callback<PinRequiredParam>): void
Subscribes to the pairing request events of the remote Bluetooth device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.on('pinRequired')](js-apis-bluetooth-connection.md#connectiononpinrequired).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -959,12 +830,15 @@ try {
```
-## bluetoothManager.off('pinRequired')
+## bluetoothManager.off('pinRequired')(deprecated)
off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void
Unsubscribes from the pairing request events of the remote Bluetooth device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.off('pinRequired')](js-apis-bluetooth-connection.md#connectionoffpinrequired).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -999,11 +873,14 @@ try {
```
-## bluetoothManager.on('bondStateChange')
+## bluetoothManager.on('bondStateChange')(deprecated)
on(type: "bondStateChange", callback: Callback<BondStateParam>): void
-Subscribes to the Bluetooth pairing state change events.
+Subscribes to the Bluetooth pairing state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.on('bondStateChange')](js-apis-bluetooth-connection.md#connectiononbondstatechange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -1038,11 +915,14 @@ try {
```
-## bluetoothManager.off('bondStateChange')
+## bluetoothManager.off('bondStateChange')(deprecated)
off(type: "bondStateChange", callback?: Callback<BondStateParam>): void
-Unsubscribes from the Bluetooth pairing state change events.
+Unsubscribes from the Bluetooth pairing state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.off('bondStateChange')](js-apis-bluetooth-connection.md#connectionoffbondstatechange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -1078,12 +958,15 @@ try {
```
-## bluetoothManager.on('stateChange')
+## bluetoothManager.on('stateChange')(deprecated)
on(type: "stateChange", callback: Callback<BluetoothState>): void
Subscribes to Bluetooth state events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [access.on('stateChange')](js-apis-bluetooth-access.md#accessonstatechange).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1117,12 +1000,15 @@ try {
```
-## bluetoothManager.off('stateChange')
+## bluetoothManager.off('stateChange')(deprecated)
off(type: "stateChange", callback?: Callback<BluetoothState>): void
Unsubscribes from Bluetooth state events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [access.off('stateChange')](js-apis-bluetooth-access.md#accessoffstatechange).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1157,12 +1043,15 @@ try {
```
-## bluetoothManager.sppListen
+## bluetoothManager.sppListen(deprecated)
sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void
Creates a server listening socket.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.sppListen](js-apis-bluetooth-socket.md#socketspplisten).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1207,12 +1096,15 @@ try {
```
-## bluetoothManager.sppAccept
+## bluetoothManager.sppAccept(deprecated)
sppAccept(serverSocket: number, callback: AsyncCallback<number>): void
Listens for a connection to be made to this socket from the client and accepts it.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.sppAccept](js-apis-bluetooth-socket.md#socketsppaccept).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1261,12 +1153,15 @@ try {
```
-## bluetoothManager.sppConnect
+## bluetoothManager.sppConnect(deprecated)
sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void
Initiates an SPP connection to a remote device from the client.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.sppConnect](js-apis-bluetooth-socket.md#socketsppconnect).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1312,12 +1207,15 @@ try {
```
-## bluetoothManager.sppCloseServerSocket
+## bluetoothManager.sppCloseServerSocket(deprecated)
sppCloseServerSocket(socket: number): void
Closes the listening socket of the server.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.sppCloseServerSocket](js-apis-bluetooth-socket.md#socketsppcloseserversocket).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1354,12 +1252,15 @@ try {
```
-## bluetoothManager.sppCloseClientSocket
+## bluetoothManager.sppCloseClientSocket(deprecated)
sppCloseClientSocket(socket: number): void
Closes the client socket.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.sppCloseClientSocket](js-apis-bluetooth-socket.md#socketsppcloseclientsocket).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1398,12 +1299,15 @@ try {
```
-## bluetoothManager.sppWrite
+## bluetoothManager.sppWrite(deprecated)
sppWrite(clientSocket: number, data: ArrayBuffer): void
Writes data to the remote device through the socket.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.sppWrite](js-apis-bluetooth-socket.md#socketsppwrite).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1445,12 +1349,15 @@ try {
```
-## bluetoothManager.on('sppRead')
+## bluetoothManager.on('sppRead')(deprecated)
on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void
Subscribes to the SPP read request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.on('sppRead')](js-apis-bluetooth-socket.md#socketonsppread).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1494,12 +1401,15 @@ try {
```
-## bluetoothManager.off('sppRead')
+## bluetoothManager.off('sppRead')(deprecated)
off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void
Unsubscribes from the SPP read request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.off('sppRead')](js-apis-bluetooth-socket.md#socketoffsppread).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1529,7 +1439,7 @@ try {
}
```
-## bluetoothManager.getProfileInstance
+## bluetoothManager.getProfileInstance(deprecated)
getProfileInstance(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile
@@ -1562,12 +1472,15 @@ try {
## bluetoothManager.BLE
-### bluetoothManager.BLE.createGattServer
+### createGattServer(deprecated)
createGattServer(): GattServer
Creates a **GattServer** instance.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.createGattServer](js-apis-bluetooth-ble.md#blecreategattserver).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Return value**
@@ -1583,12 +1496,15 @@ let gattServer = bluetoothManager.BLE.createGattServer();
```
-### bluetoothManager.BLE.createGattClientDevice
+### createGattClientDevice(deprecated)
createGattClientDevice(deviceId: string): GattClientDevice
Creates a **GattClientDevice** instance.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.createGattClientDevice](js-apis-bluetooth-ble.md#blecreategattclientdevice).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1614,12 +1530,15 @@ try {
```
-### bluetoothManager.BLE.getConnectedBLEDevices
+### getConnectedBLEDevices(deprecated)
getConnectedBLEDevices(): Array<string>
Obtains the BLE devices connected to this device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.getConnectedBLEDevices](js-apis-bluetooth-ble.md#blegetconnectedbledevices).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1651,12 +1570,15 @@ try {
```
-### bluetoothManager.BLE.startBLEScan
+### startBLEScan(deprecated)
startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void
Starts a BLE scan.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.startBLEScan](js-apis-bluetooth-ble.md#blestartblescan).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH, ohos.permission.MANAGE_BLUETOOTH, ohos.permission.LOCATION, and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1704,12 +1626,15 @@ try {
```
-### bluetoothManager.BLE.stopBLEScan
+### stopBLEScan(deprecated)
stopBLEScan(): void
Stops the BLE scan.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.startBLEScan](js-apis-bluetooth-ble.md#blestopblescan).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1735,12 +1660,15 @@ try {
```
-### bluetoothManager.BLE.on('BLEDeviceFind')
+### on('BLEDeviceFind')(deprecated)
on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void
Subscribe to the BLE device discovery events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.on('BLEDeviceFind')](js-apis-bluetooth-ble.md#bleonbledevicefind).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1774,12 +1702,15 @@ try {
```
-### bluetoothManager.BLE.off('BLEDeviceFind')
+### off('BLEDeviceFind')(deprecated)
off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void
Unsubscribes from the BLE device discovery events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.off('BLEDeviceFind')](js-apis-bluetooth-ble.md#bleoffbledevicefind).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1819,12 +1750,15 @@ try {
Provides the profile base class.
-### getConnectionDevices
+### getConnectionDevices(deprecated)
getConnectionDevices(): Array<string>
Obtains the connected devices.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.getConnectedDevices](js-apis-bluetooth-baseProfile.md#baseprofilegetconnecteddevices).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1857,12 +1791,15 @@ try {
}
```
-### getDeviceState
+### getDeviceState(deprecated)
getDeviceState(device: string): ProfileConnectionState
Obtains the connection state of the profile.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.getConnectionState](js-apis-bluetooth-baseProfile.md#baseprofilegetconnectionstate).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1901,17 +1838,24 @@ try {
}
```
+
## A2dpSourceProfile
Before using an API of **A2dpSourceProfile**, you need to create an instance of this class by using **getProfile()**.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [a2dp.A2dpSourceProfile](js-apis-bluetooth-a2dp.md#a2dpsourceprofile).
-### connect
+
+### connect(deprecated)
connect(device: string): void
Sets up an Advanced Audio Distribution Profile (A2DP) connection.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [a2dp.A2dpSourceProfile#connect](js-apis-bluetooth-a2dp.md#connect).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1945,12 +1889,15 @@ try {
```
-### disconnect
+### disconnect(deprecated)
disconnect(device: string): void
Disconnects an A2DP connection.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [a2dp.A2dpSourceProfile#disconnect](js-apis-bluetooth-a2dp.md#disconnect).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1984,11 +1931,14 @@ try {
```
-### on('connectionStateChange')
+### on('connectionStateChange')(deprecated)
on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void
-Subscribes to the A2DP connection state change events.
+Subscribes to the A2DP connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.on('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileonconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -1996,7 +1946,7 @@ Subscribes to the A2DP connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.|
+| type | string | Yes | Event type. The value **connectionStateChange** indicates a A2DP connection state change event.|
| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the A2DP connection state change event. |
**Return value**
@@ -2014,11 +1964,14 @@ a2dpSrc.on('connectionStateChange', onReceiveEvent);
```
-### off('connectionStateChange')
+### off('connectionStateChange')(deprecated)
off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
-Unsubscribes from the A2DP connection state change events.
+Unsubscribes from the A2DP connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.off('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileoffconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2026,7 +1979,7 @@ Unsubscribes from the A2DP connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.|
+| type | string | Yes | Event type. The value **connectionStateChange** indicates a A2DP connection state change event.|
| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the A2DP connection state change event. |
**Return value**
@@ -2045,12 +1998,15 @@ a2dpSrc.off('connectionStateChange', onReceiveEvent);
```
-### getPlayingState
+### getPlayingState(deprecated)
getPlayingState(device: string): PlayingState
Obtains the playing state of a device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [a2dp.A2dpSourceProfile#getPlayingState](js-apis-bluetooth-a2dp.md#getPlayingState).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -2088,10 +2044,13 @@ try {
```
-## HandsFreeAudioGatewayProfile
+## HandsFreeAudioGatewayProfile(deprecated)
Before using an API of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using **getProfile()**.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [hfp.HandsFreeAudioGatewayProfile](js-apis-bluetooth-hfp.md#HandsFreeAudioGatewayProfile).
+
### connect
@@ -2099,6 +2058,9 @@ connect(device: string): void
Sets up a Hands-free Profile (HFP) connection of a device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [hfp.HandsFreeAudioGatewayProfile#connect](js-apis-bluetooth-hfp.md#connect).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2132,12 +2094,15 @@ try {
```
-### disconnect
+### disconnect(deprecated)
disconnect(device: string): void
Disconnects the HFP connection of a device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [hfp.HandsFreeAudioGatewayProfile#disconnect](js-apis-bluetooth-hfp.md#disconnect).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2171,11 +2136,14 @@ try {
```
-### on('connectionStateChange')
+### on('connectionStateChange')(deprecated)
on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void
-Subscribes to the HFP connection state change events.
+Subscribes to the HFP connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.on('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileonconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2183,7 +2151,7 @@ Subscribes to the HFP connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. |
+| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.|
| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the HFP connection state change event. |
**Example**
@@ -2198,11 +2166,14 @@ hfpAg.on('connectionStateChange', onReceiveEvent);
```
-### off('connectionStateChange')
+### off('connectionStateChange')(deprecated)
off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
-Unsubscribes from the HFP connection state change events.
+Unsubscribes from the HFP connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.off('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileoffconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2210,7 +2181,7 @@ Unsubscribes from the HFP connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. |
+| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.|
| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the HFP connection state change event. |
**Example**
@@ -2226,7 +2197,7 @@ hfpAg.off('connectionStateChange', onReceiveEvent);
```
-## HidHostProfile
+## HidHostProfile(deprecated)
Before using an API of **HidHostProfile**, you need to create an instance of this class by using **getProfile()**.
@@ -2237,6 +2208,9 @@ connect(device: string): void
Connects to the HidHost service of a device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [hid.HidHostProfile#connect](js-apis-bluetooth-hid.md#connect).
+
**System API**: This is a system API.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
@@ -2272,12 +2246,15 @@ try {
```
-### disconnect
+### disconnect(deprecated)
disconnect(device: string): void
Disconnects from the HidHost service of a device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [hid.HidHostProfile#disconnect](js-apis-bluetooth-hid.md#disconnect).
+
**System API**: This is a system API.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
@@ -2313,11 +2290,14 @@ try {
```
-### on('connectionStateChange')
+### on('connectionStateChange')(deprecated)
on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void
-Subscribes to the HidHost connection state change events.
+Subscribes to the HidHost connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.on('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileonconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2339,11 +2319,14 @@ hidHost.on('connectionStateChange', onReceiveEvent);
```
-### off('connectionStateChange')
+### off('connectionStateChange')(deprecated)
off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
-Unsubscribes from the HidHost connection state change events.
+Unsubscribes from the HidHost connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.off('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileoffconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2370,13 +2353,19 @@ hidHost.off('connectionStateChange', onReceiveEvent);
Before using an API of **PanProfile**, you need to create an instance of this class by using **getProfile()**.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [pan.PanProfile](js-apis-bluetooth-pan.md#panprofile).
-### disconnect
+
+### disconnect(deprecated)
disconnect(device: string): void
Disconnects from the Personal Area Network (PAN) service of a device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [pan.PanProfile#disconnect](js-apis-bluetooth-pan.md#disconnect).
+
**System API**: This is a system API.
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -2412,11 +2401,14 @@ try {
```
-### on('connectionStateChange')
+### on('connectionStateChange')(deprecated)
on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void
-Subscribes to the PAN connection state change events.
+Subscribes to the PAN connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.on('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileonconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2424,8 +2416,8 @@ Subscribes to the PAN connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event. |
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the PAN connection state change event. |
+| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.|
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the PAN connection state change event. |
**Example**
@@ -2438,11 +2430,14 @@ panProfile.on('connectionStateChange', onReceiveEvent);
```
-### off('connectionStateChange')
+### off('connectionStateChange')(deprecated)
off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void
-Unsubscribes from the PAN connection state change events.
+Unsubscribes from the PAN connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.off('connectionStateChange')](js-apis-bluetooth-baseProfile.md#baseprofileoffconnectionstatechange).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2450,8 +2445,8 @@ Unsubscribes from the PAN connection state change events.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- |
-| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event. |
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the PAN connection state change event. |
+| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.|
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the PAN connection state change event. |
**Example**
@@ -2465,12 +2460,15 @@ panProfile.off('connectionStateChange', onReceiveEvent);
```
-### setTethering
+### setTethering(deprecated)
setTethering(enable: boolean): void
Sets tethering.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [pan.PanProfile#setTethering](js-apis-bluetooth-pan.md#setTethering).
+
**System API**: This is a system API.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
@@ -2506,12 +2504,15 @@ try {
```
-### isTetheringOn
+### isTetheringOn(deprecated)
isTetheringOn(): boolean
Obtains the network sharing status.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [pan.PanProfile#isTetheringOn](js-apis-bluetooth-pan.md#isTetheringOn).
+
**System API**: This is a system API.
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2538,13 +2539,19 @@ try {
Implements the Generic Attribute Profile (GATT) server. Before using an API of this class, you need to create a **GattServer** instance using **createGattServer()**.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer](js-apis-bluetooth-ble.md#GattServer).
+
-### startAdvertising
+### startAdvertising(deprecated)
startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void
Starts BLE advertising.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.startAdvertising](js-apis-bluetooth-ble.md#blestartadvertising).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2587,7 +2594,7 @@ let gattServer = bluetoothManager.BLE.createGattServer();
try {
gattServer.startAdvertising({
interval:150,
- txPower:60,
+ txPower:0,
connectable:true,
},{
serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"],
@@ -2616,12 +2623,15 @@ try {
```
-### stopAdvertising
+### stopAdvertising(deprecated)
stopAdvertising(): void
Stops BLE advertising.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.stopAdvertising](js-apis-bluetooth-ble.md#blestopadvertising).
+
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2648,12 +2658,15 @@ try {
```
-### addService
+### addService(deprecated)
addService(service: GattService): void
Adds a service to this GATT server.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#addService](js-apis-bluetooth-ble.md#addservice).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2710,12 +2723,15 @@ try {
```
-### removeService
+### removeService(deprecated)
removeService(serviceUuid: string): void
Removes a service from this GATT server.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#removeService](js-apis-bluetooth-ble.md#removeservice).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2749,12 +2765,15 @@ try {
```
-### close
+### close(deprecated)
close(): void
Closes this GATT server to unregister it from the protocol stack. After this method is called, this [GattServer](#gattserver) cannot be used.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#close](js-apis-bluetooth-ble.md#close).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2781,12 +2800,15 @@ try {
```
-### notifyCharacteristicChanged
+### notifyCharacteristicChanged(deprecated)
notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void
Notifies the connected client device when a characteristic value changes.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#notifyCharacteristicChanged](js-apis-bluetooth-ble.md#notifycharacteristicchanged).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2834,12 +2856,15 @@ try {
```
-### sendResponse
+### sendResponse(deprecated)
sendResponse(serverResponse: ServerResponse): void
Sends a response to a read or write request from the GATT client.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#sendResponse](js-apis-bluetooth-ble.md#sendresponse).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2884,12 +2909,15 @@ try {
```
-### on('characteristicRead')
+### on('characteristicRead')(deprecated)
on(type: "characteristicRead", callback: Callback<CharacteristicReadRequest>): void
Subscribes to the characteristic read request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#on('characteristicRead')](js-apis-bluetooth-ble.md#oncharacteristicread).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2927,12 +2955,15 @@ gattServer.on("characteristicRead", ReadCharacteristicReq);
```
-### off('characteristicRead')
+### off('characteristicRead')(deprecated)
off(type: "characteristicRead", callback?: Callback<CharacteristicReadRequest>): void
Unsubscribes from the characteristic read request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#off('characteristicRead')](js-apis-bluetooth-ble.md#offcharacteristicread).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2952,12 +2983,15 @@ gattServer.off("characteristicRead");
```
-### on('characteristicWrite')
+### on('characteristicWrite')(deprecated)
on(type: "characteristicWrite", callback: Callback<CharacteristicWriteRequest>): void
Subscribes to the characteristic write request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#on('characteristicWrite')](js-apis-bluetooth-ble.md#oncharacteristicwrite).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -2998,12 +3032,15 @@ gattServer.on("characteristicWrite", WriteCharacteristicReq);
```
-### off('characteristicWrite')
+### off('characteristicWrite')(deprecated)
off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteRequest>): void
Unsubscribes from the characteristic write request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#off('characteristicWrite')](js-apis-bluetooth-ble.md#offcharacteristicwrite).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3023,12 +3060,15 @@ gattServer.off("characteristicWrite");
```
-### on('descriptorRead')
+### on('descriptorRead')(deprecated)
on(type: "descriptorRead", callback: Callback<DescriptorReadRequest>): void
Subscribes to the descriptor read request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#on('descriptorRead')](js-apis-bluetooth-ble.md#ondescriptorread).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3038,7 +3078,7 @@ Subscribes to the descriptor read request events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------------- |
| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.|
-| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | Yes | Callback invoked to return a descriptor read request event from the GATT client. |
+| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | Yes | Callback invoked to return a descriptor read request event from the GATT client. |
**Example**
@@ -3066,12 +3106,15 @@ gattServer.on("descriptorRead", ReadDescriptorReq);
```
-### off('descriptorRead')
+### off('descriptorRead')(deprecated)
off(type: "descriptorRead", callback?: Callback<DescriptorReadRequest>): void
Unsubscribes from the descriptor read request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#off('descriptorRead')](js-apis-bluetooth-ble.md#offdescriptorread).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3091,12 +3134,15 @@ gattServer.off("descriptorRead");
```
-### on('descriptorWrite')
+### on('descriptorWrite')(deprecated)
on(type: "descriptorWrite", callback: Callback<DescriptorWriteRequest>): void
Subscribes to the descriptor write request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#on('descriptorWrite')](js-apis-bluetooth-ble.md#ondescriptorwrite).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3106,7 +3152,7 @@ Subscribes to the descriptor write request events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------- |
| type | string | Yes | Event type. The value **descriptorWrite** indicates a descriptor write request event.|
-| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | Yes | Callback invoked to return a descriptor write request from the GATT client. |
+| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | Yes | Callback invoked to return a descriptor write request from the GATT client. |
**Example**
@@ -3137,12 +3183,15 @@ gattServer.on("descriptorRead", WriteDescriptorReq);
```
-### off('descriptorWrite')
+### off('descriptorWrite')(deprecated)
off(type: "descriptorWrite", callback?: Callback<DescriptorWriteRequest>): void
Unsubscribes from the descriptor write request events.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#off('descriptorWrite')](js-apis-bluetooth-ble.md#offdescriptorwrite).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3162,11 +3211,14 @@ gattServer.off("descriptorWrite");
```
-### on('connectStateChange')
+### on('connectStateChange')(deprecated)
on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void
-Subscribes to the BLE connection state change events.
+Subscribes to the BLE connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#on('connectionStateChange')](js-apis-bluetooth-ble.md#onconnectionstatechange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -3192,11 +3244,14 @@ gattServer.on("connectStateChange", Connected);
```
-### off('connectStateChange')
+### off('connectStateChange')(deprecated)
off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void
-Unsubscribes from the BLE connection state change events.
+Unsubscribes from the BLE connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattServer#off('connectionStateChange')](js-apis-bluetooth-ble.md#offconnectionstatechange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -3221,13 +3276,19 @@ gattServer.off("connectStateChange");
Implements the GATT client. Before using an API of this class, you must create a **GattClientDevice** instance using **createGattClientDevice(deviceId: string)**.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice](js-apis-bluetooth-ble.md#gattclientdevice).
-### connect
+
+### connect(deprecated)
connect(): void
Initiates a connection to the remote BLE device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#connect](js-apis-bluetooth-ble.md#connect).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3254,12 +3315,15 @@ try {
```
-### disconnect
+### disconnect(deprecated)
disconnect(): void
Disconnects from the remote BLE device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#disconnect](js-apis-bluetooth-ble.md#disconnect).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3286,12 +3350,15 @@ try {
```
-### close
+### close(deprecated)
close(): void
Closes this GATT client to unregister it from the protocol stack. After this method is called, this [GattClientDevice](#gattclientdevice) instance cannot be used.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#close](js-apis-bluetooth-ble.md#close).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3320,12 +3387,15 @@ try {
-### getServices
+### getServices(deprecated)
getServices(callback: AsyncCallback<Array<GattService>>): void
Obtains all services of the remote BLE device. This API uses an asynchronous callback to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#getServices](js-apis-bluetooth-ble.md#getservices).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3371,12 +3441,15 @@ try {
```
-### getServices
+### getServices(deprecated)
getServices(): Promise<Array<GattService>>
Obtains all services of the remote BLE device. This API uses a promise to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#getServices](js-apis-bluetooth-ble.md#getservices-1).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3412,12 +3485,15 @@ try {
```
-### readCharacteristicValue
+### readCharacteristicValue(deprecated)
readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void
Reads the characteristic value of the specific service of the remote BLE device. This API uses an asynchronous callback to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#readCharacteristicValue](js-apis-bluetooth-ble.md#readcharacteristicvalue).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3476,12 +3552,15 @@ try {
```
-### readCharacteristicValue
+### readCharacteristicValue(deprecated)
readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic>
Reads the characteristic value of the specific service of the remote BLE device. This API uses an asynchronous callback to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#readCharacteristicValue](js-apis-bluetooth-ble.md#readcharacteristicvalue-1).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3536,12 +3615,15 @@ try {
```
-### readDescriptorValue
+### readDescriptorValue(deprecated)
readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void
Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses an asynchronous callback to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#readDescriptorValue](js-apis-bluetooth-ble.md#readdescriptorvalue).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3593,12 +3675,15 @@ try {
```
-### readDescriptorValue
+### readDescriptorValue(deprecated)
readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor>
Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses an asynchronous callback to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#readDescriptorValue](js-apis-bluetooth-ble.md#readdescriptorvalue-1).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3646,12 +3731,15 @@ try {
```
-### writeCharacteristicValue
+### writeCharacteristicValue(deprecated)
writeCharacteristicValue(characteristic: BLECharacteristic): void
Writes a characteristic value to the remote BLE device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#writeCharacteristicValue](js-apis-bluetooth-ble.md#writecharacteristicvalue).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3699,12 +3787,15 @@ try {
```
-### writeDescriptorValue
+### writeDescriptorValue(deprecated)
writeDescriptorValue(descriptor: BLEDescriptor): void
Writes binary data to the specific descriptor of the remote BLE device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#writeCharacteristicValue](js-apis-bluetooth-ble.md#writecharacteristicvalue-1).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3747,12 +3838,15 @@ try {
```
-### setBLEMtuSize
+### setBLEMtuSize(deprecated)
setBLEMtuSize(mtu: number): void
Sets the maximum transmission unit (MTU) that can be transmitted between the GATT client and its remote BLE device. This API can be used only after a connection is set up by calling [connect](#connect).
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#setBLEMtuSize](js-apis-bluetooth-ble.md#setBLEMtuSize).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3784,12 +3878,15 @@ try {
```
-### setNotifyCharacteristicChanged
+### setNotifyCharacteristicChanged(deprecated)
setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void
Sets the function of notifying the GATT client when the characteristic value of the remote BLE device changes.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#setCharacteristicChangeNotification](js-apis-bluetooth-ble.md#setcharacteristicchangenotification).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3835,11 +3932,14 @@ try {
```
-### on('BLECharacteristicChange')
+### on('BLECharacteristicChange')(deprecated)
on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void
-Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** method is called.
+Subscribes to the BLE characteristic changes. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** method is called.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#on('BLECharacteristicChange')](js-apis-bluetooth-ble.md#onblecharacteristicchange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -3869,11 +3969,14 @@ try {
```
-### off('BLECharacteristicChange')
+### off('BLECharacteristicChange')(deprecated)
off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void
-Unsubscribes from the BLE characteristic change events.
+Unsubscribes from the BLE characteristic changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#off('BLECharacteristicChange')](js-apis-bluetooth-ble.md#offblecharacteristicchange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -3898,11 +4001,14 @@ try {
```
-### on('BLEConnectionStateChange')
+### on('BLEConnectionStateChange')(deprecated)
on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void
-Subscribes to the BLE connection state change events.
+Subscribes to the BLE connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#on('BLEConnectionStateChange')](js-apis-bluetooth-ble.md#onbleconnectionstatechange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -3931,11 +4037,14 @@ try {
```
-### off('BLEConnectionStateChange')
+### off('BLEConnectionStateChange')(deprecated)
off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void
-Unsubscribes from the BLE connection state change events.
+Unsubscribes from the BLE connection state changes.
+
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#off('BLEConnectionStateChange')](js-apis-bluetooth-ble.md#offbleconnectionstatechange).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -3960,12 +4069,15 @@ try {
```
-### getDeviceName
+### getDeviceName(deprecated)
getDeviceName(callback: AsyncCallback<string>): void
Obtains the name of the remote BLE device. This API uses an asynchronous callback to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#getDeviceName](js-apis-bluetooth-ble.md#getdevicename).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -4002,12 +4114,15 @@ try {
```
-### getDeviceName
+### getDeviceName(deprecated)
getDeviceName(): Promise<string>
Obtains the name of the remote BLE device. This API uses a promise to return the result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#getDeviceName](js-apis-bluetooth-ble.md#getdevicename-1).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -4043,12 +4158,15 @@ try {
```
-### getRssiValue
+### getRssiValue(deprecated)
getRssiValue(callback: AsyncCallback<number>): void
Obtains the received signal strength indication (RSSI) of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect).
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#getRssiValue](js-apis-bluetooth-ble.md#getrssivalue).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -4084,12 +4202,15 @@ try {
```
-### getRssiValue
+### getRssiValue(deprecated)
getRssiValue(): Promise<number>
Obtains the RSSI of the remote BLE device. This API uses a promise to return the result. It can be used only after a connection is set up by calling [connect](#connect).
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattClientDevice#getRssiValue](js-apis-bluetooth-ble.md#getrssivalue-1).
+
**Required permissions**: ohos.permission.USE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -4122,10 +4243,13 @@ try {
}
```
-## ScanMode
+## ScanMode(deprecated)
Enumerates the scan modes.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.ScanMode](js-apis-bluetooth-connection.md#scanmode).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4137,10 +4261,13 @@ Enumerates the scan modes.
| SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | General connectable and discoverable mode.|
| SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | Limited connectable and discoverable mode.|
-## BondState
+## BondState(deprecated)
Enumerates the pairing states.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.BondState](js-apis-bluetooth-connection.md#bondstate).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4150,10 +4277,13 @@ Enumerates the pairing states.
| BOND_STATE_BONDED | 2 | Paired. |
-## SppOption
+## SppOption(deprecated)
Defines the SPP configuration parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.SppOption](js-apis-bluetooth-socket.md#sppoptions).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4163,10 +4293,13 @@ Defines the SPP configuration parameters.
| type | [SppType](#spptype) | Yes | Yes | Type of the SPP link. |
-## SppType
+## SppType(deprecated)
Enumerates the SPP link types.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [socket.SppType](js-apis-bluetooth-socket.md#spptype).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4174,10 +4307,13 @@ Enumerates the SPP link types.
| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.|
-## GattService
+## GattService(deprecated)
Defines the GATT service API parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.GattService](js-apis-bluetooth-ble.md#gattservice).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4188,10 +4324,13 @@ Defines the GATT service API parameters.
| includeServices | Array<[GattService](#gattservice)> | Yes | Yes | Services on which the service depends. |
-## BLECharacteristic
+## BLECharacteristic(deprecated)
Defines the characteristic API parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.BLECharacteristic](js-apis-bluetooth-ble.md#blecharacteristic).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4200,12 +4339,14 @@ Defines the characteristic API parameters.
| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.|
| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. |
| descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes | Yes | List of descriptors of the characteristic. |
-| properties10+ | [GattProperties](#gattproperties10) | Yes | Yes | Properties of the characteristic. |
-## BLEDescriptor
+## BLEDescriptor(deprecated)
+
+Defines the descriptor API parameters.
-Defines the BLE descriptor.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.BLEDescriptor](js-apis-bluetooth-ble.md#bledescriptor).
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -4217,10 +4358,13 @@ Defines the BLE descriptor.
| descriptorValue | ArrayBuffer | Yes | Yes | Binary value of the descriptor. |
-## NotifyCharacteristic
+## NotifyCharacteristic(deprecated)
Defines the parameters in the notifications sent when the server characteristic value changes.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.NotifyCharacteristic](js-apis-bluetooth-ble.md#notifycharacteristic).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4231,10 +4375,13 @@ Defines the parameters in the notifications sent when the server characteristic
| confirm | boolean | Yes | Yes | Whether the notification needs to be confirmed by the remote end. For a notification, set it to **true**. In this case, the remote end must confirm the receipt of the notification. For an indication, set it to **false**. In this case, the remote end does not need to confirm the receipt of the notification.|
-## CharacteristicReadRequest
+## CharacteristicReadRequest(deprecated)
Defines the parameters of the **CharacteristicReadReq** event received by the server.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.CharacteristicReadRequest](js-apis-bluetooth-ble.md#characteristicreadrequest).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4246,10 +4393,13 @@ Defines the parameters of the **CharacteristicReadReq** event received by the se
| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
-## CharacteristicWriteRequest
+## CharacteristicWriteRequest(deprecated)
Defines the parameters of the **CharacteristicWriteReq** event received by the server.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.CharacteristicWriteRequest](js-apis-bluetooth-ble.md#characteristicwriterequest).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4262,10 +4412,13 @@ Defines the parameters of the **CharacteristicWriteReq** event received by the s
| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
-## DescriptorReadRequest
+## DescriptorReadRequest(deprecated)
Defines the parameters of the **DescriptorReadReq** event received by the server.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.DescriptorReadRequest](js-apis-bluetooth-ble.md#descriptorreadrequest).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4278,10 +4431,13 @@ Defines the parameters of the **DescriptorReadReq** event received by the server
| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
-## DescriptorWriteRequest
+## DescriptorWriteRequest(deprecated)
Defines the parameters of the **DescriptorWriteReq** event received by the server.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.DescriptorWriteRequest](js-apis-bluetooth-ble.md#descriptorwriterequest).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4297,10 +4453,13 @@ Defines the parameters of the **DescriptorWriteReq** event received by the serve
| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
-## ServerResponse
+## ServerResponse(deprecated)
Defines the parameters of the server's response to the GATT client's read/write request.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.ServerResponse](js-apis-bluetooth-ble.md#serverresponse).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4312,10 +4471,13 @@ Defines the parameters of the server's response to the GATT client's read/write
| value | ArrayBuffer | Yes | No | Binary data in the response. |
-## BLEConnectChangedState
+## BLEConnectChangedState(deprecated)
Defines the parameters of **BLEConnectChangedState**.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [BLEConnectionChangeState](js-apis-bluetooth-ble.md#bleconnectionchangestate).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable| Writable| Description |
@@ -4324,10 +4486,13 @@ Defines the parameters of **BLEConnectChangedState**.
| state | [ProfileConnectionState](#profileconnectionstate) | Yes | Yes | BLE connection state. |
-## ProfileConnectionState
+## ProfileConnectionState(deprecated)
Enumerates the profile connection states.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [constant.ProfileConnectionState](js-apis-bluetooth-constant.md#profileconnectionstate).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4338,10 +4503,13 @@ Enumerates the profile connection states.
| STATE_DISCONNECTING | 3 | Disconnecting.|
-## ScanFilter
+## ScanFilter(deprecated)
Defines the scan filter parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.ScanFilter](js-apis-bluetooth-ble.md#scanfilter).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable| Writable| Description |
@@ -4359,10 +4527,13 @@ Defines the scan filter parameters.
| manufactureDataMask | ArrayBuffer | Yes | Yes | Manufacturer data mask of the device to filter, for example, **[0xFF, 0xFF, 0xFF]**.|
-## ScanOptions
+## ScanOptions(deprecated)
Defines the scan configuration parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.ScanOptions](js-apis-bluetooth-ble.md#scanoptions).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4372,10 +4543,13 @@ Defines the scan configuration parameters.
| matchMode | [MatchMode](#matchmode) | Yes | Yes | Hardware filtering match mode. The default value is **MATCH_MODE_AGGRESSIVE**.|
-## ScanDuty
+## ScanDuty(deprecated)
Enumerates the scan duty options.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.ScanDuty](js-apis-bluetooth-ble.md#scanduty).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4385,10 +4559,13 @@ Enumerates the scan duty options.
| SCAN_MODE_LOW_LATENCY | 2 | Low-latency mode. |
-## MatchMode
+## MatchMode(deprecated)
Enumerates the hardware match modes of BLE scan filters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.MatchMode](js-apis-bluetooth-ble.md#matchmode).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4397,10 +4574,13 @@ Enumerates the hardware match modes of BLE scan filters.
| MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings. |
-## ScanResult
+## ScanResult(deprecated)
Defines the scan result.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.ScanResult](js-apis-bluetooth-ble.md#scanresult).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4408,13 +4588,15 @@ Defines the scan result.
| deviceId | string | Yes | No | Address of the scanned device, for example, XX:XX:XX:XX:XX:XX.|
| rssi | number | Yes | No | RSSI of the device. |
| data | ArrayBuffer | Yes | No | Advertisement packets sent by the device. |
-| deviceName10+ | string | Yes | No | Name of the device detected. |
-## BluetoothState
+## BluetoothState(deprecated)
Enumerates the Bluetooth states.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [access.BluetoothState](js-apis-bluetooth-access.md#bluetoothstate).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4428,10 +4610,13 @@ Enumerates the Bluetooth states.
| STATE_BLE_TURNING_OFF | 6 | The LE-only mode is being turned off for Bluetooth.|
-## AdvertiseSetting
+## AdvertiseSetting(deprecated)
Defines the BLE advertising parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.AdvertiseSetting](js-apis-bluetooth-ble.md#advertisesetting).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4441,10 +4626,13 @@ Defines the BLE advertising parameters.
| connectable | boolean | Yes | Yes | Whether the advertisement is connectable. The default value is **true**. |
-## AdvertiseData
+## AdvertiseData(deprecated)
Defines the content of a BLE advertisement packet.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.AdvertiseData](js-apis-bluetooth-ble.md#advertisedata).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4452,13 +4640,15 @@ Defines the content of a BLE advertisement packet.
| serviceUuids | Array<string> | Yes | Yes | List of service UUIDs to broadcast.|
| manufactureData | Array<[ManufactureData](#manufacturedata)> | Yes | Yes | List of manufacturers to broadcast. |
| serviceData | Array<[ServiceData](#servicedata)> | Yes | Yes | List of service data to broadcast. |
-| includeDeviceName10+ | boolean | Yes | Yes | Whether the device name is contained. This parameter is optional. |
-## ManufactureData
+## ManufactureData(deprecated)
Defines the content of a BLE advertisement packet.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.ManufactureData](js-apis-bluetooth-ble.md#manufacturedata).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4467,10 +4657,13 @@ Defines the content of a BLE advertisement packet.
| manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. |
-## ServiceData
+## ServiceData(deprecated)
Defines the service data contained in an advertisement packet.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [ble.ServiceData](js-apis-bluetooth-ble.md#servicedata).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4479,23 +4672,28 @@ Defines the service data contained in an advertisement packet.
| serviceValue | ArrayBuffer | Yes | Yes | Service data. |
-## PinRequiredParam
+## PinRequiredParam(deprecated)
Defines the pairing request parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.PinRequiredParam](js-apis-bluetooth-connection.md#pinrequiredparam).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ----------- |
| deviceId | string | Yes | No | ID of the device to pair.|
| pinCode | string | Yes | No | Key for the device pairing. |
-| pinType10+ | [PinType](#pintype10) | Yes | No | Type of the device to pair.
This is a system API. |
-## BondStateParam
+## BondStateParam(deprecated)
Defines the pairing state parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.BondStateParam](js-apis-bluetooth-connection.md#bondstateparam).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4504,10 +4702,13 @@ Defines the pairing state parameters.
| state | BondState | Yes | No | State of the device.|
-## StateChangeParam
+## StateChangeParam(deprecated)
Defines the profile state change parameters.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [baseProfile.StateChangeParam](js-apis-bluetooth-baseProfile.md#statechangeparam).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable| Writable| Description |
@@ -4516,25 +4717,13 @@ Defines the profile state change parameters.
| state | [ProfileConnectionState](#profileconnectionstate) | Yes | No | Profile connection state of the device.|
-## GattProperties10+
-
-Defines the properties of a GATT characteristic.
-
-**System capability**: SystemCapability.Communication.Bluetooth.Core
-
-| Name | Type | Mandatory | Description |
-| -------- | ------ |---- | ----------- |
-| write10+ | boolean | Yes | Permits writes of the characteristic value (with a response).|
-| writeNoResponse10+ | boolean | Yes | Permits writes of the characteristic value (without a response).|
-| read10+ | boolean | Yes | Permits reads of the characteristic value.|
-| notify10+ | boolean | Yes | Permits notifications of the characteristic value.|
-| indicate10+ | boolean | Yes | Permits notifications of the characteristic value without acknowledgement.|
-
-
-## DeviceClass
+## DeviceClass(deprecated)
Defines the class of a Bluetooth device.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [connection.DeviceClass](js-apis-bluetooth-connection.md#deviceclass).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
@@ -4544,10 +4733,13 @@ Defines the class of a Bluetooth device.
| classOfDevice | number | Yes | No | Class of the device. |
-## MajorClass
+## MajorClass(deprecated)
Enumerates the major classes of Bluetooth devices.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [constant.MajorClass](js-apis-bluetooth-constant.md#majorclass).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4565,10 +4757,13 @@ Enumerates the major classes of Bluetooth devices.
| MAJOR_UNCATEGORIZED | 0x1F00 | Unclassified device. |
-## MajorMinorClass
+## MajorMinorClass(deprecated)
Enumerates the major and minor classes of Bluetooth devices.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [constant.MajorMinorClass](js-apis-bluetooth-constant.md#majorminorclass).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4661,10 +4856,13 @@ Enumerates the major and minor classes of Bluetooth devices.
| HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | Personal mobility device. |
-## PlayingState
+## PlayingState(deprecated)
Enumerates the A2DP playing states.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [a2dp.PlayingState](js-apis-bluetooth-a2dp.md#playingstate).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4673,10 +4871,13 @@ Enumerates the A2DP playing states.
| STATE_PLAYING | 0x0001 | Playing.|
-## ProfileId
+## ProfileId(deprecated)
Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**.
+> **NOTE**
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [constant.ProfileId](js-apis-bluetooth-constant.md#profileid).
+
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
@@ -4685,35 +4886,3 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | HFP profile. |
| PROFILE_HID_HOST | 6 | Human Interface Device (HID) profile. |
| PROFILE_PAN_NETWORK | 7 | PAN profile. |
-
-
-## BluetoothTransport10+
-
-Enumerates the device types. The default device type is **TRANSPORT_BR_EDR**.
-
-**System capability**: SystemCapability.Communication.Bluetooth.Core
-
-| Name | Value | Description |
-| -------------------------------- | ------ | --------------- |
-| TRANSPORT_BR_EDR10+ | 0 | Classic Bluetooth (BR/EDR) device.|
-| TRANSPORT_LE10+ | 1 | BLE device. |
-
-
-## PinType10+
-
-Enumerates the Bluetooth pairing types.
-
-**System API**: This is a system API.
-
-**System capability**: SystemCapability.Communication.Bluetooth.Core
-
-| Name | Value | Description |
-| -------------------------------- | ------ | --------------- |
-| PIN_TYPE_ENTER_PIN_CODE10+ | 0 | The user needs to enter the PIN displayed on the peer device.
This is a system API.|
-| PIN_TYPE_ENTER_PASSKEY10+ | 1 | The user needs to enter the PASSKEY displayed on the peer device.
This is a system API. |
-| PIN_TYPE_CONFIRM_PASSKEY10+ | 2 | The user needs to confirm the PASSKEY displayed on the local device.
This is a system API. |
-| PIN_TYPE_NO_PASSKEY_CONSENT10+ | 3 | There is no PASSKEY, and the user needs to accept or reject the pairing request.
This is a system API. |
-| PIN_TYPE_NOTIFY_PASSKEY10+ | 4 | The user needs to enter the PASSKEY displayed on the local device on the peer device.
This is a system API. |
-| PIN_TYPE_DISPLAY_PIN_CODE10+ | 5 | The user needs to enter the PIN displayed on the peer device for Bluetooth 2.0 devices.
This is a system API. |
-| PIN_TYPE_OOB_CONSENT10+ | 6 | The user needs to accept or reject the out of band (OOB) pairing request.
This is a system API. |
-| PIN_TYPE_PIN_16_DIGITS10+ | 7 | The user needs to enter the 16-digit PIN displayed on the peer device.
This is a system API. |
diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-deviceStandby.md b/en/application-dev/reference/apis/js-apis-resourceschedule-deviceStandby.md
new file mode 100644
index 0000000000000000000000000000000000000000..81d684b8f3d143d6e76d25faf5aa392ac9f3131a
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-resourceschedule-deviceStandby.md
@@ -0,0 +1,293 @@
+# @ohos.resourceschedule.deviceStandby (Device Standby)
+A device enters standby mode if it is unused for a long period of time or after the Power button is pressed. The standby mode prolongs the battery life without affecting the use of applications. The **deviceStandby** module provides APIs for you to check whether a device is in standby mode and request or cancel standby resource control for an application.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## Modules to Import
+
+```js
+import deviceStandby from '@ohos.resourceschedule.deviceStandby';
+```
+
+## deviceStandby.getExemptedApps
+
+getExemptedApps(resourceTypes: number, callback: AsyncCallback): void;
+
+Obtains the list of applications that can still use resources of the specified types when the device is in standby mode. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.ResourceSchedule.DeviceStandby
+
+**Required permissions**: ohos.permission.DEVICE_STANDBY_EXEMPTION
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------------------- | ---- | ------------------------------ |
+| [ResourceTypes](#resourcetype)|number | Yes | Types of resources that can be used.|
+| callback | AsyncCallback | Yes |Callback used to return the exempted application information.|
+
+**Error codes**
+
+For details about the error codes, see [Background Task Management Error Codes](../errorcodes/errorcode-backgroundTaskMgr.md).
+
+| ID | Error Message |
+| ---- | --------------------- |
+| 9800001 | Memory operation failed. |
+| 9800002 | Parcel operation failed. |
+| 9800003 | Inner transact failed. |
+| 9800004 | System service operation failed. |
+| 18700001 | Caller information verification failed. |
+
+**Example**
+
+```js
+try{
+deviceStandby.getExemptedApps(resourceTypes, (err, res) => {
+ if (err) {
+ console.log('DEVICE_STANDBY getExemptedApps callback failed. code is: ' + err.code + ',message is: ' + err.message);
+ } else {
+ console.log('DEVICE_STANDBY getExemptedApps callback success.');
+ for (let i = 0; i < res.length; i++) {
+ console.log('DEVICE_STANDBY getExemptedApps callback result ' + JSON.stringify(res[i]));
+ }
+ }
+});
+} catch (error) {
+console.log('DEVICE_STANDBY getExemptedApps throw error, code is: ' + error.code + ',message is: ' + error.message);
+}
+```
+
+## deviceStandby.getExemptedApps
+
+getExemptedApps(resourceTypes: number): Promise;
+
+Obtains the list of applications that can still use resources of the specified types when the device is in standby mode. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.ResourceSchedule.DeviceStandby
+
+**Required permissions**: ohos.permission.DEVICE_STANDBY_EXEMPTION
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------------------- | ---- | ------------------------------ |
+| [ResourceTypes](#resourcetype)|number | Yes |Types of resources that can be used.|
+
+**Return value**
+
+| Type | Description |
+| --------------------- | ---------------------------------------- |
+| Promise | Promise used to return the exempted application information.|
+
+**Error codes**
+
+For details about the error codes, see [Background Task Management Error Codes](../errorcodes/errorcode-backgroundTaskMgr.md).
+
+| ID | Error Message |
+| ---- | --------------------- |
+| 9800001 | Memory operation failed. |
+| 9800002 | Parcel operation failed. |
+| 9800003 | Inner transact failed. |
+| 9800004 | System service operation failed. |
+| 18700001 | Caller information verification failed. |
+
+**Example**
+
+```js
+try{
+deviceStandby.getExemptedApps(resourceTypes).then( res => {
+ console.log('DEVICE_STANDBY getExemptedApps promise success.');
+ for (let i = 0; i < res.length; i++) {
+ console.log('DEVICE_STANDBY getExemptedApps promise result ' + JSON.stringify(res[i]));
+ }
+}).catch( err => {
+ console.log('DEVICE_STANDBY getExemptedApps promise failed. code is: ' + err.code + ',message is: ' + err.message);
+});
+} catch (error) {
+console.log('DEVICE_STANDBY getExemptedApps throw error, code is: ' + error.code + ',message is: ' + error.message);
+}
+```
+
+## deviceStandby.requestExemptionResource
+
+requestExemptionResource(request: ResourceRequest): void;
+
+Requests exemption, so that the application can use restricted resources when the device is in standby mode.
+
+**System capability**: SystemCapability.ResourceSchedule.DeviceStandby
+
+**Required permissions**: ohos.permission.DEVICE_STANDBY_EXEMPTION
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------------------- | ---- | ------------------------------ |
+| request |[ResourceRequest](#resourcerequest)| Yes | Request body.|
+
+**Error codes**
+
+For details about the error codes, see [Background Task Management Error Codes](../errorcodes/errorcode-backgroundTaskMgr.md).
+
+| ID | Error Message |
+| ---- | --------------------- |
+| 9800001 | Memory operation failed. |
+| 9800002 | Parcel operation failed. |
+| 9800003 | Inner transact failed. |
+| 9800004 | System service operation failed. |
+| 18700001 | Caller information verification failed. |
+
+**Example**
+
+```js
+let resRequest = {
+ resourceTypes: 1,
+ uid:10003,
+ name:"com.example.app",
+ duration:10,
+ reason:"apply",
+};
+// Promise mode
+try{
+deviceStandby.requestExemptionResource(resRequest).then( () => {
+ console.log('DEVICE_STANDBY requestExemptionResource promise succeeded.');
+}).catch( err => {
+ console.log('DEVICE_STANDBY requestExemptionResource promise failed. code is: ' + err.code + ',message is: ' + err.message);
+});
+} catch (error) {
+console.log('DEVICE_STANDBY requestExemptionResource throw error, code is: ' + error.code + ',message is: ' + error.message);
+}
+
+// Asynchronous callback mode
+try{
+deviceStandby.requestExemptionResource(resRequest, (err) => {
+ if (err) {
+ console.log('DEVICE_STANDBY requestExemptionResource callback failed. code is: ' + err.code + ',message is: ' + err.message);
+ } else {
+ console.log('DEVICE_STANDBY requestExemptionResource callback succeeded.');
+ }
+});
+} catch (error) {
+console.log('DEVICE_STANDBY requestExemptionResource throw error, code is: ' + error.code + ',message is: ' + error.message);
+}
+```
+
+## deviceStandby.releaseExemptionResource
+
+releaseExemptionResource(request: ResourceRequest): void;
+
+Cancels exemption for the application.
+
+**System capability**: SystemCapability.ResourceSchedule.DeviceStandby
+
+**Required permissions**: ohos.permission.DEVICE_STANDBY_EXEMPTION
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | -------------------- | ---- | ------------------------------ |
+| request |[ResourceRequest](#resourcerequest)| Yes | Request body.|
+
+**Error codes**
+
+For details about the error codes, see [Background Task Management Error Codes](../errorcodes/errorcode-backgroundTaskMgr.md).
+
+| ID | Error Message |
+| ---- | --------------------- |
+| 9800001 | Memory operation failed. |
+| 9800002 | Parcel operation failed. |
+| 9800003 | Inner transact failed. |
+| 9800004 | System service operation failed. |
+| 18700001 | Caller information verification failed. |
+
+**Example**
+
+```js
+let resRequest = {
+ resourceTypes: 1,
+ uid:10003,
+ name:"com.demo.app",
+ duration:10,
+ reason:"unapply",
+};
+// Promise mode
+try{
+deviceStandby.releaseExemptionResource(resRequest).then( () => {
+ console.log('DEVICE_STANDBY releaseExemptionResource promise succeeded.');
+}).catch( err => {
+ console.log('DEVICE_STANDBY releaseExemptionResource promise failed. code is: ' + err.code + ',message is: ' + err.message);
+});
+} catch (error) {
+console.log('DEVICE_STANDBY releaseExemptionResource throw error, code is: ' + error.code + ',message is: ' + error.message);
+}
+
+// Asynchronous callback mode
+try{
+deviceStandby.releaseExemptionResource(resRequest, (err) => {
+ if (err) {
+ console.log('DEVICE_STANDBY releaseExemptionResource callback failed. code is: ' + err.code + ',message is: ' + err.message);
+ } else {
+ console.log('DEVICE_STANDBY releaseExemptionResource callback succeeded.');
+ }
+});
+} catch (error) {
+console.log('DEVICE_STANDBY releaseExemptionResource throw error, code is: ' + error.code + ',message is: ' + error.message);
+}
+```
+
+## ResourceType
+
+Enumerates the types of resources that can be used by exempted applications.
+
+**System capability**: SystemCapability.ResourceSchedule.DeviceStandby
+
+**System API**: This is a system API.
+
+|Name |Value |Description|
+| ------------ | ------------ |--------------|
+|NETWORK |1 |Network access resource.|
+|RUNNING_LOCK |2 |CPU running lock resource.|
+|TIMER |4 | Timer task resource.|
+|WORK_SCHEDULER |8 | Work task resource.|
+|AUTO_SYNC |16 | Automatic synchronization resource.|
+|PUSH |32 | Push kit resource.|
+|FREEZE |64 | Freezing application resource.|
+
+## ExemptedAppInfo
+
+Defines the information about an exempted application.
+
+**System capability**: SystemCapability.ResourceSchedule.DeviceStandby
+
+**System API**: This is a system API.
+
+|Name |Type | Mandatory |Description |
+| ------------ | ------------ |------------ | ------------ |
+|[resourceTypes](#resourcetype) | number | Yes |Types of resources that can be used. |
+|name |string | Yes | Name of the application. |
+|duration | number | Yes | Exemption duration.|
+
+## ResourceRequest
+
+Defines the message used to request to be an exempted application.
+
+**System capability**: SystemCapability.ResourceSchedule.DeviceStandby
+
+**System API**: This is a system API.
+
+|Name |Type | Mandatory |Description |
+| ------------ | ------------ |------------| ------------ |
+|[resourceTypes](#resourcetype) | number | Yes |Types of resources that can be used. |
+|uid | number | Yes |UID of the application. |
+|name |string | Yes | Name of the application. |
+|duration | number | Yes | Exemption duration.|
+|reason |string | Yes | Reason for the request. |
diff --git a/en/application-dev/website.md b/en/application-dev/website.md
index 82d8ec8d930d20e2720739f2c87eea2a530a91f3..9605cdbe5ca3c083d5ac8887d45fa469943ee861 100644
--- a/en/application-dev/website.md
+++ b/en/application-dev/website.md
@@ -4,7 +4,7 @@
- Quick Start
- Getting Started
- [Before You Start](quick-start/start-overview.md)
- - [Getting Started with ArkTS in Stage Model](quick-start/start-with-ets-stage.md)
+ - [Building the First ArkTS Application in Stage Model](quick-start/start-with-ets-stage.md)
- Development Fundamentals
- Application Package Fundamentals
- [Application Package Overview](quick-start/application-package-overview.md)
@@ -43,8 +43,8 @@
- [Resource Categories and Access](quick-start/resource-categories-and-access.md)
- Learning ArkTS
- [Getting Started with ArkTS](quick-start/arkts-get-started.md)
- - [Introduction to ArkTS]quick-start/arkts/introduction-to-arkts.md)
- - [TypeScript to ArkTS Migration](quick-start/arkts/typescript-to-arkts-migration-guide.md)
+ - [Introduction to ArkTS](quick-start/introduction-to-arkts.md)
+ - [TypeScript to ArkTS Migration](quick-start/typescript-to-arkts-migration-guide.md)
- UI Paradigm
- Basic Syntax
- [Basic Syntax Overview](quick-start/arkts-basic-syntax-overview.md)
@@ -147,7 +147,6 @@
- [Cross-Device Migration (for System Applications Only)](application-models/hop-cross-device-migration.md)
- [Multi-device Collaboration (for System Applications Only)](application-models/hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](application-models/subscribe-system-environment-variable-changes.md)
- - [Setting Atomic Services to Support Sharing](application-models/atomic-services-support-sharing.md)
- Process Model
- [Process Model Overview](application-models/process-model-stage.md)
- Common Events
@@ -289,14 +288,26 @@
- [Drawing Geometric Shapes (Shape)](ui/arkts-geometric-shape-drawing.md)
- [Drawing Custom Graphics on the Canvas (Canvas)](ui/arkts-drawing-customization-on-canvas.md)
- Using Animation
- - [Animation Overview](ui/arkts-animation-overview.md)
- - Animation Within a Page
- - [Layout Update Animation](ui/arkts-layout-update-animation.md)
- - [Transition Animation Within a Component](ui/arkts-transition-animation-within-component.md)
- - [Spring Curve Animation](ui/arkts-spring-animation.md)
- - Animation Between Pages
- - [Zoom Animation](ui/arkts-zoom-animation.md)
- - [Page Transition Animation](ui/arkts-page-transition-animation.md)
+ - [Animation Overview](ui/arkts-animation.md)
+ - Property Animation
+ - [Property Animation Overview](ui/arkts-attribute-animation-overview.md)
+ - [Property Animation APIs](ui/arkts-attribute-animation-apis.md)
+ - [Custom Property Animation](ui/arkts-custom-attribute-animation.md)
+ - Transition Animation
+ - [Transition Animation Overview](ui/arkts-transition-overview.md)
+ - [Enter/Exit Transition](ui/arkts-enter-exit-transition.md)
+ - [Navigation Transition](ui/arkts-navigation-transition.md)
+ - [Modal Transition](ui/arkts-modal-transition.md)
+ - [Shared Element Transition](ui/arkts-shared-element-transition.md)
+ - [Component Animation](ui/arkts-component-animation.md)
+ - Animation Curve
+ - [Traditional Curve](ui/arkts-traditional-curve.md)
+ - [Spring Curve](ui/arkts-spring-curve.md)
+ - [Animation Smoothing](ui/arkts-animation-smoothing.md)
+ - Animation Effects
+ - [Blur Effect](ui/arkts-blur-effect.md)
+ - [Shadow Effect](ui/arkts-shadow-effect.md)
+ - [Color Effect](ui/arkts-color-effect.md)
- Using Interaction Events
- [Interaction Event Overview](ui/arkts-event-overview.md)
- Universal Events
@@ -544,6 +555,7 @@
- [Ethernet Connection](connectivity/net-ethernet.md)
- [Network Connection Management](connectivity/net-connection-manager.md)
- [MDNS Management](connectivity/net-mdns.md)
+ - [Traffic Management](connectivity/net-statistics.md)
- IPC & RPC
- [IPC & RPC Overview](connectivity/ipc-rpc-overview.md)
- [IPC & RPC Development](connectivity/ipc-rpc-development-guideline.md)
@@ -574,7 +586,7 @@
- [Unified Data Definition](database/unified-data-definition.md)
- One-to-Many Data Sharing (for System Applications Only)
- [Sharing Data Using DataShareExtensionAbility](database/share-data-by-datashareextensionability.md)
- - [Data Sharing Through Silent Access](database/share-data-by-silent-access.md)
+ - [Silent Access via the DatamgrService](database/share-data-by-silent-access.md)
- Many-to-Many Data Sharing
- [Sharing Data via Unified Data Channels](database/unified-data-channels.md)
- File Management
@@ -896,7 +908,6 @@
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](reference/apis/js-apis-arkui-drawableDescriptor.md)
- [@ohos.arkui.inspector (Layout Callback)](reference/apis/js-apis-arkui-inspector.md)
- [@ohos.arkui.UIContext (UIContext)](reference/apis/js-apis-arkui-UIContext.md)
- - [@ohos.componentUtils (componentUtils)](reference/apis/js-apis-componentUtils.md)
- [@ohos.curves (Interpolation Calculation)](reference/apis/js-apis-curve.md)
- [@ohos.font (Custom Font Registration)](reference/apis/js-apis-font.md)
- [@ohos.matrix4 (Matrix Transformation)](reference/apis/js-apis-matrix4.md)
@@ -994,6 +1005,7 @@
- [@ohos.net.connection (Network Connection Management)](reference/apis/js-apis-net-connection.md)
- [@ohos.net.ethernet (Ethernet Connection Management)](reference/apis/js-apis-net-ethernet.md)
- [@ohos.net.http (Data Request)](reference/apis/js-apis-http.md)
+ - [@ohos.net.policy (Network Policy Management)](reference/apis/js-apis-net-policy.md)
- [@ohos.net.mdns (mDNS Management)](reference/apis/js-apis-net-mdns.md)
- [@ohos.net.sharing (Network Sharing)](reference/apis/js-apis-net-sharing.md)
- [@ohos.net.socket (Socket Connection)](reference/apis/js-apis-socket.md)
@@ -1058,6 +1070,7 @@
- [@ohos.cooperate (Screen Hopping)](reference/apis/js-apis-devicestatus-cooperate.md)
- [@ohos.deviceAttest (Device Attestation)](reference/apis/js-apis-deviceAttest.md)
- [@ohos.deviceInfo (Device Information)](reference/apis/js-apis-device-info.md)
+ - [@ohos.distributedDeviceManager (Device Management)](reference/apis/js-apis-distributedDeviceManager.md)
- [@ohos.distributedHardware.deviceManager (Device Management)](reference/apis/js-apis-device-manager.md)
- [@ohos.driver.deviceManager (Peripheral Management)](reference/apis/js-apis-driver-deviceManager.md)
- [@ohos.geoLocationManager (Geolocation Manager)](reference/apis/js-apis-geoLocationManager.md)
@@ -1076,6 +1089,7 @@
- [@ohos.multimodalInput.touchEvent (Touch Event)](reference/apis/js-apis-touchevent.md)
- [@ohos.multimodalInput.shortKey (Shortcut Key)](reference/apis/js-apis-shortKey.md)
- [@ohos.power (System Power Management)](reference/apis/js-apis-power.md)
+ - [@ohos.resourceschedule.deviceStandby (Device Standby)](reference/apis/js-apis-resourceschedule-deviceStandby.md)
- [@ohos.runningLock (Runninglock)](reference/apis/js-apis-runninglock.md)
- [@ohos.sensor (Sensor)](reference/apis/js-apis-sensor.md)
- [@ohos.settings (Data Item Settings)](reference/apis/js-apis-settings.md)
@@ -1100,6 +1114,7 @@
- [@ohos.enterprise.accountManager (Account Management)](reference/apis/js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (Enterprise Device Management)](reference/apis/js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.applicationManager (Application Management)](reference/apis/js-apis-enterprise-applicationManager.md)
+ - [@ohos.enterprise.browser (Browser Management)](reference/apis/js-apis-enterprise-browser.md)
- [@ohos.enterprise.bundleManager (Bundle Management)](reference/apis/js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.dateTimeManager (System Time Management)](reference/apis/js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (Device Control Management)](reference/apis/js-apis-enterprise-deviceControl.md)
diff --git a/en/device-dev/subsystems/subsys-build-FAQ.md b/en/device-dev/subsystems/subsys-build-FAQ.md
index 3922581ea092b7225683c1bfdc8016de249526cb..f6df39da206a6243b65d5bac7266ed374f3b232e 100644
--- a/en/device-dev/subsystems/subsys-build-FAQ.md
+++ b/en/device-dev/subsystems/subsys-build-FAQ.md
@@ -4,29 +4,19 @@
### "usr/sbin/ninja: invalid option -- w"
-- **Symptom**
+- **Symptom**
The build fails, and "usr/sbin/ninja: invalid option -- w" is displayed.
- The build fails, and **usr/sbin/ninja: invalid option -- w** is displayed.
+- **Possible Causes**
The Ninja version in use does not support the **--w** option.
-- **Possible Causes**
-
- The Ninja version in use does not support the **--w** option.
-
-- **Solution**
-
- Uninstall Ninja and GN, and [install Ninja and GN of the required version](../../device-dev/get-code/gettools-ide.md).
+- **Solution**
Uninstall Ninja and GN, and [install Ninja and GN of the required version](../../device-dev/get-code/gettools-ide.md).
### "/usr/bin/ld: cannot find -lncurses"
-- **Symptom**
+- **Symptom**
The build fails, and "/usr/bin/ld: cannot find -lncurses" is displayed.
- The build fails, and **/usr/bin/ld: cannot find -lncurses** is displayed.
+- **Possible Causes**
The ncurses library is not available.
-- **Possible Causes**
-
- The ncurses library is not installed.
-
-- **Solution**
+- **Solution**
```shell
sudo apt-get install lib32ncurses5-dev
@@ -34,15 +24,11 @@
### "line 77: mcopy: command not found"
-- **Symptom**
-
- The build fails, and **line 77: mcopy: command not found** is displayed.
+- **Symptom**
The build fails, and "line 77: mcopy: command not found" is displayed.
-- **Possible Causes**
+- **Possible Causes**
mcopy is not available.
- mcopy is not installed.
-
-- **Solution**
+- **Solution**
```shell
sudo apt-get install dosfstools mtools
@@ -50,39 +36,25 @@
### "riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory"
-- **Symptom**
-
- The build fails, and the following information is displayed:
**riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory**
-
-- **Possible Causes**
+- **Symptom**
The build fails, and "riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory" is displayed.
- You do not have the permission to access files in the RISC-V compiler directory.
+- **Possible Causes**
You do not have the permission to access files in the RISC-V compiler directory.
-- **Solution**
+- **Solution**
1. Run the following command to locate **gcc_riscv32**.
- 1. Run the following command to locate **gcc_riscv32**:
-
- ```shell
- which riscv32-unknown-elf-gcc
- ```
+ ```shell
+ which riscv32-unknown-elf-gcc
+ ```
-
-
- 2. Run the **chmod** command to change the directory permission to **755**.
-
-
+ 2. Run the **chmod** command to change the permission for the directory to **755**.
### "No module named 'Crypto'"
-- **Symptom**
-
- The build fails, and **No module named 'Crypto'** is displayed.
+- **Symptom**
The build fails, and "No module named'Crypto'" is displayed.
-- **Possible Causes**
+- **Possible Causes**
Crypto is not installed in Python3.
- Crypto is not installed in Python3.
-
-- **Solution**
+- **Solution**
1. Run the following command to query the Python version:
@@ -96,17 +68,13 @@
sudo pip3 install pycryptodome
```
-### "xx.sh : xx unexpected operator"
-
-- **Symptom**
-
- The build fails, and **xx.sh [: xx unexpected operator** is displayed.
+### "xx.sh: xx unexpected operator"
-- **Possible Causes**
+- **Symptom**
The build fails, and " xx.sh [: xx unexpected operator" is displayed.
- The build environment shell is not bash.
+- **Possible Causes**
The build environment shell is not bash.
-- **Solution**
+- **Solution**
```shell
sudo rm -rf /bin/sh
@@ -114,20 +82,31 @@
```
-### "some services are not authenticated. Listed as follows"
+### "some services are not authenticated. Listed as follow"
+
+- **Symptom**
The build fails, and " some services are not authenticated. Listed as follow" is displayed.
+
+- **Possible Causes**
In the .cfg file of the processes listed in the error message, **uid** is set to **root** or **system**. However, these processes are not high-privilege processes defined by the product.
+
+- **Solution**
+
+ Modify the process .cfg file to reduce the privilege level. Do not set **uid** to **root** or **system** unless necessary.
+
+ If a process must have the **root** or **system** privilege due to service requirements, modify the **high_privilege_process_list.json** file with the approval of the security experts. The **high_privilege_process_list.json** file is located in **vendor/***{company_name}/{product_name }***/security_config**.
-- **Symptom**
+ For example, the file for rk3586 is **//vendor/hihope/rk3568/security_config/high_privilege_process_list.json**.
- The build fails, and "some services are not authenticated. Listed as follows" is displayed.
-- **Possible Causes**
+### "Error: some services do not match with critical whitelist"
- For the processes listed in the error information, the UID is set to **root** or **system** in the process configuration files. However, these processes are not high-privilege processes defined by the product.
+- **Symptom**
The build fails, and "Error: some services do not match with critical whitelist" is displayed.
-- **Solution**
+- **Possible Causes**
In the .cfg file of the processes listed in the error message, the **critical** field is defined and enabled. However, the **critical** field is not allowed for the processes, or the **critical** setting does not match the settings in the whitelist.
- Modify the process configuration file to reduce the privilege level. Do not set **UID** to **root** or **system** unless necessary.
+- **Solution**
- If a process must have the **root** or **system** privilege due to service requirements, modify the **high_privilege_process_list.json** file with the approval of security experts. The **high_privilege_process_list.json** file is located in **vendor/**{*company_name*}/{*product_name*}**/security_config**. For example, the file for rk3586 is **//vendor/hihope/rk3568/security_config/high_privilege_process_list.json**.
+ Remove the **critical** field or set the first bit of the **critical** field to **0** in the .cfg file of the processes. Do not enable the **critical** field unless necessary.
+ For details about how to use the **critical** field, see [Service Management](subsys-boot-init-service.md). If **critical** needs to be enabled for a process due to service requirements, modify the **//vendor/{company_name}/{product_name}/security_config/critical_reboot_process_list.json** file with the approval of the security experts.
+ For example, the critical_reboot process control whitelist of rk3586 is **//vendor/hihope/rk3568/security_config/critical_reboot_process_list.json**.
diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md b/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md
index 0706c71bb7683308cd657f170b197a1d36b346cf..00fd9772a0edcf712b71caedb84507089a7fa913 100644
--- a/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md
+++ b/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-accessToken.md
@@ -1,43 +1,71 @@
-# App Access Control Subsystem ChangeLog
+# Application Access Control Subsystem Changelog
-## cl.accessToken.1 Change of the Media and File Permission Group
+## cl.accessToken.1 Change of the Media and Files Permission Group
The original Media and File permission group contains the following permissions:
- ohos.permission.MEDIA_LOCATION
- ohos.permission.READ_MEDIA
- ohos.permission.WRITE_MEDIA
Changed the permission group as follows:
-- Added **ohos.permission.MEDIA_LOCATION** to the Image and Video permission group.
-- Added **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** to the File permission group.
+- Added **ohos.permission.MEDIA_LOCATION** to the Images and Video permission group.
+- Added **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** to the Documents permission group.
**Change Impact**
-The permission dialog boxes are displayed by permission group.
+The dialog box for requesting permissions is displayed by permission group.
-- Before the change, if the three permissions are applied for an application, a dialog box for applying for the media and file permissions will be displayed only once.
-- After the change, if the three permissions are applied for an application, a dialog box for applying for the image and video permissions and a dialog box for applying for the file permission will be displayed.
+- Before the change, if the three permissions are applied for an application, a dialog box for requesting the media and file permissions will be displayed only once.
+- After the change, if the three permissions are applied for an application, a dialog box for requesting the image and video permissions and a dialog box for requesting the document permission will be displayed.
**Key API/Component Changes**
-Permission group before the change:
+Permission groups before the change:
| Permission | Permission Group |
| -------- | ---------------------------- |
-| ohos.permission.MEDIA_LOCATION | Media and File|
-| ohos.permission.READ_MEDIA | Media and File|
-| ohos.permission.WRITE_MEDIA | Media and File|
+| ohos.permission.MEDIA_LOCATION | Media and file|
+| ohos.permission.READ_MEDIA | Media and file|
+| ohos.permission.WRITE_MEDIA | Media and file|
Permission groups after the change:
| Permission | Permission Group |
| -------- | ---------------------------- |
-| ohos.permission.MEDIA_LOCATION | Image and Video|
-| ohos.permission.READ_MEDIA | File|
-| ohos.permission.WRITE_MEDIA | File|
+| ohos.permission.MEDIA_LOCATION | Images and videos |
+| ohos.permission.READ_MEDIA | Documents |
+| ohos.permission.WRITE_MEDIA | Documents |
**Adaptation Guide**
N/A
+## cl.accessToken.2 Change of the Permission Requesting Modes of the Telephony, Messaging, and Call Logs Permission Groups
+The permissions of the Telephony, Messaging, and Call Logs permission groups are available only to system applications. The three permission groups contain the following permissions:
+- ohos.permission.ANSWER_CALL
+- ohos.permission.MANAGE_VOICEMAIL
+- ohos.permission.READ_CELL_MESSAGES
+- ohos.permission.READ_MESSAGES
+- ohos.permission.RECEIVE_MMS
+- ohos.permission.RECEIVE_SMS
+- ohos.permission.RECEIVE_WAP_MESSAGES
+- ohos.permission.SEND_MESSAGES
+- ohos.permission.READ_CALL_LOG
+- ohos.permission.WRITE_CALL_LOG
+- ohos.permission.MEDIA_LOCATION
+
+To enable third-party application developers to apply for these permissions, the method for requesting these permissions is changed to pre-authorization mode.
+
+
+**Change Impact**
+
+The system applications can obtain these permissions only in pre-authorization mode, rather than requesting these permissions through a pop-up window, .
+
+**Key API/Component Changes**
+
+N/A
+
+**Adaptation Guide**
+
+Apply for the preceding permissions in pre-authorization mode for system applications.
diff --git a/zh-cn/OpenHarmony-Overview_zh.md b/zh-cn/OpenHarmony-Overview_zh.md
index b844f4c0ca7f5e394210af9adc04c4290d4d0242..4525cc96a741732895c02491dbfb074d964cf723 100644
--- a/zh-cn/OpenHarmony-Overview_zh.md
+++ b/zh-cn/OpenHarmony-Overview_zh.md
@@ -146,7 +146,7 @@ OpenHarmony支持如下几种系统类型:
## 支持的开发板
-当前OpenHarmony社区支持22款开发板,下表介绍3款(此处选择三种系统类型首款进入OpenHarmony主干的开发板),更多开发板信息,请参考[社区支持的开发板清单](device-dev/dev-board-on-the-master.md),社区每日构建版本获取地址请参考http://ci.openharmony.cn/dailys/dailybuilds
+当前OpenHarmony社区支持22款开发板,下表介绍3款(此处选择三种系统类型首款进入OpenHarmony主干的开发板),更多开发板信息,请参考[社区支持的开发板清单](device-dev/dev-board-on-the-master.md),社区每日构建版本获取地址请参考http://ci.openharmony.cn/workbench/cicd/dailybuild/dailylist
|系统类型 | 开发板型号| 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓|
|-------- | --------| --------| --------| -------- | -------- |
diff --git a/zh-cn/application-dev/ai/Readme-CN.md b/zh-cn/application-dev/ai/Readme-CN.md
index 98c8e17ee6722a4d60a8595e11ecf70c31fd6f26..62df7be9d4e0b3a4796898b63b4d42a2260219da 100644
--- a/zh-cn/application-dev/ai/Readme-CN.md
+++ b/zh-cn/application-dev/ai/Readme-CN.md
@@ -1,5 +1,5 @@
# AI
-- [AI开发概述](./ai-overview.md)
-- [使用MindSpore Lite JS API开发AI应用](./mindspore-guidelines-based-js.md)
-- [使用MindSpore Lite Native API开发AI应用](./mindspore-guidelines-based-native.md)
+- [AI开发概述](ai-overview.md)
+- [使用MindSpore Lite JS API开发AI应用](mindspore-guidelines-based-js.md)
+- [使用MindSpore Lite Native API开发AI应用](mindspore-guidelines-based-native.md)
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-configuration.md b/zh-cn/application-dev/application-models/arkts-ui-widget-configuration.md
index 6185654060f640e55da4100a86ad6c0509634bd9..183ac67bf051d5902269f08344160fffcd81f347 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-configuration.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-configuration.md
@@ -16,7 +16,7 @@
"extensionAbilities": [
{
"name": "EntryFormAbility",
- "srcEntry": "./ets/entryformability/EntryFormAbility.ts",
+ "srcEntry": "./ets/entryformability/EntryFormAbility.ets",
"label": "$string:EntryFormAbility_label",
"description": "$string:EntryFormAbility_desc",
"type": "form",
@@ -42,9 +42,9 @@
| description | 表示卡片的描述。取值可以是描述性内容,也可以是对描述性内容的资源索引,以支持多语言。字符串最大长度为255字节。 | 字符串 | 可缺省,缺省为空。 |
| src | 表示卡片对应的UI代码的完整路径。当为ArkTS卡片时,完整路径需要包含卡片文件的后缀,如:"./ets/widget/pages/WidgetCard.ets"。当为JS卡片时,完整路径无需包含卡片文件的后缀,如:"./js/widget/pages/WidgetCard" | 字符串 | 否 |
| uiSyntax | 表示该卡片的类型,当前支持如下两种类型:
- arkts:当前卡片为ArkTS卡片。
- hml:当前卡片为JS卡片。 | 字符串 | 可缺省,缺省值为hml |
- | window | 用于定义与显示窗口相关的配置。 | 对象 | 可缺省 |
+ | window | 用于定义与显示窗口相关的配置。 | 对象 | 可缺省,缺省值见表2。 |
| isDefault | 表示该卡片是否为默认卡片,每个UIAbility有且只有一个默认卡片。
- true:默认卡片。
- false:非默认卡片。 | 布尔值 | 否 |
- | colorMode | 表示卡片的主题样式,取值范围如下:
- auto:自适应。
- dark:深色主题。
- light:浅色主题。 | 字符串 | 可缺省,缺省值为“auto”。 |
+ | colorMode | 表示卡片的主题样式,取值范围如下:
- auto:跟随系统的颜色模式值选取主题。
- dark:深色主题。
- light:浅色主题。 | 字符串 | 可缺省,缺省值为“auto”。 |
| supportDimensions | 表示卡片支持的外观规格,取值范围:
- 1 \* 2:表示1行2列的二宫格。
- 2 \* 2:表示2行2列的四宫格。
- 2 \* 4:表示2行4列的八宫格。
- 4 \* 4:表示4行4列的十六宫格。 | 字符串数组 | 否 |
| defaultDimension | 表示卡片的默认外观规格,取值必须在该卡片supportDimensions配置的列表中。 | 字符串 | 否 |
| updateEnabled | 表示卡片是否支持周期性刷新(包含定时刷新和定点刷新),取值范围:
- true:表示支持周期性刷新,可以在定时刷新(updateDuration)和定点刷新(scheduledUpdateTime)两种方式任选其一,当两者同时配置时,定时刷新优先生效。
- false:表示不支持周期性刷新。 | 布尔类型 | 否 |
@@ -56,6 +56,13 @@
| dataProxyEnabled | 表示卡片是否支持[卡片代理刷新](./arkts-ui-widget-update-by-proxy.md),取值范围:
- true:表示支持代理刷新。
- false:表示不支持代理刷新。
设置为true时,[定时刷新和下次刷新不生效,但不影响定点刷新](./arkts-ui-widget-update-by-time.md) | 布尔类型 | 可缺省,缺省值为false。 |
| isDynamic | 表示此卡片是否为动态卡片(仅针对ArkTS卡片生效)。
- true:为动态卡片。
- false:为静态卡片,当卡片添加成功后,将以静态图显示。 | 布尔类型 | 可缺省,缺省值为true。 |
+ **表2** window对象的内部结构说明
+
+ | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
+ | -------- | -------- | -------- | -------- |
+ | designWidth | 标识页面设计基准宽度。以此为基准,根据实际设备宽度来缩放元素大小。 | 数值 | 可缺省,缺省值为720px。 |
+ | autoDesignWidth | 标识页面设计基准宽度是否自动计算。当配置为true时,designWidth将会被忽略,设计基准宽度由设备宽度与屏幕密度计算得出。 | 布尔值 | 可缺省,缺省值为false。 |
+
配置示例如下:
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md b/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md
index 34cbeedd2fa4a2df106b9b32e4f5d1b2917200a6..71c48410fea0aee1420ae1dab44b9dfa81ff1e63 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-creation.md
@@ -11,6 +11,6 @@
3. 在选择卡片的开发语言类型(Language)时,选择ArkTS选项,然后单击“Finish”,即可完成ArkTS卡片创建。

- ArkTS卡片创建完成后,工程中会新增如下卡片相关文件:卡片生命周期管理文件(EntryFormAbility.ts)、卡片页面文件(WidgetCard.ets)和卡片配置文件(form_config.json)。
+ ArkTS卡片创建完成后,工程中会新增如下卡片相关文件:卡片生命周期管理文件(EntryFormAbility.ets)、卡片页面文件(WidgetCard.ets)和卡片配置文件(form_config.json)。

diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-event-call.md b/zh-cn/application-dev/application-models/arkts-ui-widget-event-call.md
index 0289fc67984d9cce33aed0ddc3d537fa3a7c7a40..0cb866cfd4b67db3e3091ad43355aca9484154c4 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-event-call.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-event-call.md
@@ -48,7 +48,7 @@
}
```
-- 在UIAbility中接收call事件并获取参数,根据传递的method不同,执行不同的方法。其余数据可以通过readString的方式获取。需要注意的是,UIAbility需要onCreate生命周期中监听所需的方法。
+- 在UIAbility中接收call事件并获取参数,根据传递的method不同,执行不同的方法。其余数据可以通过[readString](../reference/apis/js-apis-rpc.md#readstring)方法获取。需要注意的是,UIAbility需要onCreate生命周期中监听所需的方法。
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md b/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
index 5ce615a7a3d201f0179fe871654cf614f8d88a21..dd1c84a41983ed354da06789357626beb1d3126a 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
@@ -4,7 +4,7 @@
在卡片页面中可以通过**postCardAction**接口触发message事件拉起FormExtensionAbility,然后由FormExtensionAbility刷新卡片内容,下面是这种刷新方式的简单示例。
-- 在卡片页面通过注册Button的onClick点击事件回调,并在回调中调用**postCardAction**接口触发事件至FormExtensionAbility。
+- 在卡片页面通过注册Button的onClick点击事件回调,并在回调中调用**postCardAction**接口触发事件至FormExtensionAbility。卡片页面中使用[LocalStorageProp](../quick-start/arkts-localstorage.md#localstorageprop)装饰需要刷新的卡片数据。
```ts
let storage = new LocalStorage();
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-event-overview.md b/zh-cn/application-dev/application-models/arkts-ui-widget-event-overview.md
index d4d7063c8fcdf15ea244e4259eaccf34f5a1eb1e..5ee24405260ed7ace73a2d17b51fe22b0ced315f 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-event-overview.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-event-overview.md
@@ -22,11 +22,13 @@ action参数说明:
| **Key** | **Value** | **样例描述** |
| -------- | -------- | -------- |
| "action" | string | action的类型,支持三种预定义的类型:
- "router":跳转到提供方应用的指定UIAbility。
- "message":自定义消息,触发后会调用提供方FormExtensionAbility的[onFormEvent()](../reference/apis/js-apis-app-form-formExtensionAbility.md#onformevent)生命周期回调。
- "call":后台启动提供方应用。触发后会拉起提供方应用的指定UIAbility(仅支持[launchType](uiability-launch-type.md)为singleton的UIAbility,即启动模式为单实例的UIAbility),但不会调度到前台。提供方应用需要具备后台运行权限([ohos.permission.KEEP_BACKGROUND_RUNNING](../security/permission-list.md#ohospermissionkeep_background_running))。 |
-| "bundleName" | string | "router" / "call" 类型时跳转的包名,可选。 |
-| "moduleName" | string | "router" / "call" 类型时跳转的模块名,可选。 |
-| "abilityName" | string | "router" / "call" 类型时跳转的UIAbility名,必填。 |
-| "params" | Object | 当前action携带的额外参数,内容使用JSON格式的键值对形式。"call" 类型时需填入参数'method',且类型需要为string类型,用于触发UIAbility中对应的方法,必填。 |
+| "bundleName" | string | "action"为"router" / "call" 类型时跳转的包名,可选。 |
+| "moduleName" | string | "action"为"router" / "call" 类型时跳转的模块名,可选。 |
+| "abilityName" | string | "action"为"router" / "call" 类型时跳转的UIAbility名,必填。 |
+| "params" | Object | 当前action携带的额外参数,内容使用JSON格式的键值对形式。必填。 |
+> **说明:**
+>"action"为"call" 类型时,"params"需填入参数'method',且类型需为string类型,用于触发UIAbility中对应的方法。
`postCardAction()`接口示例代码:
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md b/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md
index 19fe644cd4c7bc00b692483ff2e57b853da23eef..f32017a7ed10f405f292bd6ad26139df5613d189 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-event-router.md
@@ -57,7 +57,7 @@
let selectPage = "";
let currentWindowStage = null;
- export default class CameraAbility extends UIAbility {
+ export default class EntryAbility extends UIAbility {
// 如果UIAbility第一次启动,在收到Router事件后会触发onCreate生命周期回调
onCreate(want, launchParam) {
// 获取router事件中传递的targetPage参数
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md b/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md
index 8b16e5df4ed5b58dec26b233fe826dfed8bc0458..0ef91cf7071c85c6b5570a0b8e1665b7da757fb3 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-interaction-overview.md
@@ -1,6 +1,6 @@
# 卡片数据交互说明
-ArkTS卡片框架提供了updateForm()接口和requestForm()接口主动触发卡片的页面刷新。
+ArkTS卡片框架提供了updateForm()接口和requestForm()接口主动触发卡片的页面刷新,通过[LocalStorageProp](../quick-start/arkts-localstorage.md#localstorageprop)确认需要刷新的卡片数据。

diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-lifecycle.md b/zh-cn/application-dev/application-models/arkts-ui-widget-lifecycle.md
index 9b34f5c1d5300ff97d1efb23e00e2bd3345bf000..f3c90861a5d6cdd0ab39b940acd7d49defd9a374 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-lifecycle.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-lifecycle.md
@@ -4,7 +4,7 @@
创建ArkTS卡片,需实现[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)生命周期接口。
-1. 在EntryFormAbility.ts中,导入相关模块。
+1. 在EntryFormAbility.ets中,导入相关模块。
```ts
import formInfo from '@ohos.app.form.formInfo';
@@ -13,7 +13,7 @@
import formProvider from '@ohos.app.form.formProvider';
```
-2. 在EntryFormAbility.ts中,实现[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)生命周期接口,其中在onAddForm的入参want中可以通过[FormParam](../reference/apis/js-apis-app-form-formInfo.md#formparam)取出卡片的相关信息。
+2. 在EntryFormAbility.ets中,实现[FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)生命周期接口,其中在onAddForm的入参want中可以通过[FormParam](../reference/apis/js-apis-app-form-formInfo.md#formparam)取出卡片的相关信息。
```typescript
import formInfo from '@ohos.app.form.formInfo';
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md b/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md
index fffa5ca955827d9a76caa12c79bf74c095268bd1..219bdf5e85bb32edb9969c0f91ea464a0616c3ad 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-modules.md
@@ -15,7 +15,7 @@
- [formBindingData](../reference/apis/js-apis-app-form-formBindingData.md):提供卡片数据绑定的能力,包括FormBindingData对象的创建、相关信息的描述。
-- [页面布局(Card.ets)](arkts-ui-widget-page-overview.md):提供声明式范式的UI接口能力。
+- [页面布局(WidgetCard.ets)](arkts-ui-widget-page-overview.md):提供声明式范式的UI接口能力。
- [ArkTS卡片特有能力](arkts-ui-widget-event-overview.md):postCardAction用于卡片内部和提供方应用间的交互,仅在卡片中可以调用。
- [ArkTS卡片能力列表](arkts-ui-widget-page-overview.md#arkts卡片支持的页面能力):列举了能在ArkTS卡片中使用的API、组件、事件、属性和生命周期调度。
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md
index cac283478e8ecb04d9e449dc46f38e3d40075d7e..1630e686e1cddd466e859c66e9f17e720744df8f 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-proxy.md
@@ -7,11 +7,15 @@
**图1** 代理刷新运行原理

-如图1,与[ArkTS卡片实现原理图](../application-models/arkts-ui-widget-working-principles.md#实现原理)相比,新增了数据管理服务和数据提供方。
+如图1,与[ArkTS卡片实现原理图](../application-models/arkts-ui-widget-working-principles.md#实现原理)相比,卡片代理刷新原理新增了数据管理服务和数据提供方。
- 数据管理服务:该场景下主要提供了多应用间的数据共享的机制。
- 数据提供方(仅支持系统应用):系统应用作为数据提供方,需要开启数据共享能力,同时需要自定义`key + subscriberId`作为共享数据的标识。
+> **说明:**
+>
+> 只有系统提供了作为数据提供方的应用,同时提供公开可获得的共享数据标识,才能正常使用该特性。
+
卡片提供方处理流程(图中蓝色箭头):
1. 卡片提供方在卡片提供方的配置文件`form_config.json`中配置`dataProxyEnabled`字段为`true`,以开启卡片代理刷新功能。
@@ -28,11 +32,11 @@
1. 数据提供方以`key + subscriberId`作为数据的标识,将数据存储到数据库。
2. 数据管理服务感知到数据库变化,将新的数据发布给当前注册的所有订阅实例。
3. 卡片管理服务从订阅实例中解析出数据,发送给卡片渲染服务。
-4. 卡片渲染服务运行卡片页面代码widgets.abc,widgets.abc按新数据进行渲染,并将渲染后的数据发送至卡片使用方对应的[卡片组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md)。
+4. 卡片渲染服务运行卡片页面代码widgets.abc,widgets.abc按新数据进行渲染,并将渲染后的数据发送至卡片使用方对应的[卡片组件](../reference/arkui-ts/ts-basic-components-formcomponent.md)。
数据提供方提供的共享数据有两种类型:
-- 过程数据,不会一直存储,有老化期,普通应用可以订阅。
+- 过程数据,不会一直存储,有老化期,所有应用都可以订阅。
- 持久化数据,仅系统应用可以订阅。
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-status.md b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-status.md
index 59835a5d040fb802c25c73d12d746b2a19cd3bd2..fc550230a7a8b1188217f51fcef89f5009aeb400 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-status.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-status.md
@@ -4,7 +4,7 @@
相同的卡片可以添加到桌面上实现不同的功能,比如添加两张桌面的卡片,一张显示杭州的天气,一张显示北京的天气,设置每天早上7点触发定时刷新,卡片需要感知当前的配置是杭州还是北京,然后将对应城市的天气信息刷新到卡片上,以下示例介绍了如何根据卡片的状态动态选择需要刷新的内容。
-- 卡片配置文件:配置每天早上7点触发定时刷新
+- 卡片配置文件:配置每天早上7点触发定时刷新。
```json
{
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-time.md b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-time.md
index 0ffb74d98e2501afbbef89b567d8bed8945775b9..853cf48b68af6c9ec58b6110f6e5960c6d9955a3 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-time.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-update-by-time.md
@@ -1,7 +1,5 @@
# 卡片定时刷新和定点刷新
-在使用定时和定点刷新功能之前,需要在form_config.json配置文件中设置`updateEnabled`字段为`true`,以启用周期性刷新功能。
-
当前卡片框架提供了如下几种按时间刷新卡片的方式:
@@ -9,6 +7,7 @@
> **说明:**
>
+ > 在使用定时和定点刷新功能之前,需要在form_config.json配置文件中设置`updateEnabled`字段为`true`,以启用周期性刷新功能。
> 当配置了`updateDuration`(定时刷新)后,该设置会优先于`scheduledUpdateTime`(定点刷新)生效,即使同时配置了两者,定点刷新也会被忽略。
```json
diff --git a/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md b/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md
index e516a2add182c3f9627fc257c75714b4a9d55ba4..e40413e81bc389fd857b19081dc3b7bdd17159de 100644
--- a/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md
+++ b/zh-cn/application-dev/application-models/arkts-ui-widget-working-principles.md
@@ -17,7 +17,7 @@
**图2** ArkTS卡片渲染服务运行原理

-与JS卡片相比,ArkTS卡片支持在卡片中运行逻辑代码,为确保ArkTS卡片发生问题后不影响卡片使用方应用的使用,ArkTS卡片新增了卡片渲染服务用于运行卡片页面代码widgets.abc,卡片渲染服务由卡片管理服务管理。卡片使用方的每个卡片组件都对应了卡片渲染服务里的一个渲染实例,同一应用提供方的渲染实例运行在同一个虚拟机运行环境中,不同应用提供方的渲染实例运行在不同的虚拟机运行环境中,通过虚拟机运行环境隔离不同应用提供方卡片之间的资源与状态。开发过程中需要注意的是[globalThis](uiability-data-sync-with-ui.md#使用globalthis进行数据同步)对象的使用,相同应用提供方的卡片globalThis对象是同一个,不同应用提供方的卡片globalThis对象是不同的。
+与JS卡片相比,ArkTS卡片支持在卡片中运行逻辑代码,为确保ArkTS卡片发生问题后不影响卡片使用方应用的使用,ArkTS卡片新增了卡片渲染服务用于运行卡片页面代码widgets.abc,卡片渲染服务由卡片管理服务管理。卡片使用方的每个卡片组件都对应了卡片渲染服务里的一个渲染实例,同一应用提供方的渲染实例运行在同一个ArkTS虚拟机运行环境中,不同应用提供方的渲染实例运行在不同的ArkTS虚拟机运行环境中,通过ArkTS虚拟机运行环境隔离不同应用提供方卡片之间的资源与状态。开发过程中需要注意的是[globalThis](uiability-data-sync-with-ui.md#使用globalthis进行数据同步)对象的使用,相同应用提供方的卡片globalThis对象是同一个,不同应用提供方的卡片globalThis对象是不同的。
## ArkTS卡片的优势
diff --git a/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md b/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md
index 31e35a31aeabed1da53d70e0ba58fb38990e1175..fc285a97f12eef0c1b677a5ddfe98b7692bd47e1 100644
--- a/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md
+++ b/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md
@@ -18,7 +18,7 @@
| action | string | 否 | 否 | 系统匹配时将忽略该参数,但仍可作为参数传递给目标应用组件。 |
| entities | Array<string> | 否 | 否 | 系统匹配时将忽略该参数,但仍可作为参数传递给目标应用组件。 |
| flags | number | 否 | 否 | 不参与匹配,直接传递给系统处理,一般用来设置运行态信息,例如URI数据授权等。 |
-| parameters | {[key: string]: any} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
+| parameters | {[key: string]: Object} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
## 隐式Want匹配原理
@@ -35,7 +35,7 @@
| action | string | 是 | 否 | |
| entities | Array<string> | 是 | 否 | |
| flags | number | 否 | 否 | 不参与匹配,直接传递给系统处理,一般用来设置运行态信息,例如URI数据授权等。 |
-| parameters | {[key: string]: any} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
+| parameters | {[key: string]: Object} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
从隐式Want的定义,可得知:
diff --git a/zh-cn/application-dev/application-models/figures/WidgetModules.png b/zh-cn/application-dev/application-models/figures/WidgetModules.png
index fe11622a2c1586fca143996158e6d39732193206..970a4a93159f697e505efbfa6fc7563b0d3c822a 100644
Binary files a/zh-cn/application-dev/application-models/figures/WidgetModules.png and b/zh-cn/application-dev/application-models/figures/WidgetModules.png differ
diff --git a/zh-cn/application-dev/application-models/figures/WidgetPrinciple.png b/zh-cn/application-dev/application-models/figures/WidgetPrinciple.png
index c8ecff746db659593e94a3aada2918f1b8bee6cc..c5dedca77157d72109f5c130ab84f30d73c72fae 100644
Binary files a/zh-cn/application-dev/application-models/figures/WidgetPrinciple.png and b/zh-cn/application-dev/application-models/figures/WidgetPrinciple.png differ
diff --git a/zh-cn/application-dev/application-models/figures/WidgetProjectView.png b/zh-cn/application-dev/application-models/figures/WidgetProjectView.png
index 9d1c06e47502131983b0b7cd56e66269b5be6d88..a1c8b42becc089b6b69f58c362569faeaf84f06f 100644
Binary files a/zh-cn/application-dev/application-models/figures/WidgetProjectView.png and b/zh-cn/application-dev/application-models/figures/WidgetProjectView.png differ
diff --git a/zh-cn/application-dev/application-models/figures/WidgetRender.png b/zh-cn/application-dev/application-models/figures/WidgetRender.png
index ea682368d70d8a7f208cc7482de7fcb1407155f7..e4273aacd523e2715c629d765710af67dab9f738 100644
Binary files a/zh-cn/application-dev/application-models/figures/WidgetRender.png and b/zh-cn/application-dev/application-models/figures/WidgetRender.png differ
diff --git a/zh-cn/application-dev/application-models/hop-cross-device-migration.md b/zh-cn/application-dev/application-models/hop-cross-device-migration.md
index f8e215e21f9661168291de9d3222ef2aada3aa91..855da0ff4beb9feda0e159841923800a5a274645 100644
--- a/zh-cn/application-dev/application-models/hop-cross-device-migration.md
+++ b/zh-cn/application-dev/application-models/hop-cross-device-migration.md
@@ -46,7 +46,7 @@
| **接口名** | **描述** |
| -------- | -------- |
-| onContinue(wantParam : {[key: string]: any}): OnContinueResult | 迁移发起端在该回调中保存迁移所需要的数据,同时返回是否同意迁移:
- AGREE:表示同意。
- REJECT:表示拒绝:如应用在onContinue中异常可以直接REJECT。
- MISMATCH:表示版本不匹配:迁移发起端应用可以在onContinue中获取到迁移接收端应用的版本号,进行协商后,如果版本不匹配导致无法迁移,可以返回该错误。 |
+| onContinue(wantParam : {[key: string]: Object}): OnContinueResult | 迁移发起端在该回调中保存迁移所需要的数据,同时返回是否同意迁移:
- AGREE:表示同意。
- REJECT:表示拒绝:如应用在onContinue中异常可以直接REJECT。
- MISMATCH:表示版本不匹配:迁移发起端应用可以在onContinue中获取到迁移接收端应用的版本号,进行协商后,如果版本不匹配导致无法迁移,可以返回该错误。 |
| onCreate(want: Want, param: AbilityConstant.LaunchParam): void; | 应用迁移接收端为冷启动或多实例应用热启动时,在该回调中完成数据恢复,并触发页面恢复。详见[应用组件启动模式](uiability-launch-type.md) |
| onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | 迁移接收端为单实例应用热启动时,在该回调中完成数据恢复,并触发页面恢复。详见[应用组件启动模式](uiability-launch-type.md) |
diff --git a/zh-cn/application-dev/application-models/js-ui-widget-development.md b/zh-cn/application-dev/application-models/js-ui-widget-development.md
index 7ef75f5fb7aeb381dea35b14255d704ebc13863d..24a6abb2d41705f9b7c76141f79f5ad2c1d0c2fb 100644
--- a/zh-cn/application-dev/application-models/js-ui-widget-development.md
+++ b/zh-cn/application-dev/application-models/js-ui-widget-development.md
@@ -55,7 +55,7 @@ FormExtensionAbility类拥有如下API接口,具体的API介绍详见[接口
| onFormEvent(formId: string, message: string): void | 卡片提供方接收处理卡片事件的通知接口。 |
| onRemoveForm(formId: string): void | 卡片提供方接收销毁卡片的通知接口。 |
| onConfigurationUpdate(config: Configuration): void | 当系统配置更新时调用。 |
-| onShareForm?(formId: string): { [key: string]: any } | 卡片提供方接收卡片分享的通知接口。 |
+| onShareForm?(formId: string): { [key: string]: Object } | 卡片提供方接收卡片分享的通知接口。 |
formProvider类有如下API接口,具体的API介绍详见[接口文档](../reference/apis/js-apis-app-form-formProvider.md)。
@@ -94,7 +94,7 @@ Stage卡片开发,即基于[Stage模型](stage-model-development-overview.md)
创建Stage模型的卡片,需实现FormExtensionAbility生命周期接口。先参考[DevEco Studio服务卡片开发指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-service-widget-0000001263280425)生成服务卡片模板。
-1. 在EntryFormAbility.ts中,导入相关模块。
+1. 在EntryFormAbility.ets中,导入相关模块。
```ts
@@ -105,7 +105,7 @@ Stage卡片开发,即基于[Stage模型](stage-model-development-overview.md)
import dataPreferences from '@ohos.data.preferences';
```
-2. 在EntryFormAbility.ts中,实现FormExtension生命周期接口。
+2. 在EntryFormAbility.ets中,实现FormExtension生命周期接口。
```ts
@@ -174,7 +174,7 @@ Stage卡片开发,即基于[Stage模型](stage-model-development-overview.md)
"extensionAbilities": [
{
"name": "EntryFormAbility",
- "srcEntry": "./ets/entryformability/EntryFormAbility.ts",
+ "srcEntry": "./ets/entryformability/EntryFormAbility.ets",
"label": "$string:EntryFormAbility_label",
"description": "$string:EntryFormAbility_desc",
"type": "form",
@@ -545,6 +545,29 @@ onUpdateForm(formId) {
}
```
+ 说明:
+
+ "data"中JSON Value支持多级嵌套数据,在更新数据时,需要注意携带完整数据。
+
+ 例如:当前卡片显示07.18日Mr.Zhang的课程信息,示例如下。
+ ```ts
+ "data": {
+ "Day": "07.18",
+ "teacher": {
+ "name": "Mr.Zhang",
+ "course": "Math"
+ }
+ }
+ ```
+ 当卡片内容需要更新为07.18日Mr.Li的课程信息时,需要传递待更新的完整数据,不能值传递单个数据项,如只传name或只传course,示例如下。
+ ```ts
+ "teacher": {
+ "name": "Mr.Li",
+ "course": "English"
+ }
+ ```
+
+
- 在UIAbility中接收router事件并获取参数
diff --git a/zh-cn/application-dev/application-models/lifecycleapp-switch.md b/zh-cn/application-dev/application-models/lifecycleapp-switch.md
index d1d37d01d3f44ed1c86ccb53a461ac20bfafed32..55eb8d71971f8cc80ef26719257e8db4f761c172 100644
--- a/zh-cn/application-dev/application-models/lifecycleapp-switch.md
+++ b/zh-cn/application-dev/application-models/lifecycleapp-switch.md
@@ -9,11 +9,11 @@
| onCreate?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) |
| onWindowDisplayModeChanged?(isShownInMultiWindow: boolean, newConfig: resourceManager.Configuration): void; | Stage模型无对应接口 | 暂时未提供对应接口 |
| onStartContinuation?(): boolean; | Stage模型无对应接口 | Stage模型上,应用无需感知迁移是否成功(由应用发起迁移请求时感知),onStartContinuation废弃 |
-| onSaveData?(data: Object): boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
+| onSaveData?(data: Object): boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam : {[key: string]: Object}): AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
| onCompleteContinuation?(result: number): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
| onRestoreData?(data: Object): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)
[onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant)
多实例模式Ability迁移目标端在onCreate回调中完成数据恢复,单实例模式应用迁移目标端在onCreate回调中完成数据恢复,回调中通过判断launchParam.launchReason可获取迁移启动的场景,从而可以从Want中获取迁移前保存的数据 |
| onRemoteTerminated?(): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
-| onSaveAbilityState?(outState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
+| onSaveAbilityState?(outState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
| onRestoreAbilityState?(inState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)
应用重启后会触发Ability的onCreate方法,通过判断launchParam.launchReason可获取自恢复的场景,从而可以从Want中获取重启前保存的数据 |
| onInactive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onBackground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonbackground) |
| onActive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onForeground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonforeground) |
diff --git a/zh-cn/application-dev/application-models/lifecycleform-switch.md b/zh-cn/application-dev/application-models/lifecycleform-switch.md
index fbe5ac639ba698dd5ec967a2f1983b8e9f2da32f..7b0414b44e6ea43cdd9891f31b83aae1d48120b2 100644
--- a/zh-cn/application-dev/application-models/lifecycleform-switch.md
+++ b/zh-cn/application-dev/application-models/lifecycleform-switch.md
@@ -10,4 +10,4 @@
| onEvent?(formId: string, message: string): void; | \@ohos.app.form.FormExtensionAbility.d.ts | [onFormEvent(formId: string, message: string): void;](../reference/apis/js-apis-app-form-formExtensionAbility.md#onformevent) |
| onDestroy?(formId: string): void; | \@ohos.app.form.FormExtensionAbility.d.ts | [onRemoveForm(formId: string): void;](../reference/apis/js-apis-app-form-formExtensionAbility.md#onremoveform) |
| onAcquireFormState?(want: Want): formInfo.FormState; | \@ohos.app.form.FormExtensionAbility.d.ts | [onAcquireFormState?(want: Want): formInfo.FormState;](../reference/apis/js-apis-app-form-formExtensionAbility.md#onacquireformstate) |
-| onShare?(formId: string): {[key: string]: any}; | \@ohos.app.form.FormExtensionAbility.d.ts | [onShareForm?(formId: string): { [key: string]: any };](../reference/apis/js-apis-app-form-formExtensionAbility.md#onshareform) |
+| onShare?(formId: string): {[key: string]: Object}; | \@ohos.app.form.FormExtensionAbility.d.ts | [onShareForm?(formId: string): { [key: string]: Object };](../reference/apis/js-apis-app-form-formExtensionAbility.md#onshareform) |
diff --git a/zh-cn/application-dev/dfx/cppcrash-guidelines.md b/zh-cn/application-dev/dfx/cppcrash-guidelines.md
index 33e34e3c0caee52f25231bf3e3aeeae40425686d..e4a18bdd91431ded5f42e4ca753e64ba1556b8ee 100644
--- a/zh-cn/application-dev/dfx/cppcrash-guidelines.md
+++ b/zh-cn/application-dev/dfx/cppcrash-guidelines.md
@@ -96,8 +96,10 @@ Thread name:crasher <- 异常线程名
使用addr2line工具根据偏移地址解析行号:
+ [product name]为具体设备名。
+
```
- root:~/OpenHarmony/out/rk3568/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 0000332c
+ root:~/OpenHarmony/out/[product name]/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 0000332c
base/hiviewdfx/faultloggerd/tools/crasher/dfx_crasher.c:57
```
diff --git a/zh-cn/application-dev/file-management/save-user-file.md b/zh-cn/application-dev/file-management/save-user-file.md
index 6cbb287dc91c47a7b21834fc5946ed646da1f015..9818de82be9377a747e8ab2c063a01ba456ca0dc 100644
--- a/zh-cn/application-dev/file-management/save-user-file.md
+++ b/zh-cn/application-dev/file-management/save-user-file.md
@@ -2,55 +2,100 @@
在从网络下载文件到本地、或将已有用户文件另存为新的文件路径等场景下,需要使用FilePicker提供的保存用户文件的能力。
-对音频、图片、视频、文档类文件的保存操作类似,均通过调用对应picker的save()接口并传入对应的saveOptions来实现。
+对音频、图片、视频、文档类文件的保存操作类似,均通过调用对应picker的save()接口并传入对应的saveOptions来实现。通过Picker访问相关文件,无需申请权限。
save接口会将文件保存在文件管理器,而不是图库。
## 保存图片或视频类文件
-1. 导入选择器模块和文件管理模块。
+本例展示了从图库中选择一张图片,保存到文件管理器的示例代码。
+
+1. 导入[选择器](../reference/apis/js-apis-file-picker.md)、[文件管理](../reference/apis/js-apis-file-fs.md)、[相册管理](../reference/apis/js-apis-photoAccessHelper.md)、[数据共享谓词](../reference/apis/js-apis-data-dataSharePredicates.md)模块。
```ts
import picker from '@ohos.file.picker';
import fs from '@ohos.file.fs';
+ import photoAccessHelper from '@ohos.file.photoAccessHelper';
+ import dataSharePredicates from '@ohos.data.dataSharePredicates';
```
-2. 创建图库保存选项实例。
+2. 获取设备里第一张图片的缩略图。注意:在执行这一步之前,要先确保设备里至少有一张图片。
```ts
- const photoSaveOptions = new picker.PhotoSaveOptions(); // 创建文件管理器保存选项实例
- photoSaveOptions.newFileNames = ["PhotoViewPicker01.jpg"]; // 保存文件名(可选)
+ const context = getContext(this);
+ let photoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
+
+ let pixelmapArrayBuffer;
+ async getPixelmap() {
+ try {
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOption = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let fetchResult = await photoAccessHelper.getAssets(fetchOption);
+ console.info('[picker] getThumbnail fetchResult: ' + fetchResult);
+ const asset = await fetchResult.getFirstObject();
+ console.info('[picker] getThumbnail asset displayName = ', asset.displayName);
+ asset.getThumbnail().then((pixelMap) => {
+ let pixelBytesNumber = pixelMap.getPixelBytesNumber();
+ const readBuffer = new ArrayBuffer(pixelBytesNumber);
+ pixelMap.readPixelsToBuffer(readBuffer).then(() => {
+ pixelmapArrayBuffer = readBuffer;
+ })
+ }).catch((err) => {
+ console.error('[picker] getThumbnail failed with error: ' + err);
+ });
+ } catch (error) {
+ console.error('[picker] getThumbnail error = ' + error);
+ }
+ }
```
-3. 创建图库选择器实例,调用[save()](../reference/apis/js-apis-file-picker.md#save)接口拉起FilePicker界面进行文件保存。用户选择目标文件夹,用户选择与文件类型相对应的文件夹,即可完成文件保存操作。保存成功后,返回保存文档的uri。
+3. 创建图库选择器实例,调用[save()](../reference/apis/js-apis-file-picker.md#save)接口拉起FilePicker界面进行文件保存。用户选择目标文件夹,用户选择与文件类型相对应的文件夹,即可完成文件保存操作。保存成功后,返回保存图片的uri。
- save返回的uri权限是读写权限,可以根据结果集中uri进行文件读写等操作。注意不能在picker的回调里直接使用此uri进行打开文件操作,需要定义一个全局变量保存uri,使用类似一个按钮去触发打开文件。
-
- ```ts
- let uri = null;
- const photoViewPicker = new picker.PhotoViewPicker();
- photoViewPicker.save(photoSaveOptions).then((photoSaveResult) => {
- uri = photoSaveResult[0];
- console.info('photoViewPicker.save to file succeed and uri is:' + uri);
- }).catch((err) => {
- console.error(`Invoke photoViewPicker.save failed, code is ${err.code}, message is ${err.message}`);
- })
+ save返回的uri权限是读写权限,可以根据结果集里面的uri进行文件读写等操作。注意不能在picker的回调里直接使用此uri进行打开文件操作,需要定义一个全局变量保存uri,使用类似一个按钮去触发打开文件。
+
+ ```ts
+ let uri:string;
+ async photoViewPickerSave() {
+ try {
+ const photoSaveOptions = new picker.PhotoSaveOptions(); // 创建文件管理器保存选项实例
+ photoSaveOptions.newFileNames = ["PhotoViewPicker01.png"]; // 保存文件名(可选),方括号里的文件名自定义,每次不能重复,设备里已有这个文件的话,名字就需要改个不一样的,不然接口会报错
+
+ const photoViewPicker = new picker.PhotoViewPicker();
+ try {
+ let photoSaveResult = await photoViewPicker.save(photoSaveOptions);
+ if (photoSaveResult != undefined) {
+ console.info("[picker] photoViewPickerSave photoSaveResult = " + JSON.stringify(photoSaveResult));
+ this.uri = photoSaveResult[0];
+ console.info('photoViewPicker.save to file succeed and uri is:' + photoSaveResult[0]);
+ }
+ } catch (err) {
+ console.error(`[picker] Invoke photoViewPicker.save failed, code is ${err.code}, message is ${err.message}`);
+ }
+ } catch (error) {
+ console.info("[picker] photoViewPickerSave error = " + error);
+ }
+ }
```
4. 待界面从FilePicker返回后,再通过类似一个按钮调用其他函数,使用[fs.openSync](../reference/apis/js-apis-file-fs.md#fsopensync)接口,通过uri打开这个文件得到fd。这里需要注意接口权限参数是fs.OpenMode.READ_WRITE。
- ```ts
- let file = fs.openSync(uri, fs.OpenMode.READ_WRITE);
- console.info('file fd: ' + file.fd);
- ```
-
-5. 通过fd使用[fs.writeSync](../reference/apis/js-apis-file-fs.md#writesync)接口对这个文件进行编辑修改,编辑修改完成后关闭fd。
+ 然后,通过fd使用[fs.write](../reference/apis/js-apis-file-fs.md#fswrite)接口对这个文件进行编辑修改,编辑修改完成后关闭fd。
```ts
- let writeLen = fs.writeSync(file.fd, 'hello, world');
- console.info('write data to file succeed and size is:' + writeLen);
- fs.closeSync(file);
+ async writeOnly(uri) {
+ try {
+ let file = fs.openSync(uri, fs.OpenMode.WRITE_ONLY);
+ let writeLen = await fs.write(file.fd, pixelmapArrayBuffer);
+ fs.closeSync(file);
+ console.info("[picker] writeOnly writeLen = " + writeLen);
+ } catch (error) {
+ console.info("[picker] writeOnly error: " + error);
+ }
+ }
```
## 保存文档类文件
diff --git a/zh-cn/application-dev/file-management/select-user-file.md b/zh-cn/application-dev/file-management/select-user-file.md
index 9aab768871b70c09f369598cb0be5d35134b9a45..7a850a82466a3fcb517ca9caf7fa2a04ab9876fb 100644
--- a/zh-cn/application-dev/file-management/select-user-file.md
+++ b/zh-cn/application-dev/file-management/select-user-file.md
@@ -1,6 +1,6 @@
# 选择用户文件
-终端用户有时需要分享、保存一些图片、视频等用户文件,开发者需要在应用中支持此类使用场景。此时,开发者可以使用OpenHarmony系统预置的[文件选择器(FilePicker)](../reference/apis/js-apis-file-picker.md),实现用户文件选择及保存能力。
+终端用户有时需要分享、保存一些图片、视频等用户文件,开发者需要在应用中支持此类使用场景。此时,开发者可以使用OpenHarmony系统预置的[文件选择器(FilePicker)](../reference/apis/js-apis-file-picker.md),实现用户文件选择及保存能力。通过Picker访问相关文件,无需申请权限。
根据用户文件的常见类型,文件选择器(FilePicker)分别提供以下接口:
diff --git "a/zh-cn/application-dev/key-features/multi-device-app-dev/OpenHarmony_\347\263\273\347\273\237\350\265\204\346\272\220\345\210\206\345\261\202\350\256\276\350\256\241\350\241\250_V1.0.xlsm" "b/zh-cn/application-dev/key-features/multi-device-app-dev/OpenHarmony_\347\263\273\347\273\237\350\265\204\346\272\220\345\210\206\345\261\202\350\256\276\350\256\241\350\241\250_V1.0.xlsm"
index fdb0b1b3b41b0db843d07dbd00eaa20cfdcb88ac..03738d581e8e06c23e4a8fde40227bffb86d3764 100644
Binary files "a/zh-cn/application-dev/key-features/multi-device-app-dev/OpenHarmony_\347\263\273\347\273\237\350\265\204\346\272\220\345\210\206\345\261\202\350\256\276\350\256\241\350\241\250_V1.0.xlsm" and "b/zh-cn/application-dev/key-features/multi-device-app-dev/OpenHarmony_\347\263\273\347\273\237\350\265\204\346\272\220\345\210\206\345\261\202\350\256\276\350\256\241\350\241\250_V1.0.xlsm" differ
diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md b/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md
index 0d9e8cfe73c3b13cfd09f3611dc0faa569e4fdc6..7f7cf3786f62b95754f79d066dd083db0a893039 100644
--- a/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md
+++ b/zh-cn/application-dev/key-features/multi-device-app-dev/ide-using.md
@@ -58,8 +58,6 @@ DevEco Studio的基本使用,请参考[DevEco Studio使用指南](../../quick-
> **说明:**
> - 在一个工程中同一个设备类型只支持一个Entry类型的模块。
>
-> - 当前的DevEco Studio(3.1.1 Release)在创建工程时,设备类型仅能选择phone和tablet,默认该模块已经选择了entry类型,那么在创建wearable这个模块,只能选择feature类型。
->
> - 在下一个小节,我们将介绍如何修改Module的配置,包括Module的类型以及其支持的设备类型等。
@@ -115,7 +113,7 @@ DevEco Studio的基本使用,请参考[DevEco Studio使用指南](../../quick-
同样的,修改feature1和feature2模块中的oh-package.json文件,使其可以使用common模块中的代码。
-修改oh-package.json文件后,一定要点击右上角的“Sync Now”,否则改动不会生效!
+修改oh-package.json文件后,请点击右上角的“Sync Now”,否则改动不会生效。
## 引用ohpm包中的代码
diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md
index 78e8fced82673e71ce3a09a726d46a10124a7621..0817e2f588d3b5400ba5684aa5f80566d51a5997 100644
--- a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md
+++ b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md
@@ -354,16 +354,10 @@ struct MultiLaneList {
struct SideBarSample {
@StorageLink('currentBreakpoint') private currentBreakpoint: string = "md";
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
- @State showSideBar: boolean = false
@State selectIndex: number = 0;
aboutToAppear() {
- this.breakpointSystem.register()
- if (this.currentBreakpoint === 'sm') {
- this.showSideBar = false
- } else {
- this.showSideBar = true
- }
+ this.breakpointSystem.register()
}
aboutToDisappear() {
@@ -382,9 +376,6 @@ struct SideBarSample {
.height(36)
.onClick(() => {
this.selectIndex = index
- if (this.currentBreakpoint === 'sm') {
- this.showSideBar = false
- }
})
}
@@ -412,9 +403,8 @@ struct SideBarSample {
.maxSideBarWidth(this.currentBreakpoint === 'sm' ? '100%' : '33.33%')
.showControlButton(this.currentBreakpoint === 'sm')
.autoHide(false)
- .showSideBar(this.showSideBar)
.onChange((isBarShow: boolean) => {
- this.showSideBar = isBarShow
+
})
}
}
diff --git a/zh-cn/application-dev/media/Readme-CN.md b/zh-cn/application-dev/media/Readme-CN.md
index 5b3d92fad526aed9daaf7202ef0cc267e59f4d63..863a030c1944ff138d1e0ec10f5ea49bc1318c2e 100755
--- a/zh-cn/application-dev/media/Readme-CN.md
+++ b/zh-cn/application-dev/media/Readme-CN.md
@@ -31,6 +31,7 @@
- [开发音频通话功能](audio-call-development.md)
- [视频播放](video-playback.md)
- [视频录制](video-recording.md)
+ - [屏幕录制](avscreen-capture.md)
- 音视频编解码
- [获取支持的编解码能力](obtain-supported-codecs.md)
- [音频编码](audio-encoding.md)
diff --git a/zh-cn/application-dev/media/avscreen-capture.md b/zh-cn/application-dev/media/avscreen-capture.md
new file mode 100644
index 0000000000000000000000000000000000000000..b1614258308d05aeb6d5d0a957aa3fabaec6c071
--- /dev/null
+++ b/zh-cn/application-dev/media/avscreen-capture.md
@@ -0,0 +1,237 @@
+# 屏幕录制
+
+屏幕录制主要为主屏幕录屏功能。
+
+开发者可以调用录屏(AVScreenCapture)模块的Native API接口,完成屏幕录制,采集设备内、麦克风等的音视频源数据。当开发直播、办公等应用时,可以调用录屏模块获取音视频原始码流,然后通过流的方式流转到其他模块处理,达成直播时共享桌面的场景。
+
+录屏模块和窗口(Window)、图形(Graphic)等模块完成整个视频采集的流程。
+
+当前在进行屏幕录制时默认使用主屏,图形默认根据主屏生产录屏帧数据到显示数据缓冲队列,录屏框架从显示数据缓冲队列获取数据进行相应消费处理。
+
+## 开发指导
+
+使用AVScreenCapture录制屏幕涉及到AVScreenCapture实例的创建、音视频采集参数的配置、采集的开始与停止、资源的释放等。本开发指导将以一次录制屏幕数据的过程为例,向开发者讲解如何使用AVScreenCapturer进行屏幕录制,详细的API声明请参考[AVScreenCapture API参考](../reference/native-apis/_a_v_screen_capture.md)。
+
+使用AVScreenCapture时要明确其状态的变化,在创建实例后,调用对应的方法可以进入指定的状态实现对应的行为。
+在确定的状态下执行不合适的方法会导致AVScreenCapture发生错误,开发者需要在调用状态转换的方法前进行状态检查,避免程序运行异常。
+
+### 权限说明
+
+在开发前,请根据应用实际需求,参考[访问控制授权申请指导](../security/accesstoken-guidelines.md)申请以下权限:
+
+| 权限名 | 说明 | 授权方式 | 权限级别 |
+| ------ | ----- | --------| ------- |
+| ohos.permission.CAPTURE_SCREEN | 允许应用截取屏幕图像。| system_grant | system_core |
+| ohos.permission.MICROPHONE | 允许应用使用麦克风(可选)。
+如需录制麦克风源的音频,需要申请该权限。| user_grant | normal |
+
+### 开发步骤及注意事项
+
+开发者可以通过以下几个步骤来实现一个简单的屏幕录制功能。
+
+1. 创建AVScreenCapture实例capture。
+
+ ```c++
+ OH_AVScreenCapture* capture = AVScreenCapture_Create();
+ ```
+
+2. 配置屏幕录制参数。
+ 创建AVScreenCapture实例capture后,可以设置屏幕录制所需要的参数。
+
+ ```c++
+ OH_AudioCaptureInfo miccapinfo = {
+ .audioSampleRate = 16000,
+ .audioChannels = 2,
+ .audioSource = OH_MIC
+ };
+
+ OH_VideoCaptureInfo videocapinfo = {
+ .videoFrameWidth = display->GetWidth(),
+ .videoFrameHeight = display->Height(),
+ .videoSource = OH_VIDEO_SOURCE_SURFACE_RGBA
+ };
+
+ OH_AudioInfo audioinfo = {
+ .micCapInfo = miccapinfo,
+ };
+
+ OH_VideoInfo videoinfo = {
+ .videoCapInfo = videocapinfo
+ };
+
+ OH_RecorderInfo recorderinfo = {
+ .url = name
+ };
+
+ OH_AVScreenCaptureConfig config = {
+ .captureMode = OH_CAPTURE_HOME_SCREEN,
+ .dataType = OH_ORIGINAL_STREAM,
+ .audioInfo = audioinfo,
+ .videoInfo = videoinfo,
+ .recorderInfo = recorderinfo
+ };
+
+ OH_AVScreenCapture_Init(capture, config);
+ ```
+
+3. 设置麦克风开关。
+
+ ```c++
+ bool isMic = true;
+ OH_AVScreenCapture_SetMicrophoneEnabled(capture, isMic);
+ ```
+
+4. 回调函数的设置,主要监听录屏过程中的错误事件的发生,音频流和视频流数据的产生事件。
+
+ ```c++
+ OH_AVScreenCaptureCallback callback;
+ callback.onAudioBufferAvailable = OnAudioBufferAvailable;
+ callback.onVideoBufferAvailable = OnVideoBufferAvailable;
+ OH_AVScreenCapture_SetCallback(capture, callback);
+ ```
+
+5. 调用StartScreenCapture方法开始进行屏幕录制。
+
+ ```c++
+ OH_AVScreenCapture_StartScreenCapture(capture);
+ ```
+
+6. 调用StopScreenCapture()方法停止录制。
+
+ ```c++
+ OH_AVScreenCapture_StopScreenCapture(capture_);
+ ```
+
+7. 调用AcquireAudioBuffer()获取音频原始码流数据
+
+ ```c++
+ OH_AVScreenCapture_AcquireAudioBuffer(capture, &audiobuffer, type);
+ ```
+
+8. 调用AcquireVideoBuffer()获取音频原始码流数据。
+
+ ```c++
+ OH_NativeBuffer* buffer = OH_ScreenCapture_AcquireVideoBuffer(capture, &fence, ×tamp, &damage);
+ ```
+
+9. 调用ReleaseAudioBuffer方法释放音频buffer。
+
+ ```c++
+ OH_ScreenCapture_ReleaseAudioBuffer(capture, type);
+ ```
+
+10. 调用ReleaseVideoBuffer()释放视频数据。
+
+ ```c++
+ OH_ScreenCapture_ReleaseVideoBuffer(capture);
+ ```
+
+11. 调用release()方法销毁实例,释放资源。
+
+ ```c++
+ OH_AVScreenCapture_Release(capture);
+ ```
+
+### 完整示例
+
+下面展示了使用AVScreenCapture屏幕录制的完整示例代码。
+目前阶段流程结束后返回的buffer为原始码流,针对原始码流可以进行编码并以mp4等文件格式保存以供播放。编码格式与文件格式当前阶段仅作预留,待后续版本实现。
+
+```c++
+
+#include "multimedia/player_framework/native_avscreen_capture.h"
+#include "multimedia/player_framework/native_avscreen_capture_base.h"
+#include "multimedia/player_framework/native_avscreen_capture_errors.h"
+
+void OnError(struct OH_AVScreenCapture *capture, int32_t errorCode)
+{
+ (void) capture;
+ (void) errorCode;
+}
+
+void OnAudioBufferAvailable(struct OH_AVScreenCapture *capture, bool isReady, OH_AudioCapSourceType type)
+{
+ if (isReady) {
+ OH_AudioBuffer *audiobuffer = (struct OH_AudioBuffer*) malloc (sizeof(OH_AudioBuffer));
+ //获取音频流
+ int32_t ret = OH_AVScreenCapture_AcquireAudioBuffer(capture, &audiobuffer, type);
+ /* get buffer */
+ (void)audiobuffer->buf;
+ /* getbuffer size */
+ (void)audiobuffer->size;
+ /* get audiobuffer timestampe */
+ (void)audiobuffer->timestamp;
+ free(audiobuffer);
+ audiobuffer = nullptr;
+ //释放音频流
+ int32_t ret = OH_ScreenCapture_ReleaseAudioBuffer(capture, type);
+ }
+}
+
+void OnVideoBufferAvailable(struct OH_ScreenCapture *capture, bool isReady)
+{
+ if (isReady) {
+ int32_t fence = 0;
+ int64_t timestamp = 0;
+ struct OH_Rect damage;
+ //获取视频流
+ OH_NativeBuffer* buffer = OH_ScreenCapture_AcquireVideoBuffer(capture, &fence, ×tamp, &damage);
+ void *virAddr = nullptr;
+ OH_NativeBuffer_Map(buffer, &virAddr); //获取buffer
+ OH_NativeBuffer_Config config;
+ OH_NativeBuffer_GetNativeBufferConfig(buffer, config); //获取config信息 宽,高,format
+ // fence, timestampe, damage 获取fence,时间戳,坐标信息
+ OH_NativeBuffer_UnMap(buffer); //释放buffer
+ //释放视频流
+ int32_t ret = OH_ScreenCapture_ReleaseVideoBuffer(capture);
+ }
+}
+
+int main()
+{
+ //实例化ScreenCapture
+ struct OH_AVScreenCapture* capture = OH_AVScreenCapture_Create(void);
+ //设置回调
+ struct OH_AVScreenCaptureCallback callback;
+ callback.onError = OnError;
+ callack.onAudioBufferAvailable = OnAudioBufferAvailable ;
+ callack.onVideoBufferAvailable = OnVideoBufferAvailable;
+ int32_t ret = OH_AVScreenCapture_SetCallback(capture, callback);
+ //初始化录屏,传入配置信息OH_AVScreenRecorderConfig
+ OH_AudioCaptureInfo miccapinfo = {
+ .audioSampleRate = 16000,
+ .audioChannels = 2,
+ .audioSource = OH_MIC
+ };
+ OH_VideoCaptureInfo videocapinfo = {
+ .videoFrameWidth = 720,
+ .videoFrameHeight = 1280,
+ .videoSource = OH_VIDEO_SOURCE_SURFACE_RGBA
+ };
+ OH_AudioInfo audioinfo = {
+ .micCapInfo = miccapinfo,
+ };
+ OH_VideoInfo videoinfo = {
+ .videoCapInfo = videocapinfo
+ };
+ OH_AVScreenCaptureConfig config = {
+ .captureMode = OH_CAPTURE_HOME_SCREEN,
+ .dataType = OH_ORIGINAL_STREAM,
+ .audioInfo = audioinfo,
+ .videoInfo = videoinfo,
+ .recorderInfo = recorderinfo
+ };
+ OH_AVScreenCapture_Init(capture, config);
+ int32_t ret = OH_AVScreenCapture_Init(capture, &config);
+ //开始录屏
+ int32_t ret = OH_AVScreenCapture_StartScreenCapture(capture);
+ //mic开关设置
+ int32_t ret = OH_ScreenCapture_SetMicrophoneEnable(capture, true);
+ sleep(10); //录制10s
+ //结束录屏
+ int32_t ret = OH_ScreenCapture_StopScreenCapture(capture);
+ //释放ScreenCapture
+ int32_t ret = OH_ScreenCapture_Realease(capture);
+ return 0;
+}
+```
diff --git a/zh-cn/application-dev/media/camera-preview.md b/zh-cn/application-dev/media/camera-preview.md
index ec2f45a39cc887d96551acbb6c33a65dfcb1c9e3..2836389c3b3db5ed27629f249bbf333e3ec7caaf 100644
--- a/zh-cn/application-dev/media/camera-preview.md
+++ b/zh-cn/application-dev/media/camera-preview.md
@@ -34,7 +34,7 @@
}
```
-2. 通过CameraOutputCapability类中的previewProfiles()方法获取当前设备支持的预览能力,返回previewProfilesArray数组 。通过createPreviewOutput()方法创建预览输出流,其中,createPreviewOutput()方法中的而两个参数分别是previewProfilesArray数组中的第一项和步骤一中获取的surfaceId。
+2. 通过CameraOutputCapability类中的previewProfiles()方法获取当前设备支持的预览能力,返回previewProfilesArray数组 。通过createPreviewOutput()方法创建预览输出流,其中,createPreviewOutput()方法中的两个参数分别是previewProfilesArray数组中的第一项和步骤一中获取的surfaceId。
```ts
let previewProfilesArray = cameraOutputCapability.previewProfiles;
diff --git a/zh-cn/application-dev/media/camera-recording.md b/zh-cn/application-dev/media/camera-recording.md
index 57540310a8e8f712d6dbaa6a95d89d5a45b839f5..95b38a8bb358eff10d5330e8d39f0f439b6cc71c 100644
--- a/zh-cn/application-dev/media/camera-recording.md
+++ b/zh-cn/application-dev/media/camera-recording.md
@@ -104,7 +104,7 @@
avRecorder.start().then(() => {
console.info('avRecorder start success');
- }
+ });
```
5. 停止录像。
@@ -114,7 +114,7 @@
```ts
videoRecorder.stop().then(() => {
console.info('stop success');
- }
+ });
videoOutput.stop((err) => {
if (err) {
diff --git a/zh-cn/application-dev/media/using-ohaudio-for-playback.md b/zh-cn/application-dev/media/using-ohaudio-for-playback.md
index d9e08bbf90762efb637e2a5553870fe587cd80a5..1a99314f08c2a20ddd67de9cbb337c5bad857322 100644
--- a/zh-cn/application-dev/media/using-ohaudio-for-playback.md
+++ b/zh-cn/application-dev/media/using-ohaudio-for-playback.md
@@ -90,3 +90,16 @@ OH_AudioStreamBuilder_Destroy(builder);
```c++
OH_AudioStreamBuilder_Destroy(builder);
```
+
+## 设置低时延模式
+
+当设备支持低时延通路时,开发者可以使用低时延模式创建播放器,获得更高质量的音频体验。
+
+开发流程与普通播放场景一致,仅需要在创建音频流构造器时,调用[OH_AudioStreamBuilder_SetLatencyMode()](../reference/native-apis/_o_h_audio.md#oh_audiostreambuilder_setlatencymode)设置低时延模式。
+
+开发示例
+
+```C
+OH_AudioStream_LatencyMode latencyMode = AUDIOSTREAM_LATENCY_MODE_FAST;
+OH_AudioStreamBuilder_SetLatencyMode(builder, latencyMode);
+```
diff --git a/zh-cn/application-dev/napi/xcomponent-guidelines.md b/zh-cn/application-dev/napi/xcomponent-guidelines.md
index 179fca2339061e6d98bc73fdd130befbc8aaea99..14d176da8269fbaa801ad4f46f7ce301b64cabd6 100644
--- a/zh-cn/application-dev/napi/xcomponent-guidelines.md
+++ b/zh-cn/application-dev/napi/xcomponent-guidelines.md
@@ -81,7 +81,7 @@ XComponent({ id: 'xcomponentId1', type: 'surface', libraryname: 'nativerender' }
// ...
```
-2. **Napi模块注册**,具体使用请参考[Native API在应用工程中的使用指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/napi/napi-guidelines.md)。
+2. **Napi模块注册**,具体使用请参考[Native API在应用工程中的使用指导](napi-guidelines.md)。
```c++
// 在napi_init.cpp文件中,Init方法注册接口函数,从而将封装的C++方法传递出来,供JS侧调用
diff --git a/zh-cn/application-dev/performance/Readme.md b/zh-cn/application-dev/performance/Readme.md
index f2046079e80857cad849124b2d383f053e7994fd..e348a00d7a1d5c3d94e05961b4711f00764bfb20 100644
--- a/zh-cn/application-dev/performance/Readme.md
+++ b/zh-cn/application-dev/performance/Readme.md
@@ -6,7 +6,7 @@
- 提升应用启动和响应速度
- - [提升应用冷启动速度](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md)
+ - [提升应用冷启动速度](improve-application-startup-and-response/improve-application-cold-start-speed.md)
应用启动时延是影响用户体验的关键要素。提升应用冷启动速度,建议在以下四个阶段进行优化:
@@ -18,16 +18,16 @@
4、加载绘制首页阶段
- - [提升应用响应速度](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md)
+ - [提升应用响应速度](improve-application-startup-and-response/improve-application-response.md)
应用对用户的输入需要快速反馈,以提升交互体验。建议通过避免主线程被非UI任务阻塞、减少组件刷新的数量的方法来提升应用响应速度。
- 减少丢帧卡顿
- - [减少视图嵌套层次](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md)
+ - [减少视图嵌套层次](reduce-frame-loss-and-frame-freezing/reduce-view-nesting-levels.md)
应用将布局渲染到屏幕上的流畅度影响用户对质量的感知。建议移除多余的嵌套层次减少视图嵌套层次。
- - [减少动画丢帧](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md)
+ - [减少动画丢帧](reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md)
应用播放动画的流畅度是影响用户体验的重要因素。建议通过使用系统提供的动效API来减少动画丢帧。
diff --git a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md
index 0f7d4682082c8962454a4d1e707ae157e624ef1b..dbb87f4612f671489bea67fbee6013e22f6fbb29 100644
--- a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md
+++ b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-cold-start-speed.md
@@ -57,7 +57,7 @@ OpenHarmony的应用冷启动过程大致可分成以下四个阶段:应用进
在应用启动流程中,系统会执行Ability的生命周期回调函数。因此,不建议在这些回调函数中执行耗时过长的操作,耗时操作建议通过异步任务延迟处理或者放到其他线程执行。
-在这些生命周期回调里,推荐开发者只做必要的操作,详情可以参考:[UIAbility组件生命周期](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/application-models/uiability-lifecycle.md)
+在这些生命周期回调里,推荐开发者只做必要的操作,详情可以参考:[UIAbility组件生命周期](../../application-models/uiability-lifecycle.md)
## 4、缩短加载绘制首页阶段耗时
diff --git a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md
index 72a4a4567689d83875cd0340a848ad793f732190..acd7a634b8855d8de10a7fa0162d27d81f164b32 100644
--- a/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md
+++ b/zh-cn/application-dev/performance/improve-application-startup-and-response/improve-application-response.md
@@ -61,7 +61,7 @@ struct ImageExample1 {
### 使用TaskPool线程池异步处理
-OpenHarmony提供了[TaskPool线程池](https://gitee.com/sqsyqqy/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-taskpool.md),相比worker线程,TaskPool提供了任务优先级设置、线程池自动管理机制,示例如下:
+OpenHarmony提供了[TaskPool线程池](../../reference/apis/js-apis-taskpool.md),相比worker线程,TaskPool提供了任务优先级设置、线程池自动管理机制,示例如下:
```javascript
import taskpool from '@ohos.taskpool';
diff --git a/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md b/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md
index 63a328927a57d7363f5a3743dda6f828d587b744..caaf5d22815504e5293e0a1a5990ed56a363a9c0 100644
--- a/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md
+++ b/zh-cn/application-dev/performance/reduce-frame-loss-and-frame-freezing/reduce-animation-frame-loss.md
@@ -90,7 +90,7 @@ struct AttrAnimationExample {
}
```
-更详细的API文档请参考:https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md
+更详细的API文档请参考:[属性动画](../../reference/arkui-ts/ts-animatorproperty.md)。
## 使用系统提供的显式动效API
@@ -139,4 +139,4 @@ struct AnimateToExample {
}
```
-更详细的API文档请参考:https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md
\ No newline at end of file
+更详细的API文档请参考:[显式动画](../../reference/arkui-ts/ts-explicit-animation.md)。
\ No newline at end of file
diff --git a/zh-cn/application-dev/quick-start/arkts-mvvm.md b/zh-cn/application-dev/quick-start/arkts-mvvm.md
index 6185ed8d6574e2083605b4d2a4171ca768918106..8f0a9b1fb98430d34f544c8cc7f0b98b71333ca7 100644
--- a/zh-cn/application-dev/quick-start/arkts-mvvm.md
+++ b/zh-cn/application-dev/quick-start/arkts-mvvm.md
@@ -775,7 +775,7 @@ struct ViewA {
开发一个电话簿应用,实现功能如下:
-- 显示联系人和本机("Me")电话号码 。
+- 显示联系人和设备("Me")电话号码 。
- 选中联系人时,进入可编辑态”Edit“,可以更新该联系人详细信息,包括电话号码,住址。
@@ -788,8 +788,8 @@ ViewModel需要包括:
- AddressBook(class)
- - me (本机): 存储一个Person类。
- - contacts(本机联系人):存储一个Person类数组。
+ - me (设备): 存储一个Person类。
+ - contacts(设备联系人):存储一个Person类数组。
AddressBook类声明如下:
@@ -936,11 +936,11 @@ export class ObservedArray extends Array {
@Component
struct PageEntry {
@Provide addrBook: AddressBook = new AddressBook(
- new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["+358441234567", "+35891234567", "+49621234567889"]),
+ new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********", "18*********"]),
[
- new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["+358449876543", "+3589456789"]),
- new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["+358509876543", "+358910101010"]),
- new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["+358400908070", "+35894445555"]),
+ new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
]);
build() {
@@ -1099,236 +1099,236 @@ export class ObservedArray extends Array {
完整应用代码如下:
- ```ts
- // ViewModel classes
- let nextId = 0;
-
- @Observed
- export class ObservedArray extends Array {
- constructor(args?: any[]) {
- console.log(`ObservedArray: ${JSON.stringify(args)} `)
- if (Array.isArray(args)) {
- super(...args);
- } else {
- super(args)
- }
- }
- }
-
- @Observed
- export class Address {
- street: string;
- zip: number;
- city: string;
-
- constructor(street: string,
- zip: number,
- city: string) {
- this.street = street;
- this.zip = zip;
- this.city = city;
- }
- }
-
- @Observed
- export class Person {
- id_: string;
- name: string;
- address: Address;
- phones: ObservedArray;
-
- constructor(name: string,
- street: string,
- zip: number,
- city: string,
- phones: string[]) {
- this.id_ = `${nextId}`;
- nextId++;
- this.name = name;
- this.address = new Address(street, zip, city);
- this.phones = new ObservedArray(phones);
- }
+```ts
+
+ // ViewModel classes
+ let nextId = 0;
+
+ @Observed
+ export class ObservedArray extends Array {
+ constructor(args?: any[]) {
+ console.log(`ObservedArray: ${JSON.stringify(args)} `)
+ if (Array.isArray(args)) {
+ super(...args);
+ } else {
+ super(args)
}
-
-
- export class AddressBook {
- me: Person;
- contacts: ObservedArray;
-
- constructor(me: Person, contacts: Person[]) {
- this.me = me;
- this.contacts = new ObservedArray(contacts);
+ }
+ }
+
+ @Observed
+ export class Address {
+ street: string;
+ zip: number;
+ city: string;
+
+ constructor(street: string,
+ zip: number,
+ city: string) {
+ this.street = street;
+ this.zip = zip;
+ this.city = city;
+ }
+ }
+
+ @Observed
+ export class Person {
+ id_: string;
+ name: string;
+ address: Address;
+ phones: ObservedArray;
+
+ constructor(name: string,
+ street: string,
+ zip: number,
+ city: string,
+ phones: string[]) {
+ this.id_ = `${nextId}`;
+ nextId++;
+ this.name = name;
+ this.address = new Address(street, zip, city);
+ this.phones = new ObservedArray(phones);
+ }
+ }
+
+ export class AddressBook {
+ me: Person;
+ contacts: ObservedArray;
+
+ constructor(me: Person, contacts: Person[]) {
+ this.me = me;
+ this.contacts = new ObservedArray(contacts);
+ }
+ }
+
+ //渲染出Person对象的名称和Observed数组中的第一个号码
+ //为了更新电话号码,这里需要@ObjectLink person和@ObjectLink phones,
+ //不能使用this.person.phones,内部数组的更改不会被观察到。
+ // 在AddressBookView、PersonEditView中的onClick更新selectedPerson
+ @Component
+ struct PersonView {
+ @ObjectLink person: Person;
+ @ObjectLink phones: ObservedArray;
+ @Link selectedPerson: Person;
+
+ build() {
+ Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
+ Text(this.person.name)
+ if (this.phones.length) {
+ Text(this.phones[0])
}
}
-
- //渲染出Person对象的名称和手机Observed数组中的第一个号码
- //为了更新电话号码,这里需要@ObjectLink person和@ObjectLink phones,
- //不能使用this.person.phones,内部数组的更改不会被观察到。
- // 在AddressBookView、PersonEditView中的onClick更新selectedPerson
- @Component
- struct PersonView {
- @ObjectLink person: Person;
- @ObjectLink phones: ObservedArray;
- @Link selectedPerson: Person;
-
- build() {
- Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
- Text(this.person.name)
- if (this.phones.length) {
- Text(this.phones[0])
- }
- }
- .height(55)
- .backgroundColor(this.selectedPerson.name == this.person.name ? "#ffa0a0" : "#ffffff")
- .onClick(() => {
- this.selectedPerson = this.person;
+ .height(55)
+ .backgroundColor(this.selectedPerson.name == this.person.name ? "#ffa0a0" : "#ffffff")
+ .onClick(() => {
+ this.selectedPerson = this.person;
+ })
+ }
+ }
+
+ // 渲染Person的详细信息
+ // @Prop装饰的变量从父组件AddressBookView深拷贝数据,将变化保留在本地, TextInput的变化只会在本地副本上进行修改。
+ // 点击 "Save Changes" 会将所有数据的复制通过@Prop到@Link, 同步到其他组件
+ @Component
+ struct PersonEditView {
+ @Consume addrBook: AddressBook;
+
+ /* 指向父组件selectedPerson的引用 */
+ @Link selectedPerson: Person;
+
+ /*在本地副本上编辑,直到点击保存*/
+ @Prop name: string;
+ @Prop address: Address;
+ @Prop phones: ObservedArray;
+
+ selectedPersonIndex(): number {
+ return this.addrBook.contacts.findIndex((person) => person.id_ == this.selectedPerson.id_);
+ }
+
+ build() {
+ Column() {
+ TextInput({ text: this.name })
+ .onChange((value) => {
+ this.name = value;
})
- }
- }
-
- // 渲染Person的详细信息
- // @Prop装饰的变量从父组件AddressBookView深拷贝数据,将变化保留在本地, TextInput的变化只会在本地副本上进行修改。
- // 点击 "Save Changes" 会将所有数据的复制通过@Prop到@Link, 同步到其他组件
- @Component
- struct PersonEditView {
- @Consume addrBook: AddressBook;
-
- /* 指向父组件selectedPerson的引用 */
- @Link selectedPerson: Person;
-
- /*在本地副本上编辑,直到点击保存*/
- @Prop name: string;
- @Prop address: Address;
- @Prop phones: ObservedArray;
-
- selectedPersonIndex(): number {
- return this.addrBook.contacts.findIndex((person) => person.id_ == this.selectedPerson.id_);
- }
-
- build() {
- Column() {
- TextInput({ text: this.name })
- .onChange((value) => {
- this.name = value;
- })
- TextInput({ text: this.address.street })
- .onChange((value) => {
- this.address.street = value;
- })
-
- TextInput({ text: this.address.city })
- .onChange((value) => {
- this.address.city = value;
- })
-
- TextInput({ text: this.address.zip.toString() })
- .onChange((value) => {
- const result = parseInt(value);
- this.address.zip = isNaN(result) ? 0 : result;
- })
-
- if (this.phones.length > 0) {
- ForEach(this.phones,
- (phone, index) => {
- TextInput({ text: phone })
- .width(150)
- .onChange((value) => {
- console.log(`${index}. ${value} value has changed`)
- this.phones[index] = value;
- })
- },
- (phone, index) => `${index}-${phone}`
- )
- }
-
- Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
- Text("Save Changes")
- .onClick(() => {
- // 将本地副本更新的值赋值给指向父组件selectedPerson的引用
- // 避免创建新对象,在现有属性上进行修改
- this.selectedPerson.name = this.name;
- this.selectedPerson.address.street = this.address.street
- this.selectedPerson.address.city = this.address.city
- this.selectedPerson.address.zip = this.address.zip
- this.phones.forEach((phone: string, index: number) => {
- this.selectedPerson.phones[index] = phone
- });
+ TextInput({ text: this.address.street })
+ .onChange((value) => {
+ this.address.street = value;
+ })
+
+ TextInput({ text: this.address.city })
+ .onChange((value) => {
+ this.address.city = value;
+ })
+
+ TextInput({ text: this.address.zip.toString() })
+ .onChange((value) => {
+ const result = parseInt(value);
+ this.address.zip = isNaN(result) ? 0 : result;
+ })
+
+ if (this.phones.length > 0) {
+ ForEach(this.phones,
+ (phone, index) => {
+ TextInput({ text: phone })
+ .width(150)
+ .onChange((value) => {
+ console.log(`${index}. ${value} value has changed`)
+ this.phones[index] = value;
})
- if (this.selectedPersonIndex() != -1) {
- Text("Delete Contact")
- .onClick(() => {
- let index = this.selectedPersonIndex();
- console.log(`delete contact at index ${index}`);
-
- // 删除当前联系人
- this.addrBook.contacts.splice(index, 1);
-
- // 删除当前selectedPerson,选中态前移一位
- index = (index < this.addrBook.contacts.length) ? index : index - 1;
-
- // 如果contract被删除完,则设置me为选中态
- this.selectedPerson = (index >= 0) ? this.addrBook.contacts[index] : this.addrBook.me;
- })
- }
- }
-
- }
+ },
+ (phone, index) => `${index}-${phone}`
+ )
}
- }
-
- @Component
- struct AddressBookView {
- @ObjectLink me: Person;
- @ObjectLink contacts: ObservedArray;
- @State selectedPerson: Person = undefined;
-
- aboutToAppear() {
- this.selectedPerson = this.me;
- }
-
- build() {
- Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) {
- Text("Me:")
- PersonView({ person: this.me, phones: this.me.phones, selectedPerson: this.$selectedPerson })
-
- Divider().height(8)
-
- ForEach(this.contacts,
- contact => {
- PersonView({ person: contact, phones: contact.phones, selectedPerson: this.$selectedPerson })
- },
- contact => contact.id_
- )
-
- Divider().height(8)
-
- Text("Edit:")
- PersonEditView({
- selectedPerson: this.$selectedPerson,
- name: this.selectedPerson.name,
- address: this.selectedPerson.address,
- phones: this.selectedPerson.phones
+
+ Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
+ Text("Save Changes")
+ .onClick(() => {
+ // 将本地副本更新的值赋值给指向父组件selectedPerson的引用
+ // 避免创建新对象,在现有属性上进行修改
+ this.selectedPerson.name = this.name;
+ this.selectedPerson.address.street = this.address.street
+ this.selectedPerson.address.city = this.address.city
+ this.selectedPerson.address.zip = this.address.zip
+ this.phones.forEach((phone: string, index: number) => {
+ this.selectedPerson.phones[index] = phone
+ });
})
+ if (this.selectedPersonIndex() != -1) {
+ Text("Delete Contact")
+ .onClick(() => {
+ let index = this.selectedPersonIndex();
+ console.log(`delete contact at index ${index}`);
+
+ // 删除当前联系人
+ this.addrBook.contacts.splice(index, 1);
+
+ // 删除当前selectedPerson,选中态前移一位
+ index = (index < this.addrBook.contacts.length) ? index : index - 1;
+
+ // 如果contract被删除完,则设置me为选中态
+ this.selectedPerson = (index >= 0) ? this.addrBook.contacts[index] : this.addrBook.me;
+ })
}
- .borderStyle(BorderStyle.Solid).borderWidth(5).borderColor(0xAFEEEE).borderRadius(5)
}
+
}
-
- @Entry
- @Component
- struct PageEntry {
- @Provide addrBook: AddressBook = new AddressBook(
- new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["+358441234567", "+35891234567", "+49621234567889"]),
- [
- new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["+358449876543", "+3589456789"]),
- new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["+358509876543", "+358910101010"]),
- new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["+358400908070", "+35894445555"]),
- ]);
-
- build() {
- Column() {
- AddressBookView({ me: this.addrBook.me, contacts: this.addrBook.contacts, selectedPerson: this.addrBook.me })
- }
- }
+ }
+ }
+
+ @Component
+ struct AddressBookView {
+ @ObjectLink me: Person;
+ @ObjectLink contacts: ObservedArray;
+ @State selectedPerson: Person = undefined;
+
+ aboutToAppear() {
+ this.selectedPerson = this.me;
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) {
+ Text("Me:")
+ PersonView({ person: this.me, phones: this.me.phones, selectedPerson: this.$selectedPerson })
+
+ Divider().height(8)
+
+ ForEach(this.contacts,
+ contact => {
+ PersonView({ person: contact, phones: contact.phones, selectedPerson: this.$selectedPerson })
+ },
+ contact => contact.id_
+ )
+
+ Divider().height(8)
+
+ Text("Edit:")
+ PersonEditView({
+ selectedPerson: this.$selectedPerson,
+ name: this.selectedPerson.name,
+ address: this.selectedPerson.address,
+ phones: this.selectedPerson.phones
+ })
}
- ```
\ No newline at end of file
+ .borderStyle(BorderStyle.Solid).borderWidth(5).borderColor(0xAFEEEE).borderRadius(5)
+ }
+ }
+
+ @Entry
+ @Component
+ struct PageEntry {
+ @Provide addrBook: AddressBook = new AddressBook(
+ new Person("Gigi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********", "18*********"]),
+ [
+ new Person("Oly", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Sam", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ new Person("Vivi", "Itamerenkatu 9", 180, "Helsinki", ["18*********", "18*********"]),
+ ]);
+
+ build() {
+ Column() {
+ AddressBookView({ me: this.addrBook.me, contacts: this.addrBook.contacts, selectedPerson: this.addrBook.me })
+ }
+ }
+ }
+```
\ No newline at end of file
diff --git a/zh-cn/application-dev/quick-start/module-configuration-file.md b/zh-cn/application-dev/quick-start/module-configuration-file.md
index 13ba09c49d047564463d3c14418767168e75f3fd..3f1bb37b13b018dbd111d69f4d158808d34bc5f7 100644
--- a/zh-cn/application-dev/quick-start/module-configuration-file.md
+++ b/zh-cn/application-dev/quick-start/module-configuration-file.md
@@ -420,7 +420,7 @@ extensionAbilities示例:
## requestPermissions标签
-该标签标识应用运行时需向系统申请的权限集合。
+该标签标识应用运行时需向系统申请的权限集合,权限设置方式参见[指导](../security/accesstoken-guidelines.md)。
> **说明:**
>
diff --git a/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md b/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
index 083638d33287c0464b22dac0ee85808b92a95ef8..0d4553fa5cd806134a393ca02af5e895a864e760 100644
--- a/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
+++ b/zh-cn/application-dev/quick-start/typescript-to-arkts-migration-guide.md
@@ -651,7 +651,7 @@ interface Identity {
interface Contact {
email: string
- phone: string
+ phoneNumber: string
}
type Employee = Identity & Contact
@@ -667,7 +667,7 @@ interface Identity {
interface Contact {
email: string
- phone: string
+ phoneNumber: string
}
interface Employee extends Identity, Contact {}
@@ -3174,8 +3174,8 @@ class Person {
const person: Person = {
name: "John",
age: 30,
- email: "john@example.com",
- phone: 1234567890,
+ email: "***@example.com",
+ phoneNumber: 18*********,
}
```
@@ -3186,18 +3186,18 @@ class Person {
name: string
age: number
email: string
- phone: number
+ phoneNumber: number
- constructor(name: string, age: number, email: string, phone: number) {
+ constructor(name: string, age: number, email: string, phoneNumber: number) {
this.name = name
this.age = age
this.email = email
- this.phone = phone
+ this.phoneNumber = phoneNumber
}
}
function main(): void {
- const person: Person = new Person("John", 30, "john@example.com", 1234567890)
+ const person: Person = new Person("John", 30, "***@example.com", 18*********)
}
```
diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md
index 9597a88ad7f29b3c919f72c3fb29206e9e086167..8ca54c150a5170f503812e6a9b9e2d928da39a5a 100644
--- a/zh-cn/application-dev/reference/apis/Readme-CN.md
+++ b/zh-cn/application-dev/reference/apis/Readme-CN.md
@@ -198,22 +198,23 @@
- UI界面
- [@ohos.animator (动画)](js-apis-animator.md)
- [@ohos.arkui.componentSnapshot (组件截图)](js-apis-arkui-componentSnapshot.md)
+ - [@ohos.arkui.componentUtils (componentUtils)](js-apis-arkui-componentUtils.md)
- [@ohos.arkui.dragController (DragController)](js-apis-arkui-dragController.md)
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](js-apis-arkui-drawableDescriptor.md)
- [@ohos.arkui.inspector (布局回调)](js-apis-arkui-inspector.md)
+ - [ @ohos.arkui.performanceMonitor (性能监测)](js-apis-arkui-performancemonitor.md)
- [@ohos.arkui.UIContext (UIContext)](js-apis-arkui-UIContext.md)
- [@ohos.arkui.componentUtils (componentUtils)](js-apis-arkui-componentUtils.md)
- [@ohos.curves (插值计算)](js-apis-curve.md)
- [@ohos.font (注册自定义字体)](js-apis-font.md)
- [@ohos.matrix4 (矩阵变换)](js-apis-matrix4.md)
+ - [@ohos.measure (文本计算)](js-apis-measure.md)
- [@ohos.mediaquery (媒体查询)](js-apis-mediaquery.md)
- [@ohos.pluginComponent (PluginComponentManager)](js-apis-plugincomponent.md)
- [@ohos.promptAction (弹窗)](js-apis-promptAction.md)
- [@ohos.router (页面路由)](js-apis-router.md)
- - [@ohos.measure (文本计算)](js-apis-measure.md)
- [@ohos.uiAppearance (用户界面外观)](js-apis-uiappearance.md)
- - [ @ohos.arkui.performanceMonitor (性能监测)](js-apis-arkui-performancemonitor.md)
-
+
- 图形图像
- [@ohos.animation.windowAnimationManager (窗口动画管理)](js-apis-windowAnimationManager.md)
- [@ohos.application.WindowExtensionAbility (窗口扩展能力)](js-apis-application-windowExtensionAbility.md)
diff --git a/zh-cn/application-dev/reference/apis/enterpriseDeviceManagement-overview.md b/zh-cn/application-dev/reference/apis/enterpriseDeviceManagement-overview.md
index 07464320fcc0053c92be0b14bfe0222f7552aec1..c1e864ecd0b2ca6609f25532f59e1983b5ac91c1 100644
--- a/zh-cn/application-dev/reference/apis/enterpriseDeviceManagement-overview.md
+++ b/zh-cn/application-dev/reference/apis/enterpriseDeviceManagement-overview.md
@@ -12,12 +12,12 @@ OpenHarmony通过企业设备管理(Enterprise Device Management)API支持
- 仅支持Stage模型
### 环境准备
-- DevEco Studio可参考其官网介绍进行[下载](https://developer.harmonyos.com/cn/develop/deveco-studio#download),并进行相关的配置动作。
-- ohos-sdk-full可参考OpenHarmony网站进行[下载](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md#%E4%BB%8E%E9%95%9C%E5%83%8F%E7%AB%99%E7%82%B9%E8%8E%B7%E5%8F%96)。
+- DevEco Studio可参考其官网介绍进行下载,并进行相关的配置动作。
+- ohos-sdk-full可参考[如何替换full-sdk](../../faqs/full-sdk-switch-guide.md)进行下载。
### 开发步骤
-1. 使用DevEco Studio新建工程、[替换full-sdk](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/faqs/full-sdk-switch-guide.md)。
+1. 使用DevEco Studio新建工程、替换full-sdk。
2. 在[应用签名文件](../../security/accesstoken-overview.md#应用apl等级说明)中设置应用为系统应用,即app-feature字段为hos_system_app。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
index 48bf88b532e925535f83eac60ac14ebb54b91d7a..35a26c0cbbfc5ef6343808250471d7ca7ff7c2e4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
@@ -202,7 +202,7 @@ onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResu
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
-| wantParam | {[key: string]: any} | 是 | want相关参数。 |
+| wantParam | {[key: string]: Object} | 是 | want相关参数。 |
**返回值:**
@@ -289,7 +289,7 @@ onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Objec
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| reason | [AbilityConstant.StateType](js-apis-app-ability-abilityConstant.md#abilityconstantstatetype) | 是 | 回调保存状态的原因。 |
-| wantParam | {[key: string]: any} | 是 | want相关参数。 |
+| wantParam | {[key: string]: Object} | 是 | want相关参数。 |
**返回值:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionAbility.md
new file mode 100644
index 0000000000000000000000000000000000000000..2b2332422f59af67c269335da4894a7f42f4af26
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionAbility.md
@@ -0,0 +1,84 @@
+# @ohos.app.ability.UIExtensionAbility (带界面扩展能力基类)
+
+UIExtensionAbility是特定场景下带界面扩展能力的基类,继承自[ExtensionAbility](js-apis-app-ability-extensionAbility.md),新增带界面扩展能力相关的属性和方法。不支持开发者直接继承该基类。
+
+> **说明:**
+>
+> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> 本模块接口仅可在Stage模型下使用。
+
+## 导入模块
+
+```ts
+import UIExtensionAbility from '@ohos.app.ability.UIExtensionAbility';
+```
+
+## 属性
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| context | [UIExtensionContext](js-apis-inner-application-uiExtensionContext.md) | 是 | 否 | 上下文。 |
+
+## UIExtensionAbility.onCreate
+
+onCreate(): void
+
+UIExtensionAbility创建时回调,执行初始化业务逻辑操作。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+## UIExtensionAbility.onSessionCreate
+
+onSessionCreate(want: Want, session: UIExtensionContentSession): void
+
+当UIExtensionAbility界面内容对象创建后调用。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-app-ability-want.md) | 是 | 当前UIExtensionAbility的Want类型信息,包括ability名称、bundle名称等。 |
+| session | [UIExtensionContentSession](js-apis-app-ability-uiExtensionContentSession.md) | 是 | UIExtensionAbility界面内容相关信息。 |
+
+## UIExtensionAbility.onSessionDestroy
+
+onSessionDestroy(session: UIExtensionContentSession): void
+
+当UIExtensionAbility界面内容对象销毁后调用。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| session | [UIExtensionContentSession](js-apis-app-ability-uiExtensionContentSession.md) | 是 | UIExtensionAbility界面内容相关信息。 |
+
+## UIExtensionAbility.onForeground
+
+onForeground(): void;
+
+UIExtensionAbility生命周期回调,当UIExtensionAbility从后台转到前台时触发。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+## UIExtensionAbility.onBackground
+
+onBackground(): void;
+
+UIExtensionAbility生命周期回调,当UIExtensionAbility从前台转到后台时触发。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+## UIExtensionAbility.onDestroy
+
+onDestroy(): void | Promise<void>;
+
+UIExtensionAbility生命周期回调,在销毁时回调,执行资源清理等操作。
+在执行完onDestroy生命周期回调后,应用可能会退出,从而可能导致onDestroy中的异步函数未能正确执行,比如异步写入数据库。可以使用异步生命周期,以确保异步onDestroy完成后再继续后续的生命周期。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionContentSession.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionContentSession.md
new file mode 100644
index 0000000000000000000000000000000000000000..ea086e8f5f5c8587372f655f002c75654ae7d225
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiExtensionContentSession.md
@@ -0,0 +1,211 @@
+# @ohos.app.ability.UIExtensionContentSession (带界面扩展能力界面操作类)
+
+UIExtensionContentSession是[UIExtensionAbility](js-apis-app-ability-uiExtensionAbility.md)加载界面内容时创建的实例对象,当UIExtensionComponent控件拉起指定的UIExtensionAbility时,UIExtensionAbility会创建UIExtensionContentSession对象,并通过[onSessionCreate](js-apis-app-ability-uiExtensionAbility.md#uiextensionabilityonsessioncreate)回调传递给开发者。一个UIExtensionComponent控件对应一个UIExtensionContentSession对象,提供界面加载,结果通知等方法。每个UIExtensionAbility的UIExtensionContentSession之间互不影响,可以各自进行操作。
+
+> **说明:**
+>
+> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> 本模块接口仅可在Stage模型下使用。
+
+## 导入模块
+
+```ts
+import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
+```
+
+## UIExtensionContentSession.sendData
+
+sendData(data: { [key: string]: Object }): void
+
+发送数据给UIExtensionComponent控件。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**系统API**:此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| data | {[key: string]: Object} | 是 | 发送给UIExtensionComponent控件的数据参数。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.setReceiveDataCallback
+
+setReceiveDataCallback(callback: (data: { [key: string]: Object }) => void): void
+
+设置从UIExtensionComponent控件接收数据的回调方法。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**系统API**:此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | (data: { [key: string]: Object }) => void | 是 | 接收数据的回调方法。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.loadContent
+
+loadContent(path: string, storage?: LocalStorage): Promise<void>
+
+为当前UIExtensionComponent控件对应的窗口加载与LocalStorage相关联的具体页面内容。
+
+**系统能力:** SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
+| path | string | 是 | 设置加载页面的路径。 |
+| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | 否 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.terminateSelf
+
+terminateSelf(callback: AsyncCallback<void>): void;
+
+停止UIExtensionContentSession对应的窗口界面对象(callback形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<void> | 是 | 停止UIExtensionContentSession对应的窗口界面对象的回调函数。 |
+
+## UIExtensionContentSession.terminateSelf
+
+terminateSelf(): Promise<void>;
+
+停止UIExtensionContentSession对应的窗口界面对象(promise形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | 停止UIExtensionContentSession对应的窗口界面对象的回调函数。 |
+
+## UIExtensionContentSession.terminateSelfWithResult
+
+terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
+
+停止UIExtensionContentSession对应的窗口界面对象,并将结果返回给UIExtensionComponent控件(callback形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 是 | 返回给UIExtensionComponent控件的信息。 |
+| callback | AsyncCallback<void> | 是 | callback形式返回停止结果。 |
+
+## UIExtensionContentSession.terminateSelfWithResult
+
+terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
+
+停止UIExtensionContentSession对应的窗口界面对象,并将结果返回给UIExtensionComponent控件(promise形式)。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 是 | 返回给UIExtensionComponent控件的信息。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | promise形式返回停止结果。 |
+
+## UIExtensionContentSession.setWindowBackgroundColor
+
+setWindowBackgroundColor(color: string): void
+
+设置UIExtensionAbility加载界面的背景色。该接口需要在[loadContent()](#uiextensioncontentsessionloadcontent)调用生效后使用。
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**系统API**:此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| color | string | 是 | 需要设置的背景色,为十六进制RGB或ARGB颜色,不区分大小写,例如`#00FF00`或`#FF00FF00`。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000050 | Internal error. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContentSession.setWindowPrivacyMode
+
+setWindowPrivacyMode(isPrivacyMode: boolean): Promise<void>
+
+设置窗口是否为隐私模式,使用Promise异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。
+
+**系统能力:** SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**需要权限:** ohos.permission.PRIVACY_WINDOW
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------------- | ------- | -- | ----------------------------------------------------- |
+| isPrivacyMode | boolean | 是 | 窗口是否为隐私模式。true表示模式开启;false表示模式关闭。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------------------ |
+| Promise<void> | 无返回结果的Promise对象。 |
+
+## UIExtensionContentSession.setWindowPrivacyMode
+
+setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): void
+
+设置窗口是否为隐私模式,使用callback异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。
+
+**系统能力:** SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**需要权限:** ohos.permission.PRIVACY_WINDOW
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------------- | ------------------------- | -- | ------------------------------------------------------ |
+| isPrivacyMode | boolean | 是 | 窗口是否为隐私模式。true表示模式开启;false表示模式关闭。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-avsession.md b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
index 0deca790f529118ebd83c15c966aaccd7b4d0c63..ccd28aba9b7daf8f3aedda65d7e0063950588415 100755
--- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
@@ -56,10 +56,12 @@ import featureAbility from '@ohos.ability.featureAbility';
let currentAVSession;
let tag = "createNewSession";
let context = featureAbility.getContext();
+let sessionId; //供后续函数入参使用
-await avSession.createAVSession(context, tag, "audio").then((data) => {
+avSession.createAVSession(context, tag, "audio").then((data) => {
currentAVSession = data;
- console.info(`CreateAVSession : SUCCESS : sessionId = ${currentAVSession.sessionId}`);
+ sessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${sessionId}`);
}).catch((err) => {
console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -98,13 +100,15 @@ import featureAbility from '@ohos.ability.featureAbility';
let currentAVSession;
let tag = "createNewSession";
let context = featureAbility.getContext();
+let sessionId; //供后续函数入参使用
avSession.createAVSession(context, tag, "audio", function (err, data) {
if (err) {
console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
currentAVSession = data;
- console.info(`CreateAVSession : SUCCESS : sessionId = ${session.sessionId}`);
+ sessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${sessionId}`);
}
});
```
@@ -323,11 +327,27 @@ createController(sessionId: string): Promise\
**示例:**
```js
+import featureAbility from '@ohos.ability.featureAbility';
+
+let currentAVSession;
+let tag = "createNewSession";
+let context = featureAbility.getContext();
+let sessionId; //供后续函数入参使用
+
+avSession.createAVSession(context, tag, "audio", function (err, data) {
+ if (err) {
+ console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
+ } else {
+ currentAVSession = data;
+ sessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${sessionId}`);
+ }
+});
let currentAVcontroller;
-await avSession.createController(currentAVSession.sessionId).then((avcontroller) => {
+avSession.createController(sessionId).then((avcontroller) => {
currentAVcontroller = avcontroller;
- console.info(`CreateController : SUCCESS : ${currentAVcontroller.sessionId}`);
+ console.info('CreateController : SUCCESS ');
}).catch((err) => {
console.error(`CreateController BusinessError: code: ${err.code}, message: ${err.message}`);
});
@@ -363,13 +383,30 @@ createController(sessionId: string, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功并开始搜索,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1020,7 +1057,7 @@ avSession.startCastDeviceDiscovery(function (err) {
startCastDeviceDiscovery(filter: number, callback: AsyncCallback\): void
-开始设备搜索发现。结果通过callback异步回调方式返回。
+指定过滤条件,开始设备搜索发现。结果通过callback异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -1031,7 +1068,7 @@ startCastDeviceDiscovery(filter: number, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| filter | number | 是 | 进行设备发现的过滤条件,由ProtocolType的组合而成 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功并开始搜索,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1066,7 +1103,7 @@ startCastDeviceDiscovery(filter?: number): Promise\
**返回值:**
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当开始设备搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当命令发送成功并开始搜索,无返回结果,否则返回错误对象。 |
**示例:**
@@ -1093,7 +1130,7 @@ stopCastDeviceDiscovery(callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当成功停止搜索,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1122,7 +1159,7 @@ stopCastDeviceDiscovery(): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当成功停止搜索,无返回结果,否则返回错误对象。 |
**示例:**
@@ -1149,7 +1186,7 @@ setDiscoverable(enable: boolean, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| enable | boolean | 是 | 是否允许本设备被发现. true: 允许被发现, false:不允许被发现 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当设置成功,err为undefined,否则返回错误对象。 |
**示例:**
@@ -1184,7 +1221,7 @@ setDiscoverable(enable: boolean): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当设置成功,无返回结果,否则返回错误对象。 |
**示例:**
@@ -1210,7 +1247,7 @@ on(type: 'deviceAvailable', callback: (device: OutputDeviceInfo) => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持事件`'deviceAvailable'`,有设备更新时触发回调。 |
+| type | string | 是 | 事件回调类型,支持事件`'deviceAvailable'`,有设备被发现时触发回调。 |
| callback | (device: OutputDeviceInfo) => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则返回错误对象。 |
**错误码:**
@@ -1289,6 +1326,23 @@ getAVCastController(sessionId: string, callback: AsyncCallback\;
**示例:**
```js
+import featureAbility from '@ohos.ability.featureAbility';
+
+let currentAVSession;
+let tag = "createNewSession";
+let context = featureAbility.getContext();
+let sessionId; //供后续函数入参使用
+
+avSession.createAVSession(context, tag, "audio", function (err, data) {
+ if (err) {
+ console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
+ } else {
+ currentAVSession = data;
+ sessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${sessionId}`);
+ }
+});
+
let aVCastController;
avSession.getAVCastController(sessionId).then((avcontroller) => {
aVCastController = avcontroller;
@@ -1361,8 +1432,8 @@ startCasting(session: SessionToken, device: OutputDeviceInfo, callback: AsyncCal
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| session | [SessionToken](#sessiontoken) | 是 | 会话令牌。SessionToken表示单个token。 |
-| device | [OutputDeviceInfo](#outputdeviceinfo10) | 是 | 设备相关信息 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| device | [OutputDeviceInfo](#outputdeviceinfo10) | 是 | 设备相关信息 |
+| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功并启动投播,err为undefined,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1375,9 +1446,31 @@ startCasting(session: SessionToken, device: OutputDeviceInfo, callback: AsyncCal
**示例:**
```js
+import featureAbility from '@ohos.ability.featureAbility';
+
+let currentAVSession;
+let tag = "createNewSession";
+let context = featureAbility.getContext();
+let currSessionId; //供后续函数入参使用
+
+avSession.createAVSession(context, tag, "audio", function (err, data) {
+ if (err) {
+ console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
+ } else {
+ currentAVSession = data;
+ currSessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${currSessionId}`);
+ }
+});
+
let myToken = {
- sessionId: currentAVSession.sessionId;
+ sessionId: currSessionId,
}
+let castDevice;
+avSession.on('deviceAvailable', (device) => {
+ castDevice = device;
+ console.info(`on deviceAvailable : ${device} `);
+});
avSession.startCasting(myToken, castDevice, function (err) {
if (err) {
console.error(`startCasting BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -1410,7 +1503,7 @@ startCasting(session: SessionToken, device: OutputDeviceInfo): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当命令发送成功并启动投播,无返回结果,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1423,9 +1516,31 @@ startCasting(session: SessionToken, device: OutputDeviceInfo): Promise\
**示例:**
```js
+import featureAbility from '@ohos.ability.featureAbility';
+
+let currentAVSession;
+let tag = "createNewSession";
+let context = featureAbility.getContext();
+let currSessionId; //供后续函数入参使用
+
+avSession.createAVSession(context, tag, "audio", function (err, data) {
+ if (err) {
+ console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
+ } else {
+ currentAVSession = data;
+ currSessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${currSessionId}`);
+ }
+});
+
let myToken = {
- sessionId: currentAVSession.sessionId;
+ sessionId: currSessionId,
}
+let castDevice;
+avSession.on('deviceAvailable', (device) => {
+ castDevice = device;
+ console.info(`on deviceAvailable : ${device} `);
+});
avSession.startCasting(myToken, castDevice).then(() => {
console.info(`startCasting successfully`);
}).catch((err) => {
@@ -1448,7 +1563,7 @@ stopCasting(session: SessionToken, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| session | [SessionToken](#sessiontoken) | 是 | 会话令牌。SessionToken表示单个token。 |
-| callback | AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
+| callback | AsyncCallback\ | 是 | 回调函数。当成功结束投播,err为undefined,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1460,10 +1575,27 @@ stopCasting(session: SessionToken, callback: AsyncCallback\): void
**示例:**
```js
+import featureAbility from '@ohos.ability.featureAbility';
+
+let currentAVSession;
+let tag = "createNewSession";
+let context = featureAbility.getContext();
+let currSessionId; //供后续函数入参使用
+
+avSession.createAVSession(context, tag, "audio", function (err, data) {
+ if (err) {
+ console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
+ } else {
+ currentAVSession = data;
+ currSessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${currSessionId}`);
+ }
+});
+
let myToken = {
- sessionId: currentAVSession.sessionId;
+ sessionId: currSessionId,
}
-avSession.stopCasting(myToken, castDevice, function (err) {
+avSession.stopCasting(myToken, function (err) {
if (err) {
console.error(`stopCasting BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -1492,7 +1624,7 @@ stopCasting(session: SessionToken): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止搜索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当成功结束投播,无返回结果,否则返回错误对象。 |
**错误码:**
错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -1504,8 +1636,25 @@ stopCasting(session: SessionToken): Promise\
**示例:**
```js
+import featureAbility from '@ohos.ability.featureAbility';
+
+let currentAVSession;
+let tag = "createNewSession";
+let context = featureAbility.getContext();
+let currSessionId; //供后续函数入参使用
+
+avSession.createAVSession(context, tag, "audio", function (err, data) {
+ if (err) {
+ console.info(`CreateAVSession BusinessError: code: ${err.code}, message: ${err.message}`);
+ } else {
+ currentAVSession = data;
+ currSessionId = currentAVSession.sessionId;
+ console.info(`CreateAVSession : SUCCESS : sessionId = ${currSessionId}`);
+ }
+});
+
let myToken = {
- sessionId: currentAVSession.sessionId;
+ sessionId: currSessionId,
}
avSession.stopCasting(myToken).then(() => {
console.info(`stopCasting successfully`);
@@ -1914,7 +2063,7 @@ let eventName = "dynamic_lyric";
let args = {
lyric : "This is lyric"
}
-await currentAVSession.dispatchSessionEvent(eventName, args).catch((err) => {
+currentAVSession.dispatchSessionEvent(eventName, args).catch((err) => {
console.info(`dispatchSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`);
})
```
@@ -1953,7 +2102,7 @@ let eventName = "dynamic_lyric";
let args = {
lyric : "This is lyric"
}
-await currentAVSession.dispatchSessionEvent(eventName, args, (err) => {
+currentAVSession.dispatchSessionEvent(eventName, args, (err) => {
if(err) {
console.error(`dispatchSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`);
}
@@ -2211,7 +2360,7 @@ setExtras(extras: {[key: string]: Object}): Promise\
let extras = {
extras : "This is custom media packet"
}
-await currentAVSession.setExtras(extras).catch((err) => {
+currentAVSession.setExtras(extras).catch((err) => {
console.info(`setExtras BusinessError: code: ${err.code}, message: ${err.message}`);
})
```
@@ -2248,7 +2397,7 @@ setExtras(extras: {[key: string]: Object}, callback: AsyncCallback\): void
let extras = {
extras : "This is custom media packet"
}
-await currentAVSession.setExtras(extras, (err) => {
+currentAVSession.setExtras(extras, (err) => {
if(err) {
console.error(`setExtras BusinessError: code: ${err.code}, message: ${err.message}`);
}
@@ -2768,7 +2917,7 @@ on(type:'playNext', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持的事件是` 'playNext'`,当播放下一首命令被发送到会话时,触发该事件回调。 |
+| type | string | 是 | 事件回调类型,支持的事件是`'playNext'`,当播放下一首命令被发送到会话时,触发该事件回调。 |
| callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 |
**错误码:**
@@ -2799,7 +2948,7 @@ on(type:'playPrevious', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持的事件是` 'playPrevious'`当播放上一首命令被发送到会话时,触发该事件回调。 |
+| type | string | 是 | 事件回调类型,支持的事件是`'playPrevious'`当播放上一首命令被发送到会话时,触发该事件回调。 |
| callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 |
**错误码:**
@@ -2861,7 +3010,7 @@ on(type:'rewind', callback: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持的事件是` 'rewind'`,当快退命令被发送到会话时,触发该事件回调。 |
+| type | string | 是 | 事件回调类型,支持的事件是`'rewind'`,当快退命令被发送到会话时,触发该事件回调。 |
| callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 |
**错误码:**
@@ -3169,7 +3318,7 @@ off(type: 'pause', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'pause'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'pause'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3256,7 +3405,7 @@ off(type: 'playPrevious', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'playPrevious'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'playPrevious'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3285,7 +3434,7 @@ off(type: 'fastForward', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'fastForward'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'fastForward'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3314,7 +3463,7 @@ off(type: 'rewind', callback?: () => void): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
-| type | string | 是 | 关闭对应的监听事件,支持的事件是` 'rewind'`。 |
+| type | string | 是 | 关闭对应的监听事件,支持的事件是`'rewind'`。 |
| callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
@@ -3609,7 +3758,7 @@ stopCasting(): Promise\
| 类型 | 说明 |
| -------------- | ----------------------------- |
-| Promise\ | Promise对象。当停止投播索成功,无返回结果,否则返回错误对象。 |
+| Promise\ | Promise对象。当成功结束投播,无返回结果,否则返回错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -3732,7 +3881,7 @@ aVCastController.setDisplaySurface(function (err, value) {
getAVPlaybackState(callback: AsyncCallback\): void
-设备建立连接后,获取投播控制器。结果通过callback异步回调方式返回。
+获取当前的远端播放状态。结果通过callback异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -3740,7 +3889,7 @@ getAVPlaybackState(callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10))\> | 是 | 回调函数,返回投播控制器实例。 |
+| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10)\> | 是 | 回调函数,返回远端播放状态。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -3773,7 +3922,7 @@ getAVPlaybackState(): Promise\;
| 类型 | 说明 |
| --------- | ------------------------------------------------------------ |
-| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回投播控制器实例。 |
+| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回远端播放状态。。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -4140,7 +4289,7 @@ aVCastController.getCurrentItem(function (err, value) {
getCurrentItem(): Promise\
-结束投播。结果通过Promise异步回调方式返回。
+获取当前投播的资源信息。结果通过Promise异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -4243,8 +4392,8 @@ on(type: 'mediaItemChange', callback: Callback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持事件`'mediaItemChange'`:当播放状态变化时,触发该事件。 |
-| callback | (state: [AVQueueItem](#avqueueitem10)) => void | 是 | 回调函数,参数AVQueueItem是d当前正在播放的媒体内容。 |
+| type | string | 是 | 事件回调类型,支持事件`'mediaItemChange'`:当播放的媒体内容变化时,触发该事件。 |
+| callback | (state: [AVQueueItem](#avqueueitem10)) => void | 是 | 回调函数,参数AVQueueItem是当前正在播放的媒体内容。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -4357,7 +4506,7 @@ on(type: 'playPrevious', callback: Callback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | 是 | 事件回调类型,支持事件`'playPrevious'`:当播放下一首状态变化时,触发该事件。 |
+| type | string | 是 | 事件回调类型,支持事件`'playPrevious'`:当播放上一首状态变化时,触发该事件。 |
| callback | Callback\ | 是 | 回调函数 |
**错误码:**
@@ -4522,7 +4671,7 @@ on(type: 'error', callback: ErrorCallback): void
**错误码:**
-以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-media.md)。
+以下错误码的详细介绍请参见[媒体服务错误码](../errorcodes/errorcode-media.md)。
| 错误码ID | 错误信息 |
| -------- | --------------------- |
@@ -4558,7 +4707,7 @@ off(type: 'error'): void
**错误码:**
-以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-media.md)。
+以下错误码的详细介绍请参见[媒体服务错误码](../errorcodes/errorcode-media.md)。
| 错误码ID | 错误信息 |
| -------- | --------------------- |
@@ -4577,7 +4726,7 @@ aVCastController.off('error')
## ConnectionState10+
-播放设备的类别枚举。
+连接状态枚举。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4682,7 +4831,7 @@ aVCastController.off('error')
## AVCastCategory10+
-播放设备的类别枚举。
+投播的类别枚举。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast
@@ -4712,7 +4861,7 @@ aVCastController.off('error')
| 名称 | 类型 | 必填 | 说明 |
| ---------- | -------------- | ---- | ---------------------- |
-| castCategory | AVCastCategory | 是 | 播放设备的类别 |
+| castCategory | AVCastCategory | 是 | 投播的类别。 |
| deviceId | string | 是 | 播放设备的ID。 |
| deviceName | string | 是 | 播放设备的名称。 |
| deviceType | DeviceType | 是 | 播放设备的类型。 |
@@ -4795,7 +4944,7 @@ aVCastController.off('error')
**示例:**
```js
let AVSessionController;
-await avSession.createController(currentAVSession.sessionId).then((controller) => {
+avSession.createController(currentAVSession.sessionId).then((controller) => {
AVSessionController = controller;
}).catch((err) => {
console.error(`CreateController BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -4806,7 +4955,7 @@ await avSession.createController(currentAVSession.sessionId).then((controller) =
getAVPlaybackState(callback: AsyncCallback\): void
-设备建立连接后,获取投播控制器。结果通过callback异步回调方式返回。
+获取当前的远端播放状态。结果通过callback异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4814,7 +4963,7 @@ getAVPlaybackState(callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10))\> | 是 | 回调函数,返回投播控制器实例。 |
+| callback | AsyncCallback<[[AVPlaybackState](#avplaybackstate10)\> | 是 | 回调函数,返回远端播放状态。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -4828,7 +4977,7 @@ getAVPlaybackState(callback: AsyncCallback\): void
**示例:**
```js
-AVSessionController.getAVPlaybackState(function (err, state) {
+avsessionController.getAVPlaybackState(function (err, state) {
if (err) {
console.error(`getAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -4841,7 +4990,7 @@ AVSessionController.getAVPlaybackState(function (err, state) {
getAVPlaybackState(): Promise\;
-获取当前的远端播放状态。结果通过callback异步回调方式返回。
+获取当前的远端播放状态。结果通过Promise异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
@@ -4849,7 +4998,7 @@ getAVPlaybackState(): Promise\;
| 类型 | 说明 |
| --------- | ------------------------------------------------------------ |
-| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回投播控制器实例。 |
+| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回远端播放状态。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。
@@ -4863,7 +5012,7 @@ getAVPlaybackState(): Promise\;
**示例:**
```js
-AVSessionController.getAVPlaybackState().then((state) => {
+avsessionController.getAVPlaybackState().then((state) => {
console.info(`getAVPlaybackState : SUCCESS :`);
}).catch((err) => {
console.error(`getAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -4895,7 +5044,7 @@ getAVMetadata(): Promise\
**示例:**
```js
-AVSessionController.getAVMetadata().then((metadata) => {
+avsessionController.getAVMetadata().then((metadata) => {
console.info(`GetAVMetadata : SUCCESS : assetId : ${metadata.assetId}`);
}).catch((err) => {
console.error(`GetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -4927,7 +5076,7 @@ getAVMetadata(callback: AsyncCallback\): void
**示例:**
```js
-AVSessionController.getAVMetadata(function (err, metadata) {
+avsessionController.getAVMetadata(function (err, metadata) {
if (err) {
console.error(`GetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -4961,7 +5110,7 @@ getAVQueueTitle(): Promise\
**示例:**
```js
-AVSessionController.getAVQueueTitle().then((title) => {
+avsessionController.getAVQueueTitle().then((title) => {
console.info(`GetAVQueueTitle : SUCCESS : title : ${title}`);
}).catch((err) => {
console.error(`GetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -4993,7 +5142,7 @@ getAVQueueTitle(callback: AsyncCallback\): void
**示例:**
```js
-AVSessionController.getAVQueueTitle(function (err, title) {
+avsessionController.getAVQueueTitle(function (err, title) {
if (err) {
console.error(`GetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5027,7 +5176,7 @@ getAVQueueItems(): Promise\>
**示例:**
```js
-AVSessionController.getAVQueueItems().then((items) => {
+avsessionController.getAVQueueItems().then((items) => {
console.info(`GetAVQueueItems : SUCCESS : length : ${items.length}`);
}).catch((err) => {
console.error(`GetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5059,7 +5208,7 @@ getAVQueueItems(callback: AsyncCallback\>): void
**示例:**
```js
-AVSessionController.getAVQueueItems(function (err, items) {
+avsessionController.getAVQueueItems(function (err, items) {
if (err) {
console.error(`GetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5101,7 +5250,7 @@ skipToQueueItem(itemId: number): Promise\
```js
let queueItemId = 0;
-AVSessionController.skipToQueueItem(queueItemId).then(() => {
+avsessionController.skipToQueueItem(queueItemId).then(() => {
console.info(`SkipToQueueItem successfully`);
}).catch((err) => {
console.error(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5136,7 +5285,7 @@ skipToQueueItem(itemId: number, callback: AsyncCallback\): void
```js
let queueItemId = 0;
-AVSessionController.skipToQueueItem(queueItemId, function (err) {
+avsessionController.skipToQueueItem(queueItemId, function (err) {
if (err) {
console.error(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5170,7 +5319,7 @@ getOutputDevice(): Promise\
**示例:**
```js
-AVSessionController.getOutputDevice().then((deviceInfo) => {
+avsessionController.getOutputDevice().then((deviceInfo) => {
console.info(`GetOutputDevice : SUCCESS : isRemote : ${deviceInfo.isRemote}`);
}).catch((err) => {
console.error(`GetOutputDevice BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5202,7 +5351,7 @@ getOutputDevice(callback: AsyncCallback\): void
**示例:**
```js
-AVSessionController.getOutputDevice(function (err, deviceInfo) {
+avsessionController.getOutputDevice(function (err, deviceInfo) {
if (err) {
console.error(`GetOutputDevice BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5248,7 +5397,7 @@ sendAVKeyEvent(event: KeyEvent): Promise\
let keyItem = {code:0x49, pressedTime:2, deviceId:0};
let event = {action:2, key:keyItem, keys:[keyItem]};
-AVSessionController.sendAVKeyEvent(event).then(() => {
+avsessionController.sendAVKeyEvent(event).then(() => {
console.info(`SendAVKeyEvent Successfully`);
}).catch((err) => {
console.error(`SendAVKeyEvent BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5287,7 +5436,7 @@ sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void
let keyItem = {code:0x49, pressedTime:2, deviceId:0};
let event = {action:2, key:keyItem, keys:[keyItem]};
-AVSessionController.sendAVKeyEvent(event, function (err) {
+avsessionController.sendAVKeyEvent(event, function (err) {
if (err) {
console.error(`SendAVKeyEvent BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5322,7 +5471,7 @@ getLaunchAbility(): Promise\
**示例:**
```js
-AVSessionController.getLaunchAbility().then((agent) => {
+avsessionController.getLaunchAbility().then((agent) => {
console.info(`GetLaunchAbility : SUCCESS : wantAgent : ${agent}`);
}).catch((err) => {
console.error(`GetLaunchAbility BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5355,7 +5504,7 @@ getLaunchAbility(callback: AsyncCallback\): void
**示例:**
```js
-AVSessionController.getLaunchAbility(function (err, agent) {
+avsessionController.getLaunchAbility(function (err, agent) {
if (err) {
console.error(`GetLaunchAbility BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5389,7 +5538,7 @@ getRealPlaybackPositionSync(): number
**示例:**
```js
-let time = AVSessionController.getRealPlaybackPositionSync();
+let time = avsessionController.getRealPlaybackPositionSync();
```
### isActive10+
@@ -5418,7 +5567,7 @@ isActive(): Promise\
**示例:**
```js
-AVSessionController.isActive().then((isActive) => {
+avsessionController.isActive().then((isActive) => {
console.info(`IsActive : SUCCESS : isactive : ${isActive}`);
}).catch((err) => {
console.error(`IsActive BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5451,7 +5600,7 @@ isActive(callback: AsyncCallback\): void
**示例:**
```js
-AVSessionController.isActive(function (err, isActive) {
+avsessionController.isActive(function (err, isActive) {
if (err) {
console.error(`IsActive BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5485,7 +5634,7 @@ destroy(): Promise\
**示例:**
```js
-AVSessionController.destroy().then(() => {
+avsessionController.destroy().then(() => {
console.info(`Destroy : SUCCESS `);
}).catch((err) => {
console.error(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5517,7 +5666,7 @@ destroy(callback: AsyncCallback\): void
**示例:**
```js
-AVSessionController.destroy(function (err) {
+avsessionController.destroy(function (err) {
if (err) {
console.error(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5552,7 +5701,7 @@ getValidCommands(): Promise\>
**示例:**
```js
-AVSessionController.getValidCommands.then((validCommands) => {
+avsessionController.getValidCommands.then((validCommands) => {
console.info(`GetValidCommands : SUCCESS : size : ${validCommands.length}`);
}).catch((err) => {
console.error(`GetValidCommands BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5585,7 +5734,7 @@ getValidCommands(callback: AsyncCallback\>): void
**示例:**
```js
-AVSessionController.getValidCommands(function (err, validCommands) {
+avsessionController.getValidCommands(function (err, validCommands) {
if (err) {
console.error(`GetValidCommands BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5644,7 +5793,7 @@ let avCommand = {command:'play'};
// let avCommand = {command:'setSpeed', parameter:2.6};
// let avCommand = {command:'setLoopMode', parameter:avSession.LoopMode.LOOP_MODE_SINGLE};
// let avCommand = {command:'toggleFavorite', parameter:"false"};
-AVSessionController.sendControlCommand(avCommand).then(() => {
+avsessionController.sendControlCommand(avCommand).then(() => {
console.info(`SendControlCommand successfully`);
}).catch((err) => {
console.error(`SendControlCommand BusinessError: code: ${err.code}, message: ${err.message}`);
@@ -5696,7 +5845,7 @@ let avCommand = {command:'play'};
// let avCommand = {command:'setSpeed', parameter:2.6};
// let avCommand = {command:'setLoopMode', parameter:avSession.LoopMode.LOOP_MODE_SINGLE};
// let avCommand = {command:'toggleFavorite', parameter:"false"};
-AVSessionController.sendControlCommand(avCommand, function (err) {
+avsessionController.sendControlCommand(avCommand, function (err) {
if (err) {
console.info(`SendControlCommand BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -5748,7 +5897,7 @@ let commandName = "my_command";
let args = {
command : "This is my command"
}
-await AVSessionController.sendCommonCommand(commandName, args).catch((err) => {
+avsessionController.sendCommonCommand(commandName, args).catch((err) => {
console.info(`SendCommonCommand BusinessError: code: ${err.code}, message: ${err.message}`);
})
```
@@ -5791,7 +5940,7 @@ let commandName = "my_command";
let args = {
command : "This is my command"
}
-AVSessionController.sendCommonCommand(commandName, args, (err) => {
+avsessionController.sendCommonCommand(commandName, args, (err) => {
if(err) {
console.info(`SendCommonCommand BusinessError: code: ${err.code}, message: ${err.message}`);
}
@@ -5825,7 +5974,7 @@ getExtras(): Promise\<{[key: string]: Object}>
**示例:**
```js
-let extras = await AVSessionController.getExtras().catch((err) => {
+let extras = await avsessionController.getExtras().catch((err) => {
console.info(`getExtras BusinessError: code: ${err.code}, message: ${err.message}`);
});
```
@@ -5857,11 +6006,11 @@ getExtras(callback: AsyncCallback\<{[key: string]: Object}>): void
**示例:**
```js
-AVSessionController.getExtras(function (err, extras) {
+avsessionController.getExtras(function (err, extras) {
if (err) {
console.error(`getExtras BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
- console.info(`getExtras : SUCCESS : assetId : ${metadata.assetId}`);
+ console.info(`getExtras : SUCCESS : assetId : ${extras}`);
}
});
```
@@ -5893,12 +6042,12 @@ on(type: 'metadataChange', filter: Array\ | 'all', callback: (
**示例:**
```js
-AVSessionController.on('metadataChange', 'all', (metadata) => {
+avsessionController.on('metadataChange', 'all', (metadata) => {
console.info(`on metadataChange assetId : ${metadata.assetId}`);
});
let metaFilter = ['assetId', 'title', 'description'];
-AVSessionController.on('metadataChange', metaFilter, (metadata) => {
+avsessionController.on('metadataChange', metaFilter, (metadata) => {
console.info(`on metadataChange assetId : ${metadata.assetId}`);
});
```
@@ -5929,7 +6078,7 @@ off(type: 'metadataChange', callback?: (data: AVMetadata) => void)
**示例:**
```js
-AVSessionController.off('metadataChange');
+avsessionController.off('metadataChange');
```
### on('playbackStateChange')10+
@@ -5959,12 +6108,12 @@ on(type: 'playbackStateChange', filter: Array\ | 'all', c
**示例:**
```js
-AVSessionController.on('playbackStateChange', 'all', (playbackState) => {
+avsessionController.on('playbackStateChange', 'all', (playbackState) => {
console.info(`on playbackStateChange state : ${playbackState.state}`);
});
let playbackFilter = ['state', 'speed', 'loopMode'];
-AVSessionController.on('playbackStateChange', playbackFilter, (playbackState) => {
+avsessionController.on('playbackStateChange', playbackFilter, (playbackState) => {
console.info(`on playbackStateChange state : ${playbackState.state}`);
});
```
@@ -5995,7 +6144,7 @@ off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void)
**示例:**
```js
-AVSessionController.off('playbackStateChange');
+avsessionController.off('playbackStateChange');
```
### on('sessionDestroy')10+
@@ -6024,7 +6173,7 @@ on(type: 'sessionDestroy', callback: () => void)
**示例:**
```js
-AVSessionController.on('sessionDestroy', () => {
+avsessionController.on('sessionDestroy', () => {
console.info(`on sessionDestroy : SUCCESS `);
});
```
@@ -6055,7 +6204,7 @@ off(type: 'sessionDestroy', callback?: () => void)
**示例:**
```js
-AVSessionController.off('sessionDestroy');
+avsessionController.off('sessionDestroy');
```
### on('activeStateChange')10+
@@ -6084,7 +6233,7 @@ on(type: 'activeStateChange', callback: (isActive: boolean) => void)
**示例:**
```js
-AVSessionController.on('activeStateChange', (isActive) => {
+avsessionController.on('activeStateChange', (isActive) => {
console.info(`on activeStateChange : SUCCESS : isActive ${isActive}`);
});
```
@@ -6115,7 +6264,7 @@ off(type: 'activeStateChange', callback?: (isActive: boolean) => void)
**示例:**
```js
-AVSessionController.off('activeStateChange');
+avsessionController.off('activeStateChange');
```
### on('validCommandChange')10+
@@ -6144,7 +6293,7 @@ on(type: 'validCommandChange', callback: (commands: Array\
**示例:**
```js
-AVSessionController.on('validCommandChange', (validCommands) => {
+avsessionController.on('validCommandChange', (validCommands) => {
console.info(`validCommandChange : SUCCESS : size : ${validCommands.size}`);
console.info(`validCommandChange : SUCCESS : validCommands : ${validCommands.values()}`);
});
@@ -6176,7 +6325,7 @@ off(type: 'validCommandChange', callback?: (commands: Array\10+
@@ -6205,7 +6354,7 @@ on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: Output
**示例:**
```js
-AVSessionController.on('outputDeviceChange', (state, device) => {
+avsessionController.on('outputDeviceChange', (state, device) => {
console.info(`on outputDeviceChange state: ${state}, device : ${device}`);
});
```
@@ -6236,7 +6385,7 @@ off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: Outp
**示例:**
```js
-AVSessionController.off('outputDeviceChange');
+avsessionController.off('outputDeviceChange');
```
### on('sessionEvent')10+
@@ -6266,7 +6415,7 @@ on(type: 'sessionEvent', callback: (sessionEvent: string, args: {[key:string]: O
**示例:**
```js
-AVSessionController.on('sessionEvent', (sessionEvent, args) => {
+avsessionController.on('sessionEvent', (sessionEvent, args) => {
console.info(`OnSessionEvent, sessionEvent is ${sessionEvent}, args: ${JSON.stringify(args)}`);
});
```
@@ -6297,7 +6446,7 @@ off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key:string]:
**示例:**
```js
-AVSessionController.off('sessionEvent');
+avsessionController.off('sessionEvent');
```
### on('queueItemsChange')10+
@@ -6326,7 +6475,7 @@ on(type: 'queueItemsChange', callback: (items: Array<[AVQueueItem](#avqueueitem1
**示例:**
```js
-AVSessionController.on('queueItemsChange', (items) => {
+avsessionController.on('queueItemsChange', (items) => {
console.info(`OnQueueItemsChange, items length is ${items.length}`);
});
```
@@ -6357,7 +6506,7 @@ off(type: 'queueItemsChange', callback?: (items: Array<[AVQueueItem](#avqueueite
**示例:**
```js
-AVSessionController.off('queueItemsChange');
+avsessionController.off('queueItemsChange');
```
### on('queueTitleChange')10+
@@ -6386,7 +6535,7 @@ on(type: 'queueTitleChange', callback: (title: string) => void): void
**示例:**
```js
-AVSessionController.on('queueTitleChange', (title) => {
+avsessionController.on('queueTitleChange', (title) => {
console.info(`queueTitleChange, title is ${title}`);
});
```
@@ -6417,7 +6566,7 @@ off(type: 'queueTitleChange', callback?: (title: string) => void): void
**示例:**
```js
-AVSessionController.off('queueTitleChange');
+avsessionController.off('queueTitleChange');
```
### on('extrasChange')10+
@@ -6446,7 +6595,7 @@ on(type: 'extrasChange', callback: (extras: {[key:string]: Object}) => void): vo
**示例:**
```js
-AVSessionController.on('extrasChange', (extras) => {
+avsessionController.on('extrasChange', (extras) => {
console.info(`Caught extrasChange event,the new extra is: ${JSON.stringify(extras)}`);
});
```
@@ -6477,7 +6626,7 @@ off(type: 'extrasChange', callback?: (extras: {[key:string]: Object}) => void):
**示例:**
```js
-AVSessionController.off('extrasChange');
+avsessionController.off('extrasChange');
```
## AVControlCommandType10+
diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
index 3abb21b2c11e7a718e7f2d74d61a5b050c453b44..93b15ec6e6a50acab647ff278fdf130d35cab892 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md
@@ -55,12 +55,12 @@ let preferences = null;
try {
data_preferences.getPreferences(context, 'mystore', function (err, val) {
if (err) {
- console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
- return;
- }
- preferences = val;
- console.info("Succeeded in getting preferences.");
- })
+ console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
+ return;
+ }
+ preferences = val;
+ console.info("Succeeded in getting preferences.");
+ })
} catch (err) {
console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
@@ -195,14 +195,14 @@ let context = featureAbility.getContext();
let preferences = null;
try {
- data_preferences.getPreferences(context, {name: 'mystore'}, function (err, val) {
+ data_preferences.getPreferences(context, { name: 'mystore' }, function (err, val) {
if (err) {
- console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
- return;
- }
- preferences = val;
- console.info("Succeeded in getting preferences.");
- })
+ console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
+ return;
+ }
+ preferences = val;
+ console.info("Succeeded in getting preferences.");
+ })
} catch (err) {
console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
@@ -219,7 +219,7 @@ let preferences = null;
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err, val) {
+ data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err, val) {
if (err) {
console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
return;
@@ -275,7 +275,7 @@ let context = featureAbility.getContext();
let preferences = null;
try {
- let promise = data_preferences.getPreferences(context, {name: 'mystore'});
+ let promise = data_preferences.getPreferences(context, { name: 'mystore' });
promise.then((object) => {
preferences = object;
console.info("Succeeded in getting preferences.");
@@ -297,7 +297,7 @@ let preferences = null;
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- let promise = data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'});
+ let promise = data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' });
promise.then((object) => {
preferences = object;
console.info("Succeeded in getting preferences.");
@@ -493,7 +493,7 @@ import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- data_preferences.deletePreferences(context, {name: 'mystore'}, function (err) {
+ data_preferences.deletePreferences(context, { name: 'mystore' }, function (err) {
if (err) {
console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
return;
@@ -513,7 +513,7 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- data_preferences.deletePreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err) {
+ data_preferences.deletePreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err) {
if (err) {
console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
return;
@@ -571,7 +571,7 @@ import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- let promise = data_preferences.deletePreferences(context, {name: 'mystore'});
+ let promise = data_preferences.deletePreferences(context, { name: 'mystore' });
promise.then(() => {
console.info("Succeeded in deleting preferences.");
}).catch((err) => {
@@ -590,7 +590,7 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try{
- let promise = data_preferences.deletePreferences(this.context, {name: 'mystore', dataGroupId:'myId'});
+ let promise = data_preferences.deletePreferences(this.context, { name: 'mystore', dataGroupId:'myId' });
promise.then(() => {
console.info("Succeeded in deleting preferences.");
}).catch((err) => {
@@ -702,8 +702,8 @@ import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
let promise = data_preferences.removePreferencesFromCache(context, 'mystore');
- promise.then(() => {
- console.info("Succeeded in removing preferences.");
+ promise.then(() => {
+ console.info("Succeeded in removing preferences.");
}).catch((err) => {
console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
})
@@ -821,7 +821,7 @@ FA模型示例:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- data_preferences.removePreferencesFromCache(context, {name: 'mystore'}, function (err) {
+ data_preferences.removePreferencesFromCache(context, { name: 'mystore' }, function (err) {
if (err) {
console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
@@ -841,7 +841,7 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- data_preferences.removePreferencesFromCache(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err) {
+ data_preferences.removePreferencesFromCache(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err) {
if (err) {
console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
@@ -898,9 +898,9 @@ FA模型示例:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- let promise = data_preferences.removePreferencesFromCache(context, {name: 'mystore'});
- promise.then(() => {
- console.info("Succeeded in removing preferences.");
+ let promise = data_preferences.removePreferencesFromCache(context, { name: 'mystore' });
+ promise.then(() => {
+ console.info("Succeeded in removing preferences.");
}).catch((err) => {
console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
})
@@ -917,7 +917,7 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- let promise = data_preferences.removePreferencesFromCache(this.context, {name: 'mystore', dataGroupId:'myId'});
+ let promise = data_preferences.removePreferencesFromCache(this.context, { name: 'mystore', dataGroupId:'myId' });
promise.then(() => {
console.info("Succeeded in removing preferences.");
}).catch((err) => {
@@ -1405,7 +1405,7 @@ delete(key: string): Promise<void>
```js
try {
let promise = preferences.delete('startup');
- promise.then(() => {
+ promise.then(() => {
console.info("Succeeded in deleting the key 'startup'.");
}).catch((err) => {
console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
@@ -1520,7 +1520,7 @@ clear(callback: AsyncCallback<void>): void
```js
try {
- preferences.clear(function (err) {
+ preferences.clear(function (err) {
if (err) {
console.info("Failed to clear. code =" + err.code + ", message =" + err.message);
return;
@@ -1552,8 +1552,8 @@ clear(): Promise<void>
```js
try {
let promise = preferences.clear();
- promise.then(() => {
- console.info("Succeeded in clearing.");
+ promise.then(() => {
+ console.info("Succeeded in clearing.");
}).catch((err) => {
console.info("Failed to clear. code =" + err.code + ", message =" + err.message);
})
@@ -1601,33 +1601,33 @@ on(type: 'change', callback: Callback<{ key : string }>): void
```js
try {
- data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
- if (err) {
- console.info("Failed to get preferences.");
- return;
- }
- let observer = function (key) {
- console.info("The key " + key + " changed.");
- }
- preferences.on('change', observer);
- preferences.put('startup', 'manual', function (err) {
- if (err) {
- console.info("Failed to put the value of 'startup'. Cause: " + err);
- return;
- }
- console.info("Succeeded in putting the value of 'startup'.");
-
- preferences.flush(function (err) {
- if (err) {
- console.info("Failed to flush. Cause: " + err);
- return;
- }
- console.info("Succeeded in flushing.");
- })
- })
- })
+ data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
+ if (err) {
+ console.info("Failed to get preferences.");
+ return;
+ }
+ let observer = function (key) {
+ console.info("The key " + key + " changed.");
+ }
+ preferences.on('change', observer);
+ preferences.put('startup', 'manual', function (err) {
+ if (err) {
+ console.info("Failed to put the value of 'startup'. Cause: " + err);
+ return;
+ }
+ console.info("Succeeded in putting the value of 'startup'.");
+
+ preferences.flush(function (err) {
+ if (err) {
+ console.info("Failed to flush. Cause: " + err);
+ return;
+ }
+ console.info("Succeeded in flushing.");
+ })
+ })
+ })
} catch (err) {
- console.info("Failed to flush. code =" + err.code + ", message =" + err.message);
+ console.info("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
@@ -1660,40 +1660,39 @@ on(type: 'multiProcessChange', callback: Callback<{ key : string }>): void
```js
try {
- data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err, preferences) {
- if (err) {
- console.info("Failed to get preferences.");
- return;
- }
- let observer = function (key) {
- console.info("The key " + key + " changed.");
- }
- preferences.on('multiProcessChange', observer);
- preferences.put('startup', 'manual', function (err) {
- if (err) {
- console.info("Failed to put the value of 'startup'. Cause: " + err);
- return;
- }
- console.info("Succeeded in putting the value of 'startup'.");
-
- preferences.flush(function (err) {
- if (err) {
- console.info("Failed to flush. Cause: " + err);
- return;
- }
- console.info("Succeeded in flushing.");
- })
- })
- })
+ data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err, preferences) {
+ if (err) {
+ console.info("Failed to get preferences.");
+ return;
+ }
+ let observer = function (key) {
+ console.info("The key " + key + " changed.");
+ }
+ preferences.on('multiProcessChange', observer);
+ preferences.put('startup', 'manual', function (err) {
+ if (err) {
+ console.info("Failed to put the value of 'startup'. Cause: " + err);
+ return;
+ }
+ console.info("Succeeded in putting the value of 'startup'.");
+
+ preferences.flush(function (err) {
+ if (err) {
+ console.info("Failed to flush. Cause: " + err);
+ return;
+ }
+ console.info("Succeeded in flushing.");
+ })
+ })
+ })
} catch (err) {
- console.info("Failed to flush. code =" + err.code + ", message =" + err.message);
+ console.info("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
**示例2:**
```js
-let preferences = null;
try {
data_preferences.getPreferences(this.context, { name: 'mystore' }, function (err, val) {
if (err) {
@@ -1704,7 +1703,7 @@ try {
let observer = function (key) {
console.info("The key " + key + " changed.");
try {
- data_preferences.removePreferencesFromCache(context, { name: 'mystore' }, function (err) {
+ data_preferences.removePreferencesFromCache(this.context, { name: 'mystore' }, function (err) {
if (err) {
console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
@@ -1717,7 +1716,7 @@ try {
}
try {
- data_preferences.getPreferences(context, { name: 'mystore' }, function (err, val) {
+ data_preferences.getPreferences(this.context, { name: 'mystore' }, function (err, val) {
if (err) {
console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message);
return;
@@ -1820,7 +1819,7 @@ off(type: 'multiProcessChange', callback?: Callback<{ key : string }>): vo
```js
try {
- data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err, preferences) {
+ data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err, preferences) {
if (err) {
console.info("Failed to get preferences.");
return;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md
index 53cdc7df509aa4dc741b5971c848aab9e766484e..7a5570c7d1c7edebf7a48527915e63487f4acc64 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-image.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-image.md
@@ -1698,7 +1698,7 @@ createPixelMapList(options?: DecodingOptions): Promise>;
| 类型 | 说明 |
| -------------------------------- | --------------------- |
-| Promise> | 异步返回PixeMap数组。 |
+| Promise> | 异步返回PixelMap数组。 |
**示例:**
@@ -1731,7 +1731,7 @@ createPixelMapList(callback: AsyncCallback>): void
**示例:**
```js
-imageSourceApi.createPixelMap( pixelmaplist => {
+imageSourceApi.createPixelMapList( pixelmaplist => {
console.info('Succeeded in creating pixelmaplist object.');
})
```
@@ -1762,14 +1762,14 @@ let decodeOpts = {
desiredPixelFormat: 3,
index: 0,
};
-imageSourceApi.createPixelMap(decodeOpts, pixelmaplist => {
+imageSourceApi.createPixelMapList(decodeOpts, pixelmaplist => {
console.log('Succeeded in creating pixelmaplist object.');
})
```
-### getDelayTime10+
+### getDelayTimeList10+
-getDelayTime(callback: AsyncCallback>): void;
+getDelayTimeList(callback: AsyncCallback>): void;
获取图像延迟时间数组,使用callback形式返回结果。
@@ -1784,14 +1784,14 @@ getDelayTime(callback: AsyncCallback>): void;
**示例:**
```js
-imageSourceApi.getDelayTime( delayTimes => {
+imageSourceApi.getDelayTimeList( delayTimes => {
console.log('Succeeded in getting delay time.');
});
```
-### getDelayTime10+
+### getDelayTimeList10+
-getDelayTime(): Promise>;
+getDelayTimeList(): Promise>;
获取图像延迟时间数组,使用Promise形式返回结果。
@@ -1806,7 +1806,7 @@ getDelayTime(): Promise>;
**示例:**
```js
-let delayTimes = imageSourceApi.getDelayTime();
+let delayTimes = imageSourceApi.getDelayTimeList();
```
### getFrameCount10+
@@ -2423,7 +2423,7 @@ dequeueImage(callback: AsyncCallback\): void
```js
creator.dequeueImage((err, img) => {
if (err) {
- console.info('dequeueImage failded.');
+ console.info('dequeueImage failed.');
}
console.info('dequeueImage succeeded.');
});
@@ -2838,9 +2838,9 @@ PixelMap的初始化选项。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------ | ---------------------------------- | ---- | ---- | ---------------- |
-| sampleSize | number | 是 | 是 | 缩略图采样大小。 |
+| sampleSize | number | 是 | 是 | 缩略图采样大小,当前只能取1。 |
| rotate | number | 是 | 是 | 旋转角度。 |
-| editable | boolean | 是 | 是 | 是否可编辑。 |
+| editable | boolean | 是 | 是 | 是否可编辑。当取值为false时,图片不可二次编辑,如crop等操作将失败。 |
| desiredSize | [Size](#size) | 是 | 是 | 期望输出大小。 |
| desiredRegion | [Region](#region7) | 是 | 是 | 解码区域。 |
| desiredPixelFormat | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 解码的像素格式。 |
@@ -2869,7 +2869,7 @@ PixelMap的初始化选项。
| ------- | ------ | ---- | ---- | --------------------------------------------------- |
| format | string | 是 | 是 | 目标格式。当前只支持jpg和webp。 |
| quality | number | 是 | 是 | JPEG编码中设定输出图片质量的参数,取值范围为1-100。 |
-| bufferSize9+ | number | 是 | 是 | 用于设置图片大小,默认为10M |
+| bufferSize9+ | number | 是 | 是 | 用于设置图片大小,默认为10M。 |
## GetImagePropertyOptions7+
@@ -2898,34 +2898,34 @@ PixelMap的初始化选项。
| GPS_LONGITUDE | "GPSLongitude" | 图片经度。 |
| GPS_LATITUDE_REF | "GPSLatitudeRef" | 纬度引用,例如N或S。 |
| GPS_LONGITUDE_REF | "GPSLongitudeRef" | 经度引用,例如W或E。 |
-| DATE_TIME_ORIGINAL9+ | "DateTimeOriginal" | 拍摄时间,例如2022:09:06 15:48:00 |
-| EXPOSURE_TIME9+ | "ExposureTime" | 曝光时间,例如1/33 sec.|
-| SCENE_TYPE9+ | "SceneType" | 拍摄场景模式,例如人像、风光、运动、夜景等。 |
-| ISO_SPEED_RATINGS9+ | "ISOSpeedRatings" | ISO感光度,例如400 |
-| F_NUMBER9+ | "FNumber" | 光圈值,例如f/1.8 |
-| DATE_TIME10+ | "DateTime" | 日期时间 |
-| GPS_TIME_STAMP10+ | "GPSTimeStamp" | GPS时间戳 |
-| GPS_DATE_STAMP10+ | "GPSDateStamp" | GPS日期戳 |
-| IMAGE_DESCRIPTION10+ | "ImageDescription" | 图像信息描述 |
-| MAKE10+ | "Make" | 生产商 |
-| PHOTO_MODE10+ | "PhotoMode " | 拍照模式 |
-| SENSITIVITY_TYPE10+ | "SensitivityType" | 灵敏度类型 |
-| STANDARD_OUTPUT_SENSITIVITY10+ | "StandardOutputSensitivity" | 标准输出灵敏度 |
-| RECOMMENDED_EXPOSURE_INDEX10+ | "RecommendedExposureIndex" | 推荐曝光指数 |
-| ISO_SPEED10+ | "ISOSpeedRatings" | ISO速度等级 |
-| APERTURE_VALUE10+ | "ApertureValue" | 光圈值 |
-| EXPOSURE_BIAS_VALUE10+ | "ExposureBiasValue" | 曝光偏差值 |
-| METERING_MODE10+ | "MeteringMode" | 测光模式 |
-| LIGHT_SOURCE10+ | "LightSource" | 光源 |
-| FLASH 10+ | "Flash" | 闪光灯,记录闪光灯状态 |
-| FOCAL_LENGTH 10+ | "FocalLength" | 焦距 |
-| USER_COMMENT 10+ | "UserComment" | 用户注释 |
-| PIXEL_X_DIMENSION 10+ | "PixelXDimension" | 像素X尺寸 |
-| PIXEL_Y_DIMENSION10+ | "PixelYDimension" | 像素Y尺寸 |
-| WHITE_BALANCE 10+ | "WhiteBalance" | 白平衡 |
-| FOCAL_LENGTH_IN_35_MM_FILM 10+ | "FocalLengthIn35mmFilm" | 焦距35毫米胶片 |
-| CAPTURE_MODE 10+ | "HwMnoteCaptureMode" | 捕获模式 |
-| PHYSICAL_APERTURE 10+ | "HwMnotePhysicalAperture" | 物理孔径,光圈大小 |
+| DATE_TIME_ORIGINAL9+ | "DateTimeOriginal" | 拍摄时间,例如2022:09:06 15:48:00。当前为只读属性。 |
+| EXPOSURE_TIME9+ | "ExposureTime" | 曝光时间,例如1/33 sec。当前为只读属性。 |
+| SCENE_TYPE9+ | "SceneType" | 拍摄场景模式,例如人像、风光、运动、夜景等。当前为只读属性。 |
+| ISO_SPEED_RATINGS9+ | "ISOSpeedRatings" | ISO感光度,例如400。当前为只读属性。 |
+| F_NUMBER9+ | "FNumber" | 光圈值,例如f/1.8。当前为只读属性。 |
+| DATE_TIME10+ | "DateTime" | 日期时间,当前为只读属性。 |
+| GPS_TIME_STAMP10+ | "GPSTimeStamp" | GPS时间戳,当前为只读属性。 |
+| GPS_DATE_STAMP10+ | "GPSDateStamp" | GPS日期戳,当前为只读属性。 |
+| IMAGE_DESCRIPTION10+ | "ImageDescription" | 图像信息描述,当前为只读属性。 |
+| MAKE10+ | "Make" | 生产商,当前为只读属性。 |
+| PHOTO_MODE10+ | "PhotoMode " | 拍照模式,当前为只读属性。 |
+| SENSITIVITY_TYPE10+ | "SensitivityType" | 灵敏度类型,当前为只读属性。 |
+| STANDARD_OUTPUT_SENSITIVITY10+ | "StandardOutputSensitivity" | 标准输出灵敏度,当前为只读属性。 |
+| RECOMMENDED_EXPOSURE_INDEX10+ | "RecommendedExposureIndex" | 推荐曝光指数,当前为只读属性。 |
+| ISO_SPEED10+ | "ISOSpeedRatings" | ISO速度等级,当前为只读属性。 |
+| APERTURE_VALUE10+ | "ApertureValue" | 光圈值,当前为只读属性。 |
+| EXPOSURE_BIAS_VALUE10+ | "ExposureBiasValue" | 曝光偏差值,当前为只读属性。 |
+| METERING_MODE10+ | "MeteringMode" | 测光模式,当前为只读属性。 |
+| LIGHT_SOURCE10+ | "LightSource" | 光源,当前为只读属性。 |
+| FLASH 10+ | "Flash" | 闪光灯,记录闪光灯状态,当前为只读属性。 |
+| FOCAL_LENGTH 10+ | "FocalLength" | 焦距,当前为只读属性。 |
+| USER_COMMENT 10+ | "UserComment" | 用户注释,当前为只读属性。 |
+| PIXEL_X_DIMENSION 10+ | "PixelXDimension" | 像素X尺寸,当前为只读属性。 |
+| PIXEL_Y_DIMENSION10+ | "PixelYDimension" | 像素Y尺寸,当前为只读属性。 |
+| WHITE_BALANCE 10+ | "WhiteBalance" | 白平衡,当前为只读属性。 |
+| FOCAL_LENGTH_IN_35_MM_FILM 10+ | "FocalLengthIn35mmFilm" | 焦距35毫米胶片,当前为只读属性。 |
+| CAPTURE_MODE 10+ | "HwMnoteCaptureMode" | 捕获模式,当前为只读属性。 |
+| PHYSICAL_APERTURE 10+ | "HwMnotePhysicalAperture" | 物理孔径,光圈大小,当前为只读属性。 |
## ImageFormat9+
@@ -2967,7 +2967,7 @@ PixelMap的初始化选项。
## 补充说明
### SVG标签说明
-从API verison 10开始支持SVG标签,使用版本为(SVG) 1.1,当前支持的标签列表有:
+从API version 10开始支持SVG标签,使用版本为(SVG) 1.1,当前支持的标签列表有:
- a
- circla
- clipPath
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
index dc96dc3e100a414cc8122682bfc31b23b3981026..43790ea820446d8e932d3848e937907f81ff60f7 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
@@ -1,6 +1,8 @@
# AbilityResult
-定义Ability被拉起并退出后返回的结果码和数据,可以通过[startAbilityForResult](js-apis-ability-featureAbility.md#featureabilitystartabilityforresult7)获取被拉起Ability退出后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过[terminateSelfWithResult](js-apis-ability-featureAbility.md#featureabilityterminateselfwithresult7)返回AbilityResult对象。
+定义Ability被拉起并退出后返回的结果码和数据。
+Stage模型下,可以通过[startAbilityForResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilityforresult)获取被拉起Ability退出后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)返回AbilityResult对象。
+FA模型下,可以通过[startAbilityForResult](js-apis-ability-featureAbility.md#featureabilitystartabilityforresult7)获取被拉起Ability退出后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过[terminateSelfWithResult](js-apis-ability-featureAbility.md#featureabilityterminateselfwithresult7)返回AbilityResult对象。
> **说明:**
>
@@ -8,6 +10,12 @@
## 导入模块
+Stage模型下:
+```ts
+import common from '@ohos.app.ability.common';
+```
+
+FA模型下:
```ts
import ability from '@ohos.ability.ability';
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
index c00b39e2c60fe5edf6631160dff33c4fba0f2074..98908a1b1657f4bc1893d6faa8c7fab8ab243fc2 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
@@ -734,6 +734,234 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\
}
```
+## ServiceExtensionContext.startAbilityAsCaller10+
+
+starAbilityAsCaller(want: Want, callback: AsyncCallback): void;
+
+使用设置的caller信息启动一个Ability,caller信息由want携带,在系统服务层识别,Ability可以在onCreate生命周期的want参数中获取到caller信息。使用该接口启动一个Ability时,want的caller信息不会被当前自身的应用信息覆盖,系统服务层可获取到初始caller的信息。使用callback异步回调。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当启动Ability成功,err为undefined,否则为错误对象。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+**示例:**
+
+```ts
+import extension from '@ohos.app.ability.ServiceExtensionAbility';
+import Want from '@ohos.app.ability.Want';
+
+export default class EntryAbility extends extension {
+ onCreate(want, launchParam) {
+ // want包含启动该应用的Caller信息
+ let localWant: Want = want;
+ localWant.bundleName = 'com.example.demo';
+ localWant.moduleName = 'entry';
+ localWant.abilityName = 'TestAbility';
+
+ // 使用启动方的Caller身份信息启动新Ability
+ this.context.startAbilityAsCaller(localWant, (err) => {
+ if (err && err.code != 0) {
+ console.error('startAbilityAsCaller failed, err:' + JSON.stringify(err));
+ } else {
+ console.log('startAbilityAsCaller success.');
+ }
+ })
+ }
+}
+
+```
+
+## UIAbiliServiceExtensionContexttyContext.startAbilityAsCaller10+
+
+startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback): void;
+
+使用设置的caller信息启动一个Ability,caller信息由want携带,在系统服务层识别,Ability可以在onCreate生命周期的want参数中获取到caller信息。使用该接口启动一个Ability时,want的caller信息不会被当前自身的应用信息覆盖,系统服务层可获取到初始caller的信息。使用callback异步回调。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 是 | 启动Ability所携带的参数。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当启动Ability成功,err为undefined,否则为错误对象。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+**示例:**
+
+```ts
+import extension from '@ohos.app.ability.ServiceExtensionAbility';
+import Want from '@ohos.app.ability.Want';
+
+export default class EntryAbility extends extension {
+ onCreate(want, launchParam) {
+ // want包含启动该应用的Caller信息
+ let localWant: Want = want;
+ localWant.bundleName = 'com.example.demo';
+ localWant.moduleName = 'entry';
+ localWant.abilityName = 'TestAbility';
+
+ let option: StartOptions = {
+ displayId: 0
+ }
+
+ // 使用启动方的Caller身份信息启动新Ability
+ this.context.startAbilityAsCaller(localWant, option, (err) => {
+ if (err && err.code != 0) {
+ console.error('startAbilityAsCaller failed, err:' + JSON.stringify(err));
+ } else {
+ console.log('startAbilityAsCaller success.');
+ }
+ })
+ }
+}
+
+```
+
+## ServiceExtensionContext.startAbilityAsCaller10+
+
+startAbilityAsCaller(want: Want, options?: StartOptions): Promise;
+
+使用设置的caller信息启动一个Ability,caller信息由want携带,在系统服务层识别,Ability可以在onCreate生命周期的want参数中获取到caller信息。使用该接口启动一个Ability时,want的caller信息不会被当前自身的应用信息覆盖,系统服务层可获取到初始caller的信息。使用Promise异步回调。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**系统API**: 此接口为系统接口,三方应用不支持调用。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 是 | 启动Ability所携带的参数。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | Promise对象。无返回结果的Promise对象。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+**示例:**
+
+```ts
+import extension from '@ohos.app.ability.ServiceExtensionAbility';
+import Want from '@ohos.app.ability.Want';
+
+export default class EntryAbility extends extension {
+ onCreate(want, launchParam) {
+ // want包含启动该应用的Caller信息
+ let localWant: Want = want;
+ localWant.bundleName = 'com.example.demo';
+ localWant.moduleName = 'entry';
+ localWant.abilityName = 'TestAbility';
+
+ let option: StartOptions = {
+ displayId: 0
+ }
+
+ // 使用启动方的Caller身份信息启动新Ability
+ this.context.startAbilityAsCaller(localWant, option)
+ .then(() => {
+ console.log('startAbilityAsCaller success.');
+ })
+ .catch((err) => {
+ console.error('startAbilityAsCaller failed, err:' + JSON.stringify(err));
+ })
+ }
+}
+
+```
+
## ServiceExtensionContext.stopServiceExtensionAbility
stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
index fc9ceea38bfdf45ad4ed37ed3714e92c515a908e..227a55aa00171fb10605e3a6378cf77c5b34b8b7 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
@@ -2792,6 +2792,228 @@ startAbilityByCallWithAccount(want: Want, accountId: number): Promise<Caller&
}
```
+## UIAbilityContext.startAbilityAsCaller10+
+
+starAbilityAsCaller(want: Want, callback: AsyncCallback): void;
+
+使用设置的caller信息启动一个Ability,caller信息由want携带,在系统服务层识别,Ability可以在onCreate生命周期的want参数中获取到caller信息。使用该接口启动一个Ability时,want的caller信息不会被当前自身的应用信息覆盖,系统服务层可获取到初始caller的信息。使用callback异步回调。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当启动Ability成功,err为undefined,否则为错误对象。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+**示例:**
+
+```ts
+import UIAbility from '@ohos.app.ability.UIAbility';
+import Want from '@ohos.app.ability.Want';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want, launchParam) {
+ // want包含启动该应用的Caller信息
+ let localWant: Want = want;
+ localWant.bundleName = 'com.example.demo';
+ localWant.moduleName = 'entry';
+ localWant.abilityName = 'TestAbility';
+
+ // 使用启动方的Caller身份信息启动新Ability
+ this.context.startAbilityAsCaller(localWant, (err) => {
+ if (err && err.code != 0) {
+ console.error('startAbilityAsCaller failed, err:' + JSON.stringify(err));
+ } else {
+ console.log('startAbilityAsCaller success.');
+ }
+ })
+ }
+}
+
+```
+
+## UIAbilityContext.startAbilityAsCaller10+
+
+startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback): void;
+
+使用设置的caller信息启动一个Ability,caller信息由want携带,在系统服务层识别,Ability可以在onCreate生命周期的want参数中获取到caller信息。使用该接口启动一个Ability时,want的caller信息不会被当前自身的应用信息覆盖,系统服务层可获取到初始caller的信息。使用callback异步回调。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 是 | 启动Ability所携带的参数。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当启动Ability成功,err为undefined,否则为错误对象。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+**示例:**
+
+```ts
+import UIAbility from '@ohos.app.ability.UIAbility';
+import Want from '@ohos.app.ability.Want';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want, launchParam) {
+ // want包含启动该应用的Caller信息
+ let localWant: Want = want;
+ localWant.bundleName = 'com.example.demo';
+ localWant.moduleName = 'entry';
+ localWant.abilityName = 'TestAbility';
+
+ let option: StartOptions = {
+ displayId: 0
+ }
+
+ // 使用启动方的Caller身份信息启动新Ability
+ this.context.startAbilityAsCaller(localWant, option, (err) => {
+ if (err && err.code != 0) {
+ console.error('startAbilityAsCaller failed, err:' + JSON.stringify(err));
+ } else {
+ console.log('startAbilityAsCaller success.');
+ }
+ })
+ }
+}
+
+```
+
+## UIAbilityContext.startAbilityAsCaller10+
+
+startAbilityAsCaller(want: Want, options?: StartOptions): Promise;
+
+使用设置的caller信息启动一个Ability,caller信息由want携带,在系统服务层识别,Ability可以在onCreate生命周期的want参数中获取到caller信息。使用该接口启动一个Ability时,want的caller信息不会被当前自身的应用信息覆盖,系统服务层可获取到初始caller的信息。使用Promise异步回调。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 是 | 启动Ability所携带的参数。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | Promise对象。无返回结果的Promise对象。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+**示例:**
+
+```ts
+import UIAbility from '@ohos.app.ability.UIAbility';
+import Want from '@ohos.app.ability.Want';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want, launchParam) {
+ // want包含启动该应用的Caller信息
+ let localWant: Want = want;
+ localWant.bundleName = 'com.example.demo';
+ localWant.moduleName = 'entry';
+ localWant.abilityName = 'TestAbility';
+
+ let option: StartOptions = {
+ displayId: 0
+ }
+
+ // 使用启动方的Caller身份信息启动新Ability
+ this.context.startAbilityAsCaller(localWant, option)
+ .then(() => {
+ console.log('startAbilityAsCaller success.');
+ })
+ .catch((err) => {
+ console.error('startAbilityAsCaller failed, err:' + JSON.stringify(err));
+ })
+ }
+}
+
+```
+
## UIAbilityContext.reportDrawnCompleted10+
reportDrawnCompleted(callback: AsyncCallback\): void;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiExtensionContext.md
new file mode 100644
index 0000000000000000000000000000000000000000..f05ce2ccb14a8962de47e77b92af45b19c0bcacc
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiExtensionContext.md
@@ -0,0 +1,290 @@
+# UIExtensionContext
+
+UIExtensionContext是[UIExtensionAbility](js-apis-app-ability-uiExtensionAbility.md)的上下文环境,继承自[ExtensionContext](js-apis-inner-application-extensionContext.md),提供UIExtensionAbility的相关配置信息以及操作UIAbility的方法,如启动UIAbility等。
+
+> **说明:**
+>
+> - 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+> - 本模块接口仅可在Stage模型下使用。
+
+## 导入模块
+
+```ts
+import common from '@ohos.app.ability.common';
+```
+
+## UIExtensionContext.startAbility
+
+startAbility(want: Want, callback: AsyncCallback<void>): void;
+
+启动Ability(callback形式)。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| callback | AsyncCallback<void> | 是 | callback形式返回启动结果。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContext.startAbility
+
+startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
+
+启动Ability(callback形式)。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 是 | 启动Ability所携带的参数。 |
+| callback | AsyncCallback<void> | 是 | callback形式返回启动结果。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContext.startAbility
+
+startAbility(want: Want, options?: StartOptions): Promise<void>;
+
+启动Ability(promise形式)。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 否 | 启动Ability所携带的参数。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<void> | Promise形式返回启动结果。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContext.startAbilityForResult
+
+startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
+
+启动一个Ability。Ability被启动后,有如下情况(callback形式):
+ - 正常情况下可通过调用[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)接口使之终止并且返回结果给调用方。
+ - 异常情况下比如杀死Ability会返回异常信息给调用方, 异常信息中resultCode为-1。
+ - 如果被启动的Ability模式是单实例模式, 不同应用多次调用该接口启动这个Ability,当这个Ability调用[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)接口使之终止时,只将正常结果返回给最后一个调用方, 其它调用方返回异常信息, 异常信息中resultCode为-1。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want |[Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| callback | AsyncCallback<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | 是 | 执行结果回调函数。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContext.startAbilityForResult
+
+startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
+
+启动一个Ability。Ability被启动后,有如下情况(callback形式):
+ - 正常情况下可通过调用[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)接口使之终止并且返回结果给调用方。
+ - 异常情况下比如杀死Ability会返回异常信息给调用方,异常信息中resultCode为-1。
+ - 如果被启动的Ability模式是单实例模式, 不同应用多次调用该接口启动这个Ability,当这个Ability调用[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)接口使之终止时,只将正常结果返回给最后一个调用方,其它调用方返回异常信息, 异常信息中resultCode为-1。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want |[Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 是 | 启动Ability所携带的参数。 |
+| callback | AsyncCallback<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | 是 | 执行结果回调函数。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
+
+## UIExtensionContext.startAbilityForResult
+
+startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
+
+启动一个Ability。Ability被启动后,有如下情况(promise形式):
+ - 正常情况下可通过调用[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)接口使之终止并且返回结果给调用方。
+ - 异常情况下比如杀死Ability会返回异常信息给调用方, 异常信息中resultCode为-1。
+ - 如果被启动的Ability模式是单实例模式, 不同应用多次调用该接口启动这个Ability,当这个Ability调用[terminateSelfWithResult](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult)接口使之终止时,只将正常结果返回给最后一个调用方, 其它调用方返回异常信息, 异常信息中resultCode为-1。
+
+使用规则:
+ - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
+ - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
+ - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
+
+**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 |
+| options | [StartOptions](js-apis-app-ability-startOptions.md) | 否 | 启动Ability所携带的参数。 |
+
+
+**返回值:**
+
+| 类型 | 说明 |
+| -------- | -------- |
+| Promise<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Promise形式返回执行结果。 |
+
+**错误码:**
+
+| 错误码ID | 错误信息 |
+| ------- | -------------------------------- |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000010 | The call with the continuation flag is forbidden. |
+| 16000011 | The context does not exist. |
+| 16000012 | The application is controlled. |
+| 16000013 | The application is controlled by EDM. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+
+错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md
index 48ac1c115d1f77fcf6ad18a4e42dae9ea7ecf3fb..f39fb30dbc853ff3cd36a4639be7f52bab612c2a 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md
@@ -89,9 +89,11 @@ setBackgroundAllowed(isAllowed: boolean): Promise\
**示例:**
```js
-policy.setBackgroundAllowed(true).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setBackgroundAllowed(true).then(() => {
+ console.log("setBackgroundAllowed success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.isBackgroundAllowed10+
@@ -164,10 +166,11 @@ isBackgroundAllowed(): Promise\;
**示例:**
```js
-policy.isBackgroundAllowed().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.isBackgroundAllowed().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setPolicyByUid10+
@@ -248,9 +251,11 @@ setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\;
**示例:**
```js
-policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then(() => {
+ console.log("setPolicyByUid success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getPolicyByUid10+
@@ -329,10 +334,11 @@ getPolicyByUid(uid: number): Promise\;
**示例:**
```js
-policy.getPolicyByUid(11111).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getPolicyByUid(11111).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getUidsByPolicy10+
@@ -412,10 +418,11 @@ getUidsByPolicy(policy: NetUidPolicy): Promise\>;
**示例:**
```js
-policy.getUidsByPolicy(11111).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getUidsByPolicy(11111).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getNetQuotaPolicies10+
@@ -487,11 +494,11 @@ getNetQuotaPolicies(): Promise\>;
**示例:**
```js
-policy.getNetQuotaPolicies().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-
+policy.getNetQuotaPolicies().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setNetQuotaPolicies10+
@@ -608,9 +615,11 @@ let netquotapolicy = {
netQuotaPolicyList.push(netquotapolicy);
-policy.setNetQuotaPolicies(netQuotaPolicyList).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setNetQuotaPolicies(netQuotaPolicyList).then(() => {
+ console.log("setNetQuotaPolicies success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.isUidNetAllowed10+
@@ -692,10 +701,11 @@ isUidNetAllowed(uid: number, isMetered: boolean): Promise\;
**示例:**
```js
-policy.isUidNetAllowed(11111, true).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.isUidNetAllowed(11111, true).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.isUidNetAllowed10+
@@ -777,10 +787,11 @@ isUidNetAllowed(uid: number, iface: string): Promise\;
**示例:**
```js
-policy.isUidNetAllowed(11111, 'wlan0').then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.isUidNetAllowed(11111, 'wlan0').then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setDeviceIdleTrustlist10+
@@ -861,9 +872,11 @@ setDeviceIdleTrustlist(uids: Array\, isAllowed: boolean): Promise\
**示例:**
```js
-policy.setDeviceIdleTrustlist([11111,22222], true).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setDeviceIdleTrustlist([11111,22222], true).then(() => {
+ console.log("setDeviceIdleTrustlist success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getDeviceIdleTrustlist10+
@@ -934,10 +947,11 @@ getDeviceIdleTrustlist(): Promise\>;
**示例:**
```js
-policy.getDeviceIdleTrustlist().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getDeviceIdleTrustlist().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getBackgroundPolicyByUid10+
@@ -1017,10 +1031,11 @@ getBackgroundPolicyByUid(uid: number): Promise\;
**示例:**
```js
-policy.getBackgroundPolicyByUid(11111).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getBackgroundPolicyByUid(11111).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.resetPolicies10+
@@ -1099,9 +1114,11 @@ resetPolicies(simId: string): Promise\;
**示例:**
```js
-policy.resetPolicies('1').then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.resetPolicies('1').then(() => {
+ console.log("resetPolicies success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.updateRemindPolicy10+
@@ -1186,9 +1203,11 @@ updateRemindPolicy(netType: NetBearType, simId: string, remindType: RemindType):
```js
import connection from '@ohos.net.connection';
-policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(() => {
+ console.log("updateRemindPolicy success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setPowerSaveTrustlist10+
@@ -1269,9 +1288,11 @@ setPowerSaveTrustlist(uids: Array\, isAllowed: boolean): Promise\;
**示例:**
```js
-policy.setPowerSaveTrustlist([11111,22222], true).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setPowerSaveTrustlist([11111,22222], true).then(() => {
+ console.log("setPowerSaveTrustlist success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getPowerSaveTrustlist10+
@@ -1343,10 +1364,11 @@ getPowerSaveTrustlist(): Promise\>;
**示例:**
```js
-policy.getPowerSaveTrustlist().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getPowerSaveTrustlist().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.on
diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md b/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md
index 78519885bcc4ff6f1b392522a7fd69f760dcda75..336b6fefcd4be7da7843408c25b8245838dcf607 100755
--- a/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md
@@ -158,7 +158,7 @@ getCurrentTime(isNano?: boolean): Promise<number>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------- |
-| isNano | boolean | 否 | 返回结果是否为纳秒数。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
+| isNano | boolean | 否 | 返回结果是否为纳秒数,默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
**返回值:**
@@ -253,7 +253,7 @@ getRealActiveTime(isNano?: boolean): Promise<number>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ----------------------------------- |
-| isNano | boolean | 否 | 返回结果是否为纳秒数。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
+| isNano | boolean | 否 | 返回结果是否为纳秒数,默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
**返回值:**
@@ -348,7 +348,7 @@ getRealTime(isNano?: boolean): Promise<number>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------- |
-| isNano | boolean | 否 | 返回结果是否为纳秒数。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
+| isNano | boolean | 否 | 返回结果是否为纳秒数,默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
**返回值:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-time.md b/zh-cn/application-dev/reference/apis/js-apis-system-time.md
index f2259063030ba2c82b0dc451c4e05fe74deebe23..30de7330df7e42fc49cf58fce2ca85daaeb92b2b 100755
--- a/zh-cn/application-dev/reference/apis/js-apis-system-time.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-system-time.md
@@ -191,7 +191,7 @@ getCurrentTime(isNano?: boolean): Promise<number>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------- |
-| isNano | boolean | 否 | 返回结果是否为纳秒数。
默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
+| isNano | boolean | 否 | 返回结果是否为纳秒数,默认值为false。
默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
**返回值:**
@@ -310,7 +310,7 @@ getRealActiveTime(isNano?: boolean): Promise<number>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ----------------------------------- |
-| isNano | boolean | 否 | 返回结果是否为纳秒数。
默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
+| isNano | boolean | 否 | 返回结果是否为纳秒数,默认值为false。
默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
**返回值:**
@@ -429,7 +429,7 @@ getRealTime(isNano?: boolean): Promise<number>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------- |
-| isNano | boolean | 否 | 返回结果是否为纳秒数。
默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
+| isNano | boolean | 否 | 返回结果是否为纳秒数,默认值为false。
默认值为false。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 |
**返回值:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-timer.md b/zh-cn/application-dev/reference/apis/js-apis-system-timer.md
index 26c21d546e52a6d2757f406cc1e1e8f14b8fdd7f..435196b24b0de4db3b4148bec235fe2fb15c16c1 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-system-timer.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-system-timer.md
@@ -36,8 +36,8 @@ import systemTimer from '@ohos.systemTimer';
| 名称 | 类型 | 必填 | 说明 |
| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | number | 是 | 定时器类型。
取值为1,表示为系统启动时间定时器(定时器启动时间不能晚于当前设置的系统时间) ;
取值为2,表示为唤醒定时器;
取值为4,表示为精准定时器;
取值为8,表示为IDLE模式定时器(暂不支持)。 |
-| repeat | boolean | 是 | true为循环定时器,false为单次定时器。 |
-| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 |
+| repeat | boolean | 是 | 是否为循环定时器。
true为循环定时器,false为单次定时器。 |
+| interval | number | 否 | 定时器时间间隔。
如果是循环定时器,interval值应大于5000毫秒;单次定时器interval值为0。 |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 否 | 设置通知的WantAgent,定时器到期后通知。(支持拉起应用MainAbility,暂不支持拉起ServiceAbility。) |
| callback | number | 是 | 以回调函数的形式返回定时器的ID。 |
@@ -48,8 +48,6 @@ createTimer(options: TimerOptions, callback: AsyncCallback<number>): void
创建定时器,使用callback异步回调。
-**系统接口:** 此接口为系统接口
-
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
@@ -89,7 +87,6 @@ createTimer(options: TimerOptions): Promise<number>
创建定时器,使用Promise异步回调。
-**系统接口:** 此接口为系统接口
**系统能力:** SystemCapability.MiscServices.Time
@@ -131,9 +128,7 @@ export default {
startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void>): void
-开始定时器,使用callback异步回调。
-
-**系统接口:** 此接口为系统接口
+开启定时器,使用callback异步回调。
**系统能力:** SystemCapability.MiscServices.Time
@@ -176,9 +171,7 @@ export default {
startTimer(timer: number, triggerTime: number): Promise<void>
-开始定时器,使用Promise异步回调。
-
-**系统接口:** 此接口为系统接口
+开启定时器,使用Promise异步回调。
**系统能力:** SystemCapability.MiscServices.Time
@@ -226,8 +219,6 @@ stopTimer(timer: number, callback: AsyncCallback<void>): void
停止定时器,使用callback异步回调。
-**系统接口:** 此接口为系统接口
-
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
@@ -271,8 +262,6 @@ stopTimer(timer: number): Promise<void>
停止定时器,使用Promise异步回调。
-**系统接口:** 此接口为系统接口
-
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
@@ -319,8 +308,6 @@ destroyTimer(timer: number, callback: AsyncCallback<void>): void
销毁定时器,使用callback异步回调。
-**系统接口:** 此接口为系统接口
-
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
@@ -365,8 +352,6 @@ destroyTimer(timer: number): Promise<void>
销毁定时器,使用Promise异步回调。
-**系统接口:** 此接口为系统接口
-
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-taskpool.md b/zh-cn/application-dev/reference/apis/js-apis-taskpool.md
index 30d6b1677b8fe8508455f7fc36764e42579c6c81..02fc84bc6e34d9bc7d7a0efea7d96abf12669d57 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-taskpool.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-taskpool.md
@@ -310,7 +310,7 @@ getTaskPoolInfo(): TaskPoolInfo
**示例:**
```ts
-let taskpoolInfo:TaskPoolInfo = taskpool.getTaskPoolInfo();
+let taskpoolInfo = taskpool.getTaskPoolInfo();
```
## Priority
@@ -363,7 +363,7 @@ for (let i = 0; i < allCount; i++) {
## Task
-表示任务。使用以下方法前,需要先构造Task。
+表示任务。使用[constructor](#constructor)方法构造Task。
### constructor
@@ -404,7 +404,7 @@ let task = new taskpool.Task(printArgs, "this is my first Task");
static isCanceled(): boolean
-检查当前正在运行的任务是否已取消。
+检查当前正在运行的任务是否已取消。使用该方法前需要先构造Task。
**系统能力:** SystemCapability.Utils.Lang
@@ -469,7 +469,7 @@ taskpool.execute(task).then((res)=>{
setTransferList(transfer?: ArrayBuffer[]): void
-设置任务的传输列表。
+设置任务的传输列表。使用该方法前需要先构造Task。
> **说明:**
> 此接口可以设置任务池中ArrayBuffer的transfer列表,transfer列表中的ArrayBuffer对象在传输时不会复制buffer内容到工作线程而是转移buffer控制权至工作线程,传输后当前的ArrayBuffer失效。
@@ -519,7 +519,8 @@ console.info("testTransfer view1 byteLength: " + view1.byteLength);
| arguments | unknown[] | 是 | 是 | 创建任务传入函数所需的参数,支持的参数类型请查[序列化支持类型](#序列化支持类型)。 |
## TaskGroup10+
-表示任务组。使用以下方法前,需要先构造TaskGroup。
+
+表示任务组。使用[constructor](#constructor10)方法构造TaskGroup。
### constructor10+
@@ -539,7 +540,7 @@ let taskGroup = new taskpool.TaskGroup();
addTask(func: Function, ...args: unknown[]): void
-将待执行的函数添加到任务组中。
+将待执行的函数添加到任务组中。使用该方法前需要先构造TaskGroup。
**系统能力:** SystemCapability.Utils.Lang
@@ -575,7 +576,7 @@ taskGroup.addTask(printArgs, 100); // 100: test number
addTask(task: Task): void
-将创建好的任务添加到任务组中。
+将创建好的任务添加到任务组中。使用该方法前需要先构造TaskGroup。
**系统能力:** SystemCapability.Utils.Lang
diff --git a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md
index fe646cc007612c12a8e8ea36e7feb15b8b9e8de0..f529595b5b7acdc8c8febe1651f3d2f5ec58a556 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md
@@ -63,7 +63,7 @@ import wallpaper from '@ohos.wallpaper';
setVideo(source: string, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void
-将视频资源设置为桌面或锁屏的动态壁纸。
+将视频资源设置为桌面或锁屏的动态壁纸。使用callback异步回调。
**需要权限**:ohos.permission.SET_WALLPAPER
@@ -101,7 +101,7 @@ try {
setVideo(source: string, wallpaperType: WallpaperType): Promise<void>
-将视频资源设置为桌面或锁屏的动态壁纸。
+将视频资源设置为桌面或锁屏的动态壁纸。使用promise异步回调。
**需要权限**:ohos.permission.SET_WALLPAPER
@@ -370,7 +370,7 @@ let minWidth = wallpaper.getMinWidthSync();
restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void
-移除指定类型的壁纸,恢复为默认显示的壁纸。
+移除指定类型的壁纸,恢复为默认显示的壁纸。使用callback异步回调。
**需要权限**:ohos.permission.SET_WALLPAPER
@@ -401,7 +401,7 @@ wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => {
restore(wallpaperType: WallpaperType): Promise<void>
-移除指定类型的壁纸,恢复为默认显示的壁纸。
+移除指定类型的壁纸,恢复为默认显示的壁纸。使用promise异步回调。
**需要权限**:ohos.permission.SET_WALLPAPER
@@ -435,7 +435,7 @@ wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => {
setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void
-将指定资源设置为指定类型的壁纸。
+将指定资源设置为指定类型的壁纸。使用callback异步回调。
**需要权限**:ohos.permission.SET_WALLPAPER
@@ -490,7 +490,7 @@ imageSource.createPixelMap(opts).then((pixelMap) => {
setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>
-将指定资源设置为指定类型的壁纸。
+将指定资源设置为指定类型的壁纸。使用promise异步回调。
**需要权限**:ohos.permission.SET_WALLPAPER
@@ -546,7 +546,7 @@ imageSource.createPixelMap(opts).then((pixelMap) => {
getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void;
-获取壁纸图片的像素图。
+获取壁纸图片的像素图。使用callback异步回调。
**需要权限**:ohos.permission.GET_WALLPAPER
@@ -578,7 +578,7 @@ wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM, function (error, da
getImage(wallpaperType: WallpaperType): Promise<image.PixelMap>
-获取壁纸图片的像素图。
+获取壁纸图片的像素图。使用promise异步回调。
**需要权限**:ohos.permission.GET_WALLPAPER
diff --git a/zh-cn/application-dev/reference/apis/js-apis-worker.md b/zh-cn/application-dev/reference/apis/js-apis-worker.md
index 2ae6e87673eda293fe296ae27164873154a38e26..2911e4d1019f42ce76efa715c64e8333505b01cd 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-worker.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-worker.md
@@ -387,7 +387,7 @@ workerInstance.onexit = function(e) {
workerInstance.terminate();
// worker线程:
-//parentPort.close()
+//workerPort.close()
```
@@ -428,7 +428,7 @@ workerInstance.onerror = function(e) {
onmessage?: (event: MessageEvents) => void
-Worker对象的onmessage属性表示宿主线程接收到来自其创建的Worker通过parentPort.postMessage接口发送的消息时被调用的事件处理程序,处理程序在宿主线程中执行。
+Worker对象的onmessage属性表示宿主线程接收到来自其创建的Worker通过workerPort.postMessage接口发送的消息时被调用的事件处理程序,处理程序在宿主线程中执行。
**系统能力:** SystemCapability.Utils.Lang
@@ -1052,8 +1052,8 @@ const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts");
```js
// worker.ts
import worker from '@ohos.worker';
-const parentPort = worker.workerPort;
-parentPort.onmessageerror = function(e) {
+const workerPort = worker.workerPort;
+workerPort.onmessageerror = function(e) {
console.log("worker.ts onmessageerror")
}
```
@@ -1742,11 +1742,11 @@ workerInstance.onmessage = function(e) {
```js
// worker.ts
import worker from '@ohos.worker';
-const parentPort = worker.parentPort;
-parentPort.onmessage = function(e){
+const workerPort = worker.workerPort;
+workerPort.onmessage = function(e){
// let data = e.data;
let buffer = new ArrayBuffer(5)
- parentPort.postMessage(buffer, [buffer]);
+ workerPort.postMessage(buffer, [buffer]);
}
```
@@ -2087,7 +2087,7 @@ Actor并发模型的交互原理:各个Actor并发地处理主线程任务,
- Worker存在数量限制,当前支持最多同时存在8个Worker。
- 在API version 8及之前的版本,当Worker数量超出限制时,会抛出错误Error "Too many workers, the number of workers exceeds the maximum."。
- 从API version 9开始,当Worker数量超出限制时,会抛出错误BusinessError "Worker initialization failure, the number of workers exceeds the maximum."。
-- 主动销毁Worker可以调用新创建Worker对象的terminate()或parentPort.close()方法。
+- 主动销毁Worker可以调用新创建Worker对象的terminate()或workerPort.close()方法。
- 自API version 9版本开始,若Worker处于已经销毁或正在销毁等非运行状态时,调用其功能接口,会抛出相应的BusinessError。
- Worker的创建和销毁耗费性能,建议管理已创建的Worker并重复使用。
- 创建Worker工程时,new worker.Worker构造函数和new worker.ThreadWorker构造函数不能同时使用,否则将导致工程中Worker的功能异常。自API version 9版本开始,建议使用[new worker.ThreadWorker](#constructor9)构造函数,在API version 8及之前的版本,建议使用[new worker.Worker](#constructordeprecated)构造函数。
diff --git a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md
index e96ca170e6bad8a24e02897605ff9a2014ccf705..f4a45159e2b01cf245ee67fd869d4eae8708ec14 100644
--- a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md
+++ b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md
@@ -139,6 +139,7 @@
- [Swiper](ts-container-swiper.md)
- [Tabs](ts-container-tabs.md)
- [TabContent](ts-container-tabcontent.md)
+ - [UIExtensionComponent](ts-container-ui-extension-component.md)
- [WaterFlow](ts-container-waterflow.md)
- 媒体组件
- [Video](ts-media-components-video.md)
@@ -189,5 +190,5 @@
- [类型定义](ts-types.md)
- 已停止维护的组件
- [GridContainer](ts-container-gridcontainer.md)
-- 已停止维护的接口
+- 已停止维护的接口
- [点击控制](ts-universal-attributes-click.md)
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md
index 90a4e4d3d9c2ab1b991dc07d7b6eaa8e5b5ab34b..f8a94c8dad1e015ba978f5f9f4a80469219f60bb 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md
@@ -42,7 +42,7 @@ FormComponent(value: {
| 参数名 | 参数类型 | 必填 | 参数描述 |
| --------- | ------------------------------- | ---- | ----------------------------------------------------------------------- |
-| id | number | 是 | 卡片标识(新建卡片填0)。 |
+| id | number | 是 | 卡片标识(新建卡片填0)。
**说明:**
不同使用方不可使用相同id。
同一使用方使用相同id时,显示后添加的卡片。 |
| name | string | 是 | 卡片名称。 |
| bundle | string | 是 | 目标卡片包名。 |
| ability | string | 是 | 目标卡片Ability名称。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md
index 3f82f6a0f5597d5ffc043f96fd38ff76042f47de..d90e154e8a774c87bc3066a8599ff0004c37eca1 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md
@@ -22,11 +22,17 @@ LoadingProgress()
## 属性
+除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性:
+
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
| color | [ResourceColor](ts-types.md#resourcecolor) | 设置加载进度条前景色。
默认值:'#99666666'。
从API version 9开始,该接口支持在ArkTS卡片中使用。 |
| enableLoading10+ | boolean | 设置LoadingProgress动画显示或者不显示。
默认值:true。
**说明:**
LoadingProgress动画不显示时,该组件依旧占位。
通用属性Visibility.Hidden隐藏的是包括border、padding等整个组件范围,而enableLoading=false只隐藏LoadingProgress本身动画内容,不包括border等。|
+## 事件
+
+支持[通用事件](ts-universal-events-click.md)。
+
## 示例
```ts
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-patternlock.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-patternlock.md
index 99065afdcd9233733cb66d0d4bc08f4b8c74b4b8..79fdf9c09cefd4e110b507d2c002d69bba9f2bc8 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-patternlock.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-patternlock.md
@@ -26,13 +26,13 @@ PatternLock(controller?: PatternLockController)
| 名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------- | ------------------------------------------------------------ |
-| sideLength | [Length](ts-types.md#length) | 设置组件的宽度和高度(宽高相同)。设置为0或负数等非法值时组件不显示。
默认值:300vp |
-| circleRadius | [Length](ts-types.md#length) | 设置宫格中圆点的半径。
默认值:14vp |
+| sideLength | [Length](ts-types.md#length) | 设置组件的宽度和高度(宽高相同)。设置为0或负数时组件不显示。
默认值:288vp |
+| circleRadius | [Length](ts-types.md#length) | 设置宫格中圆点的半径。设置为0或负数时取默认值。
默认值:6vp |
| regularColor | [ResourceColor](ts-types.md#resourcecolor) | 设置宫格圆点在“未选中”状态的填充颜色。
默认值:Color.Black |
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置宫格圆点在“选中”状态的填充颜色。
默认值:Color.Black |
| activeColor | [ResourceColor](ts-types.md#resourcecolor) | 设置宫格圆点在“激活”状态的填充颜色(“激活”状态为手指经过圆点但还未选中的状态)。
默认值:Color.Black |
| pathColor | [ResourceColor](ts-types.md#resourcecolor) | 设置连线的颜色。
默认值:Color.Blue |
-| pathStrokeWidth | number \| string | 设置连线的宽度。设置为0或负数等非法值时连线不显示。
默认值:34vp |
+| pathStrokeWidth | number \| string | 设置连线的宽度。设置为0或负数时连线不显示。
默认值:12vp |
| autoReset | boolean | 设置在完成密码输入后再次在组件区域按下时是否重置组件状态。设置为true,完成密码输入后再次在组件区域按下时会重置组件状态(即清除之前输入的密码);反之若设置为false,则不会重置组件状态。
默认值:true |
## 事件
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md
index 16d0c313fe393f4a6c4674dbfa8acb78d6f51100..1c49339e8dd4360403ae19cad9ea9f51421add09 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md
@@ -27,6 +27,10 @@ RichEditor(value: RichEditorOptions)
支持[通用属性](ts-universal-attributes-size.md)。
+> **说明:**
+>
+> 其中clip属性默认值为true。
+
## 事件
除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件:
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md
index 5e7366aa0c08fcbd35d10b3f742439e7200ea908..66c61449bc1b05ea49b9320767b1e8551194b471 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md
@@ -48,7 +48,7 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, sty
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的已滑动部分颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 |
| showSteps | boolean | 设置当前是否显示步长刻度值。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。|
| showTips | value: boolean,
content10+?: [ResourceStr](ts-types.md#resourcestr) | value:设置滑动时是否显示气泡提示。
默认值:false
content:设置气泡提示的文本内容,默认显示当前百分比。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
当direction的值为Axis.Horizontal时,tip显示在滑块正上方。值为Axis.Vertical时,tip显示在滑块正左边。
tip的绘制区域为Slider自身节点的overlay。
Slider不设置边距或者边距比较小时,tip会被截断。|
-| trackThickness | [Length](ts-types.md#length) | 设置滑轨的粗细。
默认值:当参数style的值设置[SliderStyle](#sliderstyle枚举说明).OutSet 时为 4.0vp,[SliderStyle](#sliderstyle枚举说明).InSet时为20.0vp
从APIversion9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置为小于0的值时,按默认值显示。 |
+| trackThickness | [Length](ts-types.md#length) | 设置滑轨的粗细。
默认值:当参数style的值设置[SliderStyle](#sliderstyle枚举说明).OutSet 时为 4.0vp,[SliderStyle](#sliderstyle枚举说明).InSet时为20.0vp
从APIversion9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置为小于等于0的值时,按默认值显示。 |
| blockBorderColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置滑块描边颜色。 |
| blockBorderWidth10+ | [Length](ts-types.md#length) | 设置滑块描边粗细。 |
| stepColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置刻度颜色。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md
index cb28b74e70fdd9ccb2df68548a07b1fcbf65ba6f..f16a41bafda788ca4e1d719bb0dfd9c175fb6583 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md
@@ -272,39 +272,39 @@
- [ScrollBar](ts-basic-components-scrollbar.md)
滚动条组件,用于配合可滚动组件使用,如List、Grid、Scroll等。
-
+
- [Badge](ts-container-badge.md)
可以附加在单个组件上用于信息标记的容器组件。
-
+
- [AlphabetIndexer](ts-container-alphabet-indexer.md)
可以与容器组件联动用于按逻辑结构快速定位容器显示区域的索引条组件。
-
+
- [Panel](ts-container-panel.md)
可滑动面板,提供一种轻量的内容展示窗口,方便在不同尺寸中切换。
-
+
- [Refresh](ts-container-refresh.md)
可以进行页面下拉操作并显示刷新动效的容器组件。
-
+
- [AbilityComponent](ts-container-ability-component.md)
独立显示Ability的容器组件。
-
+
- [RemoteWindow](ts-basic-components-remotewindow.md)
远程控制窗口组件,可以通过此组件控制应用窗口,提供启动退出过程中控件动画和应用窗口联动动画的能力。
-
+
- [FormComponent](ts-basic-components-formcomponent.md)
提供卡片组件,实现卡片的显示功能。
-
+
- [FormLink](ts-container-formlink.md)
提供静态卡片事件交互功能。
-
+
- [Hyperlink](ts-container-hyperlink.md)
超链接组件,组件宽高范围内点击实现跳转。
@@ -312,11 +312,15 @@
- [Menu](ts-basic-components-menu.md)
以垂直列表形式显示的菜单。
-
+
- [MenuItem](ts-basic-components-menuitem.md)
用来展示菜单Menu中具体的item菜单项。
-
+
- [MenuItemGroup](ts-basic-components-menuitemgroup.md)
用来展示菜单MenuItem的分组。
+
+- [UIExtensionComponent](ts-container-ui-extension-component.md)
+
+ 在页面中嵌入显示带UI界面的Ability扩展的容器组件。
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md
index 78cb06ee049134bc9fd87a72a02fc1af3db7e37d..7702bf2fd524ddf4e6000ab0749640c78016354a 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md
@@ -97,9 +97,10 @@ List垂直布局,ListItem向右滑动,item左边的长距离滑动删除选
| -------- | -------- |
| onSelect(event: (isSelected: boolean) => void)8+ | ListItem元素被鼠标框选的状态改变时触发回调。
isSelected:进入鼠标框选范围即被选中返回true, 移出鼠标框选范围即未被选中返回false。 |
-
## 示例
+### 示例1
+
```ts
// xxx.ets
@Entry
@@ -126,6 +127,8 @@ struct ListItemExample {

+### 示例2
+
```ts
// xxx.ets
@@ -161,19 +164,18 @@ struct ListItemExample2 {
.swipeAction({
end: {
builder: this.itemEnd.bind(this, item),
- useDefaultDeleteAnimation: true,
- onDelete: () => {
+ onAction: () => {
animateTo({ duration: 1000 }, () => {
let index = this.arr.indexOf(item)
this.arr.splice(index, 1)
})
},
- deleteAreaDistance: 80,
- onEnterDeleteArea: () => {
+ actionAreaDistance: 80,
+ onEnterActionArea: () => {
this.enterEndDeleteAreaString = "enterEndDeleteArea"
this.exitEndDeleteAreaString = "not exitEndDeleteArea"
},
- onExitDeleteArea: () => {
+ onExitActionArea: () => {
this.enterEndDeleteAreaString = "not enterEndDeleteArea"
this.exitEndDeleteAreaString = "exitEndDeleteArea"
}
@@ -193,7 +195,8 @@ struct ListItemExample2 {
```

-## 示例3
+### 示例3
+
```ts
// xxx.ets
@Entry
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md
index 7a8703cdd40b24dc4be868e026ed195004ae5e4b..14eeab03c89f587dcf09e6f8f63f78d13caf3984 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md
@@ -46,8 +46,8 @@ SideBarContainer( type?: SideBarContainerType )
| controlButton | [ButtonStyle](#buttonstyle对象说明) | 设置侧边栏控制按钮的属性。 |
| showControlButton | boolean | 设置是否显示控制按钮。
默认值:true |
| sideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏的宽度。
默认值:240vp
单位:vp
**说明:**
API version 9及以下版本默认值为200vp,API version 10的默认值为240vp。
设置为小于0的值时按默认值显示。
受最小宽度和最大宽度限制,不在限制区域内取最近的点。
sideBarWidth优先于侧边栏子组件width,sideBarWidth未设置时默认值优先级高于侧边栏子组件width。 |
-| minSideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏最小宽度。
默认值:240vp
单位:vp
**说明:**
API version 9及以下版本默认值为200vp,API version 10的默认值为240vp。
设置为小于0的值时按默认值显示。
值不能超过侧边栏容器本身宽度,超过使用侧边栏容器本身宽度。
minSideBarWidth优先于侧边栏子组件minWidth,minSideBarWidth未设置时默认值优先级低于侧边栏子组件minWidth。 |
-| maxSideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏最大宽度。
默认值:280vp
单位:vp
**说明:**
设置为小于0的值时按默认值显示。
值不能超过侧边栏容器本身宽度,超过使用侧边栏容器本身宽度。
maxSideBarWidth优先于侧边栏子组件maxWidth,maxSideBarWidth未设置时默认值优先级低于侧边栏子组件maxWidth。 |
+| minSideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏最小宽度。
默认值:240vp
单位:vp
**说明:**
API version 9及以下版本默认值为200vp,API version 10的默认值为240vp。
设置为小于0的值时按默认值显示。
值不能超过侧边栏容器本身宽度,超过使用侧边栏容器本身宽度。
minSideBarWidth优先于侧边栏子组件minWidth,minSideBarWidth未设置时默认值优先级高于侧边栏子组件minWidth。 |
+| maxSideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏最大宽度。
默认值:280vp
单位:vp
**说明:**
设置为小于0的值时按默认值显示。
值不能超过侧边栏容器本身宽度,超过使用侧边栏容器本身宽度。
maxSideBarWidth优先于侧边栏子组件maxWidth,maxSideBarWidth未设置时默认值优先级高于侧边栏子组件maxWidth。 |
| autoHide9+ | boolean | 设置当侧边栏拖拽到小于最小宽度后,是否自动隐藏。
默认值:true
**说明:**
受minSideBarWidth属性方法影响,minSideBarWidth属性方法未设置值使用默认值。
拖拽过程中判断是否要自动隐藏。小于最小宽度时需要阻尼效果触发隐藏(越界一段距离) |
| sideBarPosition9+ | [SideBarPosition](#sidebarposition9枚举说明) | 设置侧边栏显示位置。
默认值:SideBarPosition.Start |
| divider10+ | [DividerStyle](#dividerstyle10对象说明) \| null | 设置分割线的样式。
- 默认为DividerStyle:显示分割线。
- null:不显示分割线。 |
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md
index 3735108a93820e37f711e00e867a5bdbe7b00934..5db42c5d42ca0cb43e5b8f93735110f5f92980c9 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-swiper.md
@@ -134,11 +134,11 @@ finishAnimation(callback?: () => void): void
| 参数名 | 参数类型 | 必填项 | 参数描述 |
| ---------------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| isShowBackground | boolean | 否 | 设置箭头底板是否显示。
默认值:false |
+| showBackground | boolean | 否 | 设置箭头底板是否显示。
默认值:false |
| isSidebarMiddle | boolean | 否 | 设置箭头显示位置。
默认值:false
默认显示在导航点指示器两侧。 |
| backgroundSize | [Length](ts-types.md#length) | 否 | 设置底板大小。
在导航点两侧显示:
默认值:24vp
在组件两侧显示:
默认值:32vp
不支持设置百分比。 |
| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置底板颜色。
在导航点两侧显示:
默认值:\#19182431
在组件两侧显示:
默认值:\#00000000 |
-| arrowSize | [Length](ts-types.md#length) | 否 | 设置箭头大小。
在导航点两侧显示时:
默认值:18vp
在组件两侧显示时:
默认值:24vp
**说明:**
isShowBackground为true时,arrowSize为backgroundSize的3/4。
不支持设置百分比。 |
+| arrowSize | [Length](ts-types.md#length) | 否 | 设置箭头大小。
在导航点两侧显示时:
默认值:18vp
在组件两侧显示时:
默认值:24vp
**说明:**
showBackground为true时,arrowSize为backgroundSize的3/4。
不支持设置百分比。 |
| arrowColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置箭头颜色。
默认值:\#182431 |
## SwiperAutoFill10+
@@ -219,7 +219,7 @@ struct SwiperExample {
.duration(1000)
.itemSpace(0)
.displayArrow({
- isShowBackground:true,
+ showBackground:true,
isSidebarMiddle:true,
backgroundSize:24,
backgroundColor:Color.White,
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-ui-extension-component.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-ui-extension-component.md
new file mode 100644
index 0000000000000000000000000000000000000000..a24cfce3bbd72d22ea4b2eb41d9bb5aab5b7e3c0
--- /dev/null
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-ui-extension-component.md
@@ -0,0 +1,253 @@
+# UIExtensionComponent
+
+UIExtensionComponent用于支持在本页面内嵌入其他应用提供的UI。展示的内容在另外一个进程中运行,本应用并不参与其中的布局和渲染。
+
+通常用于有进程隔离诉求的模块化开发场景。
+
+> **说明:**
+>
+> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
+>
+> 本组件为系统接口。
+
+## 使用约束
+
+本组件不支持预览。
+
+被拉起的Ability必须是带UI的Ability扩展,如何实现带UI的Ability扩展请参考[实现带UI的Ability扩展](../apis/js-apis-app-ability-uiExtensionAbility.md)。
+
+必须显示设置组件宽高为非0有效值。
+
+## 子组件
+
+无
+
+## 接口
+
+UIExtensionComponent(want: Want)
+
+**参数:**
+
+| 参数名 | 参数类型 | 必填 | 参数描述 |
+| ---- | ---------------------------------------- | ---- | --------------- |
+| want | [Want](../apis/js-apis-app-ability-want.md) | 是 | 要加载的Ability。 |
+
+## UIExtensionProxy
+
+用于在双方建立连接成功后,组件使用方向被拉起的Ability发送数据的场景,提供send方法。
+
+### send
+
+send(data: { [key: string]: Object }): void
+
+**参数:**
+| 参数名 | 参数类型 | 必填 | 参数描述 |
+| ---- | ---------------------------------------- | ---- | --------------- |
+| data | { [key: string]: Object } | 是 | 发送给被拉起的扩展Ability的数据。 |
+
+## 属性
+
+支持[通用属性](ts-universal-attributes-size.md)。
+
+## 事件
+
+不支持[通用事件](ts-universal-events-click.md)。
+
+将事件经过坐标转换后传递给对端Ability处理。
+
+支持以下事件:
+
+### onRemoteReady
+
+onRemoteReady(callback: [Callback](../apis/js-apis-base.md#callback)\)
+
+UIExtensionAbility连接完成时的回调,之后可使用proxy向被拉起的Ability发送数据。
+
+**参数:**
+
+| 参数名 | 类型 | 说明 |
+| ---------------------------- | ------ | ------------------------------------------------------------ |
+| proxy | UIExtensionProxy | 用于向对端Ability发送数据。 |
+
+### onReceive
+
+onReceive(callback: [Callback](../apis/js-apis-base.md#callback)\<{ [key: string]: Object }>)
+
+收到被拉起的Ability发送的数据时触发的回调。
+
+**参数:**
+
+| 参数名 | 类型 | 说明 |
+| ---------------------------- | ------ | ------------------------------------------------------------ |
+| data | { [key: string]: Object } | 收到来自对端Ability的数据。 |
+
+### onResult
+
+onResult(callback: [Callback](../apis/js-apis-base.md#callback)\<{code: number; want?: Want}>)
+
+被拉起的Ability扩展调用terminateSelfWithResult时会先触发本回调函数,再触发OnRelease。
+
+本回调内可处理对端Ability的结果数据,可参考[AbilityResult](../apis/js-apis-inner-ability-abilityResult.md)。
+
+| 参数名 | 类型 | 说明 |
+| ---------------------------- | ------ | ------------------------------------------------------------ |
+| code | number | 收到来自对端Ability的处理結果code。 |
+| want | Want | 收到来自对端Ability的处理結果[Want](../apis/js-apis-app-ability-want.md)。 |
+
+### onRelease
+
+onRelease(callback: [Callback](../apis/js-apis-base.md#callback)\)
+
+用于处理被拉起的Ability销毁时的回调。
+
+被拉起的Ability扩展调用terminateSelfWithResult或者terminateSelf时会触发本回调,此时releaseCode为0,即正常销毁。
+
+被拉起的Ability扩展意外Crash或被kill时,触发本回调,此时releaseCode为1,即异常死亡。
+
+| 参数名 | 类型 | 说明 |
+| ---------------------------- | ------ | ------------------------------------------------------------ |
+| releaseCode | number | 对端Ability销毁时的code,0为正常销毁,1为异常销毁。 |
+
+### onError
+
+onError(callback:[ErrorCallback](../apis/js-apis-base.md#errorcallback))
+
+被拉起的Ability扩展在运行过程中发生异常时触发本回调。可通过回调参数中的code、name和message获取错误信息并做处理。
+
+| 参数名 | 类型 | 说明 |
+| ---------------------------- | ------ | ------------------------------------------------------------ |
+| err | [BusinessError](../apis/js-apis-base.md#businesserror) | 报错信息。 |
+
+## 示例
+
+本示例仅展示组件使用的方法和扩展的Ability,实际运行需在设备中安装bundleName为"com.example.uiextensionprovider",abilityName为"UIExtensionProvider"的Ability扩展。
+
+```ts
+// 组件使用示例:
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World'
+ private myProxy: UIExtensionProxy
+ build() {
+ Row() {
+ Column() {
+ Text(this.message).fontColor(Color.Red)
+ UIExtensionComponent(
+ {
+ bundleName: "com.example.uiextensionprovider",
+ abilityName: "UIExtensionProvider",
+ parameters: { "x": 12345, "y": "data" }
+ }
+ )
+ .size({ width: "100%", height:"100%" })
+ .onRemoteReady((proxy) => {
+ this.message = "remote ready"
+ this.myProxy = proxy
+ })
+ .onReceive((data) => {
+ this.message = JSON.stringify(data)
+ })
+ .onRelease((releaseCode) => {
+ this.message = "Release: " + releaseCode
+ })
+ .onResult((data) => {
+ this.message = JSON.stringify(data)
+ })
+ .onError((error) => {
+ this.message = "onError: " + error["code"] + ", name: " + error.name + ", message: " + error.message
+ })
+ Button("sendData").onClick(() => {
+ this.myProxy.send({ "x": 5678910 })
+ })
+ }
+ .width("100%")
+ }
+ .height('100%')
+ }
+}
+```
+
+```ts
+// 扩展入口文件UIExtensionProvider.ts
+import UIExtensionAbility from '@ohos.app.ability.UIExtensionAbility'
+const TAG: string = '[UIExtAbility]'
+export default class UIExtAbility extends UIExtensionAbility {
+ onCreate() {
+ console.log(TAG, `UIExtAbility onCreate`)
+ }
+
+ onForeground() {
+ console.log(TAG, `UIExtAbility onForeground`)
+ }
+
+ onBackground() {
+ console.log(TAG, `UIExtAbility onBackground`)
+ }
+
+ onDestroy() {
+ console.log(TAG, `UIExtAbility onDestroy`)
+ }
+
+ onSessionCreate(want, session) {
+ console.log(TAG, `UIExtAbility onSessionCreate, want: ${JSON.stringify(want)}`)
+ let storage: LocalStorage = new LocalStorage({
+ 'session': session
+ });
+ session.loadContent('pages/extension', storage);
+ }
+
+ onSessionDestroy(session) {
+ console.log(TAG, `UIExtAbility onSessionDestroy`)
+ }
+}
+```
+
+```ts
+// 扩展Ability入口页面文件extension.ets
+import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession'
+let storage = LocalStorage.GetShared()
+@Entry(storage)
+@Component
+struct Index {
+ @State message: string = 'UIExtension'
+ @State message2:string = 'message from comp'
+ private session: UIExtensionContentSession = storage.get('session');
+ controller: TextInputController = new TextInputController()
+ onPageShow() {
+ this.session.setReceiveDataCallback((data)=> {
+ this.message2 = "data come from comp"
+ this.message = JSON.stringify(data)
+ })
+ }
+ build() {
+ Row() {
+ Column() {
+ Text(this.message2)
+ Text(this.message)
+ Button("sendData")
+ .onClick(()=>{
+ this.session.sendData({"xxx": "data from extension"})
+ })
+ Button("terminateSelf")
+ .onClick(()=>{
+ this.session.terminateSelf();
+ storage.clear();
+ }).margin(5)
+ Button("TerminateSelfWithResult")
+ .onClick(()=>{
+ this.session.terminateSelfWithResult({
+ "resultCode": 0,
+ "want": {
+ "bundleName": "myName"
+ }
+ });
+ storage.clear();
+ }).margin(5)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md
index 7b7bbcf002c7b6c351e3ef1e0d21f809d1383b14..3c4242aa7b50640606c83bea7ecd29f3a3092f04 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md
@@ -11,7 +11,7 @@
| 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- |
-| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**说明:**
path中支持使用start和end进行起点和终点的替代,如:
'Mstart.x start.y L50 50 Lend.x end.y Z',更多说明请参考[绘制路径](../../ui/ui-js-components-svg-path.md)。 | {
'',
0.0,
1.0,
false
} | 设置组件的运动路径,入参说明如下:
- path:位移动画的运动路径,使用svg路径字符串。
- from:运动路径的起点。
默认值:0.0
取值范围:[0, 1]
设置小于0的值时,按值为0处理。设置大于1的值时,按值为1处理。
- to:运动路径的终点。
默认值:1.0
取值范围:[0, 1]
设置小于0的值时,按值为0处理。设置大于1的值时,按值为1处理。
- rotatable:是否跟随路径进行旋转。 |
+| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
} | {
'',
0.0,
1.0,
false
} | 设置组件的运动路径,入参说明如下:
- path:位移动画的运动路径,使用svg路径字符串。path中支持使用start和end进行起点和终点的替代,如:'Mstart.x start.y L50 50 Lend.x end.y Z',更多说明请参考[绘制路径](../../ui/ui-js-components-svg-path.md)。
- from:运动路径的起点。
默认值:0.0
取值范围:[0, 1]
设置小于0或大于1的值时,按默认值0处理。
- to:运动路径的终点。
默认值:1.0
取值范围:[0, 1]
设置小于0或大于1的值时,按默认值1处理,且满足to值 >= 异常值处理后的from值。
- rotatable:是否跟随路径进行旋转。 |
## 示例
diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md
index 82a36dcb92d43a64fbfba913730c178361d6c731..fed2675f1716b9bf75a349d0bab19e125ce27a08 100644
--- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md
+++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md
@@ -88,12 +88,16 @@ struct Index {
getDataFromUdmfRetry(event: DragEvent, callback: (data: DragEvent)=>void)
{
- let records: Array = event.getData().getRecords();
- if (records.length !== 0) {
- callback(event);
- return true;
+ let data = event.getData();
+ if (!data) {
+ return false;
}
- return false;
+ let records: Array = data.getRecords();
+ if (!records || records.length <= 0) {
+ return false;
+ }
+ callback(event);
+ return true;
}
getDataFromUdmf(event: DragEvent, callback: (data: DragEvent)=>void)
diff --git a/zh-cn/application-dev/reference/native-apis/Readme-CN.md b/zh-cn/application-dev/reference/native-apis/Readme-CN.md
index ca14570f8c6c8989b36fa8fc5ee57f81de78a93f..dfc4354726cbe3b25cb861b1a3c851132e166791 100644
--- a/zh-cn/application-dev/reference/native-apis/Readme-CN.md
+++ b/zh-cn/application-dev/reference/native-apis/Readme-CN.md
@@ -24,6 +24,7 @@
- [AVDemuxer](_a_v_demuxer.md)
- [AVSource](_a_v_source.md)
- [OHAudio](_o_h_audio.md)
+ - [AVScreenCapture](_a_v_screen_capture.md)
- [HuksKeyApi](_huks_key_api.md)
- [HuksParamSetApi](_huks_param_set_api.md)
- [HuksTypeApi](_huks_type_api.md)
@@ -85,6 +86,9 @@
- [native_audiorenderer.h](native__audiorenderer_8h.md)
- [native_audiostream_base.h](native__audiostream__base_8h.md)
- [native_audiostreambuilder.h](native__audiostreambuilder_8h.md)
+ - [native_avscreen_capture.h](native__avscreen__capture_8h.md)
+ - [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md)
+ - [native_avscreen_capture_errors.h](native__avscreen__capture__errors_8h.md)
- [native_huks_api.h](native__huks__api_8h.md)
- [native_huks_param.h](native__huks__param_8h.md)
- [native_huks_type.h](native__huks__type_8h.md)
@@ -142,6 +146,17 @@
- [OH_AVRange](_o_h___a_v_range.md)
- [OH_AudioCapturer_Callbacks_Struct](_o_h___audio_capturer___callbacks___struct.md)
- [OH_AudioRenderer_Callbacks_Struct](_o_h___audio_renderer___callbacks___struct.md)
+ - [OH_AudioBuffer](_o_h___audio_buffer.md)
+ - [OH_AudioCaptureInfo](_o_h___audio_capture_info.md)
+ - [OH_AudioEncInfo](_o_h___audio_enc_info.md)
+ - [OH_AudioInfo](_o_h___audio_info.md)
+ - [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md)
+ - [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md)
+ - [OH_RecorderInfo](_o_h___recorder_info.md)
+ - [OH_Rect](_o_h___rect.md)
+ - [OH_VideoCaptureInfo](_o_h___video_capture_info.md)
+ - [OH_VideoEncInfo](_o_h___video_enc_info.md)
+ - [OH_VideoInfo](_o_h___video_info.md)
- [OH_Huks_Blob](_o_h___huks___blob.md)
- [OH_Huks_CertChain](_o_h___huks___cert_chain.md)
- [OH_Huks_KeyInfo](_o_h___huks___key_info.md)
diff --git a/zh-cn/application-dev/reference/native-apis/_a_v_screen_capture.md b/zh-cn/application-dev/reference/native-apis/_a_v_screen_capture.md
new file mode 100644
index 0000000000000000000000000000000000000000..074d845d3bfcb7efe24323e4fc1cf7a2e0ebfb54
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_a_v_screen_capture.md
@@ -0,0 +1,1044 @@
+# AVScreenCapture
+
+
+## 概述
+
+调用本模块下的接口,应用可以完成屏幕录制的功能。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+
+## 汇总
+
+
+### 文件
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [native_avscreen_capture.h](native__avscreen__capture_8h.md) | 声明用于构造屏幕录制对象的Native API。
**引用文件**:
**库**:libnative_avscreen_capture.so |
+| [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) | 声明用于运行屏幕录制通用的结构体、字符常量、枚举。
**引用文件**:
**库**:libnative_avscreen_capture.so |
+| [native_avscreen_capture_errors.h](native__avscreen__capture__errors_8h.md) | 声明用于运行屏幕录制过程中接口调用的错误码说明。
**引用文件**:
**库**:libnative_avscreen_capture.so |
+
+
+### 结构体
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) | 音频录制信息。 |
+| [OH_AudioEncInfo](_o_h___audio_enc_info.md) | 音频编码信息。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AudioInfo](_o_h___audio_info.md) | 音频录制参数。 |
+| [OH_VideoCaptureInfo](_o_h___video_capture_info.md) | 视频采集信息。 |
+| [OH_VideoEncInfo](_o_h___video_enc_info.md) | 视频编码信息。
**说明:** 预留接口,将在后续版本提供。|
+| [OH_VideoInfo](_o_h___video_info.md) | 视频录制参数。 |
+| [OH_RecorderInfo](_o_h___recorder_info.md) | 录制文件信息。
**说明:** 预留接口,将在后续版本提供。|
+| [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) | 屏幕录制配置参数。 |
+| [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) | OH_AVScreenCapture中所有异步回调函数指针的集合。 |
+| [OH_Rect](_o_h___rect.md) | 定义录屏界面的宽高以及画面信息。 |
+| [OH_AudioBuffer](_o_h___audio_buffer.md) | 定义了音频数据的大小,类型,时间戳等配置信息。 |
+
+
+### 类型定义
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_NativeBuffer](#oh_nativebuffer) | 提供录屏的视频原始码流类。 |
+| [OH_AVScreenCapture](#oh_avscreencapture) | 通过OH_AVScreenCapture可以获取视频与音频的原始码流。 |
+| [OH_CaptureMode](#oh_capturemode) | 枚举,表示屏幕录制的不同模式。 |
+| [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) | 枚举,表示屏幕录制时的音频源类型。 |
+| [OH_AudioCodecFormat](#oh_audiocodecformat) | 枚举,表示音频编码格式。 |
+| [OH_VideoCodecFormat](#oh_videocodecformat) | 枚举,表示视频编码格式。 |
+| [OH_DataType](#oh_datatype) | 枚举,表示屏幕录制流的数据格式。 |
+| [OH_VideoSourceType](#oh_videosourcetype) | 枚举,表示视频源格式。 |
+| [OH_ContainerFormatType](#oh_containerformattype) | 枚举,表示屏幕录制生成的文件类型。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AudioCaptureInfo](#oh_audiocaptureinfo) | 音频录制信息。 |
+| [OH_AudioEncInfo](#oh_audioencinfo) | 音频编码信息。
**说明:** 预留接口,将在后续版本提供。|
+| [OH_AudioInfo](#oh_audioinfo) | 音频录制参数。 |
+| [OH_VideoCaptureInfo](#oh_videocaptureinfo) | 视频采集信息。 |
+| [OH_VideoEncInfo](#oh_videoencinfo) | 视频编码信息。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_VideoInfo](#oh_videoinfo) | 视频录制参数。 |
+| [OH_RecorderInfo](#oh_recorderinfo) | 录制文件信息。 |
+| [OH_AVScreenCaptureConfig](#oh_avscreencaptureconfig) | 屏幕录制配置参数。 |
+| (\*[OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t errorCode) | 当OH_AVScreenCapture实例运行出错时,将调用函数指针。 |
+| (\*[OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isReady, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | 当OH_AVScreenCapture操作期间音频缓冲区可用时,将调用函数指针。 |
+| (\*[OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isReady) | 当OH_AVScreenCapture操作期间视频缓冲区可用时,将调用函数指针。 |
+| [OH_AVScreenCaptureCallback](#oh_avscreencapturecallback) | OH_AVScreenCapture中所有异步回调函数指针的集合。 |
+| [OH_Rect](#oh_rect) | 定义录屏界面的宽高以及画面信息。 |
+| [OH_AudioBuffer](#oh_audiobuffer) | 定义了音频数据的大小,类型,时间戳等配置信息。 |
+| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) | 屏幕录制过程中产生的不同结果码。 |
+
+
+### 枚举
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_CaptureMode](#oh_capturemode) { OH_CAPTURE_HOME_SCREEN = 0, OH_CAPTURE_SPECIFIED_SCREEN = 1, OH_CAPTURE_SPECIFIED_WINDOW = 2, OH_CAPTURE_INVAILD = -1 } | 枚举,表示屏幕录制的不同模式。 |
+| [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) {
OH_SOURCE_INVALID = -1, OH_SOURCE_DEFAULT = 0, OH_MIC = 1, OH_ALL_PLAYBACK = 2,
OH_APP_PLAYBACK = 3
} | 枚举,表示屏幕录制时的音频源类型。 |
+| [OH_AudioCodecFormat](#oh_audiocodecformat) { OH_AUDIO_DEFAULT = 0, OH_AAC_LC = 3, OH_AUDIO_CODEC_FORMAT_BUTT } | 枚举,表示音频编码格式。 |
+| [OH_VideoCodecFormat](#oh_videocodecformat) {
OH_VIDEO_DEFAULT = 0, OH_H264 = 2, OH_H265 = 4, OH_MPEG4 = 6,
OH_VP8 = 8, OH_VP9 = 10, OH_VIDEO_CODEC_FORMAT_BUTT
} | 枚举,表示视频编码格式。 |
+| [OH_DataType](#oh_datatype) { OH_ORIGINAL_STREAM = 0, OH_ENCODED_STREAM = 1, OH_CAPTURE_FILE = 2, OH_INVAILD = -1 } | 枚举,表示屏幕录制流的数据格式。 |
+| [OH_VideoSourceType](#oh_videosourcetype) { OH_VIDEO_SOURCE_SURFACE_YUV = 0, OH_VIDEO_SOURCE_SURFACE_ES, OH_VIDEO_SOURCE_SURFACE_RGBA, OH_VIDEO_SOURCE_BUTT } | 枚举,表示视频源格式。 |
+| [OH_ContainerFormatType](#oh_containerformattype) { CFT_MPEG_4A = 0, CFT_MPEG_4 = 1 } | 枚举,表示屏幕录制生成的文件类型。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) {
AV_SCREEN_CAPTURE_ERR_BASE = 0, AV_SCREEN_CAPTURE_ERR_OK = AV_SCREEN_CAPTURE_ERR_BASE, AV_SCREEN_CAPTURE_ERR_NO_MEMORY = AV_SCREEN_CAPTURE_ERR_BASE + 1, AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT = AV_SCREEN_CAPTURE_ERR_BASE + 2,
AV_SCREEN_CAPTURE_ERR_INVALID_VAL = AV_SCREEN_CAPTURE_ERR_BASE + 3, AV_SCREEN_CAPTURE_ERR_IO = AV_SCREEN_CAPTURE_ERR_BASE + 4, AV_SCREEN_CAPTURE_ERR_TIMEOUT = AV_SCREEN_CAPTURE_ERR_BASE + 5, AV_SCREEN_CAPTURE_ERR_UNKNOWN = AV_SCREEN_CAPTURE_ERR_BASE + 6,
AV_SCREEN_CAPTURE_ERR_SERVICE_DIED = AV_SCREEN_CAPTURE_ERR_BASE + 7, AV_SCREEN_CAPTURE_ERR_INVALID_STATE = AV_SCREEN_CAPTURE_ERR_BASE + 8, AV_SCREEN_CAPTURE_ERR_UNSUPPORT = AV_SCREEN_CAPTURE_ERR_BASE + 9, AV_SCREEN_CAPTURE_ERR_EXTEND_START = AV_SCREEN_CAPTURE_ERR_BASE + 100
} | 屏幕录制过程中产生的不同结果码。 |
+
+
+### 函数
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_AVScreenCapture_Create](#oh_avscreencapture_create) (void) | 实例化对象,创建OH_AVScreenCapture。 |
+| [OH_AVScreenCapture_Init](#oh_avscreencapture_init) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) config) | 初始化OH_AVScreenCapture相关参数。 |
+| [OH_AVScreenCapture_StartScreenCapture](#oh_avscreencapture_startscreencapture) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | 开始录屏,采集原始码流。调用后可以通过回调的监听(OH_AVScreenCaptureOnAudioBufferAvailable,OH_AVScreenCaptureOnVideoBufferAvailable)来监听当前是否有码流的产生。 |
+| [OH_AVScreenCapture_StopScreenCapture](#oh_avscreencapture_stopscreencapture) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | 结束录屏,与OH_AVScreenCapture_StartScreenCapture配合使用。调用后针对调用该接口的应用会停止录屏或屏幕共享,释放麦克风。 |
+| [OH_AVScreenCapture_StartScreenRecording](#oh_avscreencapture_startscreenrecording) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | 启动录屏,调用此接口,可采集编码后的码流。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AVScreenCapture_StopScreenRecording](#oh_avscreencapture_stopscreenrecording) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | 停止录屏,与OH_AVScreenCapture_StartScreenRecording配合使用。
**说明:** 预留接口,将在后续版本提供。|
+| [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AudioBuffer](_o_h___audio_buffer.md) \*\*audiobuffer, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | 获取音频buffer,应用在调用时,需要对audiobuffer分配对应结构体大小的内存,否则会影响拿到音频buffer的获取。 |
+| [OH_AVScreenCapture_AcquireVideoBuffer](#oh_avscreencapture_acquirevideobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t \*fence, int64_t \*timestamp, struct [OH_Rect](_o_h___rect.md) \*region) | 获取视频buffer,应用在调用时,通过此接口来获取到视频的buffer以及时间戳等信息。 |
+| [OH_AVScreenCapture_ReleaseAudioBuffer](#oh_avscreencapture_releaseaudiobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | 根据音频类型释放buffer。 |
+| [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | 根据视频类型释放buffer。 |
+| [OH_AVScreenCapture_SetCallback](#oh_avscreencapture_setcallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) callback) | 设置监听接口,通过设置监听,可以监听到调用过程中的错误信息,以及是否有可用的视频buffer和音频buffer。 |
+| [OH_AVScreenCapture_Release](#oh_avscreencapture_release) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | 释放创建的OH_AVScreenCapture实例,对应OH_AVScreenCapture_Create。 |
+| [OH_AVScreenCapture_SetMicrophoneEnabled](#oh_avscreencapture_setmicrophoneenabled) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isMicrophone) | 设置麦克风开关。 |
+
+
+## 类型定义说明
+
+
+### OH_AudioBuffer
+
+```
+typedef struct OH_AudioBuffer OH_AudioBuffer
+```
+
+**描述:**
+
+定义了音频数据的大小,类型,时间戳等配置信息。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AudioCaptureInfo
+
+```
+typedef struct OH_AudioCaptureInfo OH_AudioCaptureInfo
+```
+
+**描述:**
+
+音频录制信息。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AudioCaptureSourceType
+
+```
+typedef enum OH_AudioCaptureSourceType OH_AudioCaptureSourceType
+```
+
+**描述:**
+
+枚举,表示屏幕录制时的音频源类型。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AudioCodecFormat
+
+```
+typedef enum OH_AudioCodecFormat OH_AudioCodecFormat
+```
+
+**描述:**
+
+枚举,表示音频编码格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AudioEncInfo
+
+```
+typedef struct OH_AudioEncInfo OH_AudioEncInfo
+```
+
+**描述:**
+
+音频编码信息。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AudioInfo
+
+```
+typedef struct OH_AudioInfo OH_AudioInfo
+```
+
+**描述:**
+
+音频录制参数。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AVSCREEN_CAPTURE_ErrCode
+
+```
+typedef enum OH_AVSCREEN_CAPTURE_ErrCode OH_AVSCREEN_CAPTURE_ErrCode
+```
+
+**描述:**
+
+屏幕录制过程中产生的不同结果码。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AVScreenCapture
+
+```
+typedef struct OH_AVScreenCapture OH_AVScreenCapture
+```
+
+**描述:**
+
+通过OH_AVScreenCapture可以获取视频与音频的原始码流。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AVScreenCaptureCallback
+
+```
+typedef struct OH_AVScreenCaptureCallback OH_AVScreenCaptureCallback
+```
+
+**描述:**
+
+OH_AVScreenCapture中所有异步回调函数指针的集合。将该结构体的实例注册到OH_AVScreenCapture实例中, 并处理回调上报的信息,以保证OH_AVScreenCapture的正常运行。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| onError | 监控录屏调用操作错误,请参见[OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror)。 |
+| onAudioBufferAvailable | 监控音频码流是否有数据产生,请参见[OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable)。 |
+| onVideoBufferAvailable | 监控视频码流是否有数据产生,请参见[OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable)。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AVScreenCaptureConfig
+
+```
+typedef struct OH_AVScreenCaptureConfig OH_AVScreenCaptureConfig
+```
+
+**描述:**
+
+屏幕录制配置参数。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AVScreenCaptureOnAudioBufferAvailable
+
+```
+typedef void(* OH_AVScreenCaptureOnAudioBufferAvailable) (OH_AVScreenCapture *capture, bool isReady, OH_AudioCaptureSourceType type)
+```
+
+**描述:**
+
+当OH_AVScreenCapture操作期间音频缓冲区可用时,将调用函数指针。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| isReady | 音频缓冲区是否可用。 |
+| type | 音频源类型。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AVScreenCaptureOnError
+
+```
+typedef void(* OH_AVScreenCaptureOnError) (OH_AVScreenCapture *capture, int32_t errorCode)
+```
+
+**描述:**
+
+当OH_AVScreenCapture实例运行出错时,将调用函数指针。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| errorCode | 指定错误码。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_AVScreenCaptureOnVideoBufferAvailable
+
+```
+typedef void(* OH_AVScreenCaptureOnVideoBufferAvailable) (OH_AVScreenCapture *capture, bool isReady)
+```
+
+**描述:**
+
+当OH_AVScreenCapture操作期间视频缓冲区可用时,将调用函数指针。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| isReady | 视频缓冲区是否可用。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_CaptureMode
+
+```
+typedef enum OH_CaptureModeOH_CaptureMode
+```
+
+**描述:**
+
+枚举,表示屏幕录制的不同模式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_ContainerFormatType
+
+```
+typedef enum OH_ContainerFormatType OH_ContainerFormatType
+```
+
+**描述:**
+
+枚举,表示屏幕录制生成的文件类型。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_DataType
+
+```
+typedef enum OH_DataType OH_DataType
+```
+
+**描述:**
+
+枚举,表示屏幕录制流的数据格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_NativeBuffer
+
+```
+typedef struct OH_NativeBuffer OH_NativeBuffer
+```
+
+**描述:**
+
+提供录屏的视频原始码流类。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_RecorderInfo
+
+```
+typedef struct OH_RecorderInfo OH_RecorderInfo
+```
+
+**描述:**
+
+录制文件信息。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_Rect
+
+```
+typedef struct OH_Rect OH_Rect
+```
+
+**描述:**
+
+定义录屏界面的宽高以及画面信息。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_VideoCaptureInfo
+
+```
+typedef struct OH_VideoCaptureInfo OH_VideoCaptureInfo
+```
+
+**描述:**
+
+视频采集信息。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_VideoCodecFormat
+
+```
+typedef enum OH_VideoCodecFormat OH_VideoCodecFormat
+```
+
+**描述:**
+
+枚举,表示视频编码格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_VideoEncInfo
+
+```
+typedef struct OH_VideoEncInfo OH_VideoEncInfo
+```
+
+**描述:**
+
+视频编码参数。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_VideoInfo
+
+```
+typedef struct OH_VideoInfo OH_VideoInfo
+```
+
+**描述:**
+
+视频录制参数。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+### OH_VideoSourceType
+
+```
+typedef enum OH_VideoSourceType OH_VideoSourceType
+```
+
+**描述:**
+
+枚举,表示视频源格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+
+## 枚举类型说明
+
+
+### OH_AudioCaptureSourceType
+
+```
+enum OH_AudioCaptureSourceType
+```
+
+**描述:**
+
+枚举,表示屏幕录制时的音频源类型。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| OH_SOURCE_INVALID | 无效音频源。 |
+| OH_SOURCE_DEFAULT | 默认音频源,默认为MIC。 |
+| OH_MIC | 麦克风录制的外部音频流。 |
+| OH_ALL_PLAYBACK | 系统播放的所有内部音频流。 |
+| OH_APP_PLAYBACK | 指定应用播放的内部音频流。 |
+
+
+### OH_AudioCodecFormat
+
+```
+enum OH_AudioCodecFormat
+```
+
+**描述:**
+
+枚举,表示音频编码格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| OH_AUDIO_DEFAULT | 默认音频编码,默认为AAC_LC。 |
+| OH_AAC_LC | AAC_LC音频编码。 |
+| OH_AUDIO_CODEC_FORMAT_BUTT | 无效格式。 |
+
+
+### OH_AVSCREEN_CAPTURE_ErrCode
+
+```
+enum OH_AVSCREEN_CAPTURE_ErrCode
+```
+
+**描述:**
+
+屏幕录制过程中产生的不同结果码。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| AV_SCREEN_CAPTURE_ERR_BASE | 接口调用错误返回的基础值。 |
+| AV_SCREEN_CAPTURE_ERR_OK | 操作成功。 |
+| AV_SCREEN_CAPTURE_ERR_NO_MEMORY | 内存不足。 |
+| AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT | 不允许操作。 |
+| AV_SCREEN_CAPTURE_ERR_INVALID_VAL | 无效参数。 |
+| AV_SCREEN_CAPTURE_ERR_IO | 输入输出流异常。 |
+| AV_SCREEN_CAPTURE_ERR_TIMEOUT | 网络超时。 |
+| AV_SCREEN_CAPTURE_ERR_UNKNOWN | 未知错误。 |
+| AV_SCREEN_CAPTURE_ERR_SERVICE_DIED | 媒体服务已终止。 |
+| AV_SCREEN_CAPTURE_ERR_INVALID_STATE | 当前状态不支持此操作。 |
+| AV_SCREEN_CAPTURE_ERR_UNSUPPORT | 不支持的接口。 |
+| AV_SCREEN_CAPTURE_ERR_EXTEND_START | 预期之外的错误。 |
+
+
+### OH_CaptureMode
+
+```
+enum OH_CaptureMode
+```
+
+**描述:**
+
+枚举,表示屏幕录制的不同模式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| OH_CAPTURE_HOME_SCREEN | 录制主屏幕。 |
+| OH_CAPTURE_SPECIFIED_SCREEN | 录制指定屏幕。
**说明:** 预留接口,将在后续版本提供。 |
+| OH_CAPTURE_SPECIFIED_WINDOW | 录制指定窗口。
**说明:** 预留接口,将在后续版本提供。|
+| OH_CAPTURE_INVAILD | 无效模式。 |
+
+
+### OH_ContainerFormatType
+
+```
+enum OH_ContainerFormatType
+```
+
+**描述:**
+
+枚举,表示屏幕录制生成的文件类型。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| CFT_MPEG_4A | 音频格式 m4a。 |
+| CFT_MPEG_4 | 视频格式 mp4。 |
+
+
+### OH_DataType
+
+```
+enum OH_DataType
+```
+
+**描述:**
+
+枚举,表示屏幕录制流的数据格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| OH_ORIGINAL_STREAM | 原始流格式,如YUV/RGBA/PCM等。 |
+| OH_ENCODED_STREAM | 编码格式,如H264/AAC等。
**说明:** 预留接口,将在后续版本提供。 |
+| OH_CAPTURE_FILE | 保存文件格式,支持mp4。
**说明:** 预留接口,将在后续版本提供。 |
+| OH_INVAILD | 无效格式。 |
+
+
+### OH_VideoCodecFormat
+
+```
+enum OH_VideoCodecFormat
+```
+
+**描述:**
+
+枚举,表示视频编码格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| OH_VIDEO_DEFAULT | 默认视频编码,默认为H.264。 |
+| OH_H264 | H.264 |
+| OH_H265 | H.265/HEVC |
+| OH_MPEG4 | MPEG4 |
+| OH_VP8 | VP8 |
+| OH_VP9 | VP9 |
+| OH_VIDEO_CODEC_FORMAT_BUTT | 无效格式。 |
+
+
+### OH_VideoSourceType
+
+```
+enum OH_VideoSourceType
+```
+
+**描述:**
+
+枚举,表示视频源格式。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+| 枚举值 | 描述 |
+| -------- | -------- |
+| OH_VIDEO_SOURCE_SURFACE_YUV | YUV格式。 |
+| OH_VIDEO_SOURCE_SURFACE_ES | raw格式。 |
+| OH_VIDEO_SOURCE_SURFACE_RGBA | RGBA格式。 |
+| OH_VIDEO_SOURCE_BUTT | 无效格式。 |
+
+
+## 函数说明
+
+
+### OH_AVScreenCapture_AcquireAudioBuffer()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_AcquireAudioBuffer (struct OH_AVScreenCapture * capture, OH_AudioBuffer ** audiobuffer, OH_AudioCaptureSourceType type )
+```
+
+**描述:**
+
+获取音频buffer,应用在调用时,需要对audiobuffer分配对应结构体大小的内存,否则会影响拿到音频buffer的获取。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| audiobuffer | 保存音频buffer的结构体,通过该结构体获取到音频buffer以及buffer的时间戳等信息。 |
+| type | 音频buffer的类型,区分是麦克风录制的外部流还是系统内部播放音频的内录流,详情请参阅[OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_AcquireVideoBuffer()
+
+```
+OH_NativeBuffer* OH_AVScreenCapture_AcquireVideoBuffer (struct OH_AVScreenCapture * capture, int32_t * fence, int64_t * timestamp, struct OH_Rect * region )
+```
+
+**描述:**
+
+获取视频buffer,应用在调用时,通过此接口来获取到视频的buffer以及时间戳等信息。 buffer使用完成后,调用OH_AVScreenCapture_ReleaseVideoBuffer接口进行视频buffer的释放。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| fence | 用于同步的显示相关参数信息。 |
+| timestamp | 视频帧的时间戳。 |
+| region | 视频显示相关的坐标信息。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回OH_NativeBuffer对象,通过OH_NativeBuffer对象相关接口可以获取到视频buffer和分辨率等信息参数。
+
+
+### OH_AVScreenCapture_Create()
+
+```
+struct OH_AVScreenCapture* OH_AVScreenCapture_Create (void )
+```
+
+**描述:**
+
+实例化对象,创建OH_AVScreenCapture。可以通过调用OH_AVScreenCapture_Release释放实例。
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+返回一个指向OH_AVScreenCapture实例的指针。
+
+
+### OH_AVScreenCapture_Init()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Init (struct OH_AVScreenCapture * capture, OH_AVScreenCaptureConfig config )
+```
+
+**描述:**
+
+初始化OH_AVScreenCapture相关参数,包括下发的音频麦克风采样信息参数,音频内录相关参数(可选),视频分辨率相关参数。
+
+调用此函数,需要申请麦克风权限(ohos.permission.MICROPHONE)和截屏权限(ohos.permission.CAPTURE_SCREEN),否则会初始化失败导致无法正常录屏。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| config | 录屏初始化相关参数。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_Release()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Release (struct OH_AVScreenCapture * capture)
+```
+
+**描述:**
+
+释放创建的OH_AVScreenCapture实例,对应OH_AVScreenCapture_Create。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_ReleaseAudioBuffer()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseAudioBuffer (struct OH_AVScreenCapture * capture, OH_AudioCaptureSourceType type )
+```
+
+**描述:**
+
+根据音频类型释放buffer。当某一帧音频buffer使用完成后,调用此接口进行释放对应的音频buffer。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| type | 音频buffer的类型,区分麦克风录制的外部流还是系统内部播放音频的内录流。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_ReleaseVideoBuffer()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseVideoBuffer (struct OH_AVScreenCapture * capture)
+```
+
+**描述:**
+
+根据视频类型释放buffer。当某一帧视频buffer使用完成后,调用此接口进行释放对应的视频buffer。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_SetCallback()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCallback (struct OH_AVScreenCapture * capture, struct OH_AVScreenCaptureCallback callback )
+```
+
+**描述:**
+
+设置监听接口,通过设置监听,可以监听到调用过程中的错误信息,以及是否有可用的视频buffer和音频buffer。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| callback | [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md)的结构体,保存相关回调函数指针。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_SetMicrophoneEnabled()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMicrophoneEnabled (struct OH_AVScreenCapture * capture, bool isMicrophone )
+```
+
+**描述:**
+
+设置麦克风开关。当isMicrophone为true时,则打开麦克风,通过调用OH_AVScreenCapture_StartScreenRecording和OH_AVScreenCapture_AcquireAudioBuffer可以正常获取到音频的麦克风原始PCM数据;isMicrophone为false时,获取到的音频数据为无声数据。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+| isMicrophone | 麦克风开关参数。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK,否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_StartScreenCapture()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCapture (struct OH_AVScreenCapture * capture)
+```
+
+**描述:**
+
+开始录屏,采集原始码流。调用后可以通过回调的监听(OH_AVScreenCaptureOnAudioBufferAvailable,OH_AVScreenCaptureOnVideoBufferAvailable)来监听当前是否有码流的产生。
+
+通过调用获取音频buffer(OH_AVScreenCapture_AcquireAudioBuffer)和视频buffer(OH_AVScreenCapture_ReleaseVideoBuffer)的接口来获取录屏的原始码流
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_StartScreenRecording()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenRecording (struct OH_AVScreenCapture * capture)
+```
+
+**描述:**
+
+启动录屏,调用此接口,可采集编码后的码流。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_StopScreenCapture()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenCapture (struct OH_AVScreenCapture * capture)
+```
+
+**描述:**
+
+结束录屏,与OH_AVScreenCapture_StartScreenCapture配合使用。调用后针对调用该接口的应用会停止录屏或屏幕共享,释放麦克风。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
+
+
+### OH_AVScreenCapture_StopScreenRecording()
+
+```
+OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenRecording (struct OH_AVScreenCapture * capture)
+```
+
+**描述:**
+
+停止录屏,与OH_AVScreenCapture_StartScreenRecording配合使用。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**参数:**
+
+| 名称 | 描述 |
+| -------- | -------- |
+| capture | 指向OH_AVScreenCapture实例的指针。 |
+
+**系统能力:**
+
+SystemCapability.Multimedia.Media.AVScreenCapture
+
+**返回:**
+
+执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅[OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode)。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___a_v_screen_capture_callback.md b/zh-cn/application-dev/reference/native-apis/_o_h___a_v_screen_capture_callback.md
new file mode 100644
index 0000000000000000000000000000000000000000..191fd014f724d2fd19b35364d66ba484d97dbfd4
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___a_v_screen_capture_callback.md
@@ -0,0 +1,28 @@
+# OH_AVScreenCaptureCallback
+
+
+## 概述
+
+OH_AVScreenCapture中所有异步回调函数指针的集合。将该结构体的实例注册到OH_AVScreenCapture实例中, 并处理回调上报的信息,以保证OH_AVScreenCapture的正常运行。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| **onError** | [OH_AVScreenCaptureOnError](_a_v_screen_capture.md#oh_avscreencaptureonerror) |
+| **onAudioBufferAvailable** | [OH_AVScreenCaptureOnAudioBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonaudiobufferavailable) |
+| **onVideoBufferAvailable** | [OH_AVScreenCaptureOnVideoBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonvideobufferavailable) |
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___a_v_screen_capture_config.md b/zh-cn/application-dev/reference/native-apis/_o_h___a_v_screen_capture_config.md
new file mode 100644
index 0000000000000000000000000000000000000000..01fc82bca1582684af410ac6626c349ae2103b42
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___a_v_screen_capture_config.md
@@ -0,0 +1,92 @@
+# OH_AVScreenCaptureConfig
+
+
+## 概述
+
+屏幕录制配置参数。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [captureMode](#capturemode) | [OH_CaptureMode](_a_v_screen_capture.md#oh_capturemode)
屏幕录制的模式。 |
+| [dataType](#datatype) | [OH_DataType](_a_v_screen_capture.md#oh_datatype)
屏幕录制流的数据格式。 |
+| [audioInfo](#audioinfo) | [OH_AudioInfo](_o_h___audio_info.md)
音频录制参数。 |
+| [videoInfo](#videoinfo) | [OH_VideoInfo](_o_h___video_info.md)
视频录制参数。 |
+| [recorderInfo](#recorderinfo) | [OH_RecorderInfo](_o_h___recorder_info.md)
录制文件参数,当数据格式为OH_CAPTURE_FILE时,必须设置。
**说明:** 预留接口,将在后续版本提供。 |
+
+
+## 结构体成员变量说明
+
+
+### audioInfo
+
+```
+OH_AudioInfo OH_AVScreenCaptureConfig::audioInfo
+```
+
+**描述:**
+
+音频录制参数。
+
+
+### captureMode
+
+```
+OH_CaptureMode OH_AVScreenCaptureConfig::captureMode
+```
+
+**描述:**
+
+屏幕录制的模式。
+
+
+### dataType
+
+```
+OH_DataType OH_AVScreenCaptureConfig::dataType
+```
+
+**描述:**
+
+屏幕录制流的数据格式。
+
+
+### recorderInfo
+
+```
+OH_RecorderInfo OH_AVScreenCaptureConfig::recorderInfo
+```
+
+**描述:**
+
+录制文件参数,当数据格式为OH_CAPTURE_FILE时,必须设置。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+
+### videoInfo
+
+```
+OH_VideoInfo OH_AVScreenCaptureConfig::videoInfo
+```
+
+**描述:**
+
+视频录制参数。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___audio_buffer.md b/zh-cn/application-dev/reference/native-apis/_o_h___audio_buffer.md
new file mode 100644
index 0000000000000000000000000000000000000000..c849e2bba618b29886dc4670d370c6a9ecb9d257
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___audio_buffer.md
@@ -0,0 +1,76 @@
+# OH_AudioBuffer
+
+
+## 概述
+
+定义了音频数据的大小,类型,时间戳等配置信息。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [buf](#buf) | 音频buffer内存。 |
+| [size](#size) | 音频buffer内存大小。 |
+| [timestamp](#timestamp) | 音频buffer时间戳。 |
+| [type](#type) | 音频录制源类型。 |
+
+
+## 结构体成员变量说明
+
+
+### buf
+
+```
+uint8_t* OH_AudioBuffer::buf
+```
+
+**描述:**
+
+音频buffer内存。
+
+
+### size
+
+```
+int32_t OH_AudioBuffer::size
+```
+
+**描述:**
+
+音频buffer内存大小。
+
+
+### timestamp
+
+```
+int64_t OH_AudioBuffer::timestamp
+```
+
+**描述:**
+
+音频buffer时间戳。
+
+
+### type
+
+```
+OH_AudioCaptureSourceType OH_AudioBuffer::type
+```
+
+**描述:**
+
+音频录制源类型。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___audio_capture_info.md b/zh-cn/application-dev/reference/native-apis/_o_h___audio_capture_info.md
new file mode 100644
index 0000000000000000000000000000000000000000..93a35bb0e40e4d705f4ec86223c1cb1ec9c907b1
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___audio_capture_info.md
@@ -0,0 +1,64 @@
+# OH_AudioCaptureInfo
+
+
+## 概述
+
+音频录制信息。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [audioSampleRate](#audiosamplerate) | int32_t
音频采样率,支持列表参考**OH_AudioCapturer_GetSamplingRate**。 |
+| [audioChannels](#audiochannels) | int32_t
音频声道数。 |
+| [audioSource](#audiosource) | [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype)
音频源。 |
+
+
+## 结构体成员变量说明
+
+
+### audioChannels
+
+```
+int32_t OH_AudioCaptureInfo::audioChannels
+```
+
+**描述:**
+
+音频声道数。
+
+
+### audioSampleRate
+
+```
+int32_t OH_AudioCaptureInfo::audioSampleRate
+```
+
+**描述:**
+
+音频采样率,支持列表参考**OH_AudioCapturer_GetSamplingRate**。
+
+
+### audioSource
+
+```
+OH_AudioCaptureSourceType OH_AudioCaptureInfo::audioSource
+```
+
+**描述:**
+
+音频源。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___audio_enc_info.md b/zh-cn/application-dev/reference/native-apis/_o_h___audio_enc_info.md
new file mode 100644
index 0000000000000000000000000000000000000000..6be89fc6c48233bd1cfd2ca5f238f4fa9d4da630
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___audio_enc_info.md
@@ -0,0 +1,56 @@
+# OH_AudioEncInfo
+
+
+## 概述
+
+音频编码信息。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [audioBitrate](#audiobitrate) | int32_t
音频录制比特率。 |
+| [audioCodecformat](#audiocodecformat) | [OH_AudioCodecFormat](_a_v_screen_capture.md#oh_audiocodecformat)
音频编码格式。 |
+
+
+## 结构体成员变量说明
+
+
+### audioBitrate
+
+```
+int32_t OH_AudioEncInfo::audioBitrate
+```
+
+**描述:**
+
+音频录制比特率。
+
+
+### audioCodecformat
+
+```
+OH_AudioCodecFormat OH_AudioEncInfo::audioCodecformat
+```
+
+**描述:**
+
+音频编码格式。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___audio_info.md b/zh-cn/application-dev/reference/native-apis/_o_h___audio_info.md
new file mode 100644
index 0000000000000000000000000000000000000000..f67e43a7438c414023b3f55ecc24819c8fb5b76e
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___audio_info.md
@@ -0,0 +1,68 @@
+# OH_AudioInfo
+
+
+## 概述
+
+音频录制参数。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [micCapInfo](#miccapinfo) | [OH_AudioCaptureInfo](_o_h___audio_capture_info.md)
麦克风的音频参数。 |
+| [innerCapInfo](#innercapinfo) | [OH_AudioCaptureInfo](_o_h___audio_capture_info.md)
内录的音频参数。 |
+| [audioEncInfo](#audioencinfo) | [OH_AudioEncInfo](_o_h___audio_enc_info.md)
音频录制信息, 当dataType为OH_ORIGINAL_STREAM时不需要设置。
**说明:** 预留接口,将在后续版本提供。 |
+
+
+## 结构体成员变量说明
+
+
+### audioEncInfo
+
+```
+OH_AudioEncInfo OH_AudioInfo::audioEncInfo
+```
+
+**描述:**
+
+音频录制信息, 当dataType为OH_ORIGINAL_STREAM时不需要设置。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+
+### innerCapInfo
+
+```
+OH_AudioCaptureInfo OH_AudioInfo::innerCapInfo
+```
+
+**描述:**
+
+内录的音频参数。
+
+
+### micCapInfo
+
+```
+OH_AudioCaptureInfo OH_AudioInfo::micCapInfo
+```
+
+**描述:**
+
+麦克风的音频参数。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___recorder_info.md b/zh-cn/application-dev/reference/native-apis/_o_h___recorder_info.md
new file mode 100644
index 0000000000000000000000000000000000000000..3d8002ec662db49b991a41157ece04a182e84a89
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___recorder_info.md
@@ -0,0 +1,68 @@
+# OH_RecorderInfo
+
+
+## 概述
+
+录制文件信息。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供支持。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [url](#url) | 录制文件的URL。 |
+| [urlLen](#urllen) | 录制文件的URL长度。 |
+| [fileFormat](#fileformat) | 录制文件的格式。 |
+
+
+## 结构体成员变量说明
+
+
+### fileFormat
+
+```
+OH_ContainerFormatType OH_RecorderInfo::fileFormat
+```
+
+**描述:**
+
+录制文件的格式。
+
+
+### url
+
+```
+char* OH_RecorderInfo::url
+```
+
+**描述:**
+
+录制文件的URL。
+
+
+### urlLen
+
+```
+uint32_t OH_RecorderInfo::urlLen
+```
+
+**描述:**
+
+录制文件的URL长度。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___rect.md b/zh-cn/application-dev/reference/native-apis/_o_h___rect.md
new file mode 100644
index 0000000000000000000000000000000000000000..e17222b45e1c2737d3d77e3b62b0c1051dbbe542
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___rect.md
@@ -0,0 +1,76 @@
+# OH_Rect
+
+
+## 概述
+
+定义录屏界面的宽高以及画面信息。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [x](#x) | int32_t
录屏界面的X坐标。 |
+| [y](#y) | int32_t
录屏界面的Y坐标。 |
+| [width](#width) | int32_t
录屏界面的宽度。 |
+| [height](#height) | int32_t
录屏界面的高度。 |
+
+
+## 结构体成员变量说明
+
+
+### height
+
+```
+int32_t OH_Rect::height
+```
+
+**描述:**
+
+录屏界面的高度。
+
+
+### width
+
+```
+int32_t OH_Rect::width
+```
+
+**描述:**
+
+录屏界面的宽度。
+
+
+### x
+
+```
+int32_t OH_Rect::x
+```
+
+**描述:**
+
+录屏界面的X坐标。
+
+
+### y
+
+```
+int32_t OH_Rect::y
+```
+
+**描述:**
+
+录屏界面的Y坐标。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___video_capture_info.md b/zh-cn/application-dev/reference/native-apis/_o_h___video_capture_info.md
new file mode 100644
index 0000000000000000000000000000000000000000..3aab955c1b8b6a07e8b088f5099928abbf012f89
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___video_capture_info.md
@@ -0,0 +1,111 @@
+# OH_VideoCaptureInfo
+
+
+## 概述
+
+视频采集信息。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [displayId](#displayid) | uint64_t
录制物理屏id,使用该参数需要在capturemode为CAPTURE_SPECIFIED_SCREEN模式下使用。
**说明:** 预留接口,将在后续版本提供。 |
+| [missionIDs](#missionids) | int32_t \*
指定窗口id列表,使用该参数需要在capturemode为CAPTURE_SPECIFIED_WINDOW模式下使用。
**说明:** 预留接口,将在后续版本提供。|
+| [missionIDsLen](#missionidslen) | int32_t
指定窗口ID长度,使用该参数需要在capturemode为CAPTURE_SPECIFIED_WINDOW模式下使用。
**说明:** 预留接口,将在后续版本提供。 |
+| [videoFrameWidth](#videoframewidth) | int32_t
采集视频的宽度设置。 |
+| [videoFrameHeight](#videoframeheight) | int32_t
采集视频的高度设置。 |
+| [videoSource](#videosource) | [OH_VideoSourceType](_a_v_screen_capture.md#oh_videosourcetype)
视频采集格式设置,目前仅支持RGBA格式。 |
+
+
+## 结构体成员变量说明
+
+
+### displayId
+
+```
+uint64_t OH_VideoCaptureInfo::displayId
+```
+
+**描述:**
+
+录制物理屏id,使用该参数需要在capturemode为CAPTURE_SPECIFIED_SCREEN模式下使用。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+
+### missionIDs
+
+```
+int32_t* OH_VideoCaptureInfo::missionIDs
+```
+
+**描述:**
+
+指定窗口id列表,使用该参数需要在capturemode为CAPTURE_SPECIFIED_WINDOW模式下使用。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+### missionIDsLen
+
+```
+int32_t OH_VideoCaptureInfo::missionIDsLen
+```
+
+**描述:**
+
+指定窗口ID长度,使用该参数需要在capturemode为CAPTURE_SPECIFIED_WINDOW模式下使用。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+
+### videoFrameHeight
+
+```
+int32_t OH_VideoCaptureInfo::videoFrameHeight
+```
+
+**描述:**
+
+采集视频的高度设置。
+
+
+### videoFrameWidth
+
+```
+int32_t OH_VideoCaptureInfo::videoFrameWidth
+```
+
+**描述:**
+
+采集视频的宽度设置。
+
+
+### videoSource
+
+```
+OH_VideoSourceType OH_VideoCaptureInfo::videoSource
+```
+
+**描述:**
+
+视频采集格式设置,目前仅支持RGBA格式。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___video_enc_info.md b/zh-cn/application-dev/reference/native-apis/_o_h___video_enc_info.md
new file mode 100644
index 0000000000000000000000000000000000000000..57de57e5e5a59f794c1f9d020dd0f174bdb01d09
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___video_enc_info.md
@@ -0,0 +1,68 @@
+# OH_VideoEncInfo
+
+
+## 概述
+
+视频编码参数。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [videoCodec](#videocodec) | [OH_VideoCodecFormat](_a_v_screen_capture.md#oh_videocodecformat)
视频采集编码格式。 |
+| [videoBitrate](#videobitrate) | int32_t
视频采集比特率。 |
+| [videoFrameRate](#videoframerate) | int32_t
视频采集帧率。 |
+
+
+## 结构体成员变量说明
+
+
+### videoBitrate
+
+```
+int32_t OH_VideoEncInfo::videoBitrate
+```
+
+**描述:**
+
+视频采集比特率。
+
+
+### videoCodec
+
+```
+OH_VideoCodecFormat OH_VideoEncInfo::videoCodec
+```
+
+**描述:**
+
+视频采集编码格式。
+
+
+### videoFrameRate
+
+```
+int32_t OH_VideoEncInfo::videoFrameRate
+```
+
+**描述:**
+
+视频采集帧率。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___video_info.md b/zh-cn/application-dev/reference/native-apis/_o_h___video_info.md
new file mode 100644
index 0000000000000000000000000000000000000000..af6ad90da1d28af1099c24bddc8d24e2980fc776
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/_o_h___video_info.md
@@ -0,0 +1,56 @@
+# OH_VideoInfo
+
+
+## 概述
+
+视频录制参数。
+
+**系统能力**:SystemCapability.Multimedia.Media.AVScreenCapture
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 成员变量
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [videoCapInfo](#videocapinfo) | [OH_VideoCaptureInfo](_o_h___video_capture_info.md)
视频采集信息。 |
+| [videoEncInfo](#videoencinfo) | [OH_VideoEncInfo](_o_h___video_enc_info.md)
视频编码参数。
**说明:** 预留接口,将在后续版本提供。|
+
+
+## 结构体成员变量说明
+
+
+### videoCapInfo
+
+```
+OH_VideoCaptureInfo OH_VideoInfo::videoCapInfo
+```
+
+**描述:**
+
+视频采集信息。
+
+
+### videoEncInfo
+
+```
+OH_VideoEncInfo OH_VideoInfo::videoEncInfo
+```
+
+**描述:**
+
+视频编码参数。
+
+> **说明:**
+>
+> 预留接口,将在后续版本提供。
diff --git a/zh-cn/application-dev/reference/native-apis/_o_h_audio.md b/zh-cn/application-dev/reference/native-apis/_o_h_audio.md
index a968f45c4b706c99e2ff0a74d8e7e3a718c5af50..e66f12de0407d9718ea2708dbc032cd68ff3a643 100644
--- a/zh-cn/application-dev/reference/native-apis/_o_h_audio.md
+++ b/zh-cn/application-dev/reference/native-apis/_o_h_audio.md
@@ -53,7 +53,7 @@
| [OH_AudioStream_SampleFormat](#oh_audiostream_sampleformat) { AUDIOSTREAM_SAMPLE_U8 = 0, AUDIOSTREAM_SAMPLE_S16LE = 1, AUDIOSTREAM_SAMPLE_S24LE = 2, AUDIOSTREAM_SAMPLE_S32LE = 3 } | 定义音频流采样格式。 |
| [OH_AudioStream_EncodingType](#oh_audiostream_encodingtype) { **AUDIOSTREAM_ENCODING_TYPE_RAW** = 0 } | 定义音频流编码类型。 |
| [OH_AudioStream_Usage](#oh_audiostream_usage) { **AUDIOSTREAM_USAGE_UNKNOWN** = 0, **AUDIOSTREAM_USAGE_MUSIC** = 1, **AUDIOSTREAM_USAGE_COMMUNICATION** = 2, **AUDIOSTREAM_USAGE_GAME** = 11 } | 定义音频流使用场景。 |
-| [OH_AudioStream_LatencyMode](#oh_audiostream_latencymode) { AUDIOSTREAM_LATENCY_MODE_NORMAL } | 定义音频时延模式。 |
+| [OH_AudioStream_LatencyMode](#oh_audiostream_latencymode) { AUDIOSTREAM_LATENCY_MODE_NORMAL = 0, AUDIOSTREAM_LATENCY_MODE_FAST = 1} | 定义音频时延模式。 |
| [OH_AudioStream_State](#oh_audiostream_state) {
AUDIOSTREAM_STATE_INVALID = -1, AUDIOSTREAM_STATE_PREPARED = 1, AUDIOSTREAM_STATE_RUNNING = 2, AUDIOSTREAM_STATE_STOPPED = 3,
AUDIOSTREAM_STATE_RELEASED = 4, AUDIOSTREAM_STATE_PAUSED = 5
} | 定义音频流的状态。 |
| [OH_AudioStream_SourceType](#oh_audiostream_sourcetype) { **AUDIOSTREAM_SOURCE_TYPE_INVALID** = -1, **AUDIOSTREAM_SOURCE_TYPE_MIC**, **AUDIOSTREAM_SOURCE_TYPE_VOICE_RECOGNITION** = 1, **AUDIOSTREAM_SOURCE_TYPE_VOICE_COMMUNICATION** = 7 } | 定义音频流使用场景。 |
@@ -255,6 +255,7 @@ enum OH_AudioStream_LatencyMode
| 枚举值 | 描述 |
| -------- | -------- |
| AUDIOSTREAM_LATENCY_MODE_NORMAL | 该模式代表一个普通时延的音频流。 |
+| AUDIOSTREAM_LATENCY_MODE_FAST | 该模式代表一个低时延的音频流。 |
### OH_AudioStream_Result
diff --git a/zh-cn/application-dev/reference/native-apis/native__audiostream__base_8h.md b/zh-cn/application-dev/reference/native-apis/native__audiostream__base_8h.md
index abd1a4ea6dd8f4fbb32a50caaf4d34fe97654017..6b69f430e63495eec050147506cd0889504f7bb7 100644
--- a/zh-cn/application-dev/reference/native-apis/native__audiostream__base_8h.md
+++ b/zh-cn/application-dev/reference/native-apis/native__audiostream__base_8h.md
@@ -47,6 +47,6 @@
| [OH_AudioStream_SampleFormat](_o_h_audio.md#oh_audiostream_sampleformat) { [AUDIOSTREAM_SAMPLE_U8](_o_h_audio.md) = 0, [AUDIOSTREAM_SAMPLE_S16LE](_o_h_audio.md) = 1, [AUDIOSTREAM_SAMPLE_S24LE](_o_h_audio.md) = 2, [AUDIOSTREAM_SAMPLE_S32LE](_o_h_audio.md) = 3 } | 定义音频流采样格式。 |
| [OH_AudioStream_EncodingType](_o_h_audio.md#oh_audiostream_encodingtype) { **AUDIOSTREAM_ENCODING_TYPE_RAW** = 0 } | 定义音频流编码类型。 |
| [OH_AudioStream_Usage](_o_h_audio.md#oh_audiostream_usage) { **AUDIOSTREAM_USAGE_UNKNOWN** = 0, **AUDIOSTREAM_USAGE_MUSIC** = 1, **AUDIOSTREAM_USAGE_COMMUNICATION** = 2, **AUDIOSTREAM_USAGE_GAME** = 11 } | 定义音频流使用场景。 |
-| [OH_AudioStream_LatencyMode](_o_h_audio.md#oh_audiostream_latencymode) { [AUDIOSTREAM_LATENCY_MODE_NORMAL](_o_h_audio.md) } | 定义音频时延模式。 |
+| [OH_AudioStream_LatencyMode](_o_h_audio.md#oh_audiostream_latencymode) { [AUDIOSTREAM_LATENCY_MODE_NORMAL](_o_h_audio.md) = 0, [AUDIOSTREAM_LATENCY_MODE_FAST](_o_h_audio.md) = 1 } | 定义音频时延模式。 |
| [OH_AudioStream_State](_o_h_audio.md#oh_audiostream_state) {
[AUDIOSTREAM_STATE_INVALID](_o_h_audio.md) = -1, [AUDIOSTREAM_STATE_PREPARED](_o_h_audio.md) = 1, [AUDIOSTREAM_STATE_RUNNING](_o_h_audio.md) = 2, [AUDIOSTREAM_STATE_STOPPED](_o_h_audio.md) = 3,
[AUDIOSTREAM_STATE_RELEASED](_o_h_audio.md) = 4, [AUDIOSTREAM_STATE_PAUSED](_o_h_audio.md) = 5
} | 定义音频流的状态。 |
| [OH_AudioStream_SourceType](_o_h_audio.md#oh_audiostream_sourcetype) { **AUDIOSTREAM_SOURCE_TYPE_INVALID** = -1, **AUDIOSTREAM_SOURCE_TYPE_MIC**, **AUDIOSTREAM_SOURCE_TYPE_VOICE_RECOGNITION** = 1, **AUDIOSTREAM_SOURCE_TYPE_VOICE_COMMUNICATION** = 7 } | 定义音频流使用场景。 |
diff --git a/zh-cn/application-dev/reference/native-apis/native__avscreen__capture_8h.md b/zh-cn/application-dev/reference/native-apis/native__avscreen__capture_8h.md
new file mode 100644
index 0000000000000000000000000000000000000000..5beacce5ca040a8ff84492d0c8fcacf9b4e979fc
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/native__avscreen__capture_8h.md
@@ -0,0 +1,36 @@
+# native_avscreen_capture.h
+
+
+## 概述
+
+声明用于构造屏幕录制对象的Native API。
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 函数
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_AVScreenCapture_Create](_a_v_screen_capture.md#oh_avscreencapture_create) (void) | 实例化对象,创建OH_AVScreenCapture。 |
+| [OH_AVScreenCapture_Init](_a_v_screen_capture.md#oh_avscreencapture_init) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) config) | 初始化OH_AVScreenCapture相关参数。 |
+| [OH_AVScreenCapture_StartScreenCapture](_a_v_screen_capture.md#oh_avscreencapture_startscreencapture) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | 开始录屏,采集原始码流。调用后可以通过回调的监听(OH_AVScreenCaptureOnAudioBufferAvailable,OH_AVScreenCaptureOnVideoBufferAvailable)来监听当前是否有码流的产生。 |
+| [OH_AVScreenCapture_StopScreenCapture](_a_v_screen_capture.md#oh_avscreencapture_stopscreencapture) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | 结束录屏,与OH_AVScreenCapture_StartScreenCapture配合使用。调用后针对调用该接口的应用会停止录屏或屏幕共享,释放麦克风。 |
+| [OH_AVScreenCapture_StartScreenRecording](_a_v_screen_capture.md#oh_avscreencapture_startscreenrecording) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | 启动录屏,调用此接口,可采集编码后的码流。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AVScreenCapture_StopScreenRecording](_a_v_screen_capture.md#oh_avscreencapture_stopscreenrecording) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | 停止录屏,与OH_AVScreenCapture_StartScreenRecording配合使用。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AVScreenCapture_AcquireAudioBuffer](_a_v_screen_capture.md#oh_avscreencapture_acquireaudiobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AudioBuffer](_o_h___audio_buffer.md) \*\*audiobuffer, [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) type) | 获取音频buffer,应用在调用时,需要对audiobuffer分配对应结构体大小的内存,否则会影响拿到音频buffer的获取。 |
+| [OH_AVScreenCapture_AcquireVideoBuffer](_a_v_screen_capture.md#oh_avscreencapture_acquirevideobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t \*fence, int64_t \*timestamp, struct [OH_Rect](_o_h___rect.md) \*region) | 获取视频buffer,应用在调用时,通过此接口来获取到视频的buffer以及时间戳等信息。 |
+| [OH_AVScreenCapture_ReleaseAudioBuffer](_a_v_screen_capture.md#oh_avscreencapture_releaseaudiobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) type) | 根据音频类型释放buffer。 |
+| [OH_AVScreenCapture_ReleaseVideoBuffer](_a_v_screen_capture.md#oh_avscreencapture_releasevideobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | 根据视频类型释放buffer。 |
+| [OH_AVScreenCapture_SetCallback](_a_v_screen_capture.md#oh_avscreencapture_setcallback) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) callback) | 设置监听接口,通过设置监听,可以监听到调用过程中的错误信息,以及是否有可用的视频buffer和音频buffer。 |
+| [OH_AVScreenCapture_Release](_a_v_screen_capture.md#oh_avscreencapture_release) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | 释放创建的OH_AVScreenCapture实例,对应OH_AVScreenCapture_Create。 |
+| [OH_AVScreenCapture_SetMicrophoneEnabled](_a_v_screen_capture.md#oh_avscreencapture_setmicrophoneenabled) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool isMicrophone) | 设置麦克风开关。 |
diff --git a/zh-cn/application-dev/reference/native-apis/native__avscreen__capture__base_8h.md b/zh-cn/application-dev/reference/native-apis/native__avscreen__capture__base_8h.md
new file mode 100644
index 0000000000000000000000000000000000000000..e0cb792811be4825d69f9e6faedf233d8be05123
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/native__avscreen__capture__base_8h.md
@@ -0,0 +1,76 @@
+# native_avscreen_capture_base.h
+
+
+## 概述
+
+声明用于运行屏幕录制通用的结构体、字符常量、枚举。
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 结构体
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) | 音频录制信息。 |
+| [OH_AudioEncInfo](_o_h___audio_enc_info.md) | 音频编码信息。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AudioInfo](_o_h___audio_info.md) | 音频录制参数。 |
+| [OH_VideoCaptureInfo](_o_h___video_capture_info.md) | 视频采集信息。 |
+| [OH_VideoEncInfo](_o_h___video_enc_info.md) | 视频编码信息。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_VideoInfo](_o_h___video_info.md) | 视频录制参数。 |
+| [OH_RecorderInfo](_o_h___recorder_info.md) | 录制文件信息。 |
+| [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) | 屏幕录制配置参数。 |
+| [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) | OH_AVScreenCapture中所有异步回调函数指针的集合。 |
+| [OH_Rect](_o_h___rect.md) | 定义录屏界面的宽高以及画面信息。 |
+| [OH_AudioBuffer](_o_h___audio_buffer.md) | 定义了音频数据的大小,类型,时间戳等配置信息。 |
+
+
+### 类型定义
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_NativeBuffer](_a_v_screen_capture.md#oh_nativebuffer) | 提供录屏的视频原始码流类。 |
+| [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) | 通过OH_AVScreenCapture可以获取视频与音频的原始码流。 |
+| [OH_CaptureMode](_a_v_screen_capture.md#oh_capturemode) | 枚举,表示屏幕录制的不同模式。 |
+| [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) | 枚举,表示屏幕录制时的音频源类型。 |
+| [OH_AudioCodecFormat](_a_v_screen_capture.md#oh_audiocodecformat) | 枚举,表示音频编码格式。 |
+| [OH_VideoCodecFormat](_a_v_screen_capture.md#oh_videocodecformat) | 枚举,表示视频编码格式。 |
+| [OH_DataType](_a_v_screen_capture.md#oh_datatype) | 枚举,表示屏幕录制流的数据格式。 |
+| [OH_VideoSourceType](_a_v_screen_capture.md#oh_videosourcetype) | 枚举,表示视频源格式。 |
+| [OH_ContainerFormatType](_a_v_screen_capture.md#oh_containerformattype) | 枚举,表示屏幕录制生成的文件类型。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AudioCaptureInfo](_a_v_screen_capture.md#oh_audiocaptureinfo) | 音频录制信息。 |
+| [OH_AudioEncInfo](_a_v_screen_capture.md#oh_audioencinfo) | 音频编码信息。
**说明:** 预留接口,将在后续版本提供。 |
+| [OH_AudioInfo](_a_v_screen_capture.md#oh_audioinfo) | 音频录制参数。 |
+| [OH_VideoCaptureInfo](_a_v_screen_capture.md#oh_videocaptureinfo) | 视频采集信息。 |
+| [OH_VideoEncInfo](_a_v_screen_capture.md#oh_videoencinfo) | 视频编码信息。
**说明:** 预留接口,将在后续版本提供。|
+| [OH_VideoInfo](_a_v_screen_capture.md#oh_videoinfo) | 视频录制参数。 |
+| [OH_RecorderInfo](_a_v_screen_capture.md#oh_recorderinfo) | 录制文件信息。 |
+| [OH_AVScreenCaptureConfig](_a_v_screen_capture.md#oh_avscreencaptureconfig) | 屏幕录制配置参数。 |
+| (\*[OH_AVScreenCaptureOnError](_a_v_screen_capture.md#oh_avscreencaptureonerror)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t errorCode) | 当OH_AVScreenCapture实例运行出错时,将调用函数指针。 |
+| (\*[OH_AVScreenCaptureOnAudioBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonaudiobufferavailable)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool isReady, [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) type) | 当OH_AVScreenCapture操作期间音频缓冲区可用时,将调用函数指针。 |
+| (\*[OH_AVScreenCaptureOnVideoBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonvideobufferavailable)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool isReady) | 当OH_AVScreenCapture操作期间视频缓冲区可用时,将调用函数指针。 |
+| [OH_AVScreenCaptureCallback](_a_v_screen_capture.md#oh_avscreencapturecallback) | OH_AVScreenCapture中所有异步回调函数指针的集合。 |
+| [OH_Rect](_a_v_screen_capture.md#oh_rect) | 定义录屏界面的宽高以及画面信息。 |
+| [OH_AudioBuffer](_a_v_screen_capture.md#oh_audiobuffer) | 定义了音频数据的大小,类型,时间戳等配置信息。 |
+
+
+### 枚举
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_CaptureMode](_a_v_screen_capture.md#oh_capturemode) { [OH_CAPTURE_HOME_SCREEN](_a_v_screen_capture.md) = 0, [OH_CAPTURE_SPECIFIED_SCREEN](_a_v_screen_capture.md) = 1, [OH_CAPTURE_SPECIFIED_WINDOW](_a_v_screen_capture.md) = 2, [OH_CAPTURE_INVAILD](_a_v_screen_capture.md) = -1 } | 枚举,表示屏幕录制的不同模式。 |
+| [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) {
[OH_SOURCE_INVALID](_a_v_screen_capture.md) = -1, [OH_SOURCE_DEFAULT](_a_v_screen_capture.md) = 0, [OH_MIC](_a_v_screen_capture.md) = 1, [OH_ALL_PLAYBACK](_a_v_screen_capture.md) = 2,
[OH_APP_PLAYBACK](_a_v_screen_capture.md) = 3
} | 枚举,表示屏幕录制时的音频源类型。 |
+| [OH_AudioCodecFormat](_a_v_screen_capture.md#oh_audiocodecformat) { [OH_AUDIO_DEFAULT](_a_v_screen_capture.md) = 0, [OH_AAC_LC](_a_v_screen_capture.md) = 3, [OH_AUDIO_CODEC_FORMAT_BUTT](_a_v_screen_capture.md) } | 枚举,表示音频编码格式。 |
+| [OH_VideoCodecFormat](_a_v_screen_capture.md#oh_videocodecformat) {
[OH_VIDEO_DEFAULT](_a_v_screen_capture.md) = 0, [OH_H264](_a_v_screen_capture.md) = 2, [OH_H265](_a_v_screen_capture.md) = 4, [OH_MPEG4](_a_v_screen_capture.md) = 6,
[OH_VP8](_a_v_screen_capture.md) = 8, [OH_VP9](_a_v_screen_capture.md) = 10, [OH_VIDEO_CODEC_FORMAT_BUTT](_a_v_screen_capture.md)
} | 枚举,表示视频编码格式。 |
+| [OH_DataType](_a_v_screen_capture.md#oh_datatype) { [OH_ORIGINAL_STREAM](_a_v_screen_capture.md) = 0, [OH_ENCODED_STREAM](_a_v_screen_capture.md) = 1, [OH_CAPTURE_FILE](_a_v_screen_capture.md) = 2, OH_INVAILD = -1 } | 枚举,表示屏幕录制流的数据格式。 |
+| [OH_VideoSourceType](_a_v_screen_capture.md#oh_videosourcetype) { [OH_VIDEO_SOURCE_SURFACE_YUV](_a_v_screen_capture.md) = 0, [OH_VIDEO_SOURCE_SURFACE_ES](_a_v_screen_capture.md), [OH_VIDEO_SOURCE_SURFACE_RGBA](_a_v_screen_capture.md), [OH_VIDEO_SOURCE_BUTT](_a_v_screen_capture.md) } | 枚举,表示视频源格式。 |
+| [OH_ContainerFormatType](_a_v_screen_capture.md#oh_containerformattype) { [CFT_MPEG_4A](_a_v_screen_capture.md) = 0, [CFT_MPEG_4](_a_v_screen_capture.md) = 1 } | 枚举,表示屏幕录制生成的文件类型。
**说明:** 预留接口,将在后续版本提供。 |
diff --git a/zh-cn/application-dev/reference/native-apis/native__avscreen__capture__errors_8h.md b/zh-cn/application-dev/reference/native-apis/native__avscreen__capture__errors_8h.md
new file mode 100644
index 0000000000000000000000000000000000000000..18f1c24d6441a923a53c87ae6e7756358b497cf2
--- /dev/null
+++ b/zh-cn/application-dev/reference/native-apis/native__avscreen__capture__errors_8h.md
@@ -0,0 +1,31 @@
+# native_avscreen_capture_errors.h
+
+
+## 概述
+
+声明用于运行屏幕录制过程中接口调用的错误码说明。
+
+**起始版本:**
+
+10
+
+**相关模块:**
+
+[AVScreenCapture](_a_v_screen_capture.md)
+
+
+## 汇总
+
+
+### 类型定义
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) | 屏幕录制过程中产生的不同结果码。 |
+
+
+### 枚举
+
+| 名称 | 描述 |
+| -------- | -------- |
+| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) {
[AV_SCREEN_CAPTURE_ERR_BASE](_a_v_screen_capture.md) = 0, [AV_SCREEN_CAPTURE_ERR_OK](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE, [AV_SCREEN_CAPTURE_ERR_NO_MEMORY](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 1, [AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 2,
[AV_SCREEN_CAPTURE_ERR_INVALID_VAL](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 3, [AV_SCREEN_CAPTURE_ERR_IO](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 4, [AV_SCREEN_CAPTURE_ERR_TIMEOUT](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 5, [AV_SCREEN_CAPTURE_ERR_UNKNOWN](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 6,
[AV_SCREEN_CAPTURE_ERR_SERVICE_DIED](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 7, [AV_SCREEN_CAPTURE_ERR_INVALID_STATE](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 8, [AV_SCREEN_CAPTURE_ERR_UNSUPPORT](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 9, [AV_SCREEN_CAPTURE_ERR_EXTEND_START](_a_v_screen_capture.md) = AV_SCREEN_CAPTURE_ERR_BASE + 100
} | 屏幕录制过程中产生的不同结果码。 |
diff --git a/zh-cn/application-dev/reference/syscap.md b/zh-cn/application-dev/reference/syscap.md
index 2eeaed9a4cda4c4404c683270a3fefa164f1378e..9bee315d94442bfd52f1ae1c61ffc350255e1534 100644
--- a/zh-cn/application-dev/reference/syscap.md
+++ b/zh-cn/application-dev/reference/syscap.md
@@ -110,11 +110,11 @@ DevEco Studio会根据创建的工程所支持的设置自动配置联想能力
- 方法2:开发者可通过import的方式将模块导入,若当前设备不支持该模块,import的结果为undefined,开发者在使用其API时,需要判断其是否存在。
```ts
- import geolocation from '@ohos.geolocation';
+ import geolocationManager from '@ohos.geoLocationManager';
- if (geolocation) {
- geolocation.getCurrentLocation((location) => {
- console.log(location.latitude, location.longitude);
+ if (geolocationManager) {
+ geolocationManager.getCurrentLocation((location) => {
+ console.log('current location: ' + JSON.stringify(location));
});
} else {
console.log('该设备不支持位置信息');
diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md
index fa22574a3df5392c5d04844591b1c83dfc5f6def..abc7debd43d47b6822257730ba7d80ebf72c474b 100644
--- a/zh-cn/application-dev/security/accesstoken-guidelines.md
+++ b/zh-cn/application-dev/security/accesstoken-guidelines.md
@@ -248,7 +248,7 @@
// 授权成功
}).catch((err) => {
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
-
+ })
// ...
}
}
diff --git a/zh-cn/application-dev/security/permission-list.md b/zh-cn/application-dev/security/permission-list.md
index c9514d960e47317d10d6772f8300d270462fae3e..f2f4b0d505ac3094625a6f4c89acd20f87fd0b14 100644
--- a/zh-cn/application-dev/security/permission-list.md
+++ b/zh-cn/application-dev/security/permission-list.md
@@ -2686,7 +2686,7 @@
## ohos.permission.MANAGE_DEVICE_AUTH_CRED
-允许应用调用设备认证华为帐号凭据管理应用接口。
+允许应用调用设备认证分布式帐号凭据管理应用接口。
**权限级别**:system_basic
@@ -2695,3 +2695,27 @@
**ACL使能**:FALSE
**起始版本**:10
+
+## ohos.permission.UNINSTALL_BUNDLE
+
+允许应用卸载应用。
+
+**权限级别**:system_core
+
+**授权方式**:system_grant
+
+**ACL使能**:TRUE
+
+**起始版本**:10
+
+## ohos.permission.RECOVER_BUNDLE
+
+允许应用恢复预置应用。
+
+**权限级别**:system_core
+
+**授权方式**:system_grant
+
+**ACL使能**:TRUE
+
+**起始版本**:10
diff --git a/zh-cn/application-dev/task-management/continuous-task.md b/zh-cn/application-dev/task-management/continuous-task.md
index 77eb0c6f3975b9881f134ac758a9cb959b3033ca..7c4e84649ff67d792adbc3061a7ffbc495683c80 100644
--- a/zh-cn/application-dev/task-management/continuous-task.md
+++ b/zh-cn/application-dev/task-management/continuous-task.md
@@ -320,7 +320,7 @@
```
-### FA模型中
+### FA模型
1. 启动并连接ServiceAbility。
diff --git a/zh-cn/application-dev/task-management/efficiency-resource-request.md b/zh-cn/application-dev/task-management/efficiency-resource-request.md
index 9792d934187d8f41aef0b8dca0d4f735e2cdbd77..3dbdaf18646b9197ea4c7ed5b299ecff3404ada9 100644
--- a/zh-cn/application-dev/task-management/efficiency-resource-request.md
+++ b/zh-cn/application-dev/task-management/efficiency-resource-request.md
@@ -10,7 +10,7 @@
- **能效资源申请接口** :单独为进程申请CPU等资源的接口,保障系统应用在后台执行的诉求。申请CPU资源后,则应用或进程不被挂起。
-- **系统特权应用**:配置[runningResourcesApply特权](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-app-privilege-config-guide.md#可由设备厂商配置的特权)应用的系统应用。
+- **系统特权应用**:配置[runningResourcesApply特权](../../device-dev/subsystems/subsys-app-privilege-config-guide.md#可由设备厂商配置的特权)应用的系统应用。
### 约束与限制
@@ -33,10 +33,10 @@
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| resourceTypes | number | 是 | 申请的资源类型 |
-| isApply | boolean | 是 | 申请或释放资源
- ture表示申请资源
- false表示释放部分资源 |
+| isApply | boolean | 是 | 申请或释放资源
- true表示申请资源
- false表示释放部分资源 |
| timeOut | number | 是 | 资源使用时间(ms) |
-| isPersist | boolean | 否 | 是否为永久持有资源,默认为false
- ture表示永久持有
- false表示有限时间内持有 |
-| isProcess | boolean | 否 | 进程或应用申请,默认为false
- ture表示进程申请
- false表示应用申请 |
+| isPersist | boolean | 否 | 是否为永久持有资源,默认为false
- true表示永久持有
- false表示有限时间内持有 |
+| isProcess | boolean | 否 | 进程或应用申请,默认为false
- true表示进程申请
- false表示应用申请 |
| reason | string | 是 | 申请资源原因 |
**表3** 能效资源类型
@@ -66,8 +66,8 @@
// 应用需要在后台保持活动状态,不被挂起。
let request = {
- resourceTypes: backgroundTaskManager.ResourceType.CPU, // 资源类型是CPU资源,保证应用进程不被挂起
- isApply: true, // 释放资源
+ resourceTypes: backgroundTaskManager.ResourceType.CPU, // 资源类型是CPU资源,保证应用进程不被挂起
+ isApply: true, // 申请资源
timeOut: 0, // 超时时间,超过超时时间后资源自动释放
reason: "apply", // 申请原因
isPersist: true, // 永久持有资源
diff --git a/zh-cn/application-dev/tools/figures/suap-collect-file.png b/zh-cn/application-dev/tools/figures/suap-collect-file.png
index 3a71eca51ff0e4f8d9cd4abac6fffc214fb09471..b06402dffd58b739034f6aa2da06d958bf3f6e49 100644
Binary files a/zh-cn/application-dev/tools/figures/suap-collect-file.png and b/zh-cn/application-dev/tools/figures/suap-collect-file.png differ
diff --git a/zh-cn/application-dev/tools/figures/suap-collect.png b/zh-cn/application-dev/tools/figures/suap-collect.png
index 185a75050fac6ed245e90b119459c9837166435b..e2a1f5ff1ae062f24bc527affae57e6ed69741ca 100644
Binary files a/zh-cn/application-dev/tools/figures/suap-collect.png and b/zh-cn/application-dev/tools/figures/suap-collect.png differ
diff --git a/zh-cn/application-dev/tools/figures/suap-deps.png b/zh-cn/application-dev/tools/figures/suap-deps.png
index c820c5dbf0719ba4f493df40c13ef5d49daf33b1..1dccdff11f9322b238d003ad8705d8f20edfead4 100644
Binary files a/zh-cn/application-dev/tools/figures/suap-deps.png and b/zh-cn/application-dev/tools/figures/suap-deps.png differ
diff --git a/zh-cn/application-dev/tools/figures/suap-diff-file.png b/zh-cn/application-dev/tools/figures/suap-diff-file.png
index b6fef2e26db29a837adc6930464ddda035180b2f..fc0601b5fb417e277cb408da4a889c3bae92192a 100644
Binary files a/zh-cn/application-dev/tools/figures/suap-diff-file.png and b/zh-cn/application-dev/tools/figures/suap-diff-file.png differ
diff --git a/zh-cn/application-dev/tools/figures/suap-diff.png b/zh-cn/application-dev/tools/figures/suap-diff.png
index 5d8e3b1925fb0ef1b2ac8cc63b43f7dfc6d50adb..0c8a3abfa247f87b563d693b06f538332d48d105 100644
Binary files a/zh-cn/application-dev/tools/figures/suap-diff.png and b/zh-cn/application-dev/tools/figures/suap-diff.png differ
diff --git a/zh-cn/application-dev/tools/figures/suap-warehouse.png b/zh-cn/application-dev/tools/figures/suap-warehouse.png
index 57db255b26258db0556bfafe4d924a7296c96166..dcf44c9e52fe345f33ed82550312b9c9276d6330 100644
Binary files a/zh-cn/application-dev/tools/figures/suap-warehouse.png and b/zh-cn/application-dev/tools/figures/suap-warehouse.png differ
diff --git a/zh-cn/application-dev/tools/suap-tool.md b/zh-cn/application-dev/tools/suap-tool.md
index 64a46fcedb3cc5697869b5927a8afee8173c63a8..0ee115baf51b1b71fe4e2b46a6dcddafec1609c9 100644
--- a/zh-cn/application-dev/tools/suap-tool.md
+++ b/zh-cn/application-dev/tools/suap-tool.md
@@ -51,20 +51,20 @@ Beta版本不承诺API稳定性,在SDK升级后,可能存在API不兼容的
## 工具源码使用教程
-1.[interface仓](https://gitee.com/openharmony/interface_sdk-js/tree/master/build-tools)中 clone [diff_api](https://gitee.com/openharmony/interface_sdk-js/tree/master/build-tools/diff_api)工具(对比两个版本SDK里的API差异)和[api_collector](https://gitee.com/openharmony/interface_sdk-js/tree/master/build-tools/api_collector)工具(用于解析并汇总应用中使用到的API)到本地。
+1.[interface仓](https://gitee.com/openharmony/interface_sdk-js/tree/master/build-tools)中 clone [api_diff](https://gitee.com/openharmony/interface_sdk-js/tree/master/build-tools/api_diff)工具(对比两个版本SDK里的API差异)和[collect_application_api](https://gitee.com/openharmony/interface_sdk-js/tree/master/build-tools/collect_application_api)工具(用于解析并汇总应用中使用到的API)到本地。

-2.在本地api_collector工具目录下创建名为'deps'的文件夹,在deps文件夹,放置[typescript](https://gitee.com/openharmony/third_party_typescript/tree/master/build_package)源码。
+2.在本地collect_application_api工具目录下创建名为'deps'的文件夹,在deps文件夹,放置[typescript](https://gitee.com/openharmony/third_party_typescript/tree/master/build_package)源码。

-3.在本地diff_api工具和api_collector工具目录下进入终端,进行安装和编译。输入命令:npm install,之后进行构建:npm run build。构建成功之后,会在对应的工具文件夹下生成dist=>build=>api-diff.js和dist=>build=>api-collectort.js
+3.在本地api_diff工具和collect_application_api工具目录下进入终端,进行安装和编译。输入命令:npm install,之后进行构建:npm run build。构建成功之后,会在对应的工具文件夹下生成dist=>build=>api-diff.js和dist=>build=>api-collector.js


-4.在本地磁盘的最后一个盘符,创建名为'updateCheck'文件夹,内部分别创建'api-diff'和'collect_application_api'文件夹。将步骤3中的api-diff.js文件放置'api-diff'文件夹下,api_collect文件夹下lib文件夹以及api-collector.js放置在'collect_application_api'文件夹下。
+4.在本地磁盘的最后一个盘符,创建名为'updateCheck'文件夹,内部分别创建'api-diff'和'collect_application_api'文件夹。将步骤3中的api-diff.js文件放置'api-diff'文件夹下,collect_application_api文件夹下libs文件夹以及api-collector.js放置在'collect_application_api'文件夹下。


diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md
index c796d38d101485ff737ff0e020d20ed2f29ac7bc..7f9c9e572b380345bce3a15fb696845957903bd5 100644
--- a/zh-cn/application-dev/website.md
+++ b/zh-cn/application-dev/website.md
@@ -402,6 +402,7 @@
- [异步并发概述](arkts-utils/async-concurrency-overview.md)
- [单次I/O任务开发指导](arkts-utils/single-io-development.md)
- 使用多线程并发能力进行开发
+ - [多线程并发概述](arkts-utils/multi-thread-concurrency-overview.md)
- [TaskPool和Worker的对比](arkts-utils/taskpool-vs-worker.md)
- [CPU密集型任务开发指导](arkts-utils/cpu-intensive-task-development.md)
- [I/O密集型任务开发指导](arkts-utils/io-intensive-task-development.md)
@@ -510,6 +511,7 @@
- 相机最佳实践
- [拍照实现方案](media/camera-shooting-case.md)
- [录像实现方案](media/camera-recording-case.md)
+ - [性能提升方案(仅对系统应用开放)](media/camera-preformance-imporvement.md)
- 图片
- [图片开发概述](media/image-overview.md)
- [图片解码](media/image-decoding.md)
@@ -545,9 +547,9 @@
- [Hap包签名工具指导](security/hapsigntool-guidelines.md)
- [HarmonyAppProvision配置文件](security/app-provision-structure.md)
- AI
- - [AI开发概述](./ai/ai-overview.md)
- - [使用MindSpore Lite JS API开发AI应用](./ai/mindspore-guidelines-based-js.md)
- - [使用MindSpore Lite Native API开发AI应用](./ai/mindspore-guidelines-based-native.md)
+ - [AI开发概述](ai/ai-overview.md)
+ - [使用MindSpore Lite JS API开发AI应用](ai/mindspore-guidelines-based-js.md)
+ - [使用MindSpore Lite Native API开发AI应用](ai/mindspore-guidelines-based-native.md)
- 网络与连接
- 网络管理
- [网络管理开发概述](connectivity/net-mgmt-overview.md)
@@ -559,6 +561,7 @@
- [网络连接管理](connectivity/net-connection-manager.md)
- [MDNS管理](connectivity/net-mdns.md)
- [流量管理](connectivity/net-statistics.md)
+ - [VPN管理](connectivity/net-vpn.md)
- IPC与RPC通信
- [IPC与RPC通信概述](connectivity/ipc-rpc-overview.md)
- [IPC与RPC通信开发指导](connectivity/ipc-rpc-development-guideline.md)
@@ -625,12 +628,12 @@
- [设置分布式文件数据等级](file-management/set-security-label.md)
- [跨设备文件访问](file-management/file-access-across-devices.md)
- 后台任务(Background Task)管理
- - [后台任务概述](task-management/background-task-overview.md)
- - [短时任务](task-management/transient-task.md)
- - [长时任务](task-management/continuous-task.md)
- - [延迟任务](task-management/work-scheduler.md)
- - [代理提醒](task-management/agent-powered-reminder.md)
- - [能效资源申请(仅对系统特权应用开放)](task-management/efficiency-resource-request.md)
+ - [后台任务总体概述](task-management/background-task-overview.md)
+ - [短时任务](task-management/transient-task.md)
+ - [长时任务](task-management/continuous-task.md)
+ - [延迟任务](task-management/work-scheduler.md)
+ - [代理提醒](task-management/agent-powered-reminder.md)
+ - [能效资源申请(仅对系统特权应用开放)](task-management/efficiency-resource-request.md)
- 设备管理
- USB服务
- [USB服务开发概述](device/usb-overview.md)
@@ -743,6 +746,8 @@
- [Neural Network Runtime对接AI推理框架开发指导](napi/neural-network-runtime-guidelines.md)
- 内存管理
- [Purgeable memory开发指导](napi/purgeable-memory-guidelines.md)
+ - 设备管理
+ - [USB DDK开发指导](napi/usb-ddk-guidelines.md)
- 工具
- [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md)
- 调试工具
@@ -958,20 +963,21 @@
- UI界面
- [@ohos.animator (动画)](reference/apis/js-apis-animator.md)
- [@ohos.arkui.componentSnapshot (组件截图)](reference/apis/js-apis-arkui-componentSnapshot.md)
+ - [@ohos.arkui.componentUtils (componentUtils)](reference/apis/js-apis-arkui-componentUtils.md)
+ - [@ohos.arkui.dragController (DragController)](reference/apis/js-apis-arkui-dragController.md)
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](reference/apis/js-apis-arkui-drawableDescriptor.md)
- [@ohos.arkui.inspector (布局回调)](reference/apis/js-apis-arkui-inspector.md)
+ - [ @ohos.arkui.performanceMonitor (性能监测)](reference/apis/js-apis-arkui-performancemonitor.md)
- [@ohos.arkui.UIContext (UIContext)](reference/apis/js-apis-arkui-UIContext.md)
- - [@ohos.arkui.componentUtils (componentUtils)](reference/apis/js-apis-arkui-componentUtils.md)
- [@ohos.curves (插值计算)](reference/apis/js-apis-curve.md)
- [@ohos.font (注册自定义字体)](reference/apis/js-apis-font.md)
- [@ohos.matrix4 (矩阵变换)](reference/apis/js-apis-matrix4.md)
+ - [@ohos.measure (文本计算)](reference/apis/js-apis-measure.md)
- [@ohos.mediaquery (媒体查询)](reference/apis/js-apis-mediaquery.md)
- [@ohos.pluginComponent (PluginComponentManager)](reference/apis/js-apis-plugincomponent.md)
- [@ohos.promptAction (弹窗)](reference/apis/js-apis-promptAction.md)
- [@ohos.router (页面路由)](reference/apis/js-apis-router.md)
- - [@ohos.measure (文本计算)](reference/apis/js-apis-measure.md)
- [@ohos.uiAppearance (用户界面外观)](reference/apis/js-apis-uiappearance.md)
- - [ @ohos.arkui.performanceMonitor (性能监测)](reference/apis/js-apis-arkui-performancemonitor.md)
- 图形图像
- [@ohos.animation.windowAnimationManager (窗口动画管理)](reference/apis/js-apis-windowAnimationManager.md)
- [@ohos.application.WindowExtensionAbility (窗口扩展能力)](reference/apis/js-apis-application-windowExtensionAbility.md)
@@ -1065,11 +1071,22 @@
- [@ohos.net.sharing (网络共享管理)](reference/apis/js-apis-net-sharing.md)
- [@ohos.net.socket (Socket连接)](reference/apis/js-apis-socket.md)
- [@ohos.net.statistics (流量管理)](reference/apis/js-apis-net-statistics.md)
+ - [@ohos.net.vpn (VPN管理)](reference/apis/js-apis-net-vpn.md)
- [@ohos.net.webSocket (WebSocket连接)](reference/apis/js-apis-webSocket.md)
- [@ohos.request (上传下载)](reference/apis/js-apis-request.md)
- 通信与连接
+ - [@ohos.bluetooth.a2dp(蓝牙a2dp模块)(推荐)](reference/apis/js-apis-bluetooth-a2dp.md)
+ - [@ohos.bluetooth.access(蓝牙access模块)(推荐)](reference/apis/js-apis-bluetooth-access.md)
+ - [@ohos.bluetooth.baseProfile(蓝牙baseProfile模块)(推荐)](reference/apis/js-apis-bluetooth-baseProfile.md)
+ - [@ohos.bluetooth.ble(蓝牙ble模块)(推荐)](reference/apis/js-apis-bluetooth-ble.md)
+ - [@ohos.bluetooth.connection(蓝牙connection模块)(推荐)](reference/apis/js-apis-bluetooth-connection.md)
+ - [@ohos.bluetooth.constant(蓝牙constant模块)(推荐)](reference/apis/js-apis-bluetooth-constant.md)
+ - [@ohos.bluetooth.hfp(蓝牙hfp模块)(推荐)](reference/apis/js-apis-bluetooth-hfp.md)
+ - [@ohos.bluetooth.hid(蓝牙hid模块)(推荐)](reference/apis/js-apis-bluetooth-hid.md)
+ - [@ohos.bluetooth.pan(蓝牙pan模块)(推荐)](reference/apis/js-apis-bluetooth-pan.md)
+ - [@ohos.bluetooth.socket(蓝牙socket模块)(推荐)](reference/apis/js-apis-bluetooth-socket.md)
- [@ohos.bluetooth (蓝牙)(待停用)](reference/apis/js-apis-bluetooth.md)
- - [@ohos.bluetoothManager (蓝牙)(推荐)](reference/apis/js-apis-bluetoothManager.md)
+ - [@ohos.bluetoothManager (蓝牙)(待停用)](reference/apis/js-apis-bluetoothManager.md)
- [@ohos.connectedTag (有源标签)](reference/apis/js-apis-connectedTag.md)
- [@ohos.nfc.cardEmulation (标准NFC-cardEmulation)](reference/apis/js-apis-cardEmulation.md)
- [@ohos.nfc.controller (标准NFC)](reference/apis/js-apis-nfcController.md)
@@ -1145,7 +1162,6 @@
- [@ohos.multimodalInput.touchEvent (触摸输入事件)](reference/apis/js-apis-touchevent.md)
- [@ohos.multimodalInput.shortKey(快捷键)](reference/apis/js-apis-shortKey.md)
- [@ohos.power (系统电源管理)](reference/apis/js-apis-power.md)
- - [@ohos.resourceschedule.deviceStandby (设备待机模块)](reference/apis/js-apis-resourceschedule-deviceStandby.md)
- [@ohos.runningLock (Runninglock锁)](reference/apis/js-apis-runninglock.md)
- [@ohos.sensor (传感器)](reference/apis/js-apis-sensor.md)
- [@ohos.settings (设置数据项名称)](reference/apis/js-apis-settings.md)
@@ -1179,7 +1195,6 @@
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (企业设备管理扩展能力)](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.networkManager (网络管理)](reference/apis/js-apis-enterprise-networkManager.md)
- [@ohos.enterprise.restrictions (限制类策略)](reference/apis/js-apis-enterprise-restrictions.md)
- - [@ohos.enterprise.usbManager (USB管理)](reference/apis/js-apis-enterprise-usbManager.md)
- [@ohos.enterprise.wifiManager (WiFi管理)](reference/apis/js-apis-enterprise-wifiManager.md)
- 语言基础类库
- [@ohos.buffer (Buffer)](reference/apis/js-apis-buffer.md)
@@ -1389,6 +1404,7 @@
- [GridRow](reference/arkui-ts/ts-container-gridrow.md)
- [Grid](reference/arkui-ts/ts-container-grid.md)
- [GridItem](reference/arkui-ts/ts-container-griditem.md)
+ - [Hyperlink](reference/arkui-ts/ts-container-hyperlink.md)
- [List](reference/arkui-ts/ts-container-list.md)
- [ListItem](reference/arkui-ts/ts-container-listitem.md)
- [ListItemGroup](reference/arkui-ts/ts-container-listitemgroup.md)
@@ -1404,6 +1420,7 @@
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
+ - [UIExtensionComponent](reference/arkui-ts/ts-container-ui-extension-component.md)
- [WaterFlow](reference/arkui-ts/ts-container-waterflow.md)
- 媒体组件
- [Video](reference/arkui-ts/ts-media-components-video.md)
@@ -1437,6 +1454,7 @@
- [组件内转场](reference/arkui-ts/ts-transition-animation-component.md)
- [共享元素转场](reference/arkui-ts/ts-transition-animation-shared-elements.md)
- [组件内隐式共享元素转场](reference/arkui-ts/ts-transition-animation-geometrytransition.md)
+ - [路径动画](reference/arkui-ts/ts-motion-path-animation.md)
- 全局UI方法
- 弹窗
- [警告弹窗](reference/arkui-ts/ts-methods-alert-dialog-box.md)
@@ -1454,7 +1472,7 @@
- 已停止维护的组件
- [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md)
- 已停止维护的接口
- - [点击控制](reference/arkui-ts/ts-universal-attributes-click.md)
+ - [点击控制](reference/arkui-ts/ts-universal-attributes-click.md)
- 组件参考(兼容JS的类Web开发范式-ArkUI.Full)
- 组件通用信息
- [通用属性](reference/arkui-js/js-components-common-attributes.md)
@@ -1689,6 +1707,7 @@
- [策略管理错误码](reference/errorcodes/errorcode-net-policy.md)
- [MDNS错误码](reference/errorcodes/errorcode-net-mdns.md)
- [流量管理错误码](reference/errorcodes/errorcode-net-statistics.md)
+ - [VPN错误码](reference/errorcodes/errorcode-net-vpn.md)
- 通信与连接
- [Bluetooth错误码](reference/errorcodes/errorcode-bluetoothManager.md)
- [WIFI错误码](reference/errorcodes/errorcode-wifi.md)
@@ -1756,11 +1775,13 @@
- [AVDemuxer](reference/native-apis/_a_v_demuxer.md)
- [AVSource](reference/native-apis/_a_v_source.md)
- [OHAudio](reference/native-apis/_o_h_audio.md)
+ - [AVScreenCapture](reference/native-apis/_a_v_screen_capture.md)
- [HuksKeyApi](reference/native-apis/_huks_key_api.md)
- [HuksParamSetApi](reference/native-apis/_huks_param_set_api.md)
- [HuksTypeApi](reference/native-apis/_huks_type_api.md)
- [Init](reference/native-apis/init.md)
- [Memory](reference/native-apis/memory.md)
+ - [UsbDdk](reference/native-apis/_usb_ddk.md)
- [Hitrace](reference/native-apis/_hitrace.md)
- [Vulkan](reference/native-apis/_vulkan.md)
- 头文件
@@ -1816,6 +1837,9 @@
- [native_audiorenderer.h](reference/native-apis/native__audiorenderer_8h.md)
- [native_audiostream_base.h](reference/native-apis/native__audiostream__base_8h.md)
- [native_audiostreambuilder.h](reference/native-apis/native__audiostreambuilder_8h.md)
+ - [native_avscreen_capture.h](reference/native-apis/native__avscreen__capture_8h.md)
+ - [native_avscreen_capture_base.h](reference/native-apis/native__avscreen__capture__base_8h.md)
+ - [native_avscreen_capture_errors.h](reference/native-apis/native__avscreen__capture__errors_8h.md)
- [native_huks_api.h](reference/native-apis/native__huks__api_8h.md)
- [native_huks_param.h](reference/native-apis/native__huks__param_8h.md)
- [native_huks_type.h](reference/native-apis/native__huks__type_8h.md)
@@ -1827,6 +1851,8 @@
- [relational_store.h](reference/native-apis/relational__store_8h.md)
- [syscap_ndk.h](reference/native-apis/syscap__ndk_8h.md)
- [purgeable_memory.h](reference/native-apis/purgeable__memory_8h.md)
+ - [usb_ddk_api.h](reference/native-apis/usb__ddk__api_8h.md)
+ - [usb_ddk_types.h](reference/native-apis/usb__ddk__types_8h.md)
- [trace.h](reference/native-apis/trace_8h.md)
- [vulkan_ohos.h](reference/native-apis/vulkan__ohos_8h.md)
- 结构体
@@ -1871,6 +1897,17 @@
- [OH_AVRange](reference/native-apis/_o_h___a_v_range.md)
- [OH_AudioCapturer_Callbacks_Struct](reference/native-apis/_o_h___audio_capturer___callbacks___struct.md)
- [OH_AudioRenderer_Callbacks_Struct](reference/native-apis/_o_h___audio_renderer___callbacks___struct.md)
+ - [OH_AudioBuffer](reference/native-apis/_o_h___audio_buffer.md)
+ - [OH_AudioCaptureInfo](reference/native-apis/_o_h___audio_capture_info.md)
+ - [OH_AudioEncInfo](reference/native-apis/_o_h___audio_enc_info.md)
+ - [OH_AudioInfo](reference/native-apis/_o_h___audio_info.md)
+ - [OH_AVScreenCaptureCallback](reference/native-apis/_o_h___a_v_screen_capture_callback.md)
+ - [OH_AVScreenCaptureConfig](reference/native-apis/_o_h___a_v_screen_capture_config.md)
+ - [OH_RecorderInfo](reference/native-apis/_o_h___recorder_info.md)
+ - [OH_Rect](reference/native-apis/_o_h___rect.md)
+ - [OH_VideoCaptureInfo](reference/native-apis/_o_h___video_capture_info.md)
+ - [OH_VideoEncInfo](reference/native-apis/_o_h___video_enc_info.md)
+ - [OH_VideoInfo](reference/native-apis/_o_h___video_info.md)
- [OH_Huks_Blob](reference/native-apis/_o_h___huks___blob.md)
- [OH_Huks_CertChain](reference/native-apis/_o_h___huks___cert_chain.md)
- [OH_Huks_KeyInfo](reference/native-apis/_o_h___huks___key_info.md)
@@ -1889,6 +1926,17 @@
- [OH_Rdb_Store](reference/native-apis/_o_h___rdb___store.md)
- [OH_VBucket](reference/native-apis/_o_h___v_bucket.md)
- [OH_VObject](reference/native-apis/_o_h___v_object.md)
+ - [UsbConfigDescriptor](reference/native-apis/_usb_config_descriptor.md)
+ - [UsbControlRequestSetup](reference/native-apis/_usb_control_request_setup.md)
+ - [UsbDdkConfigDescriptor](reference/native-apis/_usb_ddk_config_descriptor.md)
+ - [UsbDdkEndpointDescriptor](reference/native-apis/_usb_ddk_endpoint_descriptor.md)
+ - [UsbDdkInterface](reference/native-apis/_usb_ddk_interface.md)
+ - [UsbDdkInterfaceDescriptor](reference/native-apis/_usb_ddk_interface_descriptor.md)
+ - [UsbDeviceDescriptor](reference/native-apis/_usb_device_descriptor.md)
+ - [UsbDeviceMemMap](reference/native-apis/_usb_device_mem_map.md)
+ - [UsbEndpointDescriptor](reference/native-apis/_usb_endpoint_descriptor.md)
+ - [UsbInterfaceDescriptor](reference/native-apis/_usb_interface_descriptor.md)
+ - [UsbRequestPipe](reference/native-apis/_usb_request_pipe.md)
- [VkExternalFormatOHOS](reference/native-apis/_vk_external_format_o_h_o_s.md)
- [VkImportNativeBufferInfoOHOS](reference/native-apis/_vk_import_native_buffer_info_o_h_o_s.md)
- [VkMemoryGetNativeBufferInfoOHOS](reference/native-apis/_vk_memory_get_native_buffer_info_o_h_o_s.md)
diff --git a/zh-cn/release-notes/api-diff/v4.0-beta2/js-apidiff-ability.md b/zh-cn/release-notes/api-diff/v4.0-beta2/js-apidiff-ability.md
new file mode 100644
index 0000000000000000000000000000000000000000..b09793d8a9a29aa8f0bba48e307bf3008888f30f
--- /dev/null
+++ b/zh-cn/release-notes/api-diff/v4.0-beta2/js-apidiff-ability.md
@@ -0,0 +1,812 @@
+| 操作 | 旧版本 | 新版本 | d.ts文件 |
+| ---- | ------ | ------ | -------- |
+|新增|NA|类名:LastExitReason;
方法or属性:CPP_CRASH = 3|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:LastExitReason;
方法or属性:JS_ERROR = 4|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:LastExitReason;
方法or属性:APP_FREEZE = 5|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:LastExitReason;
方法or属性:PERFORMANCE_CONTROL = 6|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:LastExitReason;
方法or属性:RESOURCE_CONTROL = 7|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:LastExitReason;
方法or属性:UPGRADE = 8|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:ContinueState;
方法or属性:ACTIVE = 0|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:ContinueState;
方法or属性:INACTIVE = 1|@ohos.app.ability.AbilityConstant.d.ts|
+|新增|NA|类名:abilityManager;
方法or属性:function notifySaveAsResult(parameter: AbilityResult, requestCode: number, callback: AsyncCallback\): void;|@ohos.app.ability.abilityManager.d.ts|
+|新增|NA|类名:abilityManager;
方法or属性:function notifySaveAsResult(parameter: AbilityResult, requestCode: number): Promise\;|@ohos.app.ability.abilityManager.d.ts|
+|新增|NA|类名:ApplicationStateChangeCallback;
方法or属性:onApplicationForeground(): void;|@ohos.app.ability.ApplicationStateChangeCallback.d.ts|
+|新增|NA|类名:ApplicationStateChangeCallback;
方法or属性:onApplicationBackground(): void;|@ohos.app.ability.ApplicationStateChangeCallback.d.ts|
+|新增|NA|类名:appManager;
方法or属性:function getProcessMemoryByPid(pid: number): Promise\;|@ohos.app.ability.appManager.d.ts|
+|新增|NA|类名:appManager;
方法or属性:function getProcessMemoryByPid(pid: number, callback: AsyncCallback\): void;|@ohos.app.ability.appManager.d.ts|
+|新增|NA|类名:appManager;
方法or属性:function getRunningProcessInfoByBundleName(bundleName: string, callback: AsyncCallback\>): void;|@ohos.app.ability.appManager.d.ts|
+|新增|NA|类名:appManager;
方法or属性:function getRunningProcessInfoByBundleName(bundleName: string, userId: number, callback: AsyncCallback\>): void;|@ohos.app.ability.appManager.d.ts|
+|新增|NA|类名:appManager;
方法or属性:function getRunningProcessInfoByBundleName(bundleName: string): Promise\>;|@ohos.app.ability.appManager.d.ts|
+|新增|NA|类名:appManager;
方法or属性:function getRunningProcessInfoByBundleName(bundleName: string, userId: number): Promise\>;|@ohos.app.ability.appManager.d.ts|
+|新增|NA|类名:WindowRect;
方法or属性:left: number;|@ohos.app.ability.dialogRequest.d.ts|
+|新增|NA|类名:WindowRect;
方法or属性:top: number;|@ohos.app.ability.dialogRequest.d.ts|
+|新增|NA|类名:WindowRect;
方法or属性:width: number;|@ohos.app.ability.dialogRequest.d.ts|
+|新增|NA|类名:WindowRect;
方法or属性:height: number;|@ohos.app.ability.dialogRequest.d.ts|
+|新增|NA|类名:RequestInfo;
方法or属性:windowRect?: WindowRect|@ohos.app.ability.dialogRequest.d.ts|
+|新增|NA|类名:RequestResult;
方法or属性:want?: Want;|@ohos.app.ability.dialogRequest.d.ts|
+|新增|NA|类名:missionManager;
方法or属性:function moveMissionsToForeground(missionIds: Array\, callback: AsyncCallback\): void;|@ohos.app.ability.missionManager.d.ts|
+|新增|NA|类名:missionManager;
方法or属性:function moveMissionsToForeground(missionIds: Array\, topMission: number, callback: AsyncCallback\): void;|@ohos.app.ability.missionManager.d.ts|
+|新增|NA|类名:missionManager;
方法or属性:function moveMissionsToForeground(missionIds: Array\, topMission?: number): Promise\;|@ohos.app.ability.missionManager.d.ts|
+|新增|NA|类名:missionManager;
方法or属性:function moveMissionsToBackground(missionIds: Array\, callback: AsyncCallback\>): void;|@ohos.app.ability.missionManager.d.ts|
+|新增|NA|类名:missionManager;
方法or属性:function moveMissionsToBackground(missionIds: Array\): Promise\>;|@ohos.app.ability.missionManager.d.ts|
+|新增|NA|类名:UIAbility;
方法or属性:onPrepareToTerminate(): boolean;|@ohos.app.ability.UIAbility.d.ts|
+|新增|NA|类名:UIAbility;
方法or属性:onBackPressed(): boolean;|@ohos.app.ability.UIAbility.d.ts|
+|新增|NA|类名:UIExtensionAbility;
方法or属性:context: UIExtensionContext;|@ohos.app.ability.UIExtensionAbility.d.ts|
+|新增|NA|类名:UIExtensionAbility;
方法or属性:onCreate(): void;|@ohos.app.ability.UIExtensionAbility.d.ts|
+|新增|NA|类名:UIExtensionAbility;
方法or属性:onSessionCreate(want: Want, session: UIExtensionContentSession): void;|@ohos.app.ability.UIExtensionAbility.d.ts|
+|新增|NA|类名:UIExtensionAbility;
方法or属性:onSessionDestroy(session: UIExtensionContentSession): void;|@ohos.app.ability.UIExtensionAbility.d.ts|
+|新增|NA|类名:UIExtensionAbility;
方法or属性:onForeground(): void;|@ohos.app.ability.UIExtensionAbility.d.ts|
+|新增|NA|类名:UIExtensionAbility;
方法or属性:onBackground(): void;|@ohos.app.ability.UIExtensionAbility.d.ts|
+|新增|NA|类名:UIExtensionAbility;
方法or属性:onDestroy(): void \| Promise\;|@ohos.app.ability.UIExtensionAbility.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:sendData(data: { [key: string]: Object }): void;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:setReceiveDataCallback(callback: (data: { [key: string]: Object }) => void): void;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:loadContent(path: string, storage?: LocalStorage): void;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:terminateSelf(callback: AsyncCallback\): void;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:terminateSelf(): Promise\;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\): void;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:terminateSelfWithResult(parameter: AbilityResult): Promise\;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:setWindowBackgroundColor(color: string): void;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:setWindowPrivacyMode(isPrivacyMode: boolean): Promise\;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:UIExtensionContentSession;
方法or属性:setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback\): void;|@ohos.app.ability.UIExtensionContentSession.d.ts|
+|新增|NA|类名:Params;
方法or属性:SUPPORT_CONTINUE_PAGE_STACK_KEY = 'ohos.extra.param.key.supportContinuePageStack'|@ohos.app.ability.wantConstant.d.ts|
+|新增|NA|类名:Params;
方法or属性:SUPPORT_CONTINUE_SOURCE_EXIT_KEY = 'ohos.extra.param.key.supportContinueSourceExit'|@ohos.app.ability.wantConstant.d.ts|
+|新增|NA|类名:FormBindingData;
方法or属性:proxies?: Array\;|@ohos.app.form.formBindingData.d.ts|
+|新增|NA|类名:ProxyData;
方法or属性:key: string;|@ohos.app.form.formBindingData.d.ts|
+|新增|NA|类名:ProxyData;
方法or属性:subscriberId?: string;|@ohos.app.form.formBindingData.d.ts|
+|新增|NA|类名:formHost;
方法or属性:function on(
type: 'notifyVisible',
observerCallback: Callback\>,
hostBundleName?: string
): void;|@ohos.app.form.formHost.d.ts|
+|新增|NA|类名:formHost;
方法or属性:function on(
type: 'notifyInvisible',
observerCallback: Callback\>,
hostBundleName?: string
): void;|@ohos.app.form.formHost.d.ts|
+|新增|NA|类名:formHost;
方法or属性:function off(
type: 'notifyVisible',
observerCallback?: Callback\>,
hostBundleName?: string
): void;|@ohos.app.form.formHost.d.ts|
+|新增|NA|类名:formHost;
方法or属性:function off(
type: 'notifyInvisible',
observerCallback?: Callback\>,
hostBundleName?: string
): void;|@ohos.app.form.formHost.d.ts|
+|新增|NA|类名:FormInfo;
方法or属性:isDynamic: boolean;|@ohos.app.form.formInfo.d.ts|
+|新增|NA|类名:distributedMissionManager;
方法or属性:function on(type: 'continueStateChange', callback: Callback\<{ state: ContinueState, info: ContinuableInfo }>): void;|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:distributedMissionManager;
方法or属性:function off(type: 'continueStateChange', callback?: Callback\<{ state: ContinueState, info: ContinuableInfo }>): void;|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:distributedMissionManager;
方法or属性:function continueMission(parameter: ContinueMissionInfo, callback: AsyncCallback\): void;|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:distributedMissionManager;
方法or属性:function continueMission(parameter: ContinueMissionInfo): Promise\;|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:distributedMissionManager;
方法or属性:export type ContinuableInfo = _ContinuableInfo;|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:distributedMissionManager;
方法or属性:export type ContinueMissionInfo = _ContinueMissionInfo;|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:ContinueState;
方法or属性:ACTIVE = 0|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:ContinueState;
方法or属性:INACTIVE = 1|@ohos.distributedMissionManager.d.ts|
+|新增|NA|类名:ApplicationContext;
方法or属性:on(type: 'applicationStateChange', callback: ApplicationStateChangeCallback): void;|ApplicationContext.d.ts|
+|新增|NA|类名:ApplicationContext;
方法or属性:off(type: 'applicationStateChange', callback?: ApplicationStateChangeCallback): void;|ApplicationContext.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly bundleName: string;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly moduleName: string;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly name: string;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly labelId: number;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly descriptionId: number;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly iconId: number;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly businessType: businessAbilityRouter.BusinessType;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:BusinessAbilityInfo;
方法or属性:readonly applicationInfo: ApplicationInfo;|BusinessAbilityInfo.d.ts|
+|新增|NA|类名:Context;
方法or属性:getGroupDir(dataGroupID: string, callback: AsyncCallback\): void;|Context.d.ts|
+|新增|NA|类名:Context;
方法or属性:getGroupDir(dataGroupID: string): Promise\;|Context.d.ts|
+|新增|NA|类名:ContinuableInfo;
方法or属性:srcDeviceId: string;|ContinuableInfo.d.ts|
+|新增|NA|类名:ContinuableInfo;
方法or属性:bundleName: string;|ContinuableInfo.d.ts|
+|新增|NA|类名:ContinueMissionInfo;
方法or属性:srcDeviceId: string;|ContinueMissionInfo.d.ts|
+|新增|NA|类名:ContinueMissionInfo;
方法or属性:dstDeviceId: string;|ContinueMissionInfo.d.ts|
+|新增|NA|类名:ContinueMissionInfo;
方法or属性:bundleName: string;|ContinueMissionInfo.d.ts|
+|新增|NA|类名:ContinueMissionInfo;
方法or属性:wantParam: { [key: string]: Object };|ContinueMissionInfo.d.ts|
+|新增|NA|类名:FormExtensionContext;
方法or属性:connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;|FormExtensionContext.d.ts|
+|新增|NA|类名:FormExtensionContext;
方法or属性:disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback\): void;|FormExtensionContext.d.ts|
+|新增|NA|类名:FormExtensionContext;
方法or属性:disconnectServiceExtensionAbility(connection: number): Promise\;|FormExtensionContext.d.ts|
+|新增|NA|类名:MissionInfo;
方法or属性:abilityState: number;|MissionInfo.d.ts|
+|新增|NA|类名:MissionInfo;
方法or属性:unclearable: boolean;|MissionInfo.d.ts|
+|新增|NA|类名:ProcessInformation;
方法or属性:state: appManager.ProcessState;|ProcessInformation.d.ts|
+|新增|NA|类名:ServiceExtensionContext;
方法or属性:startAbilityAsCaller(want: Want, callback: AsyncCallback\): void;|ServiceExtensionContext.d.ts|
+|新增|NA|类名:ServiceExtensionContext;
方法or属性:startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback\): void;|ServiceExtensionContext.d.ts|
+|新增|NA|类名:ServiceExtensionContext;
方法or属性:startAbilityAsCaller(want: Want, options?: StartOptions): Promise\;|ServiceExtensionContext.d.ts|
+|新增|NA|类名:UIAbilityContext;
方法or属性:startAbilityAsCaller(want: Want, callback: AsyncCallback\): void;|UIAbilityContext.d.ts|
+|新增|NA|类名:UIAbilityContext;
方法or属性:startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback\): void;|UIAbilityContext.d.ts|
+|新增|NA|类名:UIAbilityContext;
方法or属性:startAbilityAsCaller(want: Want, options?: StartOptions): Promise\;|UIAbilityContext.d.ts|
+|新增|NA|类名:UIAbilityContext;
方法or属性:setMissionContinueState(state: AbilityConstant.ContinueState, callback: AsyncCallback\): void;|UIAbilityContext.d.ts|
+|新增|NA|类名:UIAbilityContext;
方法or属性:setMissionContinueState(state: AbilityConstant.ContinueState): Promise\;|UIAbilityContext.d.ts|
+|新增|NA|类名:UIAbilityContext;
方法or属性:reportDrawnCompleted(callback: AsyncCallback\): void;|UIAbilityContext.d.ts|
+|新增|NA|类名:UIExtensionContext;
方法or属性:startAbility(want: Want, callback: AsyncCallback\): void;|UIExtensionContext.d.ts|
+|新增|NA|类名:UIExtensionContext;
方法or属性:startAbility(want: Want, options: StartOptions, callback: AsyncCallback\): void;|UIExtensionContext.d.ts|
+|新增|NA|类名:UIExtensionContext;
方法or属性:startAbility(want: Want, options?: StartOptions): Promise\;|UIExtensionContext.d.ts|
+|新增|NA|类名:UIExtensionContext;
方法or属性:startAbilityForResult(want: Want, callback: AsyncCallback\): void;|UIExtensionContext.d.ts|
+|新增|NA|类名:UIExtensionContext;
方法or属性:startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback\): void;|UIExtensionContext.d.ts|
+|新增|NA|类名:UIExtensionContext;
方法or属性:startAbilityForResult(want: Want, options?: StartOptions): Promise\;|UIExtensionContext.d.ts|
+|废弃版本有变化|类名:LastExitReason;
方法or属性:ABILITY_NOT_RESPONDING = 1
旧版本信息:|类名:LastExitReason;
方法or属性:ABILITY_NOT_RESPONDING = 1
新版本信息:10
代替接口: AbilityConstant.LastExitReason#APP_FREEZE|@ohos.app.ability.AbilityConstant.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function off(type: 'deviceConnect', callback?: Callback\): void;
旧版本信息:|类名:continuationManager;
方法or属性:function off(type: 'deviceConnect', callback?: Callback\): void;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#off|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function off(type: 'deviceDisconnect', callback?: Callback\): void;
旧版本信息:|类名:continuationManager;
方法or属性:function off(type: 'deviceDisconnect', callback?: Callback\): void;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#off|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function register(options: ContinuationExtraParams, callback: AsyncCallback\): void;
旧版本信息:|类名:continuationManager;
方法or属性:function register(options: ContinuationExtraParams, callback: AsyncCallback\): void;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#registerContinuation|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function register(options?: ContinuationExtraParams): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function register(options?: ContinuationExtraParams): Promise\;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#registerContinuation|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function unregister(token: number): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function unregister(token: number): Promise\;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#unregisterContinuation|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#updateContinuationState|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\): void;
旧版本信息:|类名:continuationManager;
方法or属性:function startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\): void;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#startContinuationDeviceManager|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:continuationManager;
方法or属性:function startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\;
新版本信息:9
代替接口: ohos.continuation.continuationManager/continuationManager#startContinuationDeviceManager|@ohos.continuation.continuationManager.d.ts|
+|废弃版本有变化|类名:Context;
方法or属性:getExternalCacheDir(): Promise\;
旧版本信息:|类名:Context;
方法or属性:getExternalCacheDir(): Promise\;
新版本信息:7
代替接口:|context.d.ts|
+|废弃版本有变化|类名:Context;
方法or属性:setShowOnLockScreen(show: boolean): Promise\;
旧版本信息:|类名:Context;
方法or属性:setShowOnLockScreen(show: boolean): Promise\;
新版本信息:9
代替接口: ohos.window/window.WindowStage#setShowOnLockScreen|context.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function off(type: 'deviceSelected', token: number): void;
旧版本信息:|类名:continuationManager;
方法or属性:function off(type: 'deviceSelected', token: number): void;
新版本信息:201,401,16600001,16600002,16600004|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function off(type: 'deviceUnselected', token: number): void;
旧版本信息:|类名:continuationManager;
方法or属性:function off(type: 'deviceUnselected', token: number): void;
新版本信息:201,401,16600001,16600002,16600004|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback\): void;
旧版本信息:|类名:continuationManager;
方法or属性:function registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback\): void;
新版本信息:201,401,16600001,16600003|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function registerContinuation(options?: ContinuationExtraParams): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function registerContinuation(options?: ContinuationExtraParams): Promise\;
新版本信息:201,401,16600001,16600003|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function unregisterContinuation(token: number): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function unregisterContinuation(token: number): Promise\;
新版本信息:201,401,16600001,16600002|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise\;
新版本信息:201,401,16600001,16600002|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function startContinuationDeviceManager(
token: number,
options: ContinuationExtraParams,
callback: AsyncCallback\
): void;
旧版本信息:|类名:continuationManager;
方法or属性:function startContinuationDeviceManager(
token: number,
options: ContinuationExtraParams,
callback: AsyncCallback\
): void;
新版本信息:201,401,16600001,16600002|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:continuationManager;
方法or属性:function startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise\;
旧版本信息:|类名:continuationManager;
方法or属性:function startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise\;
新版本信息:201,401,16600001,16600002|@ohos.continuation.continuationManager.d.ts|
+|新增(错误码)|类名:distributedMissionManager;
方法or属性:function startSyncRemoteMissions(parameter: MissionParameter): Promise\;
旧版本信息:|类名:distributedMissionManager;
方法or属性:function startSyncRemoteMissions(parameter: MissionParameter): Promise\;
新版本信息:201,401|@ohos.distributedMissionManager.d.ts|
+|新增(错误码)|类名:distributedMissionManager;
方法or属性:function stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise\;
旧版本信息:|类名:distributedMissionManager;
方法or属性:function stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise\;
新版本信息:201,401|@ohos.distributedMissionManager.d.ts|
+|新增(错误码)|类名:distributedMissionManager;
方法or属性:function registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback): Promise\;
旧版本信息:|类名:distributedMissionManager;
方法or属性:function registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback): Promise\;
新版本信息:201,401|@ohos.distributedMissionManager.d.ts|
+|新增(错误码)|类名:distributedMissionManager;
方法or属性:function unRegisterMissionListener(parameter: MissionDeviceInfo): Promise\;
旧版本信息:|类名:distributedMissionManager;
方法or属性:function unRegisterMissionListener(parameter: MissionDeviceInfo): Promise\;