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