diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index ebd765ee860491b9d070acc72252c43319509b5d..d1f91a719807a01a2171e1419d0d2ff23fa71254 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -267,6 +267,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)
@@ -296,8 +297,18 @@
- [@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)
@@ -391,6 +402,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. |