From bc9aff522fa98e19c5793aced3ee979709ccbf64 Mon Sep 17 00:00:00 2001 From: linzlinz <2495670683@qq.com> Date: Thu, 4 Sep 2025 20:40:48 +0800 Subject: [PATCH] getConnectedBleDevices Signed-off-by: linzlinz <2495670683@qq.com> --- api/@ohos.bluetooth.ble.d.ts | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/api/@ohos.bluetooth.ble.d.ts b/api/@ohos.bluetooth.ble.d.ts index 7bd6f01bd1..6d4a1b40a9 100644 --- a/api/@ohos.bluetooth.ble.d.ts +++ b/api/@ohos.bluetooth.ble.d.ts @@ -179,6 +179,24 @@ declare namespace ble { */ function getConnectedBLEDevices(): Array; + /** + * Obtains the list of devices in the connected status. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BleProfile } profile - The profile in the BLE protocol. + * It is used to obtain the connected devices corresponding to the profile. + * @returns { Array } Returns the list of device address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + function getConnectedBLEDevices(profile: BleProfile): Array; + /** * Starts scanning for specified BLE devices with filters. * @@ -6845,6 +6863,41 @@ declare namespace ble { ON_BATCH = 3, } + /** + * The Profile of the BLE protocol. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + enum BleProfile { + /** + * Indicates the profile type of the gatt, including gatt client and gatt server. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + GATT = 1, + /** + * Indicates the profile type of the gatt client. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + GATT_CLIENT = 2, + /** + * Indicates the profile type of the gatt server. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 21 + * @arkts 1.1&1.2 + */ + GATT_SERVER = 3 + } + /** * The enum of gatt disconnection reasons. * -- Gitee