1/* 2 * Copyright (c) 2020-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 deviceManager 27 * @syscap SystemCapability.DistributedHardware.DeviceManager 28 * @since 7 29 * @deprecated since 11 30 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager 31 */ 32declare namespace deviceManager { 33 /** 34 * DeviceInfo 35 * 36 * @interface DeviceInfo 37 * @syscap SystemCapability.DistributedHardware.DeviceManager 38 * @systemapi this method can be used only by system applications. 39 * @since 7 40 * @deprecated since 11 41 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceBasicInfo 42 */ 43 interface DeviceInfo { 44 /** 45 * DeviceId ID. 46 * 47 * @syscap SystemCapability.DistributedHardware.DeviceManager 48 * @systemapi this method can be used only by system applications. 49 * @since 7 50 * @deprecated since 11 51 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceBasicInfo#deviceId 52 */ 53 deviceId: string; 54 55 /** 56 * Device name of the device. 57 * 58 * @syscap SystemCapability.DistributedHardware.DeviceManager 59 * @systemapi this method can be used only by system applications. 60 * @since 7 61 * @deprecated since 11 62 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceBasicInfo#deviceName 63 */ 64 deviceName: string; 65 66 /** 67 * Device type of the device. 68 * 69 * @syscap SystemCapability.DistributedHardware.DeviceManager 70 * @systemapi this method can be used only by system applications. 71 * @since 7 72 * @deprecated since 11 73 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceBasicInfo#deviceType 74 */ 75 deviceType: DeviceType; 76 77 /** 78 * NetworkId of the device. 79 * 80 * @syscap SystemCapability.DistributedHardware.DeviceManager 81 * @systemapi this method can be used only by system applications. 82 * @since 8 83 * @deprecated since 11 84 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceBasicInfo#networkId 85 */ 86 networkId: string; 87 88 /** 89 * The distance of discovered device, in centimeter(cm). 90 * 91 * @syscap SystemCapability.DistributedHardware.DeviceManager 92 * @systemapi this method can be used only by system applications. 93 * @since 9 94 * @deprecated since 11 95 */ 96 range: number; 97 98 /** 99 * Indicates the device's trusted type 100 * 101 * @syscap SystemCapability.DistributedHardware.DeviceManager 102 * @systemapi this method can be used only by system applications. 103 * @since 10 104 * @deprecated since 11 105 */ 106 authForm: AuthForm; 107 } 108 109 /** 110 * Device trusted type definitions 111 * 112 * @enum { number } 113 * @syscap SystemCapability.DistributedHardware.DeviceManager 114 * @systemapi this method can be used only by system applications. 115 * @since 10 116 * @deprecated since 11 117 */ 118 enum AuthForm { 119 /** 120 * Indicates invalid trusted device type. 121 * 122 * @syscap SystemCapability.DistributedHardware.DeviceManager 123 * @systemapi this method can be used only by system applications. 124 * @since 10 125 * @deprecated since 11 126 */ 127 INVALID_TYPE = -1, 128 129 /** 130 * Indicates peer to peer trusted device type without account. 131 * 132 * @syscap SystemCapability.DistributedHardware.DeviceManager 133 * @systemapi this method can be used only by system applications. 134 * @since 10 135 * @deprecated since 11 136 */ 137 PEER_TO_PEER = 0, 138 139 /** 140 * Indicates identical account trusted device type. 141 * 142 * @syscap SystemCapability.DistributedHardware.DeviceManager 143 * @systemapi this method can be used only by system applications. 144 * @since 10 145 * @deprecated since 11 146 */ 147 IDENTICAL_ACCOUNT = 1, 148 149 /** 150 * Indicates across account trusted device type. 151 * 152 * @syscap SystemCapability.DistributedHardware.DeviceManager 153 * @systemapi this method can be used only by system applications. 154 * @since 10 155 * @deprecated since 11 156 */ 157 ACROSS_ACCOUNT = 2 158 } 159 160 /** 161 * Device Type definitions 162 * 163 * @enum { number } 164 * @syscap SystemCapability.DistributedHardware.DeviceManager 165 * @systemapi this method can be used only by system applications. 166 * @since 7 167 * @deprecated since 11 168 */ 169 enum DeviceType { 170 /** 171 * Indicates an unknown device type. 172 * 173 * @syscap SystemCapability.DistributedHardware.DeviceManager 174 * @systemapi this method can be used only by system applications. 175 * @since 7 176 * @deprecated since 11 177 */ 178 UNKNOWN_TYPE = 0, 179 180 /** 181 * Indicates a speaker. 182 * 183 * @syscap SystemCapability.DistributedHardware.DeviceManager 184 * @systemapi this method can be used only by system applications. 185 * @since 7 186 * @deprecated since 11 187 */ 188 SPEAKER = 0x0A, 189 190 /** 191 * Indicates a smartphone. 192 * 193 * @syscap SystemCapability.DistributedHardware.DeviceManager 194 * @systemapi this method can be used only by system applications. 195 * @since 7 196 * @deprecated since 11 197 */ 198 PHONE = 0x0E, 199 200 /** 201 * Indicates a tablet. 202 * 203 * @syscap SystemCapability.DistributedHardware.DeviceManager 204 * @systemapi this method can be used only by system applications. 205 * @since 7 206 * @deprecated since 11 207 */ 208 TABLET = 0x11, 209 210 /** 211 * Indicates a smart watch. 212 * 213 * @syscap SystemCapability.DistributedHardware.DeviceManager 214 * @systemapi this method can be used only by system applications. 215 * @since 7 216 * @deprecated since 11 217 */ 218 WEARABLE = 0x6D, 219 220 /** 221 * Indicates a car. 222 * 223 * @syscap SystemCapability.DistributedHardware.DeviceManager 224 * @systemapi this method can be used only by system applications. 225 * @since 7 226 * @deprecated since 11 227 */ 228 CAR = 0x83, 229 230 /** 231 * Indicates a smart TV. 232 * 233 * @syscap SystemCapability.DistributedHardware.DeviceManager 234 * @systemapi this method can be used only by system applications. 235 * @since 7 236 * @deprecated since 11 237 */ 238 TV = 0x9C 239 } 240 241 /** 242 * Device state change event definition 243 * 244 * @enum { number } 245 * @syscap SystemCapability.DistributedHardware.DeviceManager 246 * @systemapi this method can be used only by system applications. 247 * @since 7 248 * @deprecated since 11 249 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceStateChange 250 */ 251 enum DeviceStateChangeAction { 252 /** 253 * Device online action, which indicates the device is physically online 254 * 255 * @syscap SystemCapability.DistributedHardware.DeviceManager 256 * @systemapi this method can be used only by system applications. 257 * @since 7 258 * @deprecated since 11 259 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceStateChange#UNKNOWN 260 */ 261 ONLINE = 0, 262 263 /** 264 * Device ready action, which indicates the information between devices has been synchronized in the Distributed Data Service (DDS) module, 265 * and the device is ready for running distributed services 266 * 267 * @syscap SystemCapability.DistributedHardware.DeviceManager 268 * @systemapi this method can be used only by system applications. 269 * @since 7 270 * @deprecated since 11 271 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceStateChange#AVAILABLE 272 */ 273 READY = 1, 274 275 /** 276 * Device offline action, which Indicates the device is physically offline 277 * 278 * @syscap SystemCapability.DistributedHardware.DeviceManager 279 * @systemapi this method can be used only by system applications. 280 * @since 7 281 * @deprecated since 11 282 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceStateChange#UNAVAILABLE 283 */ 284 OFFLINE = 2, 285 286 /** 287 * Device change action 288 * 289 * @syscap SystemCapability.DistributedHardware.DeviceManager 290 * @systemapi this method can be used only by system applications. 291 * @since 7 292 * @deprecated since 11 293 */ 294 CHANGE = 3 295 } 296 297 /** 298 * Service subscribe info for device discover 299 * 300 * @interface SubscribeInfo 301 * @syscap SystemCapability.DistributedHardware.DeviceManager 302 * @systemapi this method can be used only by system applications. 303 * @since 7 304 * @deprecated since 11 305 */ 306 interface SubscribeInfo { 307 /** 308 * Service subscribe ID, the value is in scope [0, 65535], should be unique for each discover process 309 * 310 * @syscap SystemCapability.DistributedHardware.DeviceManager 311 * @systemapi this method can be used only by system applications. 312 * @since 7 313 * @deprecated since 11 314 */ 315 subscribeId: number; 316 317 /** 318 * Discovery mode for service subscription. 319 * 320 * @syscap SystemCapability.DistributedHardware.DeviceManager 321 * @systemapi this method can be used only by system applications. 322 * @since 7 323 * @deprecated since 11 324 */ 325 mode: DiscoverMode; 326 327 /** 328 * Service subscription medium. 329 * 330 * @syscap SystemCapability.DistributedHardware.DeviceManager 331 * @systemapi this method can be used only by system applications. 332 * @since 7 333 * @deprecated since 11 334 */ 335 medium: ExchangeMedium; 336 337 /** 338 * Service subscription frequency. 339 * 340 * @syscap SystemCapability.DistributedHardware.DeviceManager 341 * @systemapi this method can be used only by system applications. 342 * @since 7 343 * @deprecated since 11 344 */ 345 freq: ExchangeFreq; 346 347 /** 348 * only find the device with the same account. 349 * 350 * @syscap SystemCapability.DistributedHardware.DeviceManager 351 * @systemapi this method can be used only by system applications. 352 * @since 7 353 * @deprecated since 11 354 */ 355 isSameAccount: boolean; 356 357 /** 358 * find the sleeping devices. 359 * 360 * @syscap SystemCapability.DistributedHardware.DeviceManager 361 * @systemapi this method can be used only by system applications. 362 * @since 7 363 * @deprecated since 11 364 */ 365 isWakeRemote: boolean; 366 367 /** 368 * Subscribe capability. 369 * 370 * @syscap SystemCapability.DistributedHardware.DeviceManager 371 * @systemapi this method can be used only by system applications. 372 * @since 7 373 * @deprecated since 11 374 */ 375 capability: SubscribeCap; 376 } 377 378 /** 379 * Service publish info for device discover 380 * 381 * @interface PublishInfo 382 * @syscap SystemCapability.DistributedHardware.DeviceManager 383 * @systemapi this method can be used only by system applications. 384 * @since 9 385 * @deprecated since 11 386 */ 387 interface PublishInfo { 388 /** 389 * Service publish ID, the value is in scope [0, 65535], should be unique for each publish process 390 * 391 * @syscap SystemCapability.DistributedHardware.DeviceManager 392 * @systemapi this method can be used only by system applications. 393 * @since 9 394 * @deprecated since 11 395 */ 396 publishId: number; 397 398 /** 399 * Discovery mode for service subscription. 400 * 401 * @syscap SystemCapability.DistributedHardware.DeviceManager 402 * @systemapi this method can be used only by system applications. 403 * @since 9 404 * @deprecated since 11 405 */ 406 mode: DiscoverMode; 407 408 /** 409 * Service subscription frequency. 410 * 411 * @syscap SystemCapability.DistributedHardware.DeviceManager 412 * @systemapi this method can be used only by system applications. 413 * @since 9 414 * @deprecated since 11 415 */ 416 freq: ExchangeFreq; 417 418 /** 419 * Whether the device should be ranged by discoverer. 420 * 421 * @syscap SystemCapability.DistributedHardware.DeviceManager 422 * @systemapi this method can be used only by system applications. 423 * @since 9 424 * @deprecated since 11 425 */ 426 ranging: boolean; 427 } 428 429 /** 430 * device discover mode 431 * 432 * @enum { number } 433 * @syscap SystemCapability.DistributedHardware.DeviceManager 434 * @systemapi this method can be used only by system applications. 435 * @since 7 436 * @deprecated since 11 437 */ 438 enum DiscoverMode { 439 /** 440 * when using this key at client side, it means discovering for available nearby devices by 441 * calling @startDeviceDiscovery function, while using this key at server side indicating that 442 * a device publication or advertisement by calling @publishDeviceDiscovery. 443 * 444 * @syscap SystemCapability.DistributedHardware.DeviceManager 445 * @systemapi this method can be used only by system applications. 446 * @since 7 447 * @deprecated since 11 448 */ 449 DISCOVER_MODE_PASSIVE = 0x55, 450 451 /** 452 * when using this key at server side, it means discovering for available nearby devices by 453 * calling @startDeviceDiscovery function, while using this key at client side indicating that 454 * a device publication or advertisement by calling @publishDeviceDiscovery. 455 * 456 * @syscap SystemCapability.DistributedHardware.DeviceManager 457 * @systemapi this method can be used only by system applications. 458 * @since 7 459 * @deprecated since 11 460 */ 461 DISCOVER_MODE_ACTIVE = 0xAA 462 } 463 464 /** 465 * device discover medium 466 * 467 * @enum { number } 468 * @syscap SystemCapability.DistributedHardware.DeviceManager 469 * @systemapi this method can be used only by system applications. 470 * @since 7 471 * @deprecated since 11 472 */ 473 enum ExchangeMedium { 474 /** 475 * Automatic medium selection 476 * 477 * @syscap SystemCapability.DistributedHardware.DeviceManager 478 * @systemapi this method can be used only by system applications. 479 * @since 7 480 * @deprecated since 11 481 */ 482 AUTO = 0, 483 484 /** 485 * Bluetooth 486 * 487 * @syscap SystemCapability.DistributedHardware.DeviceManager 488 * @systemapi this method can be used only by system applications. 489 * @since 7 490 * @deprecated since 11 491 */ 492 BLE = 1, 493 494 /** 495 * Wi-Fi 496 * 497 * @syscap SystemCapability.DistributedHardware.DeviceManager 498 * @systemapi this method can be used only by system applications. 499 * @since 7 500 * @deprecated since 11 501 */ 502 COAP = 2, 503 504 /** 505 * USB 506 * 507 * @syscap SystemCapability.DistributedHardware.DeviceManager 508 * @systemapi this method can be used only by system applications. 509 * @since 7 510 * @deprecated since 11 511 */ 512 USB = 3 513 } 514 515 /** 516 * device discover freq 517 * 518 * @enum { number } 519 * @syscap SystemCapability.DistributedHardware.DeviceManager 520 * @systemapi this method can be used only by system applications. 521 * @since 7 522 * @deprecated since 11 523 */ 524 enum ExchangeFreq { 525 /** 526 * Low 527 * 528 * @syscap SystemCapability.DistributedHardware.DeviceManager 529 * @systemapi this method can be used only by system applications. 530 * @since 7 531 * @deprecated since 11 532 */ 533 LOW = 0, 534 535 /** 536 * Medium 537 * 538 * @syscap SystemCapability.DistributedHardware.DeviceManager 539 * @systemapi this method can be used only by system applications. 540 * @since 7 541 * @deprecated since 11 542 */ 543 MID = 1, 544 545 /** 546 * High 547 * 548 * @syscap SystemCapability.DistributedHardware.DeviceManager 549 * @systemapi this method can be used only by system applications. 550 * @since 7 551 * @deprecated since 11 552 */ 553 HIGH = 2, 554 555 /** 556 * Super-high 557 * 558 * @syscap SystemCapability.DistributedHardware.DeviceManager 559 * @systemapi this method can be used only by system applications. 560 * @since 7 561 * @deprecated since 11 562 */ 563 SUPER_HIGH = 3 564 } 565 566 /** 567 * device discover capability 568 * 569 * @enum { number } 570 * @syscap SystemCapability.DistributedHardware.DeviceManager 571 * @systemapi this method can be used only by system applications. 572 * @since 7 573 * @deprecated since 11 574 */ 575 enum SubscribeCap { 576 /** 577 * ddmpCapability, will be discarded later. Currently, it will be converted to OSD capability inner. 578 * 579 * @syscap SystemCapability.DistributedHardware.DeviceManager 580 * @systemapi this method can be used only by system applications. 581 * @since 7 582 * @deprecated since 11 583 */ 584 SUBSCRIBE_CAPABILITY_DDMP = 0, 585 586 /** 587 * One Super Device Capability 588 * 589 * @syscap SystemCapability.DistributedHardware.DeviceManager 590 * @systemapi this method can be used only by system applications. 591 * @since 7 592 * @deprecated since 11 593 */ 594 SUBSCRIBE_CAPABILITY_OSD = 1 595 } 596 597 /** 598 * Device Authentication param 599 * 600 * @interface AuthParam 601 * @syscap SystemCapability.DistributedHardware.DeviceManager 602 * @systemapi this method can be used only by system applications 603 * @since 7 604 * @deprecated since 11 605 */ 606 interface AuthParam { 607 /** 608 * Authentication type, 1 for pin code. 609 * 610 * @syscap SystemCapability.DistributedHardware.DeviceManager 611 * @systemapi this method can be used only by system applications 612 * @since 7 613 * @deprecated since 11 614 */ 615 authType: number; 616 617 /** 618 * Authentication extra infos. 619 * 620 * @syscap SystemCapability.DistributedHardware.DeviceManager 621 * @systemapi this method can be used only by system applications 622 * @since 7 623 * @deprecated since 11 624 */ 625 extraInfo: { [key: string]: any }; 626 } 627 628 /** 629 * Device auth info. 630 * 631 * @interface AuthInfo 632 * @syscap SystemCapability.DistributedHardware.DeviceManager 633 * @systemapi this method can be used only by system applications 634 * @since 7 635 * @deprecated since 11 636 */ 637 interface AuthInfo { 638 /** 639 * Authentication type, 1 for pin code. 640 * 641 * @syscap SystemCapability.DistributedHardware.DeviceManager 642 * @systemapi this method can be used only by system applications 643 * @since 7 644 * @deprecated since 11 645 */ 646 authType: number; 647 648 /** 649 * the token used for this authentication. 650 * 651 * @syscap SystemCapability.DistributedHardware.DeviceManager 652 * @systemapi this method can be used only by system applications 653 * @since 7 654 * @deprecated since 11 655 */ 656 token: number; 657 658 /** 659 * Authentication extra infos. 660 * 661 * @syscap SystemCapability.DistributedHardware.DeviceManager 662 * @systemapi this method can be used only by system applications 663 * @since 7 664 * @deprecated since 11 665 */ 666 extraInfo: { [key: string]: any }; 667 } 668 669 /** 670 * Creates a {@code DeviceManager} instance. 671 * <p>To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then 672 * use this instance to call other device management methods. 673 * 674 * @param { string } bundleName Indicates the bundle name of the application. 675 * @param { AsyncCallback<DeviceManager> } callback Indicates the callback to be invoked upon {@code DeviceManager} instance creation. 676 * @throws { BusinessError } 401 - Parameter error. Possible causes: 677 * 1. Mandatory parameters are left unspecified; 678 * 2. Incorrect parameter types; 679 * 3. Parameter verification failed. 680 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 681 * @syscap SystemCapability.DistributedHardware.DeviceManager 682 * @systemapi this method can be used only by system applications. 683 * @since 7 684 * @deprecated since 11 685 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.createDeviceManager 686 */ 687 function createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void; 688 689 /** 690 * Provides methods for managing devices. 691 * 692 * @interface DeviceManager 693 * @syscap SystemCapability.DistributedHardware.DeviceManager 694 * @since 7 695 * @deprecated since 11 696 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager 697 */ 698 interface DeviceManager { 699 /** 700 * Releases the {@code DeviceManager} instance after the methods for device management are no longer used. 701 * 702 * @permission ohos.permission.ACCESS_SERVICE_DM 703 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 704 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 705 * @throws { BusinessError } 11600101 - Failed to execute the function. 706 * @syscap SystemCapability.DistributedHardware.DeviceManager 707 * @systemapi this method can be used only by system applications. 708 * @since 7 709 * @deprecated since 11 710 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.releaseDeviceManager 711 */ 712 release(): void; 713 714 /** 715 * Obtains a list of trusted devices. 716 * 717 * @permission ohos.permission.ACCESS_SERVICE_DM 718 * @returns { Array<DeviceInfo> } returns a list of trusted devices. 719 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 720 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 721 * @throws { BusinessError } 11600101 - Failed to execute the function. 722 * @syscap SystemCapability.DistributedHardware.DeviceManager 723 * @systemapi this method can be used only by system applications. 724 * @since 7 725 * @deprecated since 11 726 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getAvailableDeviceListSync 727 */ 728 getTrustedDeviceListSync(): Array<DeviceInfo>; 729 730 /** 731 * Obtains a list of trusted devices. 732 * 733 * @permission ohos.permission.ACCESS_SERVICE_DM 734 * @param { boolean } isRefresh Refresh the online device list to quickly bring nearby trusted devices online. 735 * @returns { Array<DeviceInfo> } Returns a list of trusted devices. 736 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 737 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 738 * @throws { BusinessError } 401 - Parameter error. Possible causes: 739 * 1. Mandatory parameters are left unspecified; 740 * 2. Incorrect parameter type; 741 * 3. Parameter verification failed. 742 * @throws { BusinessError } 11600101 - Failed to execute the function. 743 * @syscap SystemCapability.DistributedHardware.DeviceManager 744 * @systemapi this method can be used only by system applications. 745 * @since 10 746 * @deprecated since 11 747 */ 748 getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>; 749 750 /** 751 * Obtains a list of trusted devices. 752 * 753 * @permission ohos.permission.ACCESS_SERVICE_DM 754 * @param { AsyncCallback<Array<DeviceInfo>> } callback Indicates the callback to be invoked upon getTrustedDeviceList 755 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 756 * @throws { BusinessError } 401 - Parameter error. Possible causes: 757 * 1. Mandatory parameters are left unspecified; 758 * 2. Incorrect parameter type; 759 * 3. Parameter verification failed. 760 * @syscap SystemCapability.DistributedHardware.DeviceManager 761 * @systemapi this method can be used only by system applications. 762 * @since 8 763 * @deprecated since 11 764 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getAvailableDeviceList 765 */ 766 getTrustedDeviceList(callback: AsyncCallback<Array<DeviceInfo>>): void; 767 768 /** 769 * Obtains a list of trusted devices. 770 * 771 * @permission ohos.permission.ACCESS_SERVICE_DM 772 * @returns { Promise<Array<DeviceInfo>> } Returns a list of trusted devices. 773 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 774 * @syscap SystemCapability.DistributedHardware.DeviceManager 775 * @systemapi this method can be used only by system applications. 776 * @since 8 777 * @deprecated since 11 778 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getAvailableDeviceList 779 */ 780 getTrustedDeviceList(): Promise<Array<DeviceInfo>>; 781 782 /** 783 * Obtains local device info 784 * 785 * @permission ohos.permission.ACCESS_SERVICE_DM 786 * @returns { DeviceInfo } Returns local device info. 787 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 788 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 789 * @throws { BusinessError } 11600101 - Failed to execute the function. 790 * @syscap SystemCapability.DistributedHardware.DeviceManager 791 * @systemapi this method can be used only by system applications. 792 * @since 8 793 * @deprecated since 11 794 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getLocalDeviceNetworkId 795 */ 796 getLocalDeviceInfoSync(): DeviceInfo; 797 798 /** 799 * Obtains local device info 800 * 801 * @permission ohos.permission.ACCESS_SERVICE_DM 802 * @param { AsyncCallback<DeviceInfo> } callback Indicates the callback to be invoked upon getLocalDeviceInfo 803 * @throws { BusinessError } 401 - Parameter error. Possible causes: 804 * 1. Mandatory parameters are left unspecified; 805 * 2. Incorrect parameter type; 806 * 3. Parameter verification failed. 807 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 808 * @syscap SystemCapability.DistributedHardware.DeviceManager 809 * @systemapi this method can be used only by system applications. 810 * @since 8 811 * @deprecated since 11 812 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getLocalDeviceNetworkId 813 */ 814 getLocalDeviceInfo(callback: AsyncCallback<DeviceInfo>): void; 815 816 /** 817 * Obtains local device info 818 * 819 * @permission ohos.permission.ACCESS_SERVICE_DM 820 * @returns { Promise<DeviceInfo> } Returns local device info. 821 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 822 * @syscap SystemCapability.DistributedHardware.DeviceManager 823 * @systemapi this method can be used only by system applications. 824 * @since 8 825 * @deprecated since 11 826 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getLocalDeviceNetworkId 827 */ 828 getLocalDeviceInfo(): Promise<DeviceInfo>; 829 830 /** 831 * Obtains device info 832 * 833 * @permission ohos.permission.ACCESS_SERVICE_DM 834 * @param { string } networkId - device network id. 835 * @param { AsyncCallback<DeviceInfo> } callback - Indicates the callback to be invoked upon getDeviceInfo. 836 * @throws { BusinessError } 401 - Parameter error. Possible causes: 837 * 1. Mandatory parameters are left unspecified; 838 * 2. Incorrect parameter type; 839 * 3. Parameter verification failed; 840 * 4. The size of specified networkId is greater than 255. 841 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 842 * @syscap SystemCapability.DistributedHardware.DeviceManager 843 * @systemapi this method can be used only by system applications. 844 * @since 10 845 * @deprecated since 11 846 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getDeviceName 847 */ 848 getDeviceInfo(networkId: string, callback: AsyncCallback<DeviceInfo>): void; 849 850 /** 851 * Obtains device info 852 * 853 * @permission ohos.permission.ACCESS_SERVICE_DM 854 * @param { string } networkId - device network id. 855 * @returns { Promise<DeviceInfo> } Returns device info. 856 * @throws { BusinessError } 401 - Parameter error. Possible causes: 857 * 1. Mandatory parameters are left unspecified; 858 * 2. Incorrect parameter type; 859 * 3. Parameter verification failed; 860 * 4. The size of specified networkId is greater than 255. 861 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 862 * @syscap SystemCapability.DistributedHardware.DeviceManager 863 * @systemapi this method can be used only by system applications. 864 * @since 10 865 * @deprecated since 11 866 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#getDeviceName 867 */ 868 getDeviceInfo(networkId: string): Promise<DeviceInfo>; 869 870 /** 871 * Start to discover device. 872 * 873 * @permission ohos.permission.ACCESS_SERVICE_DM 874 * @param { SubscribeInfo } subscribeInfo subscribe info to discovery device 875 * @throws { BusinessError } 401 - Parameter error. Possible causes: 876 * 1. Mandatory parameters are left unspecified; 877 * 2. Incorrect parameter type; 878 * 3. Parameter verification failed; 879 * 4. The size of specified param is greater than 255. 880 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 881 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 882 * @throws { BusinessError } 11600104 - Discovery unavailable. 883 * @throws { BusinessError } 11600101 - Failed to execute the function. 884 * @syscap SystemCapability.DistributedHardware.DeviceManager 885 * @systemapi this method can be used only by system applications. 886 * @since 8 887 * @deprecated since 11 888 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#startDiscovering 889 */ 890 startDeviceDiscovery(subscribeInfo: SubscribeInfo): void; 891 892 /** 893 * Start to discover device. 894 * 895 * @permission ohos.permission.ACCESS_SERVICE_DM 896 * @param { SubscribeInfo } subscribeInfo subscribe info to discovery device 897 * @param { string } filterOptions filterOptions to filter discovery device 898 * @throws { BusinessError } 401 - Parameter error. Possible causes: 899 * 1. Mandatory parameters are left unspecified; 900 * 2. Incorrect parameter type; 901 * 3. Parameter verification failed; 902 * 4. The size of specified param is greater than 255. 903 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 904 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 905 * @throws { BusinessError } 11600104 - Discovery unavailable. 906 * @throws { BusinessError } 11600101 - Failed to execute the function. 907 * @syscap SystemCapability.DistributedHardware.DeviceManager 908 * @systemapi this method can be used only by system applications. 909 * @since 9 910 * @deprecated since 11 911 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#startDiscovering 912 */ 913 startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void; 914 915 /** 916 * Stop to discover device. 917 * 918 * @permission ohos.permission.ACCESS_SERVICE_DM 919 * @param { number } subscribeId Service subscribe ID 920 * @throws { BusinessError } 401 - Parameter error. Possible causes: 921 * 1. Mandatory parameters are left unspecified; 922 * 2. Incorrect parameter type; 923 * 3. Parameter verification failed; 924 * 4. The size of specified param is greater than 255. 925 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 926 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 927 * @throws { BusinessError } 11600101 - Failed to execute the function. 928 * @syscap SystemCapability.DistributedHardware.DeviceManager 929 * @systemapi this method can be used only by system applications. 930 * @since 7 931 * @deprecated since 11 932 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#stopDiscovering 933 */ 934 stopDeviceDiscovery(subscribeId: number): void; 935 936 /** 937 * Publish discover device. 938 * 939 * @permission ohos.permission.ACCESS_SERVICE_DM 940 * @param { PublishInfo } publishInfo publish info to Publish discovery device 941 * @throws { BusinessError } 401 - Parameter error. Possible causes: 942 * 1. Mandatory parameters are left unspecified; 943 * 2. Incorrect parameter type; 944 * 3. Parameter verification failed. 945 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 946 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 947 * @throws { BusinessError } 11600105 - Publish unavailable. 948 * @throws { BusinessError } 11600101 - Failed to execute the function. 949 * @syscap SystemCapability.DistributedHardware.DeviceManager 950 * @systemapi this method can be used only by system applications. 951 * @since 9 952 * @deprecated since 11 953 */ 954 publishDeviceDiscovery(publishInfo: PublishInfo): void; 955 956 /** 957 * UnPublish discover device. 958 * 959 * @permission ohos.permission.ACCESS_SERVICE_DM 960 * @param { number } publishId Service publish ID, identify a publish operation, should be a unique id in package range 961 * @throws { BusinessError } 401 - Parameter error. Possible causes: 962 * 1. Mandatory parameters are left unspecified; 963 * 2. Incorrect parameter type; 964 * 3. Parameter verification failed. 965 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 966 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 967 * @throws { BusinessError } 11600101 - Failed to execute the function. 968 * @syscap SystemCapability.DistributedHardware.DeviceManager 969 * @systemapi this method can be used only by system applications. 970 * @since 9 971 * @deprecated since 11 972 */ 973 unPublishDeviceDiscovery(publishId: number): void; 974 975 /** 976 * Authenticate the specified device. 977 * 978 * @permission ohos.permission.ACCESS_SERVICE_DM 979 * @param { DeviceInfo } deviceInfo deviceInfo of device to authenticate 980 * @param { AuthParam } authParam authParam of device to authenticate 981 * @param { AsyncCallback<{ deviceId: string, pinToken?: number }> } callback Indicates the callback to be invoked upon authenticateDevice 982 * @throws { BusinessError } 401 - Parameter error. Possible causes: 983 * 1. Mandatory parameters are left unspecified; 984 * 2. Incorrect parameter type; 985 * 3. Parameter verification failed. 986 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 987 * @syscap SystemCapability.DistributedHardware.DeviceManager 988 * @systemapi this method can be used only by system applications. 989 * @since 7 990 * @deprecated since 11 991 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#bindTarget 992 */ 993 authenticateDevice( 994 deviceInfo: DeviceInfo, 995 authParam: AuthParam, 996 callback: AsyncCallback<{ deviceId: string, pinToken?: number }> 997 ): void; 998 999 /** 1000 * unAuthenticate the specified device. 1001 * 1002 * @permission ohos.permission.ACCESS_SERVICE_DM 1003 * @param { DeviceInfo } deviceInfo deviceInfo of device to unAuthenticate 1004 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1005 * 1. Mandatory parameters are left unspecified; 1006 * 2. Incorrect parameter type; 1007 * 3. Parameter verification failed. 1008 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1009 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1010 * @throws { BusinessError } 11600101 - Failed to execute the function. 1011 * @syscap SystemCapability.DistributedHardware.DeviceManager 1012 * @systemapi this method can be used only by system applications. 1013 * @since 8 1014 * @deprecated since 11 1015 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#unbindTarget 1016 */ 1017 unAuthenticateDevice(deviceInfo: DeviceInfo): void; 1018 1019 /** 1020 * verify auth info, such as pin code. 1021 * 1022 * @permission ohos.permission.ACCESS_SERVICE_DM 1023 * @param { AuthInfo } authInfo device auth info o verify 1024 * @param { AsyncCallback<{ deviceId: string, level: number }> } callback Indicates the callback to be invoked upon verifyAuthInfo 1025 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1026 * 1. Mandatory parameters are left unspecified; 1027 * 2. Incorrect parameter type; 1028 * 3. Parameter verification failed. 1029 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1030 * @syscap SystemCapability.DistributedHardware.DeviceManager 1031 * @systemapi this method can be used only by system applications. 1032 * @since 7 1033 * @deprecated since 11 1034 */ 1035 verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{ deviceId: string, level: number }>): void; 1036 1037 /** 1038 * Set user Operation from devicemanager Sea, this interface can only be used by devicemanager Sea. 1039 * 1040 * @permission ohos.permission.ACCESS_SERVICE_DM 1041 * @param { number } operateAction User Operation Actions. 1042 * @param { string } params Indicates the input param of the user. 1043 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1044 * 1. Mandatory parameters are left unspecified; 1045 * 2. Incorrect parameter type; 1046 * 3. Parameter verification failed; 1047 * 4. The size of specified params is greater than 255. 1048 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1049 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1050 * @syscap SystemCapability.DistributedHardware.DeviceManager 1051 * @systemapi this method can be used only by system applications. 1052 * @since 9 1053 * @deprecated since 11 1054 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#replyUiAction 1055 */ 1056 setUserOperation(operateAction: number, params: string): void; 1057 1058 /** 1059 * Request credential information. 1060 * 1061 * @permission ohos.permission.ACCESS_SERVICE_DM 1062 * @param { string } requestInfo - Request credential params, the params is json string, it includes version and userId. 1063 * @param { AsyncCallback<{ registerInfo: string }> } callback Indicates the callback to be invoked upon requestCredential 1064 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1065 * 1. Mandatory parameters are left unspecified; 1066 * 2. Incorrect parameter type; 1067 * 3. Parameter verification failed; 1068 * 4. The size of specified requestInfo is greater than 255. 1069 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1070 * @syscap SystemCapability.DistributedHardware.DeviceManager 1071 * @systemapi this method can be used only by system applications. 1072 * @since 10 1073 * @deprecated since 11 1074 */ 1075 requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{ registerInfo: string }>): void; 1076 1077 /** 1078 * Import credential information. 1079 * 1080 * @permission ohos.permission.ACCESS_SERVICE_DM 1081 * @param { string } credentialInfo - Import credential params, the params is json string, it includes processType, authType, 1082 * userId, deviceId, version, devicePk and credentialData, the credentialData is array, each array element 1083 * include credentialType, credentialId, serverPk, pkInfoSignature, pkInfo, authCode, peerDeviceId. 1084 * @param { AsyncCallback<{ resultInfo: string }> } callback Indicates the callback to be invoked upon importCredential. 1085 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1086 * 1. Mandatory parameters are left unspecified; 1087 * 2. Incorrect parameter type; 1088 * 3. Parameter verification failed; 1089 * 4. The size of specified credentialInfo is greater than 5999. 1090 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1091 * @syscap SystemCapability.DistributedHardware.DeviceManager 1092 * @systemapi this method can be used only by system applications. 1093 * @since 10 1094 * @deprecated since 11 1095 */ 1096 importCredential(credentialInfo: string, callback: AsyncCallback<{ resultInfo: string }>): void; 1097 1098 /** 1099 * delete credential information. 1100 * 1101 * @permission ohos.permission.ACCESS_SERVICE_DM 1102 * @param { string } queryInfo - delete credential params. the params is json string, it includes processType, authType, userId. 1103 * @param { AsyncCallback<{ resultInfo: string }> } callback Indicates the callback to be invoked upon deleteCredential 1104 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1105 * 1. Mandatory parameters are left unspecified; 1106 * 2. Incorrect parameter type; 1107 * 3. Parameter verification failed; 1108 * 4. The size of specified queryInfo is greater than 5999. 1109 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1110 * @syscap SystemCapability.DistributedHardware.DeviceManager 1111 * @systemapi this method can be used only by system applications. 1112 * @since 10 1113 * @deprecated since 11 1114 */ 1115 deleteCredential(queryInfo: string, callback: AsyncCallback<{ resultInfo: string }>): void; 1116 1117 /** 1118 * Register a callback from deviceManager service so that the devicemanager ui can be notified when ui statue 1119 * changes. 1120 * 1121 * @permission ohos.permission.ACCESS_SERVICE_DM 1122 * @param { 'uiStateChange' } type Ui state to unregister. 1123 * @param { Callback<{ param: string }> } callback Indicates the devicemanager ui state to register. 1124 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1125 * 1. Mandatory parameters are left unspecified; 1126 * 2. Incorrect parameter type; 1127 * 3. Parameter verification failed; 1128 * 4. The size of specified eventType is greater than 255. 1129 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1130 * @syscap SystemCapability.DistributedHardware.DeviceManager 1131 * @systemapi this method can be used only by system applications. 1132 * @since 9 1133 * @deprecated since 11 1134 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#on 1135 */ 1136 on(type: 'uiStateChange', callback: Callback<{ param: string }>): void; 1137 1138 /** 1139 * Unregister uiStatueChange, this interface can only be used by devicemanager ui. 1140 *ui state change 1141 * 1142 * @permission ohos.permission.ACCESS_SERVICE_DM 1143 * @param { 'uiStateChange' } type Ui state to unregister. 1144 * @param { Callback<{ param: string }> } callback Indicates the devicemanager ui state to unregister. 1145 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1146 * 1. Mandatory parameters are left unspecified; 1147 * 2. Incorrect parameter type; 1148 * 3. Parameter verification failed; 1149 * 4. The size of specified eventType is greater than 255. 1150 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1151 * @syscap SystemCapability.DistributedHardware.DeviceManager 1152 * @systemapi this method can be used only by system applications. 1153 * @since 9 1154 * @deprecated since 11 1155 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#off 1156 */ 1157 off(type: 'uiStateChange', callback?: Callback<{ param: string }>): void; 1158 1159 /** 1160 * Register a device state callback so that the application can be notified upon device state changes based on 1161 * the application bundle name. 1162 * 1163 * @permission ohos.permission.ACCESS_SERVICE_DM 1164 * @param { 'deviceStateChange' } type Device status change. 1165 * @param { Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }> } callback 1166 * Indicates the device state callback to register. 1167 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1168 * 1. Mandatory parameters are left unspecified; 1169 * 2. Incorrect parameter type; 1170 * 3. Parameter verification failed; 1171 * 4. The size of specified eventType is greater than 255. 1172 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1173 * @syscap SystemCapability.DistributedHardware.DeviceManager 1174 * @systemapi this method can be used only by system applications. 1175 * @since 7 1176 * @deprecated since 11 1177 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#on 1178 */ 1179 on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; 1180 1181 /** 1182 * UnRegister device state callback based on the application bundle name. 1183 * 1184 * @permission ohos.permission.ACCESS_SERVICE_DM 1185 * @param { 'deviceStateChange' } type Device status change. 1186 * @param { Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }> } callback Indicates the device state callback to register. 1187 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1188 * 1. Mandatory parameters are left unspecified; 1189 * 2. Incorrect parameter type; 1190 * 3. Parameter verification failed; 1191 * 4. The size of specified eventType is greater than 255. 1192 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1193 * @syscap SystemCapability.DistributedHardware.DeviceManager 1194 * @systemapi this method can be used only by system applications. 1195 * @since 7 1196 * @deprecated since 11 1197 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#off 1198 */ 1199 off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; 1200 1201 /** 1202 * Register a device found callback so that the application can be notified when the device was found 1203 * 1204 * @permission ohos.permission.ACCESS_SERVICE_DM 1205 * @param { 'deviceFound' } type Successfully discovered device. 1206 * @param { Callback<{ subscribeId: number, device: DeviceInfo }> } callback Indicates the device found callback to register. 1207 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1208 * 1. Mandatory parameters are left unspecified; 1209 * 2. Incorrect parameter type; 1210 * 3. Parameter verification failed; 1211 * 4. The size of specified eventType is greater than 255. 1212 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1213 * @syscap SystemCapability.DistributedHardware.DeviceManager 1214 * @systemapi this method can be used only by system applications. 1215 * @since 7 1216 * @deprecated since 11 1217 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#on 1218 */ 1219 on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void; 1220 1221 /** 1222 * UnRegister a device found callback so that the application can be notified when the device was found 1223 * 1224 * @permission ohos.permission.ACCESS_SERVICE_DM 1225 * @param { 'deviceFound' } type Successfully discovered device. 1226 * @param { Callback<{ subscribeId: number, device: DeviceInfo }> } callback Indicates the device found callback to register. 1227 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1228 * 1. Mandatory parameters are left unspecified; 1229 * 2. Incorrect parameter type; 1230 * 3. Parameter verification failed; 1231 * 4. The size of specified eventType is greater than 255. 1232 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1233 * @syscap SystemCapability.DistributedHardware.DeviceManager 1234 * @systemapi this method can be used only by system applications. 1235 * @since 7 1236 * @deprecated since 11 1237 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#off 1238 */ 1239 off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void; 1240 1241 /** 1242 * Register a device found result callback so that the application can be notified when the device discover was failed 1243 * 1244 * @permission ohos.permission.ACCESS_SERVICE_DM 1245 * @param { 'discoverFail' } type Discovery Device Failure. 1246 * @param { Callback<{ subscribeId: number, reason: number }> } callback Indicates the device found result callback to register. 1247 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1248 * 1. Mandatory parameters are left unspecified; 1249 * 2. Incorrect parameter type; 1250 * 3. Parameter verification failed; 1251 * 4. The size of specified eventType is greater than 255. 1252 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1253 * @syscap SystemCapability.DistributedHardware.DeviceManager 1254 * @systemapi this method can be used only by system applications. 1255 * @since 7 1256 * @deprecated since 11 1257 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#on 1258 */ 1259 on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): void; 1260 1261 /** 1262 * UnRegister a device found result callback so that the application can be notified when the device discover was failed 1263 * 1264 * @permission ohos.permission.ACCESS_SERVICE_DM 1265 * @param { 'discoverFail' } type Discovery Device Failure. 1266 * @param { Callback<{ subscribeId: number, reason: number }> } callback Indicates the device found result callback to register. 1267 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1268 * 1. Mandatory parameters are left unspecified; 1269 * 2. Incorrect parameter type; 1270 * 3. Parameter verification failed; 1271 * 4. The size of specified eventType is greater than 255. 1272 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1273 * @syscap SystemCapability.DistributedHardware.DeviceManager 1274 * @systemapi this method can be used only by system applications. 1275 * @since 7 1276 * @deprecated since 11 1277 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#off 1278 */ 1279 off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): void; 1280 1281 /** 1282 * Register a device publish result callback so that the application can be notified when the device publish success 1283 * 1284 * @permission ohos.permission.ACCESS_SERVICE_DM 1285 * @param { 'publishSuccess' } type Successfully published device. 1286 * @param { Callback<{ publishId: number }> } callback Indicates the device publish result callback to register. 1287 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1288 * 1. Mandatory parameters are left unspecified; 1289 * 2. Incorrect parameter type; 1290 * 3. Parameter verification failed; 1291 * 4. The size of specified eventType is greater than 255. 1292 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1293 * @syscap SystemCapability.DistributedHardware.DeviceManager 1294 * @systemapi this method can be used only by system applications. 1295 * @since 9 1296 * @deprecated since 11 1297 */ 1298 on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): void; 1299 1300 /** 1301 * UnRegister a device publish result callback so that the application can be notified when the device publish was failed 1302 * 1303 * @permission ohos.permission.ACCESS_SERVICE_DM 1304 * @param { 'publishSuccess' } type Successfully published device. 1305 * @param { Callback<{ publishId: number }> } callback Indicates the device publish result callback to register. 1306 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1307 * 1. Mandatory parameters are left unspecified; 1308 * 2. Incorrect parameter type; 1309 * 3. Parameter verification failed; 1310 * 4. The size of specified eventType is greater than 255. 1311 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1312 * @syscap SystemCapability.DistributedHardware.DeviceManager 1313 * @systemapi this method can be used only by system applications. 1314 * @since 9 1315 * @deprecated since 11 1316 */ 1317 off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): void; 1318 1319 /** 1320 * Register a device publish result callback so that the application can be notified when the device publish was failed 1321 * 1322 * @permission ohos.permission.ACCESS_SERVICE_DM 1323 * @param { 'publishFail' } type Failed to publish device. 1324 * @param { Callback<{ publishId: number, reason: number }> } callback Indicates the device publish result callback to register. 1325 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1326 * 1. Mandatory parameters are left unspecified; 1327 * 2. Incorrect parameter type; 1328 * 3. Parameter verification failed; 1329 * 4. The size of specified eventType is greater than 255. 1330 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1331 * @syscap SystemCapability.DistributedHardware.DeviceManager 1332 * @systemapi this method can be used only by system applications. 1333 * @since 9 1334 * @deprecated since 11 1335 */ 1336 on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): void; 1337 1338 /** 1339 * UnRegister a device publish result callback so that the application can be notified when the device publish was failed 1340 * 1341 * @permission ohos.permission.ACCESS_SERVICE_DM 1342 * @param { 'publishFail' } type Failed to publish device. 1343 * @param { Callback<{ publishId: number, reason: number }> } callback Indicates the device publish result callback to register. 1344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1345 * 1. Mandatory parameters are left unspecified; 1346 * 2. Incorrect parameter type; 1347 * 3. Parameter verification failed; 1348 * 4. The size of specified eventType is greater than 255. 1349 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1350 * @syscap SystemCapability.DistributedHardware.DeviceManager 1351 * @systemapi this method can be used only by system applications. 1352 * @since 9 1353 * @deprecated since 11 1354 */ 1355 off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): void; 1356 1357 /** 1358 * Register a serviceError callback so that the application can be notified when devicemanager service died 1359 * 1360 * @permission ohos.permission.ACCESS_SERVICE_DM 1361 * @param { 'serviceDie' } type Service death. 1362 * @param { function } callback Indicates the service error callback to register. 1363 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1364 * 1. Mandatory parameters are left unspecified; 1365 * 2. Incorrect parameter type; 1366 * 3. Parameter verification failed; 1367 * 4. The size of specified eventType is greater than 255. 1368 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1369 * @syscap SystemCapability.DistributedHardware.DeviceManager 1370 * @systemapi this method can be used only by system applications. 1371 * @since 7 1372 * @deprecated since 11 1373 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#on 1374 */ 1375 on(type: 'serviceDie', callback: () => void): void; 1376 1377 /** 1378 * UnRegister a serviceError callback so that the application can be notified when devicemanager service died 1379 * 1380 * @permission ohos.permission.ACCESS_SERVICE_DM 1381 * @param { 'serviceDie' } type Service death. 1382 * @param { function } callback Indicates the service error callback to register. 1383 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1384 * 1. Mandatory parameters are left unspecified; 1385 * 2. Incorrect parameter type; 1386 * 3. Parameter verification failed; 1387 * 4. The size of specified eventType is greater than 255. 1388 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 1389 * @syscap SystemCapability.DistributedHardware.DeviceManager 1390 * @systemapi this method can be used only by system applications. 1391 * @since 7 1392 * @deprecated since 11 1393 * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager#off 1394 */ 1395 off(type: 'serviceDie', callback?: () => void): void; 1396 } 1397} 1398 1399export default deviceManager; 1400