179a732c7Sopenharmony_ci/* 279a732c7Sopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 379a732c7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 479a732c7Sopenharmony_ci * you may not use this file except in compliance with the License. 579a732c7Sopenharmony_ci * You may obtain a copy of the License at 679a732c7Sopenharmony_ci * 779a732c7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 879a732c7Sopenharmony_ci * 979a732c7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1079a732c7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1179a732c7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1279a732c7Sopenharmony_ci * See the License for the specific language governing permissions and 1379a732c7Sopenharmony_ci * limitations under the License. 1479a732c7Sopenharmony_ci */ 1579a732c7Sopenharmony_ci 1679a732c7Sopenharmony_ciimport type { AsyncCallback, Callback } from './@ohos.base'; 1779a732c7Sopenharmony_ci 1879a732c7Sopenharmony_ci/** 1979a732c7Sopenharmony_ci * Providers interfaces to create a {@link deviceManager} instances. 2079a732c7Sopenharmony_ci * 2179a732c7Sopenharmony_ci * @namespace distributedDeviceManager 2279a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 2379a732c7Sopenharmony_ci * @since 10 2479a732c7Sopenharmony_ci */ 2579a732c7Sopenharmony_ci 2679a732c7Sopenharmony_cideclare namespace distributedDeviceManager { 2779a732c7Sopenharmony_ci 2879a732c7Sopenharmony_ci /** 2979a732c7Sopenharmony_ci * Basic description information of a distributed device. 3079a732c7Sopenharmony_ci * @interface DeviceBasicInfo 3179a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 3279a732c7Sopenharmony_ci * @since 10 3379a732c7Sopenharmony_ci */ 3479a732c7Sopenharmony_ci interface DeviceBasicInfo { 3579a732c7Sopenharmony_ci /** 3679a732c7Sopenharmony_ci * Device unique identifier, The actual value is the udid-hash confused with the appid based on sha256. 3779a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 3879a732c7Sopenharmony_ci * @since 10 3979a732c7Sopenharmony_ci */ 4079a732c7Sopenharmony_ci deviceId: string; 4179a732c7Sopenharmony_ci 4279a732c7Sopenharmony_ci /** 4379a732c7Sopenharmony_ci * Device name. 4479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 4579a732c7Sopenharmony_ci * @since 10 4679a732c7Sopenharmony_ci */ 4779a732c7Sopenharmony_ci deviceName: string; 4879a732c7Sopenharmony_ci 4979a732c7Sopenharmony_ci /** 5079a732c7Sopenharmony_ci * Device type. Currently, only support the following device types: 5179a732c7Sopenharmony_ci * 12 - Indicates a smart pc. 5279a732c7Sopenharmony_ci * 14 - Indicates a smart phone. 5379a732c7Sopenharmony_ci * 17 - Indicates a smart pad. 5479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 5579a732c7Sopenharmony_ci * @since 10 5679a732c7Sopenharmony_ci */ 5779a732c7Sopenharmony_ci deviceType: number; 5879a732c7Sopenharmony_ci 5979a732c7Sopenharmony_ci /** 6079a732c7Sopenharmony_ci * Device network id. 6179a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 6279a732c7Sopenharmony_ci * @since 10 6379a732c7Sopenharmony_ci */ 6479a732c7Sopenharmony_ci networkId?: string; 6579a732c7Sopenharmony_ci } 6679a732c7Sopenharmony_ci 6779a732c7Sopenharmony_ci /** 6879a732c7Sopenharmony_ci * The state of the nearby devices. 6979a732c7Sopenharmony_ci * @enum { DeviceStateChange } 7079a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 7179a732c7Sopenharmony_ci * @since 10 7279a732c7Sopenharmony_ci */ 7379a732c7Sopenharmony_ci enum DeviceStateChange { 7479a732c7Sopenharmony_ci /** 7579a732c7Sopenharmony_ci * This state indicates the device is online but the state is unknown,The distributed function cannot used until 7679a732c7Sopenharmony_ci * state changes to AVAILABLE. 7779a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 7879a732c7Sopenharmony_ci * @since 10 7979a732c7Sopenharmony_ci */ 8079a732c7Sopenharmony_ci UNKNOWN = 0, 8179a732c7Sopenharmony_ci 8279a732c7Sopenharmony_ci /** 8379a732c7Sopenharmony_ci * This state indicates the device has been synchronized to the database, Now the distributed function can be used. 8479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 8579a732c7Sopenharmony_ci * @since 10 8679a732c7Sopenharmony_ci */ 8779a732c7Sopenharmony_ci AVAILABLE = 1, 8879a732c7Sopenharmony_ci 8979a732c7Sopenharmony_ci /** 9079a732c7Sopenharmony_ci * This state indicates the device is offline. 9179a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 9279a732c7Sopenharmony_ci * @since 10 9379a732c7Sopenharmony_ci */ 9479a732c7Sopenharmony_ci UNAVAILABLE = 2, 9579a732c7Sopenharmony_ci } 9679a732c7Sopenharmony_ci 9779a732c7Sopenharmony_ci /** 9879a732c7Sopenharmony_ci * Creates an {@code DeviceManager} instance. 9979a732c7Sopenharmony_ci * 10079a732c7Sopenharmony_ci * To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then 10179a732c7Sopenharmony_ci * use this instance to call other device management methods. 10279a732c7Sopenharmony_ci * 10379a732c7Sopenharmony_ci * @param { string } bundleName - Indicates the bundle name of the application. 10479a732c7Sopenharmony_ci * @returns { DeviceManager } - Return the DeviceManager object. 10579a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 10679a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 10779a732c7Sopenharmony_ci * 2. Incorrect parameter types; 10879a732c7Sopenharmony_ci * 3. Parameter verification failed. 10979a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 11079a732c7Sopenharmony_ci * @since 10 11179a732c7Sopenharmony_ci */ 11279a732c7Sopenharmony_ci function createDeviceManager(bundleName: string): DeviceManager; 11379a732c7Sopenharmony_ci 11479a732c7Sopenharmony_ci /** 11579a732c7Sopenharmony_ci * Releases the {@code DeviceManager} instance that is no longer used. 11679a732c7Sopenharmony_ci * 11779a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 11879a732c7Sopenharmony_ci * @param { DeviceManager } deviceManager - Indicates the {@code DeviceManager} instance. 11979a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 12079a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 12179a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 12279a732c7Sopenharmony_ci * 2. Incorrect parameter types; 12379a732c7Sopenharmony_ci * 3. Parameter verification failed. 12479a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 12579a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 12679a732c7Sopenharmony_ci * @since 10 12779a732c7Sopenharmony_ci */ 12879a732c7Sopenharmony_ci function releaseDeviceManager(deviceManager: DeviceManager): void; 12979a732c7Sopenharmony_ci 13079a732c7Sopenharmony_ci /** 13179a732c7Sopenharmony_ci * Provides methods for managing devices. 13279a732c7Sopenharmony_ci * 13379a732c7Sopenharmony_ci * @interface DeviceManager 13479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 13579a732c7Sopenharmony_ci * @since 10 13679a732c7Sopenharmony_ci */ 13779a732c7Sopenharmony_ci interface DeviceManager { 13879a732c7Sopenharmony_ci 13979a732c7Sopenharmony_ci /** 14079a732c7Sopenharmony_ci * Get a list of available devices. This interface query all authorized and connectable devices. 14179a732c7Sopenharmony_ci * 14279a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 14379a732c7Sopenharmony_ci * @returns { Array<DeviceBasicInfo> } - Returns a list of available devices. 14479a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 14579a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 14679a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 14779a732c7Sopenharmony_ci * 2. Incorrect parameter types; 14879a732c7Sopenharmony_ci * 3. Parameter verification failed. 14979a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 15079a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 15179a732c7Sopenharmony_ci * @since 10 15279a732c7Sopenharmony_ci */ 15379a732c7Sopenharmony_ci getAvailableDeviceListSync(): Array<DeviceBasicInfo>; 15479a732c7Sopenharmony_ci 15579a732c7Sopenharmony_ci /** 15679a732c7Sopenharmony_ci * Get a list of available devices. This interface query all authorized and connectable devices. 15779a732c7Sopenharmony_ci * 15879a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 15979a732c7Sopenharmony_ci * @param { AsyncCallback<Array<DeviceBasicInfo>> } callback - Indicates the callback to be 16079a732c7Sopenharmony_ci * invoked upon getAvailableDeviceList. 16179a732c7Sopenharmony_ci * @returns Returns a list of available devices. 16279a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 16379a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 16479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 16579a732c7Sopenharmony_ci * @since 10 16679a732c7Sopenharmony_ci */ 16779a732c7Sopenharmony_ci getAvailableDeviceList(callback: AsyncCallback<Array<DeviceBasicInfo>>): void; 16879a732c7Sopenharmony_ci 16979a732c7Sopenharmony_ci /** 17079a732c7Sopenharmony_ci * Get a list of available devices. This interface query all authorized and connectable devices. 17179a732c7Sopenharmony_ci * 17279a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 17379a732c7Sopenharmony_ci * @returns { Promise<Array<DeviceBasicInfo>> } - Returns a list of available devices. 17479a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 17579a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 17679a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 17779a732c7Sopenharmony_ci * @since 10 17879a732c7Sopenharmony_ci */ 17979a732c7Sopenharmony_ci getAvailableDeviceList(): Promise<Array<DeviceBasicInfo>>; 18079a732c7Sopenharmony_ci 18179a732c7Sopenharmony_ci /** 18279a732c7Sopenharmony_ci * Get the network id of the local device. 18379a732c7Sopenharmony_ci * 18479a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 18579a732c7Sopenharmony_ci * @returns { string } - Returns local device network id. 18679a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 18779a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 18879a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 18979a732c7Sopenharmony_ci * @since 10 19079a732c7Sopenharmony_ci */ 19179a732c7Sopenharmony_ci getLocalDeviceNetworkId(): string; 19279a732c7Sopenharmony_ci 19379a732c7Sopenharmony_ci /** 19479a732c7Sopenharmony_ci * Get the device name of the local device. 19579a732c7Sopenharmony_ci * 19679a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 19779a732c7Sopenharmony_ci * @returns { string } - Returns local device name. 19879a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 19979a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 20079a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 20179a732c7Sopenharmony_ci * @since 10 20279a732c7Sopenharmony_ci */ 20379a732c7Sopenharmony_ci getLocalDeviceName(): string; 20479a732c7Sopenharmony_ci 20579a732c7Sopenharmony_ci /** 20679a732c7Sopenharmony_ci * Get the device type of the local device. 20779a732c7Sopenharmony_ci * 20879a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 20979a732c7Sopenharmony_ci * @returns { number } - Returns local device type. 21079a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 21179a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 21279a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 21379a732c7Sopenharmony_ci * @since 10 21479a732c7Sopenharmony_ci */ 21579a732c7Sopenharmony_ci getLocalDeviceType(): number; 21679a732c7Sopenharmony_ci 21779a732c7Sopenharmony_ci /** 21879a732c7Sopenharmony_ci * Get the device id of the local device. 21979a732c7Sopenharmony_ci * 22079a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 22179a732c7Sopenharmony_ci * @returns { string } - Returns local device type. 22279a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 22379a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 22479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 22579a732c7Sopenharmony_ci * @since 10 22679a732c7Sopenharmony_ci */ 22779a732c7Sopenharmony_ci getLocalDeviceId(): string; 22879a732c7Sopenharmony_ci 22979a732c7Sopenharmony_ci /** 23079a732c7Sopenharmony_ci * Get the device name by network id. 23179a732c7Sopenharmony_ci * 23279a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 23379a732c7Sopenharmony_ci * @param { string } networkId - Device network id. 23479a732c7Sopenharmony_ci * @returns { string } - Returns device name. 23579a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 23679a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 23779a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 23879a732c7Sopenharmony_ci * 2. Incorrect parameter type; 23979a732c7Sopenharmony_ci * 3. Parameter verification failed; 24079a732c7Sopenharmony_ci * 4. The size of specified networkId is greater than 255. 24179a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 24279a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 24379a732c7Sopenharmony_ci * @since 10 24479a732c7Sopenharmony_ci */ 24579a732c7Sopenharmony_ci getDeviceName(networkId: string): string; 24679a732c7Sopenharmony_ci 24779a732c7Sopenharmony_ci /** 24879a732c7Sopenharmony_ci * Get the device type by network id. 24979a732c7Sopenharmony_ci * 25079a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 25179a732c7Sopenharmony_ci * @param { string } networkId - Device network id. 25279a732c7Sopenharmony_ci * @returns { number } - Returns device type. 25379a732c7Sopenharmony_ci * @throws { BusinessError } 201 - User permission verify failed. 25479a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 25579a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 25679a732c7Sopenharmony_ci * 2. Incorrect parameter type; 25779a732c7Sopenharmony_ci * 3. Parameter verification failed; 25879a732c7Sopenharmony_ci * 4. The size of specified networkId is greater than 255. 25979a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 26079a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 26179a732c7Sopenharmony_ci * @since 10 26279a732c7Sopenharmony_ci */ 26379a732c7Sopenharmony_ci getDeviceType(networkId: string): number; 26479a732c7Sopenharmony_ci 26579a732c7Sopenharmony_ci /** 26679a732c7Sopenharmony_ci * Start to discover nearby devices. 26779a732c7Sopenharmony_ci * 26879a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 26979a732c7Sopenharmony_ci * @param { { [key: string]: Object } } discoverParam - Identifies the type of target discovered: 27079a732c7Sopenharmony_ci * discoverTargetType : 1 - Discovery target as a device by default, the value is 1. 27179a732c7Sopenharmony_ci * @param { { [key: string]: Object } } filterOptions - FilterOptions to filter discovery device. 27279a732c7Sopenharmony_ci * The type of filterOptions is map. The map are as follows: 27379a732c7Sopenharmony_ci * availableStatus: 0-1 - Discover devices only are credible, The value is 0 indicates device isn't credible; 27479a732c7Sopenharmony_ci * 0: Devices are offline, client need to bind the device by calling bindTarget() and then connect to it. 27579a732c7Sopenharmony_ci * 1: Devices already online, client can make connection. 27679a732c7Sopenharmony_ci * discoverDistance: 0-100 - Discover devices within a certain distance from the local, the unit is cm. 27779a732c7Sopenharmony_ci * authenticationStatus: 0-1 - Discover devices based on different authentication status: 27879a732c7Sopenharmony_ci * 0: Devices not authenticated. 27979a732c7Sopenharmony_ci 1: Devices already authenticated. 28079a732c7Sopenharmony_ci * The value is 1 indicates device is trust. 28179a732c7Sopenharmony_ci * authorizationType: 0-2 - Discover devices based on different authorization type: 28279a732c7Sopenharmony_ci * 0: Devices authenticated based on temporary negotiated session key. 28379a732c7Sopenharmony_ci * 1: Devices authenticated based on the same account credential key. 28479a732c7Sopenharmony_ci * 2: Devices authenticated based on different account credential keys. 28579a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 28679a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 28779a732c7Sopenharmony_ci * 2. Incorrect parameter type; 28879a732c7Sopenharmony_ci * 3. Parameter verification failed. 28979a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 29079a732c7Sopenharmony_ci * @throws { BusinessError } 11600104 - Discovery repeats. 29179a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 29279a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 29379a732c7Sopenharmony_ci * @since 10 29479a732c7Sopenharmony_ci */ 29579a732c7Sopenharmony_ci startDiscovering(discoverParam: { [key: string]: Object }, filterOptions?: { [key: string]: Object }): void; 29679a732c7Sopenharmony_ci 29779a732c7Sopenharmony_ci /** 29879a732c7Sopenharmony_ci * Stop discovering nearby devices. 29979a732c7Sopenharmony_ci * 30079a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 30179a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 30279a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 30379a732c7Sopenharmony_ci * 2. Incorrect parameter type; 30479a732c7Sopenharmony_ci * 3. Parameter verification failed. 30579a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 30679a732c7Sopenharmony_ci * @throws { BusinessError } 11600104 - Stop discovery repeats. 30779a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 30879a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 30979a732c7Sopenharmony_ci * @since 10 31079a732c7Sopenharmony_ci */ 31179a732c7Sopenharmony_ci stopDiscovering(): void; 31279a732c7Sopenharmony_ci 31379a732c7Sopenharmony_ci /** 31479a732c7Sopenharmony_ci * Bind the specified target. 31579a732c7Sopenharmony_ci * 31679a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 31779a732c7Sopenharmony_ci * @param { string } deviceId - id of device to bind. 31879a732c7Sopenharmony_ci * @param { { [key: string]: Object } } bindParam - parameters of device to bind, The parameter type is map,such as: 31979a732c7Sopenharmony_ci * "bindType" : 1-4, - This value is type of bind, the values are as follows: 32079a732c7Sopenharmony_ci * 1 - The bind type is pin code . 32179a732c7Sopenharmony_ci * 2 - The bind type is QR code. 32279a732c7Sopenharmony_ci * 3 - The bind type is nfc. 32379a732c7Sopenharmony_ci * 4 - The bind type is no_interaction. 32479a732c7Sopenharmony_ci 32579a732c7Sopenharmony_ci * "targetPkgName" : "xxxx", - The package name of binding target. 32679a732c7Sopenharmony_ci * "appName" : "xxxx", - The app name that try to bind the target. 32779a732c7Sopenharmony_ci * "appOperation" : "xxxx" - The reason why the app want to bind the target package. 32879a732c7Sopenharmony_ci * "customDescription" : "xxxx" - The detail description of the operation. 32979a732c7Sopenharmony_ci * @param { AsyncCallback<{deviceId: string}> } callback - indicates the callback to be invoked upon bindDevice. 33079a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 33179a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 33279a732c7Sopenharmony_ci * 2. Incorrect parameter type; 33379a732c7Sopenharmony_ci * 3. Parameter verification failed; 33479a732c7Sopenharmony_ci * 4. The size of specified deviceId is greater than 255. 33579a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 33679a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 33779a732c7Sopenharmony_ci * @throws { BusinessError } 11600103 - Bind invalid. 33879a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 33979a732c7Sopenharmony_ci * @since 10 34079a732c7Sopenharmony_ci */ 34179a732c7Sopenharmony_ci bindTarget(deviceId: string, bindParam: { [key: string]: Object }, callback: AsyncCallback<{deviceId: string}>): void; 34279a732c7Sopenharmony_ci 34379a732c7Sopenharmony_ci /** 34479a732c7Sopenharmony_ci * Unbind the specified target. 34579a732c7Sopenharmony_ci * 34679a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 34779a732c7Sopenharmony_ci * @param { string } deviceId - id of device to unbind 34879a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 34979a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 35079a732c7Sopenharmony_ci * 2. Incorrect parameter type; 35179a732c7Sopenharmony_ci * 3. Parameter verification failed; 35279a732c7Sopenharmony_ci * 4. The size of specified deviceId is greater than 255. 35379a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 35479a732c7Sopenharmony_ci * @throws { BusinessError } 11600101 - Failed to execute the function. 35579a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 35679a732c7Sopenharmony_ci * @since 10 35779a732c7Sopenharmony_ci */ 35879a732c7Sopenharmony_ci unbindTarget(deviceId: string): void; 35979a732c7Sopenharmony_ci 36079a732c7Sopenharmony_ci /** 36179a732c7Sopenharmony_ci * The reply of ui operation from pin-code window, this interface can only be used by pin-code-hap of devicemanager. 36279a732c7Sopenharmony_ci * 36379a732c7Sopenharmony_ci * @permission ohos.permission.ACCESS_SERVICE_DM 36479a732c7Sopenharmony_ci * @param { number } action - The reply action of user operation. 36579a732c7Sopenharmony_ci * @param { string } actionResult - Indicates the user operation result. 36679a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 36779a732c7Sopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 36879a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 36979a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 37079a732c7Sopenharmony_ci * 2. Incorrect parameter type; 37179a732c7Sopenharmony_ci * 3. Parameter verification failed; 37279a732c7Sopenharmony_ci * 4. The size of specified actionResult is greater than 255. 37379a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 37479a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 37579a732c7Sopenharmony_ci * @since 10 37679a732c7Sopenharmony_ci */ 37779a732c7Sopenharmony_ci replyUiAction(action: number, actionResult: string): void; 37879a732c7Sopenharmony_ci 37979a732c7Sopenharmony_ci /** 38079a732c7Sopenharmony_ci * Register a device state callback so that the application can be notified upon device state changes based on 38179a732c7Sopenharmony_ci * the application bundle name. 38279a732c7Sopenharmony_ci * 38379a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 38479a732c7Sopenharmony_ci * @param { 'deviceStateChange' } type - Device state change. 38579a732c7Sopenharmony_ci * @param { Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }> } callback 38679a732c7Sopenharmony_ci * Indicates the device state callback to register. 38779a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 38879a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 38979a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 39079a732c7Sopenharmony_ci * 2. Incorrect parameter type; 39179a732c7Sopenharmony_ci * 3. Parameter verification failed; 39279a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 39379a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 39479a732c7Sopenharmony_ci * @since 10 39579a732c7Sopenharmony_ci */ 39679a732c7Sopenharmony_ci on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void; 39779a732c7Sopenharmony_ci 39879a732c7Sopenharmony_ci /** 39979a732c7Sopenharmony_ci * UnRegister device state callback based on the application bundle name. 40079a732c7Sopenharmony_ci * 40179a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 40279a732c7Sopenharmony_ci * @param { 'deviceStateChange' } type - Device state change. 40379a732c7Sopenharmony_ci * @param { Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }> } callback 40479a732c7Sopenharmony_ci * Indicates the device state callback to unregister. 40579a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 40679a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 40779a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 40879a732c7Sopenharmony_ci * 2. Incorrect parameter type; 40979a732c7Sopenharmony_ci * 3. Parameter verification failed; 41079a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 41179a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 41279a732c7Sopenharmony_ci * @since 10 41379a732c7Sopenharmony_ci */ 41479a732c7Sopenharmony_ci off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void; 41579a732c7Sopenharmony_ci 41679a732c7Sopenharmony_ci /** 41779a732c7Sopenharmony_ci * Register a device discovery result callback so that the application can be notified when discovery success. 41879a732c7Sopenharmony_ci * 41979a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 42079a732c7Sopenharmony_ci * @param { 'discoverSuccess' } type - Successfully discovered device. 42179a732c7Sopenharmony_ci * @param { Callback<{ subscribeId: number, device: DeviceBasicInfo }> } callback 42279a732c7Sopenharmony_ci * Indicates the device discovery callback to register. 42379a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 42479a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 42579a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 42679a732c7Sopenharmony_ci * 2. Incorrect parameter type; 42779a732c7Sopenharmony_ci * 3. Parameter verification failed; 42879a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 42979a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 43079a732c7Sopenharmony_ci * @since 10 43179a732c7Sopenharmony_ci */ 43279a732c7Sopenharmony_ci on(type: 'discoverSuccess', callback: Callback<{ device: DeviceBasicInfo }>): void; 43379a732c7Sopenharmony_ci 43479a732c7Sopenharmony_ci /** 43579a732c7Sopenharmony_ci * UnRegister the device discovery result callback. 43679a732c7Sopenharmony_ci * 43779a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 43879a732c7Sopenharmony_ci * @param { 'discoverSuccess' } type - Successfully discovered device. 43979a732c7Sopenharmony_ci * @param { Callback<{ subscribeId: number, device: DeviceBasicInfo }> } callback 44079a732c7Sopenharmony_ci * Indicates the device discovery callback to unregister. 44179a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 44279a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 44379a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 44479a732c7Sopenharmony_ci * 2. Incorrect parameter type; 44579a732c7Sopenharmony_ci * 3. Parameter verification failed; 44679a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 44779a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 44879a732c7Sopenharmony_ci * @since 10 44979a732c7Sopenharmony_ci */ 45079a732c7Sopenharmony_ci off(type: 'discoverSuccess', callback?: Callback<{ device: DeviceBasicInfo }>): void; 45179a732c7Sopenharmony_ci 45279a732c7Sopenharmony_ci /** 45379a732c7Sopenharmony_ci * Register a device name change callback so that the application can be notified when discovery success. 45479a732c7Sopenharmony_ci * 45579a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 45679a732c7Sopenharmony_ci * @param { 'deviceNameChange' } type - Changed device name. 45779a732c7Sopenharmony_ci * @param { Callback<{ deviceName: string }> } callback - Indicates the device name change callback to register. 45879a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 45979a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 46079a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 46179a732c7Sopenharmony_ci * 2. Incorrect parameter type; 46279a732c7Sopenharmony_ci * 3. Parameter verification failed; 46379a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 46479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 46579a732c7Sopenharmony_ci * @since 10 46679a732c7Sopenharmony_ci */ 46779a732c7Sopenharmony_ci on(type: 'deviceNameChange', callback: Callback<{ deviceName: string }>): void; 46879a732c7Sopenharmony_ci 46979a732c7Sopenharmony_ci /** 47079a732c7Sopenharmony_ci * UnRegister the device name change result callback. 47179a732c7Sopenharmony_ci * 47279a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 47379a732c7Sopenharmony_ci * @param { 'deviceNameChange' } type - Changed device name. 47479a732c7Sopenharmony_ci * @param { Callback<{ deviceName: string }> } callback - Indicates the device name change callback to unregister. 47579a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 47679a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 47779a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 47879a732c7Sopenharmony_ci * 2. Incorrect parameter type; 47979a732c7Sopenharmony_ci * 3. Parameter verification failed; 48079a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 48179a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 48279a732c7Sopenharmony_ci * @since 10 48379a732c7Sopenharmony_ci */ 48479a732c7Sopenharmony_ci off(type: 'deviceNameChange', callback?: Callback<{ deviceName: string }>): void; 48579a732c7Sopenharmony_ci 48679a732c7Sopenharmony_ci /** 48779a732c7Sopenharmony_ci * Register a device discovery result callback so that the application can be notified when discover failed. 48879a732c7Sopenharmony_ci * 48979a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 49079a732c7Sopenharmony_ci * @param { 'discoverFailure' } type - Discovery Device Failure. 49179a732c7Sopenharmony_ci * @param { Callback<{ subscribeId: number, reason: number }> } callback 49279a732c7Sopenharmony_ci * Indicates the device found result callback to register. 49379a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 49479a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 49579a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 49679a732c7Sopenharmony_ci * 2. Incorrect parameter type; 49779a732c7Sopenharmony_ci * 3. Parameter verification failed; 49879a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 49979a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 50079a732c7Sopenharmony_ci * @since 10 50179a732c7Sopenharmony_ci */ 50279a732c7Sopenharmony_ci on(type: 'discoverFailure', callback: Callback<{ reason: number }>): void; 50379a732c7Sopenharmony_ci 50479a732c7Sopenharmony_ci /** 50579a732c7Sopenharmony_ci * UnRegister the device discovery result callback. 50679a732c7Sopenharmony_ci * 50779a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 50879a732c7Sopenharmony_ci * @param { 'discoverFailure' } type - Discovery Device Failure. 50979a732c7Sopenharmony_ci * @param { Callback<{ subscribeId: number, reason: number }> } callback 51079a732c7Sopenharmony_ci * Indicates the device found result callback to unregister. 51179a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 51279a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 51379a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 51479a732c7Sopenharmony_ci * 2. Incorrect parameter type; 51579a732c7Sopenharmony_ci * 3. Parameter verification failed; 51679a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 51779a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 51879a732c7Sopenharmony_ci * @since 10 51979a732c7Sopenharmony_ci */ 52079a732c7Sopenharmony_ci off(type: 'discoverFailure', callback?: Callback<{ reason: number }>): void; 52179a732c7Sopenharmony_ci 52279a732c7Sopenharmony_ci /** 52379a732c7Sopenharmony_ci * Register a serviceError callback so that the application can be notified when devicemanager service died 52479a732c7Sopenharmony_ci * 52579a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 52679a732c7Sopenharmony_ci * @param { 'serviceDie' } type - Service death. 52779a732c7Sopenharmony_ci * @param { Callback<{}> } callback - Indicates the service error callback to register. 52879a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 52979a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 53079a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 53179a732c7Sopenharmony_ci * 2. Incorrect parameter type; 53279a732c7Sopenharmony_ci * 3. Parameter verification failed; 53379a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 53479a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 53579a732c7Sopenharmony_ci * @since 10 53679a732c7Sopenharmony_ci */ 53779a732c7Sopenharmony_ci on(type: 'serviceDie', callback?: Callback<{}>): void; 53879a732c7Sopenharmony_ci 53979a732c7Sopenharmony_ci /** 54079a732c7Sopenharmony_ci * UnRegister the service error callback. 54179a732c7Sopenharmony_ci * 54279a732c7Sopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 54379a732c7Sopenharmony_ci * @param { 'serviceDie' } type - Service death. 54479a732c7Sopenharmony_ci * @param { Callback<{}> } callback - Indicates the service error callback to unregister. 54579a732c7Sopenharmony_ci * @throws { BusinessError } 201 - Permission verify failed. 54679a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 54779a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 54879a732c7Sopenharmony_ci * 2. Incorrect parameter type; 54979a732c7Sopenharmony_ci * 3. Parameter verification failed; 55079a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 55179a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 55279a732c7Sopenharmony_ci * @since 10 55379a732c7Sopenharmony_ci */ 55479a732c7Sopenharmony_ci off(type: 'serviceDie', callback?: Callback<{}>): void; 55579a732c7Sopenharmony_ci 55679a732c7Sopenharmony_ci /** 55779a732c7Sopenharmony_ci * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges. 55879a732c7Sopenharmony_ci * 55979a732c7Sopenharmony_ci * @permission ohos.permission.ACCESS_SERVICE_DM 56079a732c7Sopenharmony_ci * @param { 'replyResult' } type - Ui reply result to register. 56179a732c7Sopenharmony_ci * @param { Callback<{ param: string }> } callback - Indicates the devicemanager ui state to register. 56279a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 56379a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 56479a732c7Sopenharmony_ci * 2. Incorrect parameter type; 56579a732c7Sopenharmony_ci * 3. Parameter verification failed; 56679a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 56779a732c7Sopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 56879a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 56979a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 57079a732c7Sopenharmony_ci * @since 10 57179a732c7Sopenharmony_ci */ 57279a732c7Sopenharmony_ci on(type: 'replyResult', callback: Callback<{ param: string }>): void; 57379a732c7Sopenharmony_ci 57479a732c7Sopenharmony_ci /** 57579a732c7Sopenharmony_ci * Unregister uiStateChange, this interface can only be used by devicemanager ui. 57679a732c7Sopenharmony_ci * 57779a732c7Sopenharmony_ci * @permission ohos.permission.ACCESS_SERVICE_DM 57879a732c7Sopenharmony_ci * @param { 'replyResult' } type - Ui reply result to unregister. 57979a732c7Sopenharmony_ci * @param { Callback<{ param: string }> } callback - Indicates the devicemanager ui state to unregister. 58079a732c7Sopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 58179a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 58279a732c7Sopenharmony_ci * 2. Incorrect parameter type; 58379a732c7Sopenharmony_ci * 3. Parameter verification failed; 58479a732c7Sopenharmony_ci * 4. The size of specified type is greater than 255. 58579a732c7Sopenharmony_ci * @throws { BusinessError } 202 - The caller is not a system application. 58679a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 58779a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 58879a732c7Sopenharmony_ci * @since 10 58979a732c7Sopenharmony_ci */ 59079a732c7Sopenharmony_ci off(type: 'replyResult', callback?: Callback<{ param: string }>): void; 59179a732c7Sopenharmony_ci } 59279a732c7Sopenharmony_ci} 59379a732c7Sopenharmony_ci 59479a732c7Sopenharmony_ciexport default distributedDeviceManager;