changelogs-distributedDeviceManager.md 5.3 KB
Newer Older
1 2 3
# 设备管理ChangeLog
## cl.distributedDeviceManager.1 接口变更

史晓晓 已提交
4
从Opeharmonny 4.0.9.2版本开始,新增了设备管理接口。
5 6 7

**变更影响**

史晓晓 已提交
8
原有的接口[API参考](../../../application-dev/reference/apis/js-apis-device-manager.md)暂时可继续使用,但是停止维护,建议使用新接口进行开发。
9 10 11 12 13 14 15

**关键的接口/组件变更**

##新增接口如下:

| 模块名                    | 类名                | 新增接口声明                                                   | 是否支持三方应用调用             |                                        
| ------------------------- | ------------------- | ------------------------------------------------------------ | ------------------------------- |
史晓晓 已提交
16 17 18 19 20 21 22 23 24
| @ohos.distributedDeviceManager       | deviceManager        | **function** createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void;            | 是    |
| @ohos.distributedDeviceManager       | deviceManager        | **function** releaseDeviceManager(): void; | 是 |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getAvailableDeviceListSync(): Array<DeviceBasicInfo>; | 是 |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getAvailableDeviceList(callback:AsyncCallback<Array<DeviceBasicInfo>>): void; | 是    |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getAvailableDeviceList(): Promise<Array<DeviceBasicInfo>>; | 是              |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getLocalDeviceNetworkIdSync(): string; | 是            |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getLocalDeviceNameSync(): string; | 是         |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getLocalDeviceTypeSync(): number; | 是           |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getLocalDeviceIdSync(): string; | 是    |
25 26
| @ohos.distributedDeviceManager       | deviceManager        | **function** getDeviceNameSync(networkId: string): string; | 是     |
| @ohos.distributedDeviceManager       | deviceManager        | **function** getDeviceTypeSync(networkId: string): number; | 是     |
史晓晓 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| @ohos.distributedDeviceManager       | deviceManager        | **function** startDiscovering(subscribeId: number, filterOptions?: string): void; | 是 |
| @ohos.distributedDeviceManager       | deviceManager        | **function** stopDiscovering(subscribeId: number): void; | 是       |
| @ohos.distributedDeviceManager       | deviceManager        | **function** bindTarget(deviceId: string, bindParam: BindParam, callback: AsyncCallback<{deviceId: string}>): void; | 是      |
| @ohos.distributedDeviceManager       | deviceManager        | **function** unbindTarget(deviceId: string): void; | 是     |
| @ohos.distributedDeviceManager       | deviceManager        | **function** replyUiAction(action: number, params: string): void; | 否    |
| @ohos.distributedDeviceManager       | deviceManager        | **function** on(type: 'replyResult', callback: Callback<{ param: string}>): void; | 否       |
| @ohos.distributedDeviceManager       | deviceManager        | **function** off(type: 'replyResult', callback?: Callback<{ param: string}>): void; |否       |
| @ohos.distributedDeviceManager       | deviceManager        | **function** on(type: 'deviceStatusChange', callback: Callback<{ action: DeviceStatusChange, device: DeviceBasicInfo }>): void; | 是   |
| @ohos.distributedDeviceManager       | deviceManager        | **function** off(type: 'deviceStatusChange', callback?: Callback<{ action: DeviceStatusChange, device: DeviceBasicInfo }>): void; | 是   |
| @ohos.distributedDeviceManager       | deviceManager        | **function** on(type: 'discoverSuccess', callback: Callback<{ subscribeId: number, device: DeviceBasicInfo }>): void; | 是               |
| @ohos.distributedDeviceManager       | deviceManager        | **function** off(type: 'discoverSuccess', callback?: Callback<{ subscribeId: number, device: DeviceBasicInfo }>): void; | 是               |
| @ohos.distributedDeviceManager       | deviceManager        | **function** on(type: 'deviceNameChange', callback: Callback<{ deviceName: string }>): void; | 是   |
| @ohos.distributedDeviceManager       | deviceManager        | **function** off(type: 'deviceNameChange', callback?: Callback<{ deviceName: string }>): void; | 是 |
| @ohos.distributedDeviceManager       | deviceManager        | **function** on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): void; | 是         |
| @ohos.distributedDeviceManager       | deviceManager        | **function** off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): void; | 是        |
| @ohos.distributedDeviceManager       | deviceManager        | **function** on(type: 'serviceDie', callback: () => void): void; | 是    |
| @ohos.distributedDeviceManager       | deviceManager        | **function** off(type: 'serviceDie', callback?: () => void): void; | 是    |
44 45 46 47

**适配指导**

请参考各接口的[API参考](../../../application-dev/reference/apis/js-apis-distributedDeviceManager.md)