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
API | Description | Substitute API |
---|---|---|
function createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void | Use deviceManager.createDeviceManager to create a DeviceManager instance. | function createDeviceManager(bundleName: string): DeviceManager; |
function release(): void | Use 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>; | Deprecated | N/A |
function getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): void | Use 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(): 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 getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void | 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 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>): void | 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 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): void | Use startDiscovering to discover devices nearby. | function startDiscovering(discoverParam: {[key: string]: Object} , filterOptions?: {[key: string]: Object} ): void; |
function startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void | Use startDiscovering to discover devices nearby. | function startDiscovering(discoverParam: {[key: string]: Object} , filterOptions?: {[key: string]: Object} ): void; |
function stopDeviceDiscovery(subscribeId: number): void | Use stopDiscovering to stop discovering nearby devices. | function stopDiscovering(): void; |
function publishDeviceDiscovery(publishInfo: PublishInfo): void | Deprecated | N/A |
function unPublishDeviceDiscovery(publishId: number): void | Deprecated | N/A |
function authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void | Use bindTarget to bind a device. | function bindTarget(deviceId: string, bindParam: {[key: string]: Object} , callback: AsyncCallback<{deviceId: string}>): void; |
function unAuthenticateDevice(deviceInfo: DeviceInfo): void | Use unbindTarget to unbind a device. | function unbindTarget(deviceId: string): void; |
function verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): void | Deprecated | N/A |
function setUserOperation(operateAction: number, params: string): void | Use 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; | Deprecated | N/A |
function importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; | Deprecated | N/A |
function deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; | Deprecated | N/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 }>): void | Use 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 }>): void | Use 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 }>): void | Use 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 }>): void | Use 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 }>): void | Use 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 }>): void | Use 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 }>): void | Deprecated | N/A |
function off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): void | Deprecated | N/A |
function on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): void | Deprecated | N/A |
function off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): void | Deprecated | N/A |
function on(type: 'serviceDie', callback: () => void): void | Use on('serviceDie') to subscribe to unexpected termination of the DeviceManager service. | function on(type: 'serviceDie', callback?: Callback<{}>): void; |
function off(type: 'serviceDie', callback?: () => void): void | Use off('serviceDie') to unsubscribe from unexpected termination of the DeviceManager service. | function off(type: 'serviceDie', callback?: Callback<{}>): void; |
interface DeviceInfo | Use DeviceBasicInfo to represent the basic information about a distributed device. | interface DeviceBasicInfo |
interface SubscribeInfo | Deprecated | N/A |
interface AuthParam | Deprecated | N/A |
interface AuthInfo | Deprecated | N/A |
interface PublishInfo | Deprecated | N/A |
enum DeviceType | Deprecated | N/A |
enum AuthForm | Deprecated | N/A |
enum DeviceStateChangeAction | Use DeviceStateChange to enumerate device states. | enum DeviceStateChange |
enum DiscoverMode | Deprecated | N/A |
enum ExchangeMedium | Deprecated | N/A |
enum ExchangeFreq | Deprecated | N/A |
enum SubscribeCap | Deprecated | N/A |
Adaptation Guide
You are advised to use @ohos.distributedDeviceManager.