diff --git a/api/@ohos.bluetooth.connection.d.ts b/api/@ohos.bluetooth.connection.d.ts index efbc3b9f7738e38b5f256cea1f68ce30e9afb4af..232125efaa128cb84183e198ee8c35e957371acb 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;