1# Distributed Device Management Subsystem Changelog
2
3## c1.device_manager.1 Deprecation of APIs
4
5**Access Level**
6
7Before the change, the APIs are system interfaces and can be called only by system applications.
8
9**Reason for Change**
10
11The 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.
12
13**Change Impact**
14
15The change is not compatible with earlier versions. You are advised to use new APIs.
16
17**Valid Since**
18
19OpenHarmony SDK 4.1.2.3
20
21**Deprecated APIs**
22
23| API| Description| Substitute API|
24| -- | -- | -- |
25| function createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void | Use [deviceManager.createDeviceManager](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#devicemanagercreatedevicemanager) to create a **DeviceManager** instance.| function createDeviceManager(bundleName: string): DeviceManager; |
26| function release(): void | Use [deviceManager.releaseDeviceManager](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#devicemanagerreleasedevicemanager) to release a **DeviceManager** instance.| function releaseDeviceManager(deviceManager: DeviceManager): void; |
27| function getTrustedDeviceListSync(): Array<DeviceInfo> | Use [getAvailableDeviceListSync](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getavailabledevicelistsync) to obtain all trusted devices. This API returns the result synchronously.| function getAvailableDeviceListSync(): Array<DeviceBasicInfo>; |
28| function getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>; | Deprecated| N/A|
29| function getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): void | Use [getAvailableDeviceList](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getavailabledevicelist) to obtain all trusted devices. This API uses an asynchronous callback to return the result.| function getAvailableDeviceList(callback:AsyncCallback<Array<DeviceBasicInfo>>): void; |
30| function getTrustedDeviceList(): Promise<Array<DeviceInfo>> | Use [getAvailableDeviceList](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getavailabledevicelist-1) to obtain all trusted devices. This API uses a promise to return the result.| function getAvailableDeviceList(): Promise<Array<DeviceBasicInfo>>; |
31| function getLocalDeviceInfoSync(): DeviceInfo | Use [getLocalDeviceNetworkId](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicenetworkid) to obtain the network ID of the local device.<br> Use [getLocalDeviceName](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicename) to obtain the name of the local device.<br> Use [getLocalDeviceType](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicetype) to obtain the type of the local device.<br> Use [getLocalDeviceId](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldeviceid) to obtain the ID of the local device.| function getLocalDeviceNetworkId(): string; <br> function getLocalDeviceName(): string; <br> function getLocalDeviceType(): number; <br> function getLocalDeviceId(): string; |
32| function getLocalDeviceInfo(callback:AsyncCallback&lt;DeviceInfo&gt;): void | Use [getLocalDeviceNetworkId](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicenetworkid) to obtain the network ID of the local device.<br> Use [getLocalDeviceName](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicename) to obtain the name of the local device.<br> Use [getLocalDeviceType](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicetype) to obtain the type of the local device.<br> Use [getLocalDeviceId](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldeviceid) to obtain the ID of the local device.| function getLocalDeviceNetworkId(): string; <br> function getLocalDeviceName(): string; <br> function getLocalDeviceType(): number; <br> function getLocalDeviceId(): string; |
33| function getLocalDeviceInfo(): Promise&lt;DeviceInfo&gt; | Use [getLocalDeviceNetworkId](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicenetworkid) to obtain the network ID of the local device.<br> Use [getLocalDeviceName](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicename) to obtain the name of the local device.<br> Use [getLocalDeviceType](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldevicetype) to obtain the type of the local device.<br> Use [getLocalDeviceId](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getlocaldeviceid) to obtain the ID of the local device.| function getLocalDeviceNetworkId(): string; <br> function getLocalDeviceName(): string; <br> function getLocalDeviceType(): number; <br> function getLocalDeviceId(): string; |
34| function getDeviceInfo(networkId: string, callback:AsyncCallback&lt;DeviceInfo&gt;): void | Use [getDeviceName](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getdevicename) to obtain the device name based on a network ID.<br> Use [getDeviceType](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getdevicetype) to obtain the device type based on a network ID.| function getDeviceName(networkId: string): string; <br> function getDeviceType(networkId: string): number; |
35| function getDeviceInfo(networkId: string): Promise&lt;DeviceInfo&gt; | Use [getDeviceName](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getdevicename) to obtain the device name based on a network ID.<br> Use [getDeviceType](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#getdevicetype) to obtain the device type based on a network ID.| function getDeviceName(networkId: string): string; <br> function getDeviceType(networkId: string): number; |
36| function startDeviceDiscovery(subscribeInfo: SubscribeInfo): void | Use [startDiscovering](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#startdiscovering) to discover devices nearby.| function startDiscovering(discoverParam: {[key:&nbsp;string]:&nbsp;Object} , filterOptions?: {[key:&nbsp;string]:&nbsp;Object} ): void; |
37| function startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void | Use [startDiscovering](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#startdiscovering) to discover devices nearby.| function startDiscovering(discoverParam: {[key:&nbsp;string]:&nbsp;Object} , filterOptions?: {[key:&nbsp;string]:&nbsp;Object} ): void; |
38| function stopDeviceDiscovery(subscribeId: number): void | Use [stopDiscovering](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#stopdiscovering) to stop discovering nearby devices.| function stopDiscovering(): void; |
39| function publishDeviceDiscovery(publishInfo: PublishInfo): void | Deprecated| N/A|
40| function unPublishDeviceDiscovery(publishId: number): void | Deprecated| N/A|
41| function authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback&lt;{deviceId: string, pinToken ?: number}&gt;): void | Use [bindTarget](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#bindtarget) to bind a device.| function bindTarget(deviceId: string, bindParam: {[key:&nbsp;string]:&nbsp;Object} , callback: AsyncCallback&lt;{deviceId: string}>): void; |
42| function unAuthenticateDevice(deviceInfo: DeviceInfo): void | Use [unbindTarget](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#unbindtarget) to unbind a device.| function unbindTarget(deviceId: string): void; |
43| function verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback&lt;{deviceId: string, level: number}&gt;): void | Deprecated| N/A|
44| function setUserOperation(operateAction: number, params: string): void | Use [replyUiAction](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#replyuiaction) to reply to the user's UI operation behavior.| function replyUiAction(action: number, actionResult: string): void; |
45| function requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback&lt;{registerInfo: string}&gt;): void; | Deprecated| N/A|
46| function importCredential(credentialInfo: string, callback: AsyncCallback&lt;{resultInfo: string}&gt;): void; | Deprecated| N/A|
47| function deleteCredential(queryInfo: string, callback: AsyncCallback&lt;{resultInfo: string}&gt;): void; | Deprecated| N/A|
48| function on(type: 'uiStateChange', callback: Callback&lt;{ param: string}&gt;): void; | Use [on('replyResult')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#onreplyresult) to subscribe to the UI operation reply result.| function on(type: 'replyResult', callback: Callback&lt;{ param: string}&gt;): void; |
49| function off(type: 'uiStateChange', callback?: Callback&lt;{ param: string}&gt;): void; | Use [off('replyResult')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#offreplyresult) to unsubscribe from the UI operation reply result.| function off(type: 'replyResult', callback?: Callback&lt;{ param: string}&gt;): void; |
50| function on(type: 'deviceStateChange',  callback: Callback&lt;{ action: DeviceStateChangeAction, device: DeviceInfo }&gt;): void | Use [on('deviceStateChange')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#ondevicestatechange) to subscribe to device state changes.| function on(type: 'deviceStateChange', callback: Callback&lt;{ action: DeviceStateChange, device: DeviceBasicInfo }&gt;): void; |
51| function off(type: 'deviceStateChange', callback?: Callback&lt;{ action: DeviceStateChangeAction, device: DeviceInfo }&gt;): void | Use [off('deviceStateChange')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#offdevicestatechange) to unsubscribe from device state changes.| function off(type: 'deviceStateChange', callback?: Callback&lt;{ action: DeviceStateChange, device: DeviceBasicInfo }&gt;): void; |
52| function on(type: 'deviceFound', callback: Callback&lt;{ subscribeId: number, device: DeviceInfo }&gt;): void | Use [on('discoverSuccess')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#ondiscoversuccess) to subscribe to successful discovery of devices.| function on(type: 'discoverSuccess', callback: Callback&lt;{ device: DeviceBasicInfo }&gt;): void; |
53| function off(type: 'deviceFound', callback?: Callback&lt;{ subscribeId: number, device: DeviceInfo }&gt;): void | Use [off('discoverSuccess')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#offdiscoversuccess) to unsubscribe from successful discovery of devices.| function off(type: 'discoverSuccess', callback?: Callback&lt;{ device: DeviceBasicInfo }&gt;): void; |
54| function on(type: 'discoverFail', callback: Callback&lt;{ subscribeId: number, reason: number }&gt;): void | Use [on('discoverFailure')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#ondiscoverfailure) to subscribe to failed discovery of devices.| function on(type: 'discoverFailure', callback: Callback&lt;{ reason: number }&gt;): void; |
55| function off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason: number }&gt;): void | Use [off('discoverFailure')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#offdiscoverfailure) to unsubscribe from failed discovery of devices.| function off(type: 'discoverFailure', callback?: Callback&lt;{ reason: number }&gt;): void; |
56| function on(type: 'publishSuccess', callback: Callback&lt;{ publishId: number }&gt;): void |  Deprecated| N/A|
57| function off(type: 'publishSuccess', callback?: Callback&lt;{ publishId: number }&gt;): void |  Deprecated| N/A|
58| function on(type: 'publishFail', callback: Callback&lt;{ publishId: number, reason: number }&gt;): void |  Deprecated| N/A|
59| function off(type: 'publishFail', callback?: Callback&lt;{ publishId: number, reason: number }&gt;): void |  Deprecated| N/A|
60| function on(type: 'serviceDie', callback: () =&gt; void): void | Use [on('serviceDie')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#onservicedie) to subscribe to unexpected termination of the DeviceManager service.| function on(type: 'serviceDie', callback?: Callback&lt;{}&gt;): void; |
61| function off(type: 'serviceDie', callback?: () =&gt; void): void | Use [off('serviceDie')](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#offservicedie) to unsubscribe from unexpected termination of the DeviceManager service.| function off(type: 'serviceDie', callback?: Callback&lt;{}&gt;): void; |
62| interface DeviceInfo | Use [DeviceBasicInfo](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#devicebasicinfo) to represent the basic information about a distributed device.| interface DeviceBasicInfo |
63| interface SubscribeInfo | Deprecated| N/A|
64| interface AuthParam | Deprecated| N/A|
65| interface AuthInfo | Deprecated| N/A|
66| interface PublishInfo | Deprecated| N/A|
67| enum DeviceType | Deprecated| N/A|
68| enum AuthForm | Deprecated| N/A|
69| enum DeviceStateChangeAction | Use [DeviceStateChange](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md#devicestatechange) to enumerate device states.| enum DeviceStateChange |
70| enum DiscoverMode | Deprecated| N/A|
71| enum ExchangeMedium | Deprecated| N/A|
72| enum ExchangeFreq | Deprecated| N/A|
73| enum SubscribeCap | Deprecated| N/A|
74
75**Adaptation Guide**
76
77You are advised to use [@ohos.distributedDeviceManager](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md).
78