1/* 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import type { AsyncCallback, Callback } from './@ohos.base'; 17 18/** 19 * Providers interfaces to create a {@link deviceManager} instances. 20 * 21 * @namespace distributedDeviceManager 22 * @syscap SystemCapability.DistributedHardware.DeviceManager 23 * @since 10 24 */ 25 26declare namespace distributedDeviceManager { 27 28 /** 29 * Basic description information of a distributed device. 30 * @interface DeviceBasicInfo 31 * @syscap SystemCapability.DistributedHardware.DeviceManager 32 * @since 10 33 */ 34 interface DeviceBasicInfo { 35 /** 36 * Device unique identifier, The actual value is the udid-hash confused with the appid based on sha256. 37 * @syscap SystemCapability.DistributedHardware.DeviceManager 38 * @since 10 39 */ 40 deviceId: string; 41 42 /** 43 * Device name. 44 * @syscap SystemCapability.DistributedHardware.DeviceManager 45 * @since 10 46 */ 47 deviceName: string; 48 49 /** 50 * Device type. Currently, only support the following device types: 51 * 12 - Indicates a smart pc. 52 * 14 - Indicates a smart phone. 53 * 17 - Indicates a smart pad. 54 * @syscap SystemCapability.DistributedHardware.DeviceManager 55 * @since 10 56 */ 57 deviceType: string; 58 59 /** 60 * Device network id. 61 * @syscap SystemCapability.DistributedHardware.DeviceManager 62 * @since 10 63 */ 64 networkId?: string; 65 66 /** 67 * Device extra data. 68 * @type { ?string } 69 * @syscap SystemCapability.DistributedHardware.DeviceManager 70 * @since 16 71 */ 72 extraData?: string; 73 } 74 75 /** 76 * The state of the nearby devices. 77 * @enum { DeviceStateChange } 78 * @syscap SystemCapability.DistributedHardware.DeviceManager 79 * @since 10 80 */ 81 enum DeviceStateChange { 82 /** 83 * This state indicates the device is online but the state is unknown,The distributed function cannot used until 84 * state changes to AVAILABLE. 85 * @syscap SystemCapability.DistributedHardware.DeviceManager 86 * @since 10 87 */ 88 UNKNOWN = 0, 89 90 /** 91 * This state indicates the device has been synchronized to the database, Now the distributed function can be used. 92 * @syscap SystemCapability.DistributedHardware.DeviceManager 93 * @since 10 94 */ 95 AVAILABLE = 1, 96 97 /** 98 * This state indicates the device is offline. 99 * @syscap SystemCapability.DistributedHardware.DeviceManager 100 * @since 10 101 */ 102 UNAVAILABLE = 2, 103 } 104 105 /** 106 * Creates an {@code DeviceManager} instance. 107 * 108 * To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then 109 * use this instance to call other device management methods. 110 * 111 * @param { string } bundleName - Indicates the bundle name of the application. 112 * @returns { DeviceManager } - Return the DeviceManager object. 113 * @throws { BusinessError } 401 - Parameter error. Possible causes: 114 * 1. Mandatory parameters are left unspecified; 115 * 2. Incorrect parameter types; 116 * 3. Parameter verification failed. 117 * @syscap SystemCapability.DistributedHardware.DeviceManager 118 * @since 10 119 */ 120 function createDeviceManager(bundleName: string): DeviceManager; 121 122 /** 123 * Releases the {@code DeviceManager} instance that is no longer used. 124 * 125 * @permission ohos.permission.DISTRIBUTED_DATASYNC 126 * @param { DeviceManager } deviceManager - Indicates the {@code DeviceManager} instance. 127 * @throws { BusinessError } 201 - User permission verify failed. 128 * @throws { BusinessError } 401 - Parameter error. Possible causes: 129 * 1. Mandatory parameters are left unspecified; 130 * 2. Incorrect parameter types; 131 * 3. Parameter verification failed. 132 * @throws { BusinessError } 11600101 - Failed to execute the function. 133 * @syscap SystemCapability.DistributedHardware.DeviceManager 134 * @since 10 135 */ 136 function releaseDeviceManager(deviceManager: DeviceManager): void; 137 138 /** 139 * Provides methods for managing devices. 140 * 141 * @interface DeviceManager 142 * @syscap SystemCapability.DistributedHardware.DeviceManager 143 * @since 10 144 */ 145 interface DeviceManager { 146 147 /** 148 * Get a list of available devices. This interface query all authorized and connectable devices. 149 * 150 * @permission ohos.permission.DISTRIBUTED_DATASYNC 151 * @returns { Array<DeviceBasicInfo> } - Returns a list of available devices. 152 * @throws { BusinessError } 201 - User permission verify failed. 153 * @throws { BusinessError } 401 - Parameter error. Possible causes: 154 * 1. Mandatory parameters are left unspecified; 155 * 2. Incorrect parameter types; 156 * 3. Parameter verification failed. 157 * @throws { BusinessError } 11600101 - Failed to execute the function. 158 * @syscap SystemCapability.DistributedHardware.DeviceManager 159 * @since 10 160 */ 161 getAvailableDeviceListSync(): Array<DeviceBasicInfo>; 162 163 /** 164 * Get a list of available devices. This interface query all authorized and connectable devices. 165 * 166 * @permission ohos.permission.DISTRIBUTED_DATASYNC 167 * @param { AsyncCallback<Array<DeviceBasicInfo>> } callback - Indicates the callback to be 168 * invoked upon getAvailableDeviceList. 169 * @returns Returns a list of available devices. 170 * @throws { BusinessError } 201 - User permission verify failed. 171 * @throws { BusinessError } 11600101 - Failed to execute the function. 172 * @syscap SystemCapability.DistributedHardware.DeviceManager 173 * @since 10 174 */ 175 getAvailableDeviceList(callback: AsyncCallback<Array<DeviceBasicInfo>>): void; 176 177 /** 178 * Get a list of available devices. This interface query all authorized and connectable devices. 179 * 180 * @permission ohos.permission.DISTRIBUTED_DATASYNC 181 * @returns { Promise<Array<DeviceBasicInfo>> } - Returns a list of available devices. 182 * @throws { BusinessError } 201 - User permission verify failed. 183 * @throws { BusinessError } 11600101 - Failed to execute the function. 184 * @syscap SystemCapability.DistributedHardware.DeviceManager 185 * @since 10 186 */ 187 getAvailableDeviceList(): Promise<Array<DeviceBasicInfo>>; 188 189 /** 190 * Get the network id of the local device. 191 * 192 * @permission ohos.permission.DISTRIBUTED_DATASYNC 193 * @returns { string } - Returns local device network id. 194 * @throws { BusinessError } 201 - User permission verify failed. 195 * @throws { BusinessError } 11600101 - Failed to execute the function. 196 * @syscap SystemCapability.DistributedHardware.DeviceManager 197 * @since 10 198 */ 199 getLocalDeviceNetworkId(): string; 200 201 /** 202 * Get the device name of the local device. 203 * 204 * @permission ohos.permission.DISTRIBUTED_DATASYNC 205 * @returns { string } - Returns local device name. 206 * @throws { BusinessError } 201 - User permission verify failed. 207 * @throws { BusinessError } 11600101 - Failed to execute the function. 208 * @syscap SystemCapability.DistributedHardware.DeviceManager 209 * @since 10 210 */ 211 getLocalDeviceName(): string; 212 213 /** 214 * Get the device type of the local device. 215 * 216 * @permission ohos.permission.DISTRIBUTED_DATASYNC 217 * @returns { number } - Returns local device type. 218 * @throws { BusinessError } 201 - User permission verify failed. 219 * @throws { BusinessError } 11600101 - Failed to execute the function. 220 * @syscap SystemCapability.DistributedHardware.DeviceManager 221 * @since 10 222 */ 223 getLocalDeviceType(): number; 224 225 /** 226 * Get the device id of the local device. 227 * 228 * @permission ohos.permission.DISTRIBUTED_DATASYNC 229 * @returns { string } - Returns local device type. 230 * @throws { BusinessError } 201 - User permission verify failed. 231 * @throws { BusinessError } 11600101 - Failed to execute the function. 232 * @syscap SystemCapability.DistributedHardware.DeviceManager 233 * @since 10 234 */ 235 getLocalDeviceId(): string; 236 237 /** 238 * Get the device name by network id. 239 * 240 * @permission ohos.permission.DISTRIBUTED_DATASYNC 241 * @param { string } networkId - Device network id. 242 * @returns { string } - Returns device name. 243 * @throws { BusinessError } 201 - User permission verify failed. 244 * @throws { BusinessError } 401 - Parameter error. Possible causes: 245 * 1. Mandatory parameters are left unspecified; 246 * 2. Incorrect parameter type; 247 * 3. Parameter verification failed; 248 * 4. The size of specified networkId is greater than 255. 249 * @throws { BusinessError } 11600101 - Failed to execute the function. 250 * @syscap SystemCapability.DistributedHardware.DeviceManager 251 * @since 10 252 */ 253 getDeviceName(networkId: string): string; 254 255 /** 256 * Get the device type by network id. 257 * 258 * @permission ohos.permission.DISTRIBUTED_DATASYNC 259 * @param { string } networkId - Device network id. 260 * @returns { number } - Returns device type. 261 * @throws { BusinessError } 201 - User permission verify failed. 262 * @throws { BusinessError } 401 - Parameter error. Possible causes: 263 * 1. Mandatory parameters are left unspecified; 264 * 2. Incorrect parameter type; 265 * 3. Parameter verification failed; 266 * 4. The size of specified networkId is greater than 255. 267 * @throws { BusinessError } 11600101 - Failed to execute the function. 268 * @syscap SystemCapability.DistributedHardware.DeviceManager 269 * @since 10 270 */ 271 getDeviceType(networkId: string): number; 272 273 /** 274 * Start to discover nearby devices. 275 * 276 * @permission ohos.permission.DISTRIBUTED_DATASYNC 277 * @param { { [key: string]: Object } } discoverParam - Identifies the type of target discovered: 278 * discoverTargetType : 1 - Discovery target as a device by default, the value is 1. 279 * @param { { [key: string]: Object } } filterOptions - FilterOptions to filter discovery device. 280 * The type of filterOptions is map. The map are as follows: 281 * availableStatus: 0-1 - Discover devices only are credible, The value is 0 indicates device isn't credible; 282 * 0: Devices are offline, client need to bind the device by calling bindTarget() and then connect to it. 283 * 1: Devices already online, client can make connection. 284 * discoverDistance: 0-100 - Discover devices within a certain distance from the local, the unit is cm. 285 * authenticationStatus: 0-1 - Discover devices based on different authentication status: 286 * 0: Devices not authenticated. 287 1: Devices already authenticated. 288 * The value is 1 indicates device is trust. 289 * authorizationType: 0-2 - Discover devices based on different authorization type: 290 * 0: Devices authenticated based on temporary negotiated session key. 291 * 1: Devices authenticated based on the same account credential key. 292 * 2: Devices authenticated based on different account credential keys. 293 * @throws { BusinessError } 401 - Parameter error. Possible causes: 294 * 1. Mandatory parameters are left unspecified; 295 * 2. Incorrect parameter type; 296 * 3. Parameter verification failed. 297 * @throws { BusinessError } 201 - Permission verify failed. 298 * @throws { BusinessError } 11600104 - Discovery repeats. 299 * @throws { BusinessError } 11600101 - Failed to execute the function. 300 * @syscap SystemCapability.DistributedHardware.DeviceManager 301 * @since 10 302 */ 303 startDiscovering(discoverParam: { [key: string]: Object }, filterOptions?: { [key: string]: Object }): void; 304 305 /** 306 * Stop discovering nearby devices. 307 * 308 * @permission ohos.permission.DISTRIBUTED_DATASYNC 309 * @throws { BusinessError } 401 - Parameter error. Possible causes: 310 * 1. Mandatory parameters are left unspecified; 311 * 2. Incorrect parameter type; 312 * 3. Parameter verification failed. 313 * @throws { BusinessError } 201 - Permission verify failed. 314 * @throws { BusinessError } 11600104 - Stop discovery repeats. 315 * @throws { BusinessError } 11600101 - Failed to execute the function. 316 * @syscap SystemCapability.DistributedHardware.DeviceManager 317 * @since 10 318 */ 319 stopDiscovering(): void; 320 321 /** 322 * Bind the specified target. 323 * 324 * @permission ohos.permission.DISTRIBUTED_DATASYNC 325 * @param { string } deviceId - id of device to bind. 326 * @param { { [key: string]: Object } } bindParam - parameters of device to bind, The parameter type is map,such as: 327 * "bindType" : 1-4, - This value is type of bind, the values are as follows: 328 * 1 - The bind type is pin code . 329 * 2 - The bind type is QR code. 330 * 3 - The bind type is nfc. 331 * 4 - The bind type is no_interaction. 332 333 * "targetPkgName" : "xxxx", - The package name of binding target. 334 * "appName" : "xxxx", - The app name that try to bind the target. 335 * "appOperation" : "xxxx" - The reason why the app want to bind the target package. 336 * "customDescription" : "xxxx" - The detail description of the operation. 337 * @param { AsyncCallback<{deviceId: string}> } callback - indicates the callback to be invoked upon bindDevice. 338 * @throws { BusinessError } 401 - Parameter error. Possible causes: 339 * 1. Mandatory parameters are left unspecified; 340 * 2. Incorrect parameter type; 341 * 3. Parameter verification failed; 342 * 4. The size of specified deviceId is greater than 255. 343 * @throws { BusinessError } 201 - Permission verify failed. 344 * @throws { BusinessError } 11600101 - Failed to execute the function. 345 * @throws { BusinessError } 11600103 - Bind invalid. 346 * @syscap SystemCapability.DistributedHardware.DeviceManager 347 * @since 10 348 */ 349 bindTarget(deviceId: string, bindParam: { [key: string]: Object }, callback: AsyncCallback<{deviceId: string}>): void; 350 351 /** 352 * Unbind the specified target. 353 * 354 * @permission ohos.permission.DISTRIBUTED_DATASYNC 355 * @param { string } deviceId - id of device to unbind 356 * @throws { BusinessError } 401 - Parameter error. Possible causes: 357 * 1. Mandatory parameters are left unspecified; 358 * 2. Incorrect parameter type; 359 * 3. Parameter verification failed; 360 * 4. The size of specified deviceId is greater than 255. 361 * @throws { BusinessError } 201 - Permission verify failed. 362 * @throws { BusinessError } 11600101 - Failed to execute the function. 363 * @syscap SystemCapability.DistributedHardware.DeviceManager 364 * @since 10 365 */ 366 unbindTarget(deviceId: string): void; 367 368 /** 369 * The reply of ui operation from pin-code window, this interface can only be used by pin-code-hap of devicemanager. 370 * 371 * @permission ohos.permission.ACCESS_SERVICE_DM 372 * @param { number } action - The reply action of user operation. 373 * @param { string } actionResult - Indicates the user operation result. 374 * @throws { BusinessError } 201 - Permission verify failed. 375 * @throws { BusinessError } 202 - The caller is not a system application. 376 * @throws { BusinessError } 401 - Parameter error. Possible causes: 377 * 1. Mandatory parameters are left unspecified; 378 * 2. Incorrect parameter type; 379 * 3. Parameter verification failed; 380 * 4. The size of specified actionResult is greater than 255. 381 * @syscap SystemCapability.DistributedHardware.DeviceManager 382 * @systemapi this method can be used only by system applications. 383 * @since 10 384 */ 385 replyUiAction(action: number, actionResult: string): void; 386 387 /** 388 * Register a device state callback so that the application can be notified upon device state changes based on 389 * the application bundle name. 390 * 391 * @permission ohos.permission.DISTRIBUTED_DATASYNC 392 * @param { 'deviceStateChange' } type - Device state change. 393 * @param { Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }> } callback 394 * Indicates the device state callback to register. 395 * @throws { BusinessError } 201 - Permission verify failed. 396 * @throws { BusinessError } 401 - Parameter error. Possible causes: 397 * 1. Mandatory parameters are left unspecified; 398 * 2. Incorrect parameter type; 399 * 3. Parameter verification failed; 400 * 4. The size of specified type is greater than 255. 401 * @syscap SystemCapability.DistributedHardware.DeviceManager 402 * @since 10 403 */ 404 on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void; 405 406 /** 407 * UnRegister device state callback based on the application bundle name. 408 * 409 * @permission ohos.permission.DISTRIBUTED_DATASYNC 410 * @param { 'deviceStateChange' } type - Device state change. 411 * @param { Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }> } callback 412 * Indicates the device state callback to unregister. 413 * @throws { BusinessError } 201 - Permission verify failed. 414 * @throws { BusinessError } 401 - Parameter error. Possible causes: 415 * 1. Mandatory parameters are left unspecified; 416 * 2. Incorrect parameter type; 417 * 3. Parameter verification failed; 418 * 4. The size of specified type is greater than 255. 419 * @syscap SystemCapability.DistributedHardware.DeviceManager 420 * @since 10 421 */ 422 off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }>): void; 423 424 /** 425 * Register a device discovery result callback so that the application can be notified when discovery success. 426 * 427 * @permission ohos.permission.DISTRIBUTED_DATASYNC 428 * @param { 'discoverSuccess' } type - Successfully discovered device. 429 * @param { Callback<{ subscribeId: number, device: DeviceBasicInfo }> } callback 430 * Indicates the device discovery callback to register. 431 * @throws { BusinessError } 201 - Permission verify failed. 432 * @throws { BusinessError } 401 - Parameter error. Possible causes: 433 * 1. Mandatory parameters are left unspecified; 434 * 2. Incorrect parameter type; 435 * 3. Parameter verification failed; 436 * 4. The size of specified type is greater than 255. 437 * @syscap SystemCapability.DistributedHardware.DeviceManager 438 * @since 10 439 */ 440 on(type: 'discoverSuccess', callback: Callback<{ device: DeviceBasicInfo }>): void; 441 442 /** 443 * UnRegister the device discovery result callback. 444 * 445 * @permission ohos.permission.DISTRIBUTED_DATASYNC 446 * @param { 'discoverSuccess' } type - Successfully discovered device. 447 * @param { Callback<{ subscribeId: number, device: DeviceBasicInfo }> } callback 448 * Indicates the device discovery callback to unregister. 449 * @throws { BusinessError } 201 - Permission verify failed. 450 * @throws { BusinessError } 401 - Parameter error. Possible causes: 451 * 1. Mandatory parameters are left unspecified; 452 * 2. Incorrect parameter type; 453 * 3. Parameter verification failed; 454 * 4. The size of specified type is greater than 255. 455 * @syscap SystemCapability.DistributedHardware.DeviceManager 456 * @since 10 457 */ 458 off(type: 'discoverSuccess', callback?: Callback<{ device: DeviceBasicInfo }>): void; 459 460 /** 461 * Register a device name change callback so that the application can be notified when discovery success. 462 * 463 * @permission ohos.permission.DISTRIBUTED_DATASYNC 464 * @param { 'deviceNameChange' } type - Changed device name. 465 * @param { Callback<{ deviceName: string }> } callback - Indicates the device name change callback to register. 466 * @throws { BusinessError } 201 - Permission verify failed. 467 * @throws { BusinessError } 401 - Parameter error. Possible causes: 468 * 1. Mandatory parameters are left unspecified; 469 * 2. Incorrect parameter type; 470 * 3. Parameter verification failed; 471 * 4. The size of specified type is greater than 255. 472 * @syscap SystemCapability.DistributedHardware.DeviceManager 473 * @since 10 474 */ 475 on(type: 'deviceNameChange', callback: Callback<{ deviceName: string }>): void; 476 477 /** 478 * UnRegister the device name change result callback. 479 * 480 * @permission ohos.permission.DISTRIBUTED_DATASYNC 481 * @param { 'deviceNameChange' } type - Changed device name. 482 * @param { Callback<{ deviceName: string }> } callback - Indicates the device name change callback to unregister. 483 * @throws { BusinessError } 201 - Permission verify failed. 484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 485 * 1. Mandatory parameters are left unspecified; 486 * 2. Incorrect parameter type; 487 * 3. Parameter verification failed; 488 * 4. The size of specified type is greater than 255. 489 * @syscap SystemCapability.DistributedHardware.DeviceManager 490 * @since 10 491 */ 492 off(type: 'deviceNameChange', callback?: Callback<{ deviceName: string }>): void; 493 494 /** 495 * Register a device discovery result callback so that the application can be notified when discover failed. 496 * 497 * @permission ohos.permission.DISTRIBUTED_DATASYNC 498 * @param { 'discoverFailure' } type - Discovery Device Failure. 499 * @param { Callback<{ subscribeId: number, reason: number }> } callback 500 * Indicates the device found result callback to register. 501 * @throws { BusinessError } 201 - Permission verify failed. 502 * @throws { BusinessError } 401 - Parameter error. Possible causes: 503 * 1. Mandatory parameters are left unspecified; 504 * 2. Incorrect parameter type; 505 * 3. Parameter verification failed; 506 * 4. The size of specified type is greater than 255. 507 * @syscap SystemCapability.DistributedHardware.DeviceManager 508 * @since 10 509 */ 510 on(type: 'discoverFailure', callback: Callback<{ reason: number }>): void; 511 512 /** 513 * UnRegister the device discovery result callback. 514 * 515 * @permission ohos.permission.DISTRIBUTED_DATASYNC 516 * @param { 'discoverFailure' } type - Discovery Device Failure. 517 * @param { Callback<{ subscribeId: number, reason: number }> } callback 518 * Indicates the device found result callback to unregister. 519 * @throws { BusinessError } 201 - Permission verify failed. 520 * @throws { BusinessError } 401 - Parameter error. Possible causes: 521 * 1. Mandatory parameters are left unspecified; 522 * 2. Incorrect parameter type; 523 * 3. Parameter verification failed; 524 * 4. The size of specified type is greater than 255. 525 * @syscap SystemCapability.DistributedHardware.DeviceManager 526 * @since 10 527 */ 528 off(type: 'discoverFailure', callback?: Callback<{ reason: number }>): void; 529 530 /** 531 * Register a serviceError callback so that the application can be notified when devicemanager service died 532 * 533 * @permission ohos.permission.DISTRIBUTED_DATASYNC 534 * @param { 'serviceDie' } type - Service death. 535 * @param { Callback<{}> } callback - Indicates the service error callback to register. 536 * @throws { BusinessError } 201 - Permission verify failed. 537 * @throws { BusinessError } 401 - Parameter error. Possible causes: 538 * 1. Mandatory parameters are left unspecified; 539 * 2. Incorrect parameter type; 540 * 3. Parameter verification failed; 541 * 4. The size of specified type is greater than 255. 542 * @syscap SystemCapability.DistributedHardware.DeviceManager 543 * @since 10 544 */ 545 on(type: 'serviceDie', callback?: Callback<{}>): void; 546 547 /** 548 * UnRegister the service error callback. 549 * 550 * @permission ohos.permission.DISTRIBUTED_DATASYNC 551 * @param { 'serviceDie' } type - Service death. 552 * @param { Callback<{}> } callback - Indicates the service error callback to unregister. 553 * @throws { BusinessError } 201 - Permission verify failed. 554 * @throws { BusinessError } 401 - Parameter error. Possible causes: 555 * 1. Mandatory parameters are left unspecified; 556 * 2. Incorrect parameter type; 557 * 3. Parameter verification failed; 558 * 4. The size of specified type is greater than 255. 559 * @syscap SystemCapability.DistributedHardware.DeviceManager 560 * @since 10 561 */ 562 off(type: 'serviceDie', callback?: Callback<{}>): void; 563 564 /** 565 * Register a callback from deviceManager service so that the devicemanager ui can be notified when uiStateChanges. 566 * 567 * @permission ohos.permission.ACCESS_SERVICE_DM 568 * @param { 'replyResult' } type - Ui reply result to register. 569 * @param { Callback<{ param: string }> } callback - Indicates the devicemanager ui state to register. 570 * @throws { BusinessError } 401 - Parameter error. Possible causes: 571 * 1. Mandatory parameters are left unspecified; 572 * 2. Incorrect parameter type; 573 * 3. Parameter verification failed; 574 * 4. The size of specified type is greater than 255. 575 * @throws { BusinessError } 202 - The caller is not a system application. 576 * @syscap SystemCapability.DistributedHardware.DeviceManager 577 * @systemapi this method can be used only by system applications. 578 * @since 10 579 */ 580 on(type: 'replyResult', callback: Callback<{ param: string }>): void; 581 582 /** 583 * Unregister uiStateChange, this interface can only be used by devicemanager ui. 584 * 585 * @permission ohos.permission.ACCESS_SERVICE_DM 586 * @param { 'replyResult' } type - Ui reply result to unregister. 587 * @param { Callback<{ param: string }> } callback - Indicates the devicemanager ui state to unregister. 588 * @throws { BusinessError } 401 - Parameter error. Possible causes: 589 * 1. Mandatory parameters are left unspecified; 590 * 2. Incorrect parameter type; 591 * 3. Parameter verification failed; 592 * 4. The size of specified type is greater than 255. 593 * @throws { BusinessError } 202 - The caller is not a system application. 594 * @syscap SystemCapability.DistributedHardware.DeviceManager 595 * @systemapi this method can be used only by system applications. 596 * @since 10 597 */ 598 off(type: 'replyResult', callback?: Callback<{ param: string }>): void; 599 } 600} 601 602export default distributedDeviceManager;