From 64071a157c80c1be5344adae9850b12e34e6f043 Mon Sep 17 00:00:00 2001 From: BrainL Date: Wed, 4 Jun 2025 17:05:14 +0800 Subject: [PATCH 1/7] dm add interface & lable Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ets | 646 ----------------------- api/@ohos.distributedDeviceManager.d.ts | 322 ++++++++++- 2 files changed, 303 insertions(+), 665 deletions(-) delete mode 100644 api/@ohos.distributedDeviceManager.d.ets diff --git a/api/@ohos.distributedDeviceManager.d.ets b/api/@ohos.distributedDeviceManager.d.ets deleted file mode 100644 index 1912263af9..0000000000 --- a/api/@ohos.distributedDeviceManager.d.ets +++ /dev/null @@ -1,646 +0,0 @@ -/* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * @kit DistributedServiceKit - */ - -import type { AsyncCallback, Callback } from './@ohos.base'; - -/** - * Providers interfaces to create a {@link deviceManager} instances. - * - * @namespace distributedDeviceManager - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - -declare namespace distributedDeviceManager { - - /** - * Basic description information of a distributed device. - * @interface DeviceBasicInfo - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - export interface DeviceBasicInfo { - /** - * Device identifier. The actual value is udid-hash confused with appid and salt value based on sha256. - * This id remains unchanged after application installation. If the application is uninstalled and reinstalled, - * the obtained ID will change. - * @type { string } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - deviceId: string; - - /** - * Device name. - * @type { string } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - deviceName: string; - - /** - * Obtains the device type represented by a string, - * which can be {@code phone}, {@code tablet}, {@code tv}, {@code smartVision}, {@code car}. - * @type { string } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - deviceType: string; - - /** - * Device network id. - * @type { ?string } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - networkId?: string; - } - - /** - * The state of the nearby devices. - * @enum { number } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - export enum DeviceStateChange { - /** - * This state indicates the device is online but the state is unknown,The distributed function cannot used until - * state changes to AVAILABLE. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - UNKNOWN = 0, - - /** - * This state indicates the device has been synchronized to the database, Now the distributed function can be used. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - AVAILABLE = 1, - - /** - * This state indicates the device is offline. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - UNAVAILABLE = 2, - } - - /** - * Creates an {@code DeviceManager} instance. - * - * To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then - * use this instance to call other device management methods. - * - * @param { string } bundleName - Indicates the bundle name of the application. - * @returns { DeviceManager } - Return the DeviceManager object. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - export function createDeviceManager(bundleName: string): DeviceManager; - - /** - * Releases the {@code DeviceManager} instance that is no longer used. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { DeviceManager } deviceManager - Indicates the {@code DeviceManager} instance. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; - * 3. Parameter verification failed. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - export function releaseDeviceManager(deviceManager: DeviceManager): void; - - interface DeviceResult { - deviceId: string; - } - - interface DeviceResultNumber { - reason: number; - } - - type DeviceResultCallback = AsyncCallback; - -// 定义接口 -interface DeviceStateChangeData { - action: DeviceStateChange; - device: DeviceBasicInfo; -} - -interface DeviceStateChangeAction { - device: DeviceBasicInfo; -} - -// 提取类型 -type DeviceStateChangeCallback = Callback; - -type DeviceStateChangeCallbackAction = Callback; - -type DeviceStateString = Callback; -type DeviceStateNumber = Callback; - -interface ServiceDieData {} -type ServiceDieCallback = Callback; - /** - * Provides methods for managing devices. - * - * @interface DeviceManager - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - export interface DeviceManager { - - /** - * Get a list of available devices. This interface query all authorized and connectable devices. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @returns { Array } - Returns a list of available devices. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; - * 3. Parameter verification failed. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getAvailableDeviceListSync(): Array; - - /** - * Get a list of available devices. This interface query all authorized and connectable devices. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { AsyncCallback> } callback - Indicates the callback to be - * invoked upon getAvailableDeviceList. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getAvailableDeviceList(callback: AsyncCallback>): void; - - /** - * Get a list of available devices. This interface query all authorized and connectable devices. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @returns { Promise> } - Returns a list of available devices. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getAvailableDeviceList(): Promise>; - - /** - * Get the network id of the local device. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @returns { string } - Returns local device network id. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getLocalDeviceNetworkId(): string; - - /** - * Get the device name of the local device. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @returns { string } - Returns local device name. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getLocalDeviceName(): string; - - /** - * Get the device type of the local device. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @returns { number } - Returns local device type. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getLocalDeviceType(): number; - - /** - * Get the device id of the local device. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @returns { string } - Device identifier. The actual value is udid-hash confused with appid and salt value based on sha256. - * This id remains unchanged after application installation. If the application is uninstalled and reinstalled, - * the obtained ID will change. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getLocalDeviceId(): string; - - /** - * Get the device name by network id. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { string } networkId - Device network id. - * @returns { string } - Returns device name. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified networkId is greater than 255. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getDeviceName(networkId: string): string; - - /** - * Get the device type by network id. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { string } networkId - Device network id. - * @returns { double } - Returns device type. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified networkId is greater than 255. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - getDeviceType(networkId: string): double; - - /** - * Start to discover nearby devices. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { object } discoverParam - Identifies the type of target discovered: - * discoverTargetType : 1 - Discovery target as a device by default, the value is 1. - * @param { object } filterOptions - FilterOptions to filter discovery device. - * The type of filterOptions is map. The map are as follows: - * availableStatus: 0-1 - Discover devices only are credible, The value is 0 indicates device isn't credible; - * 0: Devices are offline, client need to bind the device by calling bindTarget() and then connect to it. - * 1: Devices already online, client can make connection. - * discoverDistance: 0-100 - Discover devices within a certain distance from the local, the unit is cm. - * authenticationStatus: 0-1 - Discover devices based on different authentication status: - * 0: Devices not authenticated. - 1: Devices already authenticated. - * The value is 1 indicates device is trust. - * authorizationType: 0-2 - Discover devices based on different authorization type: - * 0: Devices authenticated based on temporary negotiated session key. - * 1: Devices authenticated based on the same account credential key. - * 2: Devices authenticated based on different account credential keys. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 11600104 - Discovery unavailable. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - startDiscovering(discoverParam: Record, filterOptions?: Record): void; - - /** - * Stop discovering nearby devices. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 11600104 - Discovery unavailable. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - stopDiscovering(): void; - - /** - * Bind the specified target. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { string } deviceId - id of device to bind. - * @param { object } bindParam - parameters of device to bind, The parameter type is map,such as: - * "bindType" : 1, - This value is type of bind, the values are as follows: - * 1 - The bind type is pin code . - - * "targetPkgName" : "xxxx", - The package name of binding target. - * "appName" : "xxxx", - The app name that try to bind the target. - * "appOperation" : "xxxx" - The reason why the app want to bind the target package. - * "customDescription" : "xxxx" - The detail description of the operation. - * @param { AsyncCallback<{deviceId: string;}> } callback - indicates the callback to be invoked upon bindDevice. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified deviceId is greater than 255. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @throws { BusinessError } 11600103 - Authentication unavailable. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - bindTarget(deviceId: string, bindParam: Record, callback: DeviceResultCallback): void; - - /** - * Unbind the specified target. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { string } deviceId - id of device to unbind - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified deviceId is greater than 255. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 11600101 - Failed to execute the function. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - unbindTarget(deviceId: string): void; - - /** - * The reply of ui operation from pin-code window, this interface can only be used by pin-code-hap of devicemanager. - * - * @permission ohos.permission.ACCESS_SERVICE_DM - * @param { number } action - The reply action of user operation. - * @param { string } actionResult - Indicates the user operation result. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified actionResult is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @systemapi this method can be used only by system applications. - * @since 10 - */ - replyUiAction(action: number, actionResult: string): void; - - /** - * Register a device state callback so that the application can be notified upon device state changes based on - * the application bundle name. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'deviceStateChange' } type - Device state change. - * @param { Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }> } callback - * Indicates the device state callback to register. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - on(type: 'deviceStateChange', callback: DeviceStateChangeCallback): void; - - /** - * UnRegister device state callback based on the application bundle name. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'deviceStateChange' } type - Device state change. - * @param { Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }> } callback - * Indicates the device state callback to unregister. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - off(type: 'deviceStateChange', callback?: DeviceStateChangeCallback): void; - - /** - * Register a device discovery result callback so that the application can be notified when discovery success. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'discoverSuccess' } type - Successfully discovered device. - * @param { Callback<{ device: DeviceBasicInfo; }> } callback - Indicates the device discovery callback to register. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - on(type: 'discoverSuccess', callback: DeviceStateChangeCallbackAction): void; - - /** - * UnRegister the device discovery result callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'discoverSuccess' } type - Successfully discovered device. - * @param { Callback<{ device: DeviceBasicInfo; }> } callback - Indicates the device discovery callback to unregister. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - off(type: 'discoverSuccess', callback?: DeviceStateChangeCallbackAction): void; - - /** - * Register a device name change callback so that the application can be notified when discovery success. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'deviceNameChange' } type - Changed device name. - * @param { Callback<{ deviceName: string; }> } callback - Indicates the device name change callback to register. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - on(type: 'deviceNameChange', callback: DeviceStateString): void; - - /** - * UnRegister the device name change result callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'deviceNameChange' } type - Changed device name. - * @param { Callback<{ deviceName: string; }> } callback - Indicates the device name change callback to unregister. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - off(type: 'deviceNameChange', callback?: DeviceStateString): void; - - /** - * Register a device discovery result callback so that the application can be notified when discover failed. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'discoverFailure' } type - Discovery Device Failure. - * @param { Callback<{ reason: number; }> } callback - * Indicates the device found result callback to register. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - on(type: 'discoverFailure', callback: DeviceStateNumber): void; - - /** - * UnRegister the device discovery result callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'discoverFailure' } type - Discovery Device Failure. - * @param { Callback<{ reason: number; }> } callback - * Indicates the device found result callback to unregister. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - off(type: 'discoverFailure', callback?: DeviceStateNumber): void; - - /** - * Register a serviceError callback so that the application can be notified when devicemanager service died - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'serviceDie' } type - Service death. - * @param { Callback<{}> } callback - Indicates the service error callback to register. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - on(type: 'serviceDie', callback?: ServiceDieCallback): void; - - /** - * UnRegister the service error callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'serviceDie' } type - Service death. - * @param { Callback<{}> } callback - Indicates the service error callback to unregister. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission - * required to call the API. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 - */ - off(type: 'serviceDie', callback?: ServiceDieCallback): void; - - /** - * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges. - * - * @permission ohos.permission.ACCESS_SERVICE_DM - * @param { 'replyResult' } type - Ui reply result to register. - * @param { Callback<{ param: string; }> } callback - Indicates the devicemanager ui state to register. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @systemapi this method can be used only by system applications. - * @since 10 - */ - on(type: 'replyResult', callback: DeviceStateString): void; - - /** - * Unregister uiStateChange, this interface can only be used by devicemanager ui. - * - * @permission ohos.permission.ACCESS_SERVICE_DM - * @param { 'replyResult' } type - Ui reply result to unregister. - * @param { Callback<{ param: string; }> } callback - Indicates the devicemanager ui state to unregister. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter type; - * 3. Parameter verification failed; - * 4. The size of specified type is greater than 255. - * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @systemapi this method can be used only by system applications. - * @since 10 - */ - off(type: 'replyResult', callback?: DeviceStateString): void; - } -} - -export default distributedDeviceManager; \ No newline at end of file diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 54dc1a290a..bc6c39228b 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -25,7 +25,8 @@ import type { AsyncCallback, Callback } from './@ohos.base'; * * @namespace distributedDeviceManager * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace distributedDeviceManager { @@ -34,7 +35,8 @@ declare namespace distributedDeviceManager { * Basic description information of a distributed device. * @interface DeviceBasicInfo * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface DeviceBasicInfo { /** @@ -43,7 +45,8 @@ declare namespace distributedDeviceManager { * the obtained ID will change. * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceId: string; @@ -51,7 +54,8 @@ declare namespace distributedDeviceManager { * Device name. * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceName: string; @@ -60,7 +64,8 @@ declare namespace distributedDeviceManager { * which can be {@code phone}, {@code tablet}, {@code tv}, {@code smartVision}, {@code car}. * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceType: string; @@ -68,7 +73,8 @@ declare namespace distributedDeviceManager { * Device network id. * @type { ?string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ networkId?: string; @@ -76,7 +82,8 @@ declare namespace distributedDeviceManager { * Device extra data. * @type { ?string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ extraData?: string; } @@ -142,7 +149,8 @@ declare namespace distributedDeviceManager { * @interface ServiceProfileInfo * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since 15 + * @since arkts {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 */ interface ServiceProfileInfo { /** @@ -150,7 +158,8 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since 15 + * @since arkts {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceId: string; @@ -187,7 +196,8 @@ declare namespace distributedDeviceManager { * @interface DeviceProfileInfo * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since 15 + * @since arkts {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 */ interface DeviceProfileInfo { /** @@ -195,7 +205,8 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since 15 + * @since arkts {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceId: string; @@ -231,7 +242,8 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since 15 + * @since arkts {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceType: string; @@ -249,7 +261,8 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since 15 + * @since arkts {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceName: string; @@ -624,7 +637,8 @@ declare namespace distributedDeviceManager { * 2. Incorrect parameter type; * 3. Parameter verification failed. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function createDeviceManager(bundleName: string): DeviceManager; @@ -642,6 +656,108 @@ declare namespace distributedDeviceManager { */ function releaseDeviceManager(deviceManager: DeviceManager): void; + /* + * On and off deviceNameChange and replyResult callback param. + * + * @interface DeviceResult + * @since 20 + * @arkts 1.2 + */ + interface DeviceResult { + deviceId: string; + } + + /* + * On and off discoverFailure callback param. + * + * @interface DeviceResultNumber + * @since 20 + * @arkts 1.2 + */ + interface DeviceResultNumber { + reason: number; + } + + /* + * On and off deviceStateChange callback param. + * + * @interface DeviceStateChangeData + * @since 20 + * @arkts 1.2 + */ + interface DeviceStateChangeData { + action: DeviceStateChange; + device: DeviceBasicInfo; + } + + /* + * On and off discoverSuccess callback param. + * + * @interface DeviceStateChangeAction + * @since 20 + * @arkts 1.2 + */ + interface DeviceStateChangeAction { + device: DeviceBasicInfo; + } + + /* + * On and off serviceDie callback param. + * + * @interface ServiceDieData + * @since 20 + * @arkts 1.2 + */ + interface ServiceDieData {} + + /* + * On and off deviceStateChange callback. + * + * @since 20 + * @arkts 1.2 + */ + type DeviceStateChangeCallback = Callback; + + /* + * On and off discoverSuccess callback. + * + * @since 20 + * @arkts 1.2 + */ + type DeviceStateChangeCallbackAction = Callback; + + /* + * On and off deviceNameChange callback. + * + * @since 20 + * @arkts 1.2 + */ + type DeviceStateString = Callback; + + /* + * On and off discoverFailure callback. + * + * @since 20 + * @arkts 1.2 + */ + type DeviceStateNumber = Callback; + + /* + * On and off serviceDie callback. + * + * @since 20 + * @arkts 1.2 + */ + type ServiceDieCallback = Callback; + + /* + * On and off replyResult callback. + * + * @since 20 + * @arkts 1.2 + */ + type DeviceResultCallback = AsyncCallback; + /** * Provides methods for managing devices. * @@ -696,7 +812,8 @@ declare namespace distributedDeviceManager { * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 11600101 - Failed to execute the function. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ getLocalDeviceNetworkId(): string; @@ -734,7 +851,8 @@ declare namespace distributedDeviceManager { * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 11600101 - Failed to execute the function. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ getLocalDeviceId(): string; @@ -752,7 +870,8 @@ declare namespace distributedDeviceManager { * 4. The size of specified networkId is greater than 255. * @throws { BusinessError } 11600101 - Failed to execute the function. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ getDeviceName(networkId: string): string; @@ -770,7 +889,8 @@ declare namespace distributedDeviceManager { * 4. The size of specified networkId is greater than 255. * @throws { BusinessError } 11600101 - Failed to execute the function. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ getDeviceType(networkId: string): number; @@ -857,7 +977,8 @@ declare namespace distributedDeviceManager { * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 11600101 - Failed to execute the function. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ unbindTarget(deviceId: string): void; @@ -899,6 +1020,21 @@ declare namespace distributedDeviceManager { */ on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }>): void; + /** + * Register a device state callback so that the application can be notified upon device state changes based on + * the application bundle name. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceStateChange' } type - Device state change. + * @param { DeviceStateChangeCallback } callback + * Indicates the device state callback to register. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + on(type: 'deviceStateChange', callback: DeviceStateChangeCallback): void; + /** * UnRegister device state callback based on the application bundle name. * @@ -917,6 +1053,20 @@ declare namespace distributedDeviceManager { */ off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }>): void; + /** + * UnRegister device state callback based on the application bundle name. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceStateChange' } type - Device state change. + * @param { DeviceStateChangeCallback } callback + * Indicates the device state callback to unregister. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + off(type: 'deviceStateChange', callback?: DeviceStateChangeCallback): void; + /** * Register a device discovery result callback so that the application can be notified when discovery success. * @@ -934,6 +1084,19 @@ declare namespace distributedDeviceManager { */ on(type: 'discoverSuccess', callback: Callback<{ device: DeviceBasicInfo; }>): void; + /** + * Register a device discovery result callback so that the application can be notified when discovery success. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverSuccess' } type - Successfully discovered device. + * @param { DeviceStateChangeCallbackAction } callback - Indicates the device discovery callback to register. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + on(type: 'discoverSuccess', callback: DeviceStateChangeCallbackAction): void; + /** * UnRegister the device discovery result callback. * @@ -951,6 +1114,19 @@ declare namespace distributedDeviceManager { */ off(type: 'discoverSuccess', callback?: Callback<{ device: DeviceBasicInfo; }>): void; + /** + * UnRegister the device discovery result callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverSuccess' } type - Successfully discovered device. + * @param { DeviceStateChangeCallbackAction } callback - Indicates the device discovery callback to unregister. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + off(type: 'discoverSuccess', callback?: DeviceStateChangeCallbackAction): void; + /** * Register a device name change callback so that the application can be notified when discovery success. * @@ -968,6 +1144,19 @@ declare namespace distributedDeviceManager { */ on(type: 'deviceNameChange', callback: Callback<{ deviceName: string; }>): void; + /** + * Register a device name change callback so that the application can be notified when discovery success. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceNameChange' } type - Changed device name. + * @param { DeviceStateString } callback - Indicates the device name change callback to register. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + on(type: 'deviceNameChange', callback: DeviceStateString): void; + /** * UnRegister the device name change result callback. * @@ -985,6 +1174,19 @@ declare namespace distributedDeviceManager { */ off(type: 'deviceNameChange', callback?: Callback<{ deviceName: string; }>): void; + /** + * UnRegister the device name change result callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceNameChange' } type - Changed device name. + * @param { DeviceStateString } callback - Indicates the device name change callback to unregister. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + off(type: 'deviceNameChange', callback?: DeviceStateString): void; + /** * Register a device discovery result callback so that the application can be notified when discover failed. * @@ -1003,6 +1205,20 @@ declare namespace distributedDeviceManager { */ on(type: 'discoverFailure', callback: Callback<{ reason: number; }>): void; + /** + * Register a device discovery result callback so that the application can be notified when discover failed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverFailure' } type - Discovery Device Failure. + * @param { DeviceStateNumber } callback + * Indicates the device found result callback to register. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + on(type: 'discoverFailure', callback: DeviceStateNumber): void; + /** * UnRegister the device discovery result callback. * @@ -1021,6 +1237,20 @@ declare namespace distributedDeviceManager { */ off(type: 'discoverFailure', callback?: Callback<{ reason: number; }>): void; + /** + * UnRegister the device discovery result callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverFailure' } type - Discovery Device Failure. + * @param { DeviceStateNumber } callback + * Indicates the device found result callback to unregister. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + off(type: 'discoverFailure', callback?: DeviceStateNumber): void; + /** * Register a serviceError callback so that the application can be notified when devicemanager service died * @@ -1038,6 +1268,19 @@ declare namespace distributedDeviceManager { */ on(type: 'serviceDie', callback?: Callback<{}>): void; + /** + * Register a serviceError callback so that the application can be notified when devicemanager service died + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'serviceDie' } type - Service death. + * @param { ServiceDieCallback } callback - Indicates the service error callback to register. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + on(type: 'serviceDie', callback?: ServiceDieCallback): void; + /** * UnRegister the service error callback. * @@ -1055,6 +1298,19 @@ declare namespace distributedDeviceManager { */ off(type: 'serviceDie', callback?: Callback<{}>): void; + /** + * UnRegister the service error callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'serviceDie' } type - Service death. + * @param { ServiceDieCallback } callback - Indicates the service error callback to unregister. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ + off(type: 'serviceDie', callback?: ServiceDieCallback): void; + /** * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges. * @@ -1073,6 +1329,20 @@ declare namespace distributedDeviceManager { */ on(type: 'replyResult', callback: Callback<{ param: string; }>): void; + /** + * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges. + * + * @permission ohos.permission.ACCESS_SERVICE_DM + * @param { 'replyResult' } type - Ui reply result to register. + * @param { DeviceStateString } callback - Indicates the devicemanager ui state to register. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @systemapi this method can be used only by system applications. + * @since 20 + * @arkts 1.2 + */ + on(type: 'replyResult', callback: DeviceStateString): void; + /** * Unregister uiStateChange, this interface can only be used by devicemanager ui. * @@ -1091,6 +1361,20 @@ declare namespace distributedDeviceManager { */ off(type: 'replyResult', callback?: Callback<{ param: string; }>): void; + /** + * Unregister uiStateChange, this interface can only be used by devicemanager ui. + * + * @permission ohos.permission.ACCESS_SERVICE_DM + * @param { 'replyResult' } type - Ui reply result to unregister. + * @param { DeviceStateString } callback - Indicates the devicemanager ui state to unregister. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @systemapi this method can be used only by system applications. + * @since 20 + * @arkts 1.2 + */ + off(type: 'replyResult', callback?: DeviceStateString): void; + /** * Get the device list under the same account. * -- Gitee From f0cd929cbe65db380c8e928d87605c6ccee07fb3 Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 5 Jun 2025 19:17:15 +0800 Subject: [PATCH 2/7] code check Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 83 ++++++++++++++++++------- 1 file changed, 59 insertions(+), 24 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index bc6c39228b..5793e62926 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -656,103 +656,138 @@ declare namespace distributedDeviceManager { */ function releaseDeviceManager(deviceManager: DeviceManager): void; - /* + /** * On and off deviceNameChange and replyResult callback param. - * * @interface DeviceResult + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ interface DeviceResult { + /** + * Get deviceNameChange and replyResult device id. + * @type { string } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ deviceId: string; } - /* + /** * On and off discoverFailure callback param. - * * @interface DeviceResultNumber + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ interface DeviceResultNumber { + /** + * Get discoverFailure by reason number. + * @type { number } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ reason: number; } - /* + /** * On and off deviceStateChange callback param. - * * @interface DeviceStateChangeData + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ interface DeviceStateChangeData { + /** + * Get deviceStateChange by DeviceStateChange enum. + * @type { DeviceStateChange } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ action: DeviceStateChange; + /** + * Get deviceStateChange by device info. + * @type { DeviceBasicInfo } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ device: DeviceBasicInfo; } - /* + /** * On and off discoverSuccess callback param. - * * @interface DeviceStateChangeAction + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ interface DeviceStateChangeAction { + /** + * Get discoverSuccess by device info. + * @type { DeviceBasicInfo } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 20 + * @arkts 1.2 + */ device: DeviceBasicInfo; } - /* + /** * On and off serviceDie callback param. - * * @interface ServiceDieData + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ interface ServiceDieData {} - /* + /** * On and off deviceStateChange callback. - * + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ type DeviceStateChangeCallback = Callback; - /* + /** * On and off discoverSuccess callback. - * + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ type DeviceStateChangeCallbackAction = Callback; - /* + /** * On and off deviceNameChange callback. - * + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ type DeviceStateString = Callback; - /* + /** * On and off discoverFailure callback. - * + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ type DeviceStateNumber = Callback; - /* + /** * On and off serviceDie callback. - * + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ type ServiceDieCallback = Callback; - /* + /** * On and off replyResult callback. - * + * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 */ @@ -1335,7 +1370,7 @@ declare namespace distributedDeviceManager { * @permission ohos.permission.ACCESS_SERVICE_DM * @param { 'replyResult' } type - Ui reply result to register. * @param { DeviceStateString } callback - Indicates the devicemanager ui state to register. - * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 201 - Permission verification failed. A non-system application calls a system API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 20 @@ -1367,7 +1402,7 @@ declare namespace distributedDeviceManager { * @permission ohos.permission.ACCESS_SERVICE_DM * @param { 'replyResult' } type - Ui reply result to unregister. * @param { DeviceStateString } callback - Indicates the devicemanager ui state to unregister. - * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 201 - Permission verification failed. A non-system application calls a system API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 20 -- Gitee From 3a25cafa6871a67c3b2cf60414e3f515a93a32cc Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 12 Jun 2025 19:37:53 +0800 Subject: [PATCH 3/7] type defines description modify Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 5793e62926..9dc858ba3e 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -746,7 +746,9 @@ declare namespace distributedDeviceManager { interface ServiceDieData {} /** - * On and off deviceStateChange callback. + * Defines the DeviceStateChangeCallback. + * + * @typedef { Callback } DeviceStateChangeCallback * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 @@ -754,7 +756,9 @@ declare namespace distributedDeviceManager { type DeviceStateChangeCallback = Callback; /** - * On and off discoverSuccess callback. + * Defines the DeviceStateChangeCallbackAction. + * + * @typedef { Callback } DeviceStateChangeCallbackAction * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 @@ -762,7 +766,9 @@ declare namespace distributedDeviceManager { type DeviceStateChangeCallbackAction = Callback; /** - * On and off deviceNameChange callback. + * Defines the DeviceStateString. + * + * @typedef { Callback } DeviceStateString * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 @@ -770,7 +776,9 @@ declare namespace distributedDeviceManager { type DeviceStateString = Callback; /** - * On and off discoverFailure callback. + * Defines the DeviceStateNumber. + * + * @typedef { Callback } DeviceStateNumber * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 @@ -778,7 +786,9 @@ declare namespace distributedDeviceManager { type DeviceStateNumber = Callback; /** - * On and off serviceDie callback. + * Defines the ServiceDieCallback. + * + * @typedef { Callback } ServiceDieCallback * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 @@ -786,7 +796,9 @@ declare namespace distributedDeviceManager { type ServiceDieCallback = Callback; /** - * On and off replyResult callback. + * Defines the DeviceResultCallback. + * + * @typedef { AsyncCallback } DeviceResultCallback * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 * @arkts 1.2 -- Gitee From b6f10417aa6be01fa3c6d87dc20cee418a6e4cb1 Mon Sep 17 00:00:00 2001 From: BrainL Date: Thu, 19 Jun 2025 11:39:03 +0800 Subject: [PATCH 4/7] interface description modify Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 9dc858ba3e..1de2226f20 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -82,8 +82,7 @@ declare namespace distributedDeviceManager { * Device extra data. * @type { ?string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ extraData?: string; } @@ -747,7 +746,7 @@ declare namespace distributedDeviceManager { /** * Defines the DeviceStateChangeCallback. - * + * * @typedef { Callback } DeviceStateChangeCallback * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -757,7 +756,7 @@ declare namespace distributedDeviceManager { /** * Defines the DeviceStateChangeCallbackAction. - * + * * @typedef { Callback } DeviceStateChangeCallbackAction * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -767,7 +766,7 @@ declare namespace distributedDeviceManager { /** * Defines the DeviceStateString. - * + * * @typedef { Callback } DeviceStateString * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -777,7 +776,7 @@ declare namespace distributedDeviceManager { /** * Defines the DeviceStateNumber. - * + * * @typedef { Callback } DeviceStateNumber * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -787,7 +786,7 @@ declare namespace distributedDeviceManager { /** * Defines the ServiceDieCallback. - * + * * @typedef { Callback } ServiceDieCallback * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -797,7 +796,7 @@ declare namespace distributedDeviceManager { /** * Defines the DeviceResultCallback. - * + * * @typedef { AsyncCallback } DeviceResultCallback * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -1451,7 +1450,7 @@ declare namespace distributedDeviceManager { * Put the device list under the same account. * * @permission ohos.permission.ACCESS_SERVICE_DM - * @param { Array } deviceProfileInfoList - parameter for querying the device list for put, + * @param { Array } deviceProfileInfoList - parameter for querying the device list for put, * @returns { Promise } - Returns operation result. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Mandatory parameters are left unspecified; @@ -1496,7 +1495,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.ACCESS_SERVICE_DM * @param { number } maxNameLength - the max number of bytes of the local device display name - * + * * @returns { Promise } - Returns device display name. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1. Mandatory parameters are left unspecified; @@ -1587,14 +1586,14 @@ declare namespace distributedDeviceManager { * Get the device network id list by conditions. * * @permission ohos.permission.ACCESS_SERVICE_DM - * @param { NetworkIdQueryFilter } filterOptions - parameter for querying the device network id list, + * @param { NetworkIdQueryFilter } filterOptions - parameter for querying the device network id list, * The parameter type is map, such as: * "wiseDeviceId" : xx-xxxxx - Get device network id list by wiseDevice id. * "onlineStatus" : 1, - Get device network id list by online status. * 0 - indicates that the device is offline. * 1 - indicates that the device is online. * @returns { Promise> } - Returns a list of device network id. - * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission * required to call the API. * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. * @throws { BusinessError } 401 - Parameter error. Possible causes: -- Gitee From 6a52303428633daf79e0ad2ffe6e2908c92cd072 Mon Sep 17 00:00:00 2001 From: BrainL Date: Fri, 20 Jun 2025 15:11:27 +0800 Subject: [PATCH 5/7] interface description modify Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 1de2226f20..6541c375df 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -1104,7 +1104,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { 'deviceStateChange' } type - Device state change. - * @param { DeviceStateChangeCallback } callback + * @param { DeviceStateChangeCallback } [callback] * Indicates the device state callback to unregister. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @syscap SystemCapability.DistributedHardware.DeviceManager @@ -1165,7 +1165,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { 'discoverSuccess' } type - Successfully discovered device. - * @param { DeviceStateChangeCallbackAction } callback - Indicates the device discovery callback to unregister. + * @param { DeviceStateChangeCallbackAction } [callback] - Indicates the device discovery callback to unregister. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -1225,7 +1225,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { 'deviceNameChange' } type - Changed device name. - * @param { DeviceStateString } callback - Indicates the device name change callback to unregister. + * @param { DeviceStateString } [callback] - Indicates the device name change callback to unregister. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -1288,7 +1288,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { 'discoverFailure' } type - Discovery Device Failure. - * @param { DeviceStateNumber } callback + * @param { DeviceStateNumber } [callback] * Indicates the device found result callback to unregister. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @syscap SystemCapability.DistributedHardware.DeviceManager @@ -1319,7 +1319,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { 'serviceDie' } type - Service death. - * @param { ServiceDieCallback } callback - Indicates the service error callback to register. + * @param { ServiceDieCallback } [callback] - Indicates the service error callback to register. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -1349,7 +1349,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { 'serviceDie' } type - Service death. - * @param { ServiceDieCallback } callback - Indicates the service error callback to unregister. + * @param { ServiceDieCallback } [callback] - Indicates the service error callback to unregister. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 20 @@ -1412,7 +1412,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.ACCESS_SERVICE_DM * @param { 'replyResult' } type - Ui reply result to unregister. - * @param { DeviceStateString } callback - Indicates the devicemanager ui state to unregister. + * @param { DeviceStateString } [callback] - Indicates the devicemanager ui state to unregister. * @throws { BusinessError } 201 - Permission verification failed. A non-system application calls a system API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. -- Gitee From 80e5e7f266c6cc530def807868ee451fc2115e3b Mon Sep 17 00:00:00 2001 From: BrainL Date: Fri, 20 Jun 2025 15:34:41 +0800 Subject: [PATCH 6/7] interface description modify Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 6541c375df..9012791dcb 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -1382,6 +1382,7 @@ declare namespace distributedDeviceManager { * @param { 'replyResult' } type - Ui reply result to register. * @param { DeviceStateString } callback - Indicates the devicemanager ui state to register. * @throws { BusinessError } 201 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 20 @@ -1414,6 +1415,7 @@ declare namespace distributedDeviceManager { * @param { 'replyResult' } type - Ui reply result to unregister. * @param { DeviceStateString } [callback] - Indicates the devicemanager ui state to unregister. * @throws { BusinessError } 201 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 20 -- Gitee From 9162bb85a265cb35cbc4ea4f42d46ed9df0b4e91 Mon Sep 17 00:00:00 2001 From: BrainL Date: Tue, 24 Jun 2025 10:21:11 +0800 Subject: [PATCH 7/7] delete extraData Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 9012791dcb..2654cc6cbc 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -77,14 +77,6 @@ declare namespace distributedDeviceManager { * @arkts 1.1&1.2 */ networkId?: string; - - /** - * Device extra data. - * @type { ?string } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since 18 - */ - extraData?: string; } /** -- Gitee