From 8aa44501d1c79ec755a8ce0e9a79cc00a011eddc Mon Sep 17 00:00:00 2001 From: BrainL Date: Tue, 9 Sep 2025 12:30:06 +0800 Subject: [PATCH 1/3] revert dm interface to 1.1 Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 423 +++--------------------- 1 file changed, 38 insertions(+), 385 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index a9b7ef6792..2bc216f0aa 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -25,8 +25,7 @@ import type { AsyncCallback, Callback } from './@ohos.base'; * * @namespace distributedDeviceManager * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ declare namespace distributedDeviceManager { @@ -35,8 +34,7 @@ declare namespace distributedDeviceManager { * Basic description information of a distributed device. * @interface DeviceBasicInfo * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ interface DeviceBasicInfo { /** @@ -45,8 +43,7 @@ declare namespace distributedDeviceManager { * the obtained ID will change. * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ deviceId: string; @@ -54,8 +51,7 @@ declare namespace distributedDeviceManager { * Device name. * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ deviceName: string; @@ -64,8 +60,7 @@ declare namespace distributedDeviceManager { * which can be {@code phone}, {@code tablet}, {@code tv}, {@code smartVision}, {@code car}. * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ deviceType: string; @@ -73,155 +68,41 @@ declare namespace distributedDeviceManager { * Device network id. * @type { ?string } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ networkId?: string; } /** * The state of the nearby devices. - * @enum { int } + * @enum { number } * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ AVAILABLE = 1, /** * This state indicates the device is offline. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ UNAVAILABLE = 2, } - /** - * Device status change result. - * @interface DeviceStateChangeResult - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface DeviceStateChangeResult { - /** - * The state of the nearby devices. - * @type { DeviceStateChange } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - action: DeviceStateChange; - /** - * Basic description information of a distributed device. - * @type { DeviceBasicInfo } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - device: DeviceBasicInfo; - } - - /** - * Device name change result. - * @interface DeviceNameChangeResult - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface DeviceNameChangeResult { - /** - * Device name. - * @type { string } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - deviceName: string; - } - - /** - * Discovery failure result. - * @interface DiscoveryFailureResult - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface DiscoveryFailureResult { - /** - * Discovery failure cause code. - * @type { int } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - reason: int; - } - - /** - * Discovery successful result. - * @interface DiscoverySuccessResult - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface DiscoverySuccessResult { - /** - * Basic description information of a distributed device. - * @type { DeviceBasicInfo } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - device: DeviceBasicInfo; - } - - /** - * Reply result. - * @interface ReplyResult - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ReplyResult { - /** - * Param of ui state changes. - * @type { string } - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - param: string; - } - - /** - * ServiceDie data. - * @interface ServiceDieData - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - interface ServiceDieData {} - /** * Device profile information filter options. * @interface DeviceProfileInfoFilterOptions @@ -253,8 +134,7 @@ declare namespace distributedDeviceManager { * @interface ServiceProfileInfo * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since arkts {'1.1':'15','1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ interface ServiceProfileInfo { /** @@ -262,8 +142,7 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since arkts {'1.1':'15','1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ deviceId: string; @@ -300,8 +179,7 @@ declare namespace distributedDeviceManager { * @interface DeviceProfileInfo * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since arkts {'1.1':'15','1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ interface DeviceProfileInfo { /** @@ -309,8 +187,7 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since arkts {'1.1':'15','1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ deviceId: string; @@ -346,8 +223,7 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since arkts {'1.1':'15','1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ deviceType: string; @@ -365,8 +241,7 @@ declare namespace distributedDeviceManager { * @type { string } * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi - * @since arkts {'1.1':'15','1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ deviceName: string; @@ -741,8 +616,7 @@ declare namespace distributedDeviceManager { * 2. Incorrect parameter type; * 3. Parameter verification failed. * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function createDeviceManager(bundleName: string): DeviceManager; @@ -765,8 +639,7 @@ declare namespace distributedDeviceManager { * * @interface DeviceManager * @syscap SystemCapability.DistributedHardware.DeviceManager - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ interface DeviceManager { @@ -815,8 +688,7 @@ 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ getLocalDeviceNetworkId(): string; @@ -854,8 +726,7 @@ 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ getLocalDeviceId(): string; @@ -873,8 +744,7 @@ 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ getDeviceName(networkId: string): string; @@ -883,7 +753,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { string } networkId - Device network id. - * @returns { int } - Returns device type. + * @returns { number } - 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; @@ -892,10 +762,9 @@ 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ - getDeviceType(networkId: string): int; + getDeviceType(networkId: string): number; /** * Start to discover nearby devices. @@ -980,8 +849,7 @@ 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ unbindTarget(deviceId: string): void; @@ -1021,26 +889,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * 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 } 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - on(type: 'deviceStateChange', callback: Callback): void; + on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }>): void; /** * UnRegister device state callback based on the application bundle name. @@ -1058,25 +907,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * UnRegister device state callback based on the application bundle name. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'deviceStateChange' } type - Device state change. - * @param { Callback } [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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - off(type: 'deviceStateChange', callback?: Callback): void; + off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChange; device: DeviceBasicInfo; }>): void; /** * Register a device discovery result callback so that the application can be notified when discovery success. @@ -1093,24 +924,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * 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 } 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - on(type: 'discoverSuccess', callback: Callback): void; + on(type: 'discoverSuccess', callback: Callback<{ device: DeviceBasicInfo; }>): void; /** * UnRegister the device discovery result callback. @@ -1127,24 +941,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * UnRegister the device discovery result callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'discoverSuccess' } type - Successfully discovered device. - * @param { Callback } [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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - off(type: 'discoverSuccess', callback?: Callback): void; + off(type: 'discoverSuccess', callback?: Callback<{ device: DeviceBasicInfo; }>): void; /** * Register a device name change callback so that the application can be notified when discovery success. @@ -1161,24 +958,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * 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 } 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - on(type: 'deviceNameChange', callback: Callback): void; + on(type: 'deviceNameChange', callback: Callback<{ deviceName: string; }>): void; /** * UnRegister the device name change result callback. @@ -1195,24 +975,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * UnRegister the device name change result callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'deviceNameChange' } type - Changed device name. - * @param { Callback } [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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - off(type: 'deviceNameChange', callback?: Callback): void; + off(type: 'deviceNameChange', callback?: Callback<{ deviceName: string; }>): void; /** * Register a device discovery result callback so that the application can be notified when discover failed. @@ -1230,25 +993,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * 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 } 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - on(type: 'discoverFailure', callback: Callback): void; + on(type: 'discoverFailure', callback: Callback<{ reason: number; }>): void; /** * UnRegister the device discovery result callback. @@ -1266,25 +1011,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * UnRegister the device discovery result callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { 'discoverFailure' } type - Discovery Device Failure. - * @param { Callback } [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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - off(type: 'discoverFailure', callback?: Callback): void; + off(type: 'discoverFailure', callback?: Callback<{ reason: number; }>): void; /** * Register a serviceError callback so that the application can be notified when devicemanager service died @@ -1301,24 +1028,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - on(type: 'serviceDie', callback?: Callback): void; + on(type: 'serviceDie', callback?: Callback<{}>): void; /** * UnRegister the service error callback. @@ -1335,24 +1045,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - /** - * 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 arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - off(type: 'serviceDie', callback?: Callback): void; + off(type: 'serviceDie', callback?: Callback<{}>): void; /** * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges. @@ -1365,32 +1058,12 @@ declare namespace distributedDeviceManager { * 2. Incorrect parameter type; * 3. Parameter verification failed; * 4. The size of specified type is greater than 255. - * @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. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 10 */ - /** - * 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 } 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 } 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. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @systemapi this method can be used only by system applications. - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - on(type: 'replyResult', callback: Callback): void; + on(type: 'replyResult', callback: Callback<{ param: string; }>): void; /** * Unregister uiStateChange, this interface can only be used by devicemanager ui. @@ -1403,32 +1076,12 @@ declare namespace distributedDeviceManager { * 2. Incorrect parameter type; * 3. Parameter verification failed; * 4. The size of specified type is greater than 255. - * @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. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 10 */ - /** - * 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 } [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 } 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. - * @syscap SystemCapability.DistributedHardware.DeviceManager - * @systemapi this method can be used only by system applications. - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 - */ - off(type: 'replyResult', callback?: Callback): void; + off(type: 'replyResult', callback?: Callback<{ param: string; }>): void; /** * Get the device list under the same account. -- Gitee From b84d7f569cf7fbf340fb15619158318f9f1787dc Mon Sep 17 00:00:00 2001 From: BrainL Date: Tue, 9 Sep 2025 14:31:05 +0800 Subject: [PATCH 2/3] modify revert Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 326 +++++++++++++++++++++++- 1 file changed, 313 insertions(+), 13 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 2bc216f0aa..967c86562f 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -103,6 +103,103 @@ declare namespace distributedDeviceManager { UNAVAILABLE = 2, } + /** + * Device status change result. + * @interface DeviceStateChangeResult + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + interface DeviceStateChangeResult { + /** + * The state of the nearby devices. + * @type { DeviceStateChange } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + action: DeviceStateChange; + /** + * Basic description information of a distributed device. + * @type { DeviceBasicInfo } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + device: DeviceBasicInfo; + } + + /** + * Device name change result. + * @interface DeviceNameChangeResult + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + interface DeviceNameChangeResult { + /** + * Device name. + * @type { string } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + deviceName: string; + } + + /** + * Discovery failure result. + * @interface DiscoveryFailureResult + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + interface DiscoveryFailureResult { + /** + * Discovery failure cause code. + * @type { number } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + reason: number; + } + + /** + * Discovery successful result. + * @interface DiscoverySuccessResult + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + interface DiscoverySuccessResult { + /** + * Basic description information of a distributed device. + * @type { DeviceBasicInfo } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + device: DeviceBasicInfo; + } + + /** + * Reply result. + * @interface ReplyResult + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @systemapi + * @since 10 + */ + interface ReplyResult { + /** + * Param of ui state changes. + * @type { string } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @systemapi + * @since 10 + */ + param: string; + } + + /** + * ServiceDie data. + * @interface ServiceDieData + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + interface ServiceDieData {} + /** * Device profile information filter options. * @interface DeviceProfileInfoFilterOptions @@ -764,7 +861,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - getDeviceType(networkId: string): number; + getDeviceType(networkId: string): number; /** * Start to discover nearby devices. @@ -889,7 +986,25 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } 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: Callback): void; /** * UnRegister device state callback based on the application bundle name. @@ -907,7 +1022,24 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } [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?: Callback): void; /** * Register a device discovery result callback so that the application can be notified when discovery success. @@ -924,7 +1056,23 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } 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: Callback): void; /** * UnRegister the device discovery result callback. @@ -941,7 +1089,23 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } [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?: Callback): void; /** * Register a device name change callback so that the application can be notified when discovery success. @@ -958,7 +1122,23 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } 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: Callback): void; /** * UnRegister the device name change result callback. @@ -975,7 +1155,23 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } [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?: Callback): void; /** * Register a device discovery result callback so that the application can be notified when discover failed. @@ -993,7 +1189,24 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } 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: Callback): void; /** * UnRegister the device discovery result callback. @@ -1011,7 +1224,24 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { Callback } [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?: Callback): void; /** * Register a serviceError callback so that the application can be notified when devicemanager service died @@ -1028,7 +1258,23 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - 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 { 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?: Callback): void; /** * UnRegister the service error callback. @@ -1045,7 +1291,23 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - off(type: 'serviceDie', callback?: Callback<{}>): 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?: Callback): void; /** * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges. @@ -1058,12 +1320,31 @@ declare namespace distributedDeviceManager { * 2. Incorrect parameter type; * 3. Parameter verification failed; * 4. The size of specified type is greater than 255. + * @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. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 10 */ - 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 { Callback } 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 } 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. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @systemapi this method can be used only by system applications. + * @since 10 + */ + on(type: 'replyResult', callback: Callback): void; /** * Unregister uiStateChange, this interface can only be used by devicemanager ui. @@ -1076,12 +1357,31 @@ declare namespace distributedDeviceManager { * 2. Incorrect parameter type; * 3. Parameter verification failed; * 4. The size of specified type is greater than 255. + * @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. * @syscap SystemCapability.DistributedHardware.DeviceManager * @systemapi this method can be used only by system applications. * @since 10 */ - 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 { Callback } [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 } 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. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @systemapi this method can be used only by system applications. + * @since 10 + */ + off(type: 'replyResult', callback?: Callback): void; /** * Get the device list under the same account. -- Gitee From 9ea7f74aafccf39ef0d9674475ca2e0d2a3521b0 Mon Sep 17 00:00:00 2001 From: BrainL Date: Tue, 9 Sep 2025 14:35:16 +0800 Subject: [PATCH 3/3] revert kits for DM Signed-off-by: BrainL --- api/@ohos.distributedDeviceManager.d.ts | 8 ++++---- kits/@kit.DistributedServiceKit.d.ts | 10 ---------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/api/@ohos.distributedDeviceManager.d.ts b/api/@ohos.distributedDeviceManager.d.ts index 967c86562f..992fc64a9e 100644 --- a/api/@ohos.distributedDeviceManager.d.ts +++ b/api/@ohos.distributedDeviceManager.d.ts @@ -151,11 +151,11 @@ declare namespace distributedDeviceManager { interface DiscoveryFailureResult { /** * Discovery failure cause code. - * @type { number } + * @type { int } * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - reason: number; + reason: int; } /** @@ -850,7 +850,7 @@ declare namespace distributedDeviceManager { * * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param { string } networkId - Device network id. - * @returns { number } - Returns device type. + * @returns { int } - 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; @@ -861,7 +861,7 @@ declare namespace distributedDeviceManager { * @syscap SystemCapability.DistributedHardware.DeviceManager * @since 10 */ - getDeviceType(networkId: string): number; + getDeviceType(networkId: string): int; /** * Start to discover nearby devices. diff --git a/kits/@kit.DistributedServiceKit.d.ts b/kits/@kit.DistributedServiceKit.d.ts index 627d8003e9..f404686bc7 100644 --- a/kits/@kit.DistributedServiceKit.d.ts +++ b/kits/@kit.DistributedServiceKit.d.ts @@ -18,7 +18,6 @@ * @kit DistributedServiceKit */ -/*** if arkts 1.1 */ import cooperate from '@ohos.cooperate'; import distributedDeviceManager from '@ohos.distributedDeviceManager'; import deviceManager from '@ohos.distributedHardware.deviceManager'; @@ -33,12 +32,3 @@ export { cooperate, deviceManager, distributedDeviceManager, hardwareManager, abilityConnectionManager, linkEnhance, DistributedExtensionAbility, DistributedExtensionContext, proxyChannelManager }; -/*** endif */ - -/*** if arkts 1.2 */ -import distributedDeviceManager from '@ohos.distributedDeviceManager'; - -export { - distributedDeviceManager -}; -/*** endif */ -- Gitee