harmony 鸿蒙设备管理ChangeLog

  • 2023-06-24
  • 浏览 (450)

设备管理ChangeLog

cl.device_manager.1 接口权限变更

从Openharmony 4.0.8.2版本开始,部分接口新增权限校验。

变更影响

从Openharmony 4.0.8.2之后版本开发的应用,需要持有相应权限,否则无法正常调用接口。

关键的接口/组件变更

模块名 类名 方法/属性/枚举/常量 新增权限
@ohos.distributedHardware.deviceManager deviceManager function release(): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getTrustedDeviceListSync(): Array<DeviceInfo> ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>; ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getTrustedDeviceList(): Promise<Array<DeviceInfo>> ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getLocalDeviceInfoSync(): DeviceInfo ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getLocalDeviceInfo(): Promise<DeviceInfo> ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function getDeviceInfo(networkId: string): Promise<DeviceInfo> ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function startDeviceDiscovery(subscribeInfo: SubscribeInfo): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function stopDeviceDiscovery(subscribeId: number): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function publishDeviceDiscovery(publishInfo: PublishInfo): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function unPublishDeviceDiscovery(publishId: number): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function unAuthenticateDevice(deviceInfo: DeviceInfo): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function setUserOperation(operateAction: number, params: string): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{registerInfo: string}>): void; ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function on(type: ‘uiStateChange’, callback: Callback<{ param: string}>): void; ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function off(type: ‘uiStateChange’, callback?: Callback<{ param: string}>): void; ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function on(type: ‘deviceStateChange’, callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function off(type: ‘deviceStateChange’, callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function on(type: ‘deviceFound’, callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function off(type: ‘deviceFound’, callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function on(type: ‘discoverFail’, callback: Callback<{ subscribeId: number, reason: number }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function off(type: ‘discoverFail’, callback?: Callback<{ subscribeId: number, reason: number }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function on(type: ‘publishSuccess’, callback: Callback<{ publishId: number }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function off(type: ‘publishSuccess’, callback?: Callback<{ publishId: number }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function on(type: ‘publishFail’, callback: Callback<{ publishId: number, reason: number }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function off(type: ‘publishFail’, callback?: Callback<{ publishId: number, reason: number }>): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function on(type: ‘serviceDie’, callback: () => void): void ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManager deviceManager function off(type: ‘serviceDie’, callback?: () => void): void ohos.permission.ACCESS_SERVICE_DM

适配指导

调用以上接口,需要申请相应的权限才能正常调用。

cl.device_manager.2 所有接口进行系统接口权限校验

从Openharmony 4.0.8.2版本开始,所有接口进行系统接口权限校验。

变更影响

非系统应用无法调用系统接口,如调用方为非系统应用或未申请SystemApi相关权限,将无法调用接口。

关键的接口/组件变更

所有接口均进行系统接口权限校验,接口明细如下:

接口、枚举或变量名 类型 是否为SystemApi
createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void; interface
release(): void interface
getTrustedDeviceListSync(): Array<DeviceInfo> interface
getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>; interface
getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): void interface
getTrustedDeviceList(): Promise<Array<DeviceInfo>> interface
getLocalDeviceInfoSync(): DeviceInfo interface
getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void interface
getLocalDeviceInfo(): Promise<DeviceInfo> interface
getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): void interface
getDeviceInfo(networkId: string): Promise<DeviceInfo> interface
startDeviceDiscovery(subscribeInfo: SubscribeInfo): void interface
startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void interface
stopDeviceDiscovery(subscribeId: number): void interface
publishDeviceDiscovery(publishInfo: PublishInfo): void interface
unPublishDeviceDiscovery(publishId: number): void interface
authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void interface
unAuthenticateDevice(deviceInfo: DeviceInfo): void interface
verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): void interface
setUserOperation(operateAction: number, params: string): void interface
requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{registerInfo: string}>): void; interface
importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; interface
deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; interface
on(type: ‘uiStateChange’, callback: Callback<{ param: string}>): void; interface
off(type: ‘uiStateChange’, callback?: Callback<{ param: string}>): void; interface
on(type: ‘deviceStateChange’, callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void interface
off(type: ‘deviceStateChange’, callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void interface
on(type: ‘deviceFound’, callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void interface
off(type: ‘deviceFound’, callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void interface
on(type: ‘discoverFail’, callback: Callback<{ subscribeId: number, reason: number }>): void interface
off(type: ‘discoverFail’, callback?: Callback<{ subscribeId: number, reason: number }>): void interface
on(type: ‘publishSuccess’, callback: Callback<{ publishId: number }>): void interface
off(type: ‘publishSuccess’, callback?: Callback<{ publishId: number }>): void interface
on(type: ‘publishFail’, callback: Callback<{ publishId: number, reason: number }>): void interface
off(type: ‘publishFail’, callback?: Callback<{ publishId: number, reason: number }>): void interface
on(type: ‘serviceDie’, callback: () => void): void interface
off(type: ‘serviceDie’, callback?: () => void): void interface

适配指导

调用以上接口,调用方需要为系统应用或申请SystemApi相关权限。

你可能感兴趣的鸿蒙文章

harmony 鸿蒙arkui子系统ChangeLog

harmony 鸿蒙分布式数据管理子系统ChangeLog

harmony 鸿蒙分布式数据管理子系统ChangeLog

harmony 鸿蒙文件子系统ChangeLog

harmony 鸿蒙泛Sensor子系统Changelog

0  赞