From e8bfe2085456b1e8afbd3b24a81303648c8ffae2 Mon Sep 17 00:00:00 2001 From: wanzixuan Date: Wed, 23 Jul 2025 11:26:08 +0800 Subject: [PATCH] modify overload interface for communication_bluetooth Signed-off-by: wanzixuan --- api/@ohos.bluetooth.connection.d.ts | 47 ++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/api/@ohos.bluetooth.connection.d.ts b/api/@ohos.bluetooth.connection.d.ts index efbc3b9f77..232125efaa 100644 --- a/api/@ohos.bluetooth.connection.d.ts +++ b/api/@ohos.bluetooth.connection.d.ts @@ -415,6 +415,29 @@ declare namespace connection { */ function cancelPairingDevice(deviceId: string): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getRemoteDeviceName { getRemoteDeviceNameWithDeviceId, getRemoteDeviceNameWithDeviceIdAlias }; + + /** + * Obtains the name of a peer Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { string } Returns the device name in character string format. + * @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 20 + * @arkts 1.2 + */ + function getRemoteDeviceNameWithDeviceId(deviceId: string): string; + /** * Obtains the name of a peer Bluetooth device. * @@ -464,11 +487,28 @@ declare namespace connection { * @syscap SystemCapability.Communication.Bluetooth.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 */ function getRemoteDeviceName(deviceId: string): string; + /** + * Obtains the name or alias of the Bluetooth peer device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { boolean } [alias] - Indicates whether to obtain the device alias. If the parameter is not provided, the device alias is obtained by default. + * @returns { string } Returns the device name in character string format. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth disabled. + * @throws { BusinessError } 2900099 - Failed to obtain the name or alias of the peer Bluetooth device. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 20 + * @arkts 1.2 + */ + function getRemoteDeviceNameWithDeviceIdAlias(deviceId: string, alias?: boolean): string; + /** * Obtains the name or alias of the Bluetooth peer device. * @@ -485,8 +525,7 @@ declare namespace connection { * @throws { BusinessError } 2900099 - Failed to obtain the name or alias of the peer Bluetooth device. * @syscap SystemCapability.Communication.Bluetooth.Core * @atomicservice - * @since arkts {'1.1':'16','1.2':'20'} - * @arkts 1.1&1.2 + * @since 16 */ function getRemoteDeviceName(deviceId: string, alias?: boolean): string; -- Gitee