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