161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit DistributedServiceKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type { AsyncCallback, Callback } from './@ohos.base';
2261847f8eSopenharmony_ci
2361847f8eSopenharmony_ci/**
2461847f8eSopenharmony_ci * Providers interfaces to create a {@link deviceManager} instances.
2561847f8eSopenharmony_ci *
2661847f8eSopenharmony_ci * @namespace distributedDeviceManager
2761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager
2861847f8eSopenharmony_ci * @since 10
2961847f8eSopenharmony_ci */
3061847f8eSopenharmony_ci
3161847f8eSopenharmony_cideclare namespace distributedDeviceManager {
3261847f8eSopenharmony_ci
3361847f8eSopenharmony_ci  /**
3461847f8eSopenharmony_ci   * Basic description information of a distributed device.
3561847f8eSopenharmony_ci   * @interface DeviceBasicInfo
3661847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedHardware.DeviceManager
3761847f8eSopenharmony_ci   * @since 10
3861847f8eSopenharmony_ci   */
3961847f8eSopenharmony_ci  interface DeviceBasicInfo {
4061847f8eSopenharmony_ci    /**
4161847f8eSopenharmony_ci     * Device identifier. The actual value is udid-hash confused with appid and salt value based on sha256.
4261847f8eSopenharmony_ci     * This id remains unchanged after application installation. If the application is uninstalled and reinstalled,
4361847f8eSopenharmony_ci     * the obtained ID will change.
4461847f8eSopenharmony_ci     * @type { string }
4561847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
4661847f8eSopenharmony_ci     * @since 10
4761847f8eSopenharmony_ci     */
4861847f8eSopenharmony_ci    deviceId: string;
4961847f8eSopenharmony_ci
5061847f8eSopenharmony_ci    /**
5161847f8eSopenharmony_ci     * Device name.
5261847f8eSopenharmony_ci     * @type { string }
5361847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
5461847f8eSopenharmony_ci     * @since 10
5561847f8eSopenharmony_ci     */
5661847f8eSopenharmony_ci    deviceName: string;
5761847f8eSopenharmony_ci
5861847f8eSopenharmony_ci    /**
5961847f8eSopenharmony_ci     * Obtains the device type represented by a string,
6061847f8eSopenharmony_ci     * which can be {@code phone}, {@code tablet}, {@code tv}, {@code smartVision}, {@code car}.
6161847f8eSopenharmony_ci     * @type { string }
6261847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
6361847f8eSopenharmony_ci     * @since 10
6461847f8eSopenharmony_ci     */
6561847f8eSopenharmony_ci    deviceType: string;
6661847f8eSopenharmony_ci
6761847f8eSopenharmony_ci    /**
6861847f8eSopenharmony_ci     * Device network id.
6961847f8eSopenharmony_ci     * @type { ?string }
7061847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
7161847f8eSopenharmony_ci     * @since 10
7261847f8eSopenharmony_ci     */
7361847f8eSopenharmony_ci    networkId?: string;
7461847f8eSopenharmony_ci  }
7561847f8eSopenharmony_ci
7661847f8eSopenharmony_ci  /**
7761847f8eSopenharmony_ci   * The state of the nearby devices.
7861847f8eSopenharmony_ci   * @enum { number }
7961847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedHardware.DeviceManager
8061847f8eSopenharmony_ci   * @since 10
8161847f8eSopenharmony_ci   */
8261847f8eSopenharmony_ci  enum DeviceStateChange {
8361847f8eSopenharmony_ci    /**
8461847f8eSopenharmony_ci     * This state indicates the device is online but the state is unknown,The distributed function cannot used until
8561847f8eSopenharmony_ci     * state changes to AVAILABLE.
8661847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
8761847f8eSopenharmony_ci     * @since 10
8861847f8eSopenharmony_ci     */
8961847f8eSopenharmony_ci    UNKNOWN = 0,
9061847f8eSopenharmony_ci
9161847f8eSopenharmony_ci    /**
9261847f8eSopenharmony_ci     * This state indicates the device has been synchronized to the database, Now the distributed function can be used.
9361847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
9461847f8eSopenharmony_ci     * @since 10
9561847f8eSopenharmony_ci     */
9661847f8eSopenharmony_ci    AVAILABLE = 1,
9761847f8eSopenharmony_ci
9861847f8eSopenharmony_ci    /**
9961847f8eSopenharmony_ci     * This state indicates the device is offline.
10061847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
10161847f8eSopenharmony_ci     * @since 10
10261847f8eSopenharmony_ci     */
10361847f8eSopenharmony_ci    UNAVAILABLE = 2,
10461847f8eSopenharmony_ci  }
10561847f8eSopenharmony_ci
10661847f8eSopenharmony_ci  /**
10761847f8eSopenharmony_ci   * Creates an {@code DeviceManager} instance.
10861847f8eSopenharmony_ci   *
10961847f8eSopenharmony_ci   * To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then
11061847f8eSopenharmony_ci   * use this instance to call other device management methods.
11161847f8eSopenharmony_ci   *
11261847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the bundle name of the application.
11361847f8eSopenharmony_ci   * @returns { DeviceManager } - Return the DeviceManager object.
11461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes:
11561847f8eSopenharmony_ci   *                                                  1. Mandatory parameters are left unspecified;
11661847f8eSopenharmony_ci   *                                                  2. Incorrect parameter type;
11761847f8eSopenharmony_ci   *                                                  3. Parameter verification failed.
11861847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedHardware.DeviceManager
11961847f8eSopenharmony_ci   * @since 10
12061847f8eSopenharmony_ci   */
12161847f8eSopenharmony_ci  function createDeviceManager(bundleName: string): DeviceManager;
12261847f8eSopenharmony_ci
12361847f8eSopenharmony_ci  /**
12461847f8eSopenharmony_ci   * Releases the {@code DeviceManager} instance that is no longer used.
12561847f8eSopenharmony_ci   *
12661847f8eSopenharmony_ci   * @permission ohos.permission.DISTRIBUTED_DATASYNC
12761847f8eSopenharmony_ci   * @param { DeviceManager } deviceManager - Indicates the {@code DeviceManager} instance.
12861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
12961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes:
13061847f8eSopenharmony_ci   *                                                  1. Mandatory parameters are left unspecified;
13161847f8eSopenharmony_ci   *                                                  2. Incorrect parameter types;
13261847f8eSopenharmony_ci   *                                                  3. Parameter verification failed.
13361847f8eSopenharmony_ci   * @throws { BusinessError } 11600101 - Failed to execute the function.
13461847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedHardware.DeviceManager
13561847f8eSopenharmony_ci   * @since 10
13661847f8eSopenharmony_ci   */
13761847f8eSopenharmony_ci  function releaseDeviceManager(deviceManager: DeviceManager): void;
13861847f8eSopenharmony_ci
13961847f8eSopenharmony_ci  /**
14061847f8eSopenharmony_ci   * Provides methods for managing devices.
14161847f8eSopenharmony_ci   *
14261847f8eSopenharmony_ci   * @interface DeviceManager
14361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedHardware.DeviceManager
14461847f8eSopenharmony_ci   * @since 10
14561847f8eSopenharmony_ci   */
14661847f8eSopenharmony_ci  interface DeviceManager {
14761847f8eSopenharmony_ci
14861847f8eSopenharmony_ci    /**
14961847f8eSopenharmony_ci     * Get a list of available devices. This interface query all authorized and connectable devices.
15061847f8eSopenharmony_ci     *
15161847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
15261847f8eSopenharmony_ci     * @returns { Array<DeviceBasicInfo> } - Returns a list of available devices.
15361847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
15461847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
15561847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
15661847f8eSopenharmony_ci     *                                                  2. Incorrect parameter types;
15761847f8eSopenharmony_ci     *                                                  3. Parameter verification failed.
15861847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
15961847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
16061847f8eSopenharmony_ci     * @since 10
16161847f8eSopenharmony_ci     */
16261847f8eSopenharmony_ci    getAvailableDeviceListSync(): Array<DeviceBasicInfo>;
16361847f8eSopenharmony_ci
16461847f8eSopenharmony_ci    /**
16561847f8eSopenharmony_ci     * Get a list of available devices. This interface query all authorized and connectable devices.
16661847f8eSopenharmony_ci     *
16761847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
16861847f8eSopenharmony_ci     * @param { AsyncCallback<Array<DeviceBasicInfo>> } callback - Indicates the callback to be
16961847f8eSopenharmony_ci     * invoked upon getAvailableDeviceList.
17061847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
17161847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
17261847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
17361847f8eSopenharmony_ci     * @since 10
17461847f8eSopenharmony_ci     */
17561847f8eSopenharmony_ci    getAvailableDeviceList(callback: AsyncCallback<Array<DeviceBasicInfo>>): void;
17661847f8eSopenharmony_ci
17761847f8eSopenharmony_ci    /**
17861847f8eSopenharmony_ci     * Get a list of available devices. This interface query all authorized and connectable devices.
17961847f8eSopenharmony_ci     *
18061847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
18161847f8eSopenharmony_ci     * @returns { Promise<Array<DeviceBasicInfo>> } - Returns a list of available devices.
18261847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
18361847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
18461847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
18561847f8eSopenharmony_ci     * @since 10
18661847f8eSopenharmony_ci     */
18761847f8eSopenharmony_ci    getAvailableDeviceList(): Promise<Array<DeviceBasicInfo>>;
18861847f8eSopenharmony_ci
18961847f8eSopenharmony_ci    /**
19061847f8eSopenharmony_ci     * Get the network id of the local device.
19161847f8eSopenharmony_ci     *
19261847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
19361847f8eSopenharmony_ci     * @returns { string } - Returns local device network id.
19461847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
19561847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
19661847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
19761847f8eSopenharmony_ci     * @since 10
19861847f8eSopenharmony_ci     */
19961847f8eSopenharmony_ci    getLocalDeviceNetworkId(): string;
20061847f8eSopenharmony_ci
20161847f8eSopenharmony_ci    /**
20261847f8eSopenharmony_ci     * Get the device name of the local device.
20361847f8eSopenharmony_ci     *
20461847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
20561847f8eSopenharmony_ci     * @returns { string } - Returns local device name.
20661847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
20761847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
20861847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
20961847f8eSopenharmony_ci     * @since 10
21061847f8eSopenharmony_ci     */
21161847f8eSopenharmony_ci    getLocalDeviceName(): string;
21261847f8eSopenharmony_ci
21361847f8eSopenharmony_ci    /**
21461847f8eSopenharmony_ci     * Get the device type of the local device.
21561847f8eSopenharmony_ci     *
21661847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
21761847f8eSopenharmony_ci     * @returns { number } - Returns local device type.
21861847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
21961847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
22061847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
22161847f8eSopenharmony_ci     * @since 10
22261847f8eSopenharmony_ci     */
22361847f8eSopenharmony_ci    getLocalDeviceType(): number;
22461847f8eSopenharmony_ci
22561847f8eSopenharmony_ci    /**
22661847f8eSopenharmony_ci     * Get the device id of the local device.
22761847f8eSopenharmony_ci     *
22861847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
22961847f8eSopenharmony_ci     * @returns { string } - Device identifier. The actual value is udid-hash confused with appid and salt value based on sha256.
23061847f8eSopenharmony_ci     * This id remains unchanged after application installation. If the application is uninstalled and reinstalled,
23161847f8eSopenharmony_ci     * the obtained ID will change.
23261847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
23361847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
23461847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
23561847f8eSopenharmony_ci     * @since 10
23661847f8eSopenharmony_ci     */
23761847f8eSopenharmony_ci    getLocalDeviceId(): string;
23861847f8eSopenharmony_ci
23961847f8eSopenharmony_ci    /**
24061847f8eSopenharmony_ci     * Get the device name by network id.
24161847f8eSopenharmony_ci     *
24261847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
24361847f8eSopenharmony_ci     * @param { string } networkId - Device network id.
24461847f8eSopenharmony_ci     * @returns { string } - Returns device name.
24561847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
24661847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
24761847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
24861847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
24961847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
25061847f8eSopenharmony_ci     *                                                  4. The size of specified networkId is greater than 255.
25161847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
25261847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
25361847f8eSopenharmony_ci     * @since 10
25461847f8eSopenharmony_ci     */
25561847f8eSopenharmony_ci    getDeviceName(networkId: string): string;
25661847f8eSopenharmony_ci
25761847f8eSopenharmony_ci    /**
25861847f8eSopenharmony_ci     * Get the device type by network id.
25961847f8eSopenharmony_ci     *
26061847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
26161847f8eSopenharmony_ci     * @param { string } networkId - Device network id.
26261847f8eSopenharmony_ci     * @returns { number } - Returns device type.
26361847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
26461847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
26561847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
26661847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
26761847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
26861847f8eSopenharmony_ci     *                                                  4. The size of specified networkId is greater than 255.
26961847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
27061847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
27161847f8eSopenharmony_ci     * @since 10
27261847f8eSopenharmony_ci     */
27361847f8eSopenharmony_ci    getDeviceType(networkId: string): number;
27461847f8eSopenharmony_ci
27561847f8eSopenharmony_ci    /**
27661847f8eSopenharmony_ci     * Start to discover nearby devices.
27761847f8eSopenharmony_ci     *
27861847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
27961847f8eSopenharmony_ci     * @param { object } discoverParam - Identifies the type of target discovered:
28061847f8eSopenharmony_ci     *       discoverTargetType : 1     - Discovery target as a device by default, the value is 1.
28161847f8eSopenharmony_ci     * @param { object } filterOptions - FilterOptions to filter discovery device.
28261847f8eSopenharmony_ci     * The type of filterOptions is map. The map are as follows:
28361847f8eSopenharmony_ci     *       availableStatus: 0-1       - Discover devices only are credible, The value is 0 indicates device isn't credible;
28461847f8eSopenharmony_ci     *                                      0: Devices are offline, client need to bind the device by calling bindTarget() and then connect to it.
28561847f8eSopenharmony_ci     *                                      1: Devices already online, client can make connection.
28661847f8eSopenharmony_ci     *       discoverDistance: 0-100    - Discover devices within a certain distance from the local, the unit is cm.
28761847f8eSopenharmony_ci     *       authenticationStatus: 0-1  - Discover devices based on different authentication status:
28861847f8eSopenharmony_ci     *                                      0: Devices not authenticated.
28961847f8eSopenharmony_ci                                            1: Devices already authenticated.
29061847f8eSopenharmony_ci     *                                The value is 1 indicates device is trust.
29161847f8eSopenharmony_ci     *       authorizationType: 0-2     - Discover devices based on different authorization type:
29261847f8eSopenharmony_ci     *                                      0: Devices authenticated based on temporary negotiated session key.
29361847f8eSopenharmony_ci     *                                      1: Devices authenticated based on the same account credential key.
29461847f8eSopenharmony_ci     *                                      2: Devices authenticated based on different account credential keys.
29561847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
29661847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
29761847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
29861847f8eSopenharmony_ci     *                                                  3. Parameter verification failed.
29961847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
30061847f8eSopenharmony_ci     * @throws { BusinessError } 11600104 - Discovery unavailable.
30161847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
30261847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
30361847f8eSopenharmony_ci     * @since 10
30461847f8eSopenharmony_ci     */
30561847f8eSopenharmony_ci    startDiscovering(discoverParam: { [key: string]: Object; }, filterOptions?: { [key: string]: Object; }): void;
30661847f8eSopenharmony_ci
30761847f8eSopenharmony_ci    /**
30861847f8eSopenharmony_ci     * Stop discovering nearby devices.
30961847f8eSopenharmony_ci     *
31061847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
31161847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
31261847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
31361847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
31461847f8eSopenharmony_ci     *                                                  3. Parameter verification failed.
31561847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
31661847f8eSopenharmony_ci     * @throws { BusinessError } 11600104 - Discovery unavailable.
31761847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
31861847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
31961847f8eSopenharmony_ci     * @since 10
32061847f8eSopenharmony_ci     */
32161847f8eSopenharmony_ci    stopDiscovering(): void;
32261847f8eSopenharmony_ci
32361847f8eSopenharmony_ci    /**
32461847f8eSopenharmony_ci     * Bind the specified target.
32561847f8eSopenharmony_ci     *
32661847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
32761847f8eSopenharmony_ci     * @param { string } deviceId - id of device to bind.
32861847f8eSopenharmony_ci     * @param { object } bindParam - parameters of device to bind, The parameter type is map,such as:
32961847f8eSopenharmony_ci     *      "bindType" : 1,           - This value is type of bind, the values are as follows:
33061847f8eSopenharmony_ci     *                                  1 - The bind type is pin code .
33161847f8eSopenharmony_ci
33261847f8eSopenharmony_ci     *      "targetPkgName" : "xxxx", - The package name of binding target.
33361847f8eSopenharmony_ci     *      "appName" : "xxxx",       - The app name that try to bind the target.
33461847f8eSopenharmony_ci     *      "appOperation" : "xxxx"   - The reason why the app want to bind the target package.
33561847f8eSopenharmony_ci     *      "customDescription" : "xxxx" - The detail description of the operation.
33661847f8eSopenharmony_ci     * @param { AsyncCallback<{deviceId: string;}> } callback - indicates the callback to be invoked upon bindDevice.
33761847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
33861847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
33961847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
34061847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
34161847f8eSopenharmony_ci     *                                                  4. The size of specified deviceId is greater than 255.
34261847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
34361847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
34461847f8eSopenharmony_ci     * @throws { BusinessError } 11600103 - Authentication unavailable.
34561847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
34661847f8eSopenharmony_ci     * @since 10
34761847f8eSopenharmony_ci     */
34861847f8eSopenharmony_ci    bindTarget(deviceId: string, bindParam: { [key: string]: Object; }, callback: AsyncCallback<{deviceId: string;}>): void;
34961847f8eSopenharmony_ci
35061847f8eSopenharmony_ci    /**
35161847f8eSopenharmony_ci     * Unbind the specified target.
35261847f8eSopenharmony_ci     *
35361847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
35461847f8eSopenharmony_ci     * @param { string } deviceId - id of device to unbind
35561847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
35661847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
35761847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
35861847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
35961847f8eSopenharmony_ci     *                                                  4. The size of specified deviceId is greater than 255.
36061847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
36161847f8eSopenharmony_ci     * @throws { BusinessError } 11600101 - Failed to execute the function.
36261847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
36361847f8eSopenharmony_ci     * @since 10
36461847f8eSopenharmony_ci     */
36561847f8eSopenharmony_ci    unbindTarget(deviceId: string): void;
36661847f8eSopenharmony_ci
36761847f8eSopenharmony_ci    /**
36861847f8eSopenharmony_ci     * The reply of ui operation from pin-code window, this interface can only be used by pin-code-hap of devicemanager.
36961847f8eSopenharmony_ci     *
37061847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_SERVICE_DM
37161847f8eSopenharmony_ci     * @param { number } action - The reply action of user operation.
37261847f8eSopenharmony_ci     * @param { string } actionResult - Indicates the user operation result.
37361847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
37461847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
37561847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
37661847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
37761847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
37861847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
37961847f8eSopenharmony_ci     *                                                  4. The size of specified actionResult is greater than 255.
38061847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
38161847f8eSopenharmony_ci     * @systemapi this method can be used only by system applications.
38261847f8eSopenharmony_ci     * @since 10
38361847f8eSopenharmony_ci     */
38461847f8eSopenharmony_ci    replyUiAction(action: number, actionResult: string): void;
38561847f8eSopenharmony_ci
38661847f8eSopenharmony_ci    /**
38761847f8eSopenharmony_ci     * Register a device state callback so that the application can be notified upon device state changes based on
38861847f8eSopenharmony_ci     * the application bundle name.
38961847f8eSopenharmony_ci     *
39061847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
39161847f8eSopenharmony_ci     * @param { 'deviceStateChange' } type - Device state change.
39261847f8eSopenharmony_ci     * @param { Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }> } callback
39361847f8eSopenharmony_ci     * Indicates the device state callback to register.
39461847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
39561847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
39661847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
39761847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
39861847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
39961847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
40061847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
40161847f8eSopenharmony_ci     * @since 10
40261847f8eSopenharmony_ci     */
40361847f8eSopenharmony_ci    on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }>): void;
40461847f8eSopenharmony_ci
40561847f8eSopenharmony_ci    /**
40661847f8eSopenharmony_ci     * UnRegister device state callback based on the application bundle name.
40761847f8eSopenharmony_ci     *
40861847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
40961847f8eSopenharmony_ci     * @param { 'deviceStateChange' } type - Device state change.
41061847f8eSopenharmony_ci     * @param { Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }> } callback
41161847f8eSopenharmony_ci     * Indicates the device state callback to unregister.
41261847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
41361847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
41461847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
41561847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
41661847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
41761847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
41861847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
41961847f8eSopenharmony_ci     * @since 10
42061847f8eSopenharmony_ci     */
42161847f8eSopenharmony_ci    off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }>): void;
42261847f8eSopenharmony_ci
42361847f8eSopenharmony_ci    /**
42461847f8eSopenharmony_ci     * Register a device discovery result callback so that the application can be notified when discovery success.
42561847f8eSopenharmony_ci     *
42661847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
42761847f8eSopenharmony_ci     * @param { 'discoverSuccess' } type - Successfully discovered device.
42861847f8eSopenharmony_ci     * @param { Callback<{ device: DeviceBasicInfo; }> } callback - Indicates the device discovery callback to register.
42961847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
43061847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
43161847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
43261847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
43361847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
43461847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
43561847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
43661847f8eSopenharmony_ci     * @since 10
43761847f8eSopenharmony_ci     */
43861847f8eSopenharmony_ci    on(type: 'discoverSuccess', callback: Callback<{ device: DeviceBasicInfo; }>): void;
43961847f8eSopenharmony_ci
44061847f8eSopenharmony_ci    /**
44161847f8eSopenharmony_ci     * UnRegister the device discovery result callback.
44261847f8eSopenharmony_ci     *
44361847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
44461847f8eSopenharmony_ci     * @param { 'discoverSuccess' } type - Successfully discovered device.
44561847f8eSopenharmony_ci     * @param { Callback<{ device: DeviceBasicInfo; }> } callback - Indicates the device discovery callback to unregister.
44661847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
44761847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
44861847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
44961847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
45061847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
45161847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
45261847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
45361847f8eSopenharmony_ci     * @since 10
45461847f8eSopenharmony_ci     */
45561847f8eSopenharmony_ci    off(type: 'discoverSuccess', callback?: Callback<{ device: DeviceBasicInfo; }>): void;
45661847f8eSopenharmony_ci
45761847f8eSopenharmony_ci    /**
45861847f8eSopenharmony_ci     * Register a device name change callback so that the application can be notified when discovery success.
45961847f8eSopenharmony_ci     *
46061847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
46161847f8eSopenharmony_ci     * @param { 'deviceNameChange' } type - Changed device name.
46261847f8eSopenharmony_ci     * @param { Callback<{ deviceName: string; }> } callback - Indicates the device name change callback to register.
46361847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
46461847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
46561847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
46661847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
46761847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
46861847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
46961847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
47061847f8eSopenharmony_ci     * @since 10
47161847f8eSopenharmony_ci     */
47261847f8eSopenharmony_ci    on(type: 'deviceNameChange', callback: Callback<{ deviceName: string; }>): void;
47361847f8eSopenharmony_ci
47461847f8eSopenharmony_ci    /**
47561847f8eSopenharmony_ci     * UnRegister the device name change result callback.
47661847f8eSopenharmony_ci     *
47761847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
47861847f8eSopenharmony_ci     * @param { 'deviceNameChange' } type - Changed device name.
47961847f8eSopenharmony_ci     * @param { Callback<{ deviceName: string; }> } callback - Indicates the device name change callback to unregister.
48061847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
48161847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
48261847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
48361847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
48461847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
48561847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
48661847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
48761847f8eSopenharmony_ci     * @since 10
48861847f8eSopenharmony_ci     */
48961847f8eSopenharmony_ci    off(type: 'deviceNameChange', callback?: Callback<{ deviceName: string; }>): void;
49061847f8eSopenharmony_ci
49161847f8eSopenharmony_ci    /**
49261847f8eSopenharmony_ci     * Register a device discovery result callback so that the application can be notified when discover failed.
49361847f8eSopenharmony_ci     *
49461847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
49561847f8eSopenharmony_ci     * @param { 'discoverFailure' } type - Discovery Device Failure.
49661847f8eSopenharmony_ci     * @param { Callback<{ reason: number; }> } callback
49761847f8eSopenharmony_ci     * Indicates the device found result callback to register.
49861847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
49961847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
50061847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
50161847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
50261847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
50361847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
50461847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
50561847f8eSopenharmony_ci     * @since 10
50661847f8eSopenharmony_ci     */
50761847f8eSopenharmony_ci    on(type: 'discoverFailure', callback: Callback<{ reason: number; }>): void;
50861847f8eSopenharmony_ci
50961847f8eSopenharmony_ci    /**
51061847f8eSopenharmony_ci     * UnRegister the device discovery result callback.
51161847f8eSopenharmony_ci     *
51261847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
51361847f8eSopenharmony_ci     * @param { 'discoverFailure' } type - Discovery Device Failure.
51461847f8eSopenharmony_ci     * @param { Callback<{ reason: number; }> } callback
51561847f8eSopenharmony_ci     * Indicates the device found result callback to unregister.
51661847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
51761847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
51861847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
51961847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
52061847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
52161847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
52261847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
52361847f8eSopenharmony_ci     * @since 10
52461847f8eSopenharmony_ci     */
52561847f8eSopenharmony_ci    off(type: 'discoverFailure', callback?: Callback<{ reason: number; }>): void;
52661847f8eSopenharmony_ci
52761847f8eSopenharmony_ci    /**
52861847f8eSopenharmony_ci     * Register a serviceError callback so that the application can be notified when devicemanager service died
52961847f8eSopenharmony_ci     *
53061847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
53161847f8eSopenharmony_ci     * @param { 'serviceDie' } type - Service death.
53261847f8eSopenharmony_ci     * @param { Callback<{}> } callback - Indicates the service error callback to register.
53361847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
53461847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
53561847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
53661847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
53761847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
53861847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
53961847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
54061847f8eSopenharmony_ci     * @since 10
54161847f8eSopenharmony_ci     */
54261847f8eSopenharmony_ci    on(type: 'serviceDie', callback?: Callback<{}>): void;
54361847f8eSopenharmony_ci
54461847f8eSopenharmony_ci    /**
54561847f8eSopenharmony_ci     * UnRegister the service error callback.
54661847f8eSopenharmony_ci     *
54761847f8eSopenharmony_ci     * @permission ohos.permission.DISTRIBUTED_DATASYNC
54861847f8eSopenharmony_ci     * @param { 'serviceDie' } type - Service death.
54961847f8eSopenharmony_ci     * @param { Callback<{}> } callback - Indicates the service error callback to unregister.
55061847f8eSopenharmony_ci     * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
55161847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
55261847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
55361847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
55461847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
55561847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
55661847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
55761847f8eSopenharmony_ci     * @since 10
55861847f8eSopenharmony_ci     */
55961847f8eSopenharmony_ci    off(type: 'serviceDie', callback?: Callback<{}>): void;
56061847f8eSopenharmony_ci
56161847f8eSopenharmony_ci    /**
56261847f8eSopenharmony_ci     * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges.
56361847f8eSopenharmony_ci     *
56461847f8eSopenharmony_ci     * @permission ohos.permission.ACCESS_SERVICE_DM
56561847f8eSopenharmony_ci     * @param { 'replyResult' } type - Ui reply result to register.
56661847f8eSopenharmony_ci     * @param { Callback<{ param: string; }> } callback - Indicates the devicemanager ui state to register.
56761847f8eSopenharmony_ci     * @throws { BusinessError } 401 - Parameter error. Possible causes:
56861847f8eSopenharmony_ci     *                                                  1. Mandatory parameters are left unspecified;
56961847f8eSopenharmony_ci     *                                                  2. Incorrect parameter type;
57061847f8eSopenharmony_ci     *                                                  3. Parameter verification failed;
57161847f8eSopenharmony_ci     *                                                  4. The size of specified type is greater than 255.
57261847f8eSopenharmony_ci     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
57361847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedHardware.DeviceManager
57461847f8eSopenharmony_ci     * @systemapi this method can be used only by system applications.
57561847f8eSopenharmony_ci     * @since 10
57661847f8eSopenharmony_ci     */
57761847f8eSopenharmony_ci    on(type: 'replyResult', callback: Callback<{ param: string; }>): void;
57861847f8eSopenharmony_ci
57961847f8eSopenharmony_ci    /**
58061847f8eSopenharmony_ci      * Unregister uiStateChange, this interface can only be used by devicemanager ui.
58161847f8eSopenharmony_ci      *
58261847f8eSopenharmony_ci      * @permission ohos.permission.ACCESS_SERVICE_DM
58361847f8eSopenharmony_ci      * @param { 'replyResult' } type - Ui reply result to unregister.
58461847f8eSopenharmony_ci      * @param { Callback<{ param: string; }> } callback - Indicates the devicemanager ui state to unregister.
58561847f8eSopenharmony_ci      * @throws { BusinessError } 401 - Parameter error. Possible causes:
58661847f8eSopenharmony_ci      *                                                  1. Mandatory parameters are left unspecified;
58761847f8eSopenharmony_ci      *                                                  2. Incorrect parameter type;
58861847f8eSopenharmony_ci      *                                                  3. Parameter verification failed;
58961847f8eSopenharmony_ci      *                                                  4. The size of specified type is greater than 255.
59061847f8eSopenharmony_ci      * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
59161847f8eSopenharmony_ci      * @syscap SystemCapability.DistributedHardware.DeviceManager
59261847f8eSopenharmony_ci      * @systemapi this method can be used only by system applications.
59361847f8eSopenharmony_ci      * @since 10
59461847f8eSopenharmony_ci      */
59561847f8eSopenharmony_ci    off(type: 'replyResult', callback?: Callback<{ param: string; }>): void;
59661847f8eSopenharmony_ci  }
59761847f8eSopenharmony_ci}
59861847f8eSopenharmony_ci
59961847f8eSopenharmony_ciexport default distributedDeviceManager;