diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md
index 636487cc3dd633f9e8a5141ebc044c786e4441bd..5682fbb050877b4177d08b975fc02ef284e991d4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md
@@ -1144,7 +1144,7 @@ let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
## bluetooth.BLE
-### bluetooth.BLE.createGattServer(deprecated)
+createGattServer(deprecated)
createGattServer(): GattServer
@@ -1168,7 +1168,7 @@ let gattServer = bluetooth.BLE.createGattServer();
```
-### bluetooth.BLE.createGattClientDevice(deprecated)
+createGattClientDevice(deprecated)
createGattClientDevice(deviceId: string): GattClientDevice
@@ -1198,7 +1198,7 @@ let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX');
```
-### bluetooth.BLE.getConnectedBLEDevices(deprecated)
+getConnectedBLEDevices(deprecated)
getConnectedBLEDevices(): Array<string>
@@ -1224,7 +1224,7 @@ let result = bluetooth.BLE.getConnectedBLEDevices();
```
-### bluetooth.BLE.startBLEScan(deprecated)
+startBLEScan(deprecated)
startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void
@@ -1270,7 +1270,7 @@ bluetooth.BLE.startBLEScan(
```
-### bluetooth.BLE.stopBLEScan(deprecated)
+stopBLEScan(deprecated)
stopBLEScan(): void
@@ -1294,7 +1294,7 @@ bluetooth.BLE.stopBLEScan();
```
-### bluetooth.BLE.on('BLEDeviceFind')(deprecated)
+on('BLEDeviceFind')(deprecated)
on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void
@@ -1328,7 +1328,7 @@ bluetooth.BLE.on('BLEDeviceFind', onReceiveEvent);
```
-### bluetooth.BLE.off('BLEDeviceFind')(deprecated)
+off('BLEDeviceFind')(deprecated)
off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md
index 5b21150a6ac89e288d26ebb7bd592a8caa35e056..a5c7dfcdd04a8961450d20242ad092fd33e7f17e 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md
@@ -705,6 +705,182 @@ try {
```
+## bluetoothManager.getRemoteProfileUuids10+
+
+getRemoteProfileUuids(device: string, callback: AsyncCallback<Array<ProfileUuids>>): void
+
+获取对端蓝牙设备支持的Profile UUID。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.USE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ----------------------------------- |
+| device | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
+| callback | AsyncCallback<Array<[ProfileUuids](#profileuuids10)>> | 是 | 回调函数。当获取uuid成功,err为undefined,否则为错误对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ bluetoothManager.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);
+}
+
+```
+
+
+## bluetoothManager.getRemoteProfileUuids10+
+
+getRemoteProfileUuids(device: string): Promise<Array<ProfileUuids>>
+
+获取对端蓝牙设备支持的Profile UUID。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.USE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ----------------------------------- |
+| device | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------- |
+| Promise<Array<[ProfileUuids](#profileuuids10)>> | 返回promise对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ bluetoothManager.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);
+}
+```
+
+
+## bluetoothManager.getLocalProfileUuids10+
+
+getLocalProfileUuids(callback: AsyncCallback<Array<ProfileUuids>>): void
+
+获取本地设备的profile uuid。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.USE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ----------------------------------- |
+| callback | AsyncCallback<Array<[ProfileUuids](#profileuuids10)>> | 是 | 回调函数。当获取uuid成功,err为undefined,否则为错误对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ bluetoothManager.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);
+}
+```
+
+
+## bluetoothManager.getLocalProfileUuids10+
+
+getLocalProfileUuids(): Promise<Array<ProfileUuids>>
+
+获取本地设备的profile uuid。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.USE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------- |
+| Promise<Array<[ProfileUuids](#profileuuids10)>> | 返回promise对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ bluetoothManager.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);
+}
+```
+
+
## bluetoothManager.setDevicePairingConfirmation
setDevicePairingConfirmation(device: string, accept: boolean): void
@@ -1562,7 +1738,7 @@ try {
## bluetoothManager.BLE
-### bluetoothManager.BLE.createGattServer
+createGattServer
createGattServer(): GattServer
@@ -1583,7 +1759,7 @@ let gattServer = bluetoothManager.BLE.createGattServer();
```
-### bluetoothManager.BLE.createGattClientDevice
+createGattClientDevice
createGattClientDevice(deviceId: string): GattClientDevice
@@ -1614,7 +1790,7 @@ try {
```
-### bluetoothManager.BLE.getConnectedBLEDevices
+getConnectedBLEDevices
getConnectedBLEDevices(): Array<string>
@@ -1651,7 +1827,7 @@ try {
```
-### bluetoothManager.BLE.startBLEScan
+startBLEScan
startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void
@@ -1704,7 +1880,7 @@ try {
```
-### bluetoothManager.BLE.stopBLEScan
+stopBLEScan
stopBLEScan(): void
@@ -1735,7 +1911,7 @@ try {
```
-### bluetoothManager.BLE.on('BLEDeviceFind')
+on('BLEDeviceFind')
on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void
@@ -1774,7 +1950,7 @@ try {
```
-### bluetoothManager.BLE.off('BLEDeviceFind')
+off('BLEDeviceFind')
off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void
@@ -1901,6 +2077,194 @@ try {
}
```
+## bluetoothManager.setConnectionStrategy10+
+
+setConnectionStrategy(device: string, strategy: ConnectionStrategy, callback: AsyncCallback<void>): void
+
+设置该设备Profile的连接策略。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.MANAGE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ----------------------------------- |
+| device | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
+| strategy | [ConnectionStrategy](#connectionstrategy10) | 是 |profile的连接策略。 |
+| callback | AsyncCallback<void> | 是 | 回调函数。当设置成功,err为undefined,否则为错误对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile;
+ 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);
+}
+```
+
+## bluetoothManager.setConnectionStrategy10+
+
+setConnectionStrategy(device: string, strategy: ConnectionStrategy): Promise<void>
+
+设置该设备Profile的连接策略。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.MANAGE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ----------------------------------- |
+| device | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
+| strategy | [ConnectionStrategy](#connectionstrategy10) | 是 |profile的连接策略。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------- |
+| Promise<void> | 返回promise对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile;
+ let setRet = a2dpSrc.setConnectionStrategy("XX:XX:XX:XX:XX:XX", 1).then((data) => {
+ console.info("setConnectionStrategy");
+ }, (error) => {
+ console.error("setConnectionStrategy errCode: " + err.code + ", errMessage: " + err.message);
+ });
+} catch (err) {
+ console.error("errCode: " + err.code + ", errMessage: " + err.message);
+}
+```
+
+## bluetoothManager.getConnectionStrategy10+
+
+getConnectionStrategy(device: string, callback: AsyncCallback<ConnectionStrategy>): void
+
+获取该Profile的连接策略。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.MANAGE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ----------------------------------- |
+| device | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
+| callback | AsyncCallback<[ConnectionStrategy](#connectionstrategy10)> | 是 | 回调函数。当获取策略成功,err为undefined,否则为错误对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile;
+ 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);
+}
+```
+
+## bluetoothManager.getConnectionStrategy10+
+
+getConnectionStrategy(device: string): Promise<ConnectionStrategy>
+
+获取该Profile的连接策略。
+
+**系统接口**:此接口为系统接口。
+
+**需要权限**:ohos.permission.MANAGE_BLUETOOTH
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------ | ---- | ----------------------------------- |
+| device | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------- | ------------- |
+| Promise<[ConnectionStrategy](#connectionstrategy10)> | 返回promise对象。 |
+
+**错误码**:
+
+以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。
+
+| 错误码ID | 错误信息 |
+| -------- | ---------------------------- |
+|2900001 | Service stopped. |
+|2900003 | Bluetooth switch is off. |
+|2900004 | Profile is not supported. |
+|2900099 | Operation failed. |
+
+**示例:**
+
+```js
+try {
+ let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile;
+ 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);
+}
+```
+
## A2dpSourceProfile
使用A2dpSourceProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。
@@ -4699,6 +5063,21 @@ try {
| TRANSPORT_LE10+ | 1 | 表示低功耗蓝牙(BLE)设备。 |
+## ConnectionStrategy10+
+
+枚举,表示Profile的连接策略。
+
+**系统接口:** 此接口为系统接口。
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+| 名称 | 值 | 说明 |
+| -------------------------------- | ------ | --------------- |
+| CONNECT_STRATEGY_UNSUPPORTED 10+ | 0 | 当设备未配对时的默认连接策略。
此接口为系统接口。 |
+| CONNECT_STRATEGY_ALLOWED 10+ | 1 | 设备允许接受或发起配对时的连接策略。
此接口为系统接口。 |
+| CONNECT_STRATEGY_FORBIDDEN 10+ | 2 | 设备不允许接受或发起配对时的连接策略。
此接口为系统接口。 |
+
+
## PinType10+
枚举,蓝牙配对类型。
@@ -4717,3 +5096,25 @@ try {
| PIN_TYPE_DISPLAY_PIN_CODE10+ | 5 | bluetooth 2.0设备,用户需要输入对端设备上显示的PIN码。
此接口为系统接口。 |
| PIN_TYPE_OOB_CONSENT10+ | 6 | 用户需要接受或拒绝OOB配对请求。
此接口为系统接口。 |
| PIN_TYPE_PIN_16_DIGITS10+ | 7 | 用户需要输入对端设备上显示的16位PIN码。
此接口为系统接口。 |
+
+
+## ProfileUuids10+
+
+枚举,表示Profile的UUID。
+
+**系统接口:** 此接口为系统接口。
+
+**系统能力**:SystemCapability.Communication.Bluetooth.Core。
+
+| 名称 | 值 | 说明 |
+| ------------------------------------| ------ | --------------- |
+| PROFILE_UUID_HFP_AG 10+ | 0000111F-0000-1000-8000-00805F9B34FB | 代表HFPAG Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_HFP_HF 10+ | 0000111E-0000-1000-8000-00805F9B34FB | 代表HFPHF Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_HSP_AG 10+ | 00001112-0000-1000-8000-00805F9B34FB | 代表HSPAG Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_HSP_HS 10+ | 00001108-0000-1000-8000-00805F9B34FB | 代表HSPHS Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_A2DP_SRC 10+ | 0000110A-0000-1000-8000-00805F9B34FB | 代表A2DPSRC Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_A2DP_SINK 10+ | 0000110B-0000-1000-8000-00805F9B34FB | 代表A2DPSINK Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_AVRCP_CT 10+ | 0000110E-0000-1000-8000-00805F9B34FB | 代表AVRCPCT Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_AVRCP_TG 10+ | 0000110C-0000-1000-8000-00805F9B34FB | 代表AVRCPTG Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_HID 10+ | 00001124-0000-1000-8000-00805F9B34FB | 代表HID Profile的UUID。
此接口为系统接口。 |
+| PROFILE_UUID_HOGP 10+ | 00001812-0000-1000-8000-00805F9B34FB | 代表HOGP Profile的UUID。
此接口为系统接口。 |