openharmony 鸿蒙 changelogs-distributedDeviceManager

2023-10-30 浏览 (433)

设备管理ChangeLog

cl.distributedDeviceManager.1 接口变更

从Openharmony 4.0.9.2版本开始,新增设备管理接口。

变更影响

原有的接口API参考暂时可继续使用,但是停止维护,建议使用新接口进行开发。

关键的接口/组件变更

##新增接口如下:

模块名类名新增接口声明
@ohos.distributedDeviceManagerfunctionfunction createDeviceManager(bundleName: string): DeviceManager;
@ohos.distributedDeviceManagerfunctionfunction releaseDeviceManager(deviceManager: DeviceManager): void;
@ohos.distributedDeviceManagerDeviceManagerfunction getAvailableDeviceListSync(): Array<DeviceBasicInfo>;
@ohos.distributedDeviceManagerDeviceManagerfunction getAvailableDeviceList(callback:AsyncCallback<Array<DeviceBasicInfo>>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction getAvailableDeviceList(): Promise<Array<DeviceBasicInfo>>;
@ohos.distributedDeviceManagerDeviceManagerfunction getLocalDeviceNetworkId(): string;
@ohos.distributedDeviceManagerDeviceManagerfunction getLocalDeviceName(): string;
@ohos.distributedDeviceManagerDeviceManagerfunction getLocalDeviceType(): number;
@ohos.distributedDeviceManagerDeviceManagerfunction getLocalDeviceId(): string;
@ohos.distributedDeviceManagerDeviceManagerfunction getDeviceName(networkId: string): string;
@ohos.distributedDeviceManagerDeviceManagerfunction getDeviceType(networkId: string): number;
@ohos.distributedDeviceManagerDeviceManagerfunction startDiscovering(discoverParam: {[key: string]: Object} , filterOptions?: {[key: string]: Object} ): void;
@ohos.distributedDeviceManagerDeviceManagerfunction stopDiscovering(): void;
@ohos.distributedDeviceManagerDeviceManagerfunction bindTarget(deviceId: string, bindParam: {[key: string]: Object} , callback: AsyncCallback<{deviceId: string}>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction unbindTarget(deviceId: string): void;
@ohos.distributedDeviceManagerDeviceManagerfunction replyUiAction(action: number, actionResult: string): void;
@ohos.distributedDeviceManagerDeviceManagerfunction on(type: 'replyResult', callback: Callback<{ param: string}>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction off(type: 'replyResult', callback?: Callback<{ param: string}>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction on(type: 'discoverSuccess', callback: Callback<{ device: DeviceBasicInfo }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction off(type: 'discoverSuccess', callback?: Callback<{ device: DeviceBasicInfo }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction on(type: 'deviceNameChange', callback: Callback<{ deviceName: string }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction off(type: 'deviceNameChange', callback?: Callback<{ deviceName: string }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction on(type: 'discoverFailure', callback: Callback<{ reason: number }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction off(type: 'discoverFailure', callback?: Callback<{ reason: number }>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction on(type: 'serviceDie', callback?: Callback<{}>): void;
@ohos.distributedDeviceManagerDeviceManagerfunction off(type: 'serviceDie', callback?: Callback<{}>): void;

适配指导

请参考各接口的API参考

你可能感兴趣的鸿蒙文章

harmony 鸿蒙arkui子系统ChangeLog

harmony 鸿蒙位置服务子系统ChangeLog

harmony 鸿蒙输入法框架子系统-输入法框架ChangeLog

harmony 鸿蒙multimedia子系统ChangeLog

harmony 鸿蒙主题框架子系统锁屏管理ChangeLog

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