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/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/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 e9a91b92b7ff81b5ab8a014aeeb779eb0653f25a..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/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/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 85be9e3325327ce6ae69da98e88a909c167757be..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)。
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/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/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/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 08a231c2db0dd0cc7cbdc728f02661e2caf8c3d2..ff43b8196f407b4362f434c84766af1f614be8ed 100755
--- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
@@ -327,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;
-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}`);
});
@@ -367,13 +383,30 @@ createController(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;
@@ -1379,8 +1446,25 @@ 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: sessionId,
+ sessionId: currSessionId,
}
let castDevice;
avSession.on('deviceAvailable', (device) => {
@@ -1432,8 +1516,25 @@ 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: sessionId,
+ sessionId: currSessionId,
}
let castDevice;
avSession.on('deviceAvailable', (device) => {
@@ -1474,15 +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: sessionId,
+ sessionId: currSessionId,
}
-let castDevice;
-avSession.on('deviceAvailable', (device) => {
- castDevice = device;
- console.info(`on deviceAvailable : ${device} `);
-});
-avSession.stopCasting(myToken, castDevice, function (err) {
+avSession.stopCasting(myToken, function (err) {
if (err) {
console.error(`stopCasting BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
@@ -1523,14 +1636,26 @@ 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: sessionId,
+ sessionId: currSessionId,
}
-let castDevice;
-avSession.on('deviceAvailable', (device) => {
- castDevice = device;
- console.info(`on deviceAvailable : ${device} `);
-});
avSession.stopCasting(myToken).then(() => {
console.info(`stopCasting successfully`);
}).catch((err) => {
@@ -5885,7 +6010,7 @@ 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}`);
}
});
```
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-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-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/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-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-universal-events-drag-drop.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md
index abdecdbb2ca35499df938b03c7170ac8565203b2..291aeb168e1a2a4d8b401084e78cf967b7cbe370 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/security/permission-list.md b/zh-cn/application-dev/security/permission-list.md
index c9514d960e47317d10d6772f8300d270462fae3e..3af6ac1bbce8a2fad0989c3248de7f3f5c4797d2 100644
--- a/zh-cn/application-dev/security/permission-list.md
+++ b/zh-cn/application-dev/security/permission-list.md
@@ -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/website.md b/zh-cn/application-dev/website.md
index dab3efb2a3f12c1d88cb383034b0754d8ebff9ba..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)
- 调试工具
@@ -1066,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)
@@ -1146,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)
@@ -1180,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)
@@ -1390,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)
@@ -1439,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)
@@ -1456,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)
@@ -1691,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)
@@ -1758,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)
- 头文件
@@ -1818,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)
@@ -1829,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)
- 结构体
@@ -1873,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)
@@ -1891,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/changelogs/OpenHarmony_4.0.9.3/changelogs-distributeddatamgr.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.9.3/changelogs-distributeddatamgr.md
new file mode 100644
index 0000000000000000000000000000000000000000..5e014b9724e4e68471ec53f75fe4330bca701b75
--- /dev/null
+++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.9.3/changelogs-distributeddatamgr.md
@@ -0,0 +1,112 @@
+# 分布式数据子系统ChangeLog
+
+## cl.data.cloudData修改Action接口改名为clearAction
+
+**变更影响**
+
+基于OpenHarmony4.0.9.3及之后的SDK版本开发的应用,可以使用clearAction接口指定清除本地下载的云端数据的行为枚举。
+
+**关键接口/组件变更**
+
+修改前的接口原型:
+
+ ```ts
+ enum Action {
+ CLEAR_CLOUD_INFO,
+ CLEAR_CLOUD_DATA_AND_INFO
+ }
+ ```
+
+修改后的接口原型:
+
+ ```ts
+ enum ClearAction {
+ CLEAR_CLOUD_INFO,
+ CLEAR_CLOUD_DATA_AND_INFO
+ }
+ ```
+
+## cl.data.cloudData修改clean接口改名为clear
+
+**变更影响**
+
+基于OpenHarmony4.0.9.3及之后的SDK版本开发的应用,可以使用clear接口清除本地下载的云端数据。
+
+**关键接口/组件变更**
+
+修改前的接口原型:
+
+ ```ts
+ static clean(
+ accountId: string,
+ appActions: { [bundleName: string]: Action },
+ callback: AsyncCallback
+ ): void;
+ static clean(accountId: string, appActions: { [bundleName: string]: Action }): Promise;
+ ```
+
+修改后的接口原型:
+
+ ```ts
+ static clear(
+ accountId: string,
+ appActions: { [bundleName: string]: ClearAction },
+ callback: AsyncCallback
+ ): void;
+ static clear(accountId: string, appActions: { [bundleName: string]: ClearAction }): Promise;
+ ```
+
+## cl.data.relationalStore修改Statistic中的success为successful
+
+**变更影响**
+
+基于OpenHarmony4.0.9.3及之后的SDK版本开发的应用,可以使用Statistic.successful表示数据库表中端云同步成功的行数。
+
+**关键接口/组件变更**
+
+Statistic中的枚举项success变更为successful,successful表示数据库表中端云同步成功的行数。
+
+修改前的接口原型:
+
+ ```ts
+ interface Statistic {
+ total: number;
+ success: number;
+ failed: number;
+ remained: number;
+ }
+ ```
+
+修改后的接口原型:
+
+ ```ts
+ interface Statistic {
+ total: number;
+ successful: number;
+ failed: number;
+ remained: number;
+ }
+ ```
+
+## cl.data.relationalStore修改setDistributedTables接口入参type类型由number变为DistributedType
+
+**变更影响**
+
+基于OpenHarmony4.0.9.3及之后的SDK版本开发的应用,setDistributedTables接口入参type类型由number变为DistributedType。
+
+**关键接口/组件变更**
+
+修改前setDistributedTables接口:
+
+ ```ts
+setDistributedTables(tables: Array, type: number, config: DistributedConfig, callback: AsyncCallback): void;
+setDistributedTables(tables: Array, type?: number, config?: DistributedConfig): Promise;
+ ```
+
+修改后setDistributedTables接口:
+
+ ```ts
+setDistributedTables(tables: Array, type: DistributedType, config: DistributedConfig, callback: AsyncCallback): void;
+setDistributedTables(tables: Array, type?: DistributedType, config?: DistributedConfig): Promise;
+ ```
+