openharmony 鸿蒙 changelogs-device-manager

2023-10-30 浏览 (464)

Distributed Device Management Subsystem Changelog

c1.device_manager.1 Deprecation of APIs

Access Level

Before the change, the APIs are system interfaces and can be called only by system applications.

Reason for Change

The APIs need to be open to third-party applications. The new APIs incorporate complete functions of the old system interfaces and are more standard and atomic, with full compliance with community API specifications.

Change Impact

The change is not compatible with earlier versions. You are advised to use new APIs.

Valid Since

OpenHarmony SDK 4.1.2.3

Deprecated APIs

APIDescriptionSubstitute API
function createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): voidUse deviceManager.createDeviceManager to create a DeviceManager instance.function createDeviceManager(bundleName: string): DeviceManager;
function release(): voidUse deviceManager.releaseDeviceManager to release a DeviceManager instance.function releaseDeviceManager(deviceManager: DeviceManager): void;
function getTrustedDeviceListSync(): Array<DeviceInfo>Use getAvailableDeviceListSync to obtain all trusted devices. This API returns the result synchronously.function getAvailableDeviceListSync(): Array<DeviceBasicInfo>;
function getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>;DeprecatedN/A
function getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): voidUse getAvailableDeviceList to obtain all trusted devices. This API uses an asynchronous callback to return the result.function getAvailableDeviceList(callback:AsyncCallback<Array<DeviceBasicInfo>>): void;
function getTrustedDeviceList(): Promise<Array<DeviceInfo>>Use getAvailableDeviceList to obtain all trusted devices. This API uses a promise to return the result.function getAvailableDeviceList(): Promise<Array<DeviceBasicInfo>>;
function getLocalDeviceInfoSync(): DeviceInfoUse getLocalDeviceNetworkId to obtain the network ID of the local device.
Use getLocalDeviceName to obtain the name of the local device.
Use getLocalDeviceType to obtain the type of the local device.
Use getLocalDeviceId to obtain the ID of the local device.
function getLocalDeviceNetworkId(): string;
function getLocalDeviceName(): string;
function getLocalDeviceType(): number;
function getLocalDeviceId(): string;
function getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): voidUse getLocalDeviceNetworkId to obtain the network ID of the local device.
Use getLocalDeviceName to obtain the name of the local device.
Use getLocalDeviceType to obtain the type of the local device.
Use getLocalDeviceId to obtain the ID of the local device.
function getLocalDeviceNetworkId(): string;
function getLocalDeviceName(): string;
function getLocalDeviceType(): number;
function getLocalDeviceId(): string;
function getLocalDeviceInfo(): Promise<DeviceInfo>Use getLocalDeviceNetworkId to obtain the network ID of the local device.
Use getLocalDeviceName to obtain the name of the local device.
Use getLocalDeviceType to obtain the type of the local device.
Use getLocalDeviceId to obtain the ID of the local device.
function getLocalDeviceNetworkId(): string;
function getLocalDeviceName(): string;
function getLocalDeviceType(): number;
function getLocalDeviceId(): string;
function getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): voidUse getDeviceName to obtain the device name based on a network ID.
Use getDeviceType to obtain the device type based on a network ID.
function getDeviceName(networkId: string): string;
function getDeviceType(networkId: string): number;
function getDeviceInfo(networkId: string): Promise<DeviceInfo>Use getDeviceName to obtain the device name based on a network ID.
Use getDeviceType to obtain the device type based on a network ID.
function getDeviceName(networkId: string): string;
function getDeviceType(networkId: string): number;
function startDeviceDiscovery(subscribeInfo: SubscribeInfo): voidUse startDiscovering to discover devices nearby.function startDiscovering(discoverParam: {[key: string]: Object} , filterOptions?: {[key: string]: Object} ): void;
function startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): voidUse startDiscovering to discover devices nearby.function startDiscovering(discoverParam: {[key: string]: Object} , filterOptions?: {[key: string]: Object} ): void;
function stopDeviceDiscovery(subscribeId: number): voidUse stopDiscovering to stop discovering nearby devices.function stopDiscovering(): void;
function publishDeviceDiscovery(publishInfo: PublishInfo): voidDeprecatedN/A
function unPublishDeviceDiscovery(publishId: number): voidDeprecatedN/A
function authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): voidUse bindTarget to bind a device.function bindTarget(deviceId: string, bindParam: {[key: string]: Object} , callback: AsyncCallback<{deviceId: string}>): void;
function unAuthenticateDevice(deviceInfo: DeviceInfo): voidUse unbindTarget to unbind a device.function unbindTarget(deviceId: string): void;
function verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): voidDeprecatedN/A
function setUserOperation(operateAction: number, params: string): voidUse replyUiAction to reply to the user's UI operation behavior.function replyUiAction(action: number, actionResult: string): void;
function requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{registerInfo: string}>): void;DeprecatedN/A
function importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;DeprecatedN/A
function deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;DeprecatedN/A
function on(type: 'uiStateChange', callback: Callback<{ param: string}>): void;Use on('replyResult') to subscribe to the UI operation reply result.function on(type: 'replyResult', callback: Callback<{ param: string}>): void;
function off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void;Use off('replyResult') to unsubscribe from the UI operation reply result.function off(type: 'replyResult', callback?: Callback<{ param: string}>): void;
function on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidUse on('deviceStateChange') to subscribe to device state changes.function on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void;
function off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidUse off('deviceStateChange') to unsubscribe from device state changes.function off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void;
function on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): voidUse on('discoverSuccess') to subscribe to successful discovery of devices.function on(type: 'discoverSuccess', callback: Callback<{ device: DeviceBasicInfo }>): void;
function off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): voidUse off('discoverSuccess') to unsubscribe from successful discovery of devices.function off(type: 'discoverSuccess', callback?: Callback<{ device: DeviceBasicInfo }>): void;
function on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): voidUse on('discoverFailure') to subscribe to failed discovery of devices.function on(type: 'discoverFailure', callback: Callback<{ reason: number }>): void;
function off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): voidUse off('discoverFailure') to unsubscribe from failed discovery of devices.function off(type: 'discoverFailure', callback?: Callback<{ reason: number }>): void;
function on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voidDeprecatedN/A
function off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): voidDeprecatedN/A
function on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): voidDeprecatedN/A
function off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): voidDeprecatedN/A
function on(type: 'serviceDie', callback: () => void): voidUse on('serviceDie') to subscribe to unexpected termination of the DeviceManager service.function on(type: 'serviceDie', callback?: Callback<{}>): void;
function off(type: 'serviceDie', callback?: () => void): voidUse off('serviceDie') to unsubscribe from unexpected termination of the DeviceManager service.function off(type: 'serviceDie', callback?: Callback<{}>): void;
interface DeviceInfoUse DeviceBasicInfo to represent the basic information about a distributed device.interface DeviceBasicInfo
interface SubscribeInfoDeprecatedN/A
interface AuthParamDeprecatedN/A
interface AuthInfoDeprecatedN/A
interface PublishInfoDeprecatedN/A
enum DeviceTypeDeprecatedN/A
enum AuthFormDeprecatedN/A
enum DeviceStateChangeActionUse DeviceStateChange to enumerate device states.enum DeviceStateChange
enum DiscoverModeDeprecatedN/A
enum ExchangeMediumDeprecatedN/A
enum ExchangeFreqDeprecatedN/A
enum SubscribeCapDeprecatedN/A

Adaptation Guide

You are advised to use @ohos.distributedDeviceManager.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Multimedia Subsystem Changelog

harmony 鸿蒙Upload and Download Subsystem Changelog

harmony 鸿蒙ArkUI Subsystem Changelog

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/e22d9aa8838d4e0181dc1e04ac8030d0