1/* 2 * Copyright (c) 2021-2022 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 ConnectivityKit 19 */ 20 21import type { NfcATag as _NfcATag, NfcBTag as _NfcBTag, NfcFTag as _NfcFTag, NfcVTag as _NfcVTag } from './tag/nfctech'; 22import { 23 IsoDepTag as _IsoDepTag, 24 NdefTag as _NdefTag, 25 MifareClassicTag as _MifareClassicTag, 26 MifareUltralightTag as _MifareUltralightTag, 27 NdefFormatableTag as _NdefFormatableTag, 28 BarcodeTag as _BarcodeTag 29} from './tag/nfctech'; 30import { NdefMessage as _NdefMessage } from './tag/nfctech'; 31import { TagSession as _TagSession } from './tag/tagSession'; 32import type { PacMap } from './ability/dataAbilityHelper'; 33import type rpc from './@ohos.rpc'; 34import type { AsyncCallback } from './@ohos.base'; 35import Want from './@ohos.app.ability.Want'; 36import type { ElementName } from './bundleManager/ElementName'; 37 38/** 39 * Provides methods to operate or manage NFC tag. 40 * 41 * @namespace tag 42 * @syscap SystemCapability.Communication.NFC.Tag 43 * @since 7 44 */ 45/** 46 * Provides methods to operate or manage NFC tag. 47 * 48 * @namespace tag 49 * @syscap SystemCapability.Communication.NFC.Tag 50 * @atomicservice 51 * @since 12 52 */ 53declare namespace tag { 54 /** 55 * Indicates an NFC-A tag. 56 * 57 * @constant 58 * @syscap SystemCapability.Communication.NFC.Tag 59 * @since 7 60 */ 61 /** 62 * Indicates an NFC-A tag. 63 * 64 * @constant 65 * @syscap SystemCapability.Communication.NFC.Tag 66 * @atomicservice 67 * @since 12 68 */ 69 const NFC_A = 1; 70 71 /** 72 * Indicates an NFC-B tag. 73 * 74 * @constant 75 * @syscap SystemCapability.Communication.NFC.Tag 76 * @since 7 77 */ 78 /** 79 * Indicates an NFC-B tag. 80 * 81 * @constant 82 * @syscap SystemCapability.Communication.NFC.Tag 83 * @atomicservice 84 * @since 12 85 */ 86 const NFC_B = 2; 87 88 /** 89 * Indicates an ISO_DEP tag. 90 * 91 * @constant 92 * @syscap SystemCapability.Communication.NFC.Tag 93 * @since 7 94 */ 95 /** 96 * Indicates an ISO_DEP tag. 97 * 98 * @constant 99 * @syscap SystemCapability.Communication.NFC.Tag 100 * @atomicservice 101 * @since 12 102 */ 103 const ISO_DEP = 3; 104 105 /** 106 * Indicates an NFC-F tag. 107 * 108 * @constant 109 * @syscap SystemCapability.Communication.NFC.Tag 110 * @since 7 111 */ 112 /** 113 * Indicates an NFC-F tag. 114 * 115 * @constant 116 * @syscap SystemCapability.Communication.NFC.Tag 117 * @atomicservice 118 * @since 12 119 */ 120 const NFC_F = 4; 121 122 /** 123 * Indicates an NFC-V tag. 124 * 125 * @constant 126 * @syscap SystemCapability.Communication.NFC.Tag 127 * @since 7 128 */ 129 /** 130 * Indicates an NFC-V tag. 131 * 132 * @constant 133 * @syscap SystemCapability.Communication.NFC.Tag 134 * @atomicservice 135 * @since 12 136 */ 137 const NFC_V = 5; 138 139 /** 140 * Indicates an NDEF tag. 141 * 142 * @constant 143 * @syscap SystemCapability.Communication.NFC.Tag 144 * @since 7 145 */ 146 /** 147 * Indicates an NDEF tag. 148 * 149 * @constant 150 * @syscap SystemCapability.Communication.NFC.Tag 151 * @atomicservice 152 * @since 12 153 */ 154 const NDEF = 6; 155 156 /** 157 * Indicates an NDEF Formatable tag. 158 * 159 * @constant 160 * @syscap SystemCapability.Communication.NFC.Tag 161 * @since 9 162 */ 163 /** 164 * Indicates an NDEF Formatable tag. 165 * 166 * @constant 167 * @syscap SystemCapability.Communication.NFC.Tag 168 * @atomicservice 169 * @since 12 170 */ 171 const NDEF_FORMATABLE = 7; 172 173 /** 174 * Indicates an MIFARE CLASSIC tag. 175 * 176 * @constant 177 * @syscap SystemCapability.Communication.NFC.Tag 178 * @since 7 179 */ 180 /** 181 * Indicates an MIFARE CLASSIC tag. 182 * 183 * @constant 184 * @syscap SystemCapability.Communication.NFC.Tag 185 * @atomicservice 186 * @since 12 187 */ 188 const MIFARE_CLASSIC = 8; 189 190 /** 191 * Indicates an MIFARE ULTRALIGHT tag. 192 * 193 * @constant 194 * @syscap SystemCapability.Communication.NFC.Tag 195 * @since 7 196 */ 197 /** 198 * Indicates an MIFARE ULTRALIGHT tag. 199 * 200 * @constant 201 * @syscap SystemCapability.Communication.NFC.Tag 202 * @atomicservice 203 * @since 12 204 */ 205 const MIFARE_ULTRALIGHT = 9; 206 207 /** 208 * Indicates an NfcBarcode tag. 209 * 210 * @constant 211 * @syscap SystemCapability.Communication.NFC.Tag 212 * @atomicservice 213 * @since 18 214 */ 215 const NFC_BARCODE = 10; 216 217 /** 218 * TNF types definitions, see NFCForum-TS-NDEF_1.0. 219 * 220 * @enum { number } 221 * @syscap SystemCapability.Communication.NFC.Tag 222 * @since 9 223 */ 224 /** 225 * TNF types definitions, see NFCForum-TS-NDEF_1.0. 226 * 227 * @enum { number } 228 * @syscap SystemCapability.Communication.NFC.Tag 229 * @atomicservice 230 * @since 12 231 */ 232 enum TnfType { 233 /** 234 * Empty 235 * 236 * @syscap SystemCapability.Communication.NFC.Tag 237 * @since 9 238 */ 239 /** 240 * Empty 241 * 242 * @syscap SystemCapability.Communication.NFC.Tag 243 * @atomicservice 244 * @since 12 245 */ 246 TNF_EMPTY = 0x0, 247 248 /** 249 * NFC Forum well-known type [NFC RTD] 250 * 251 * @syscap SystemCapability.Communication.NFC.Tag 252 * @since 9 253 */ 254 /** 255 * NFC Forum well-known type [NFC RTD] 256 * 257 * @syscap SystemCapability.Communication.NFC.Tag 258 * @atomicservice 259 * @since 12 260 */ 261 TNF_WELL_KNOWN = 0x1, 262 263 /** 264 * Media-type as defined in RFC 2046 [RFC 2046] 265 * 266 * @syscap SystemCapability.Communication.NFC.Tag 267 * @since 9 268 */ 269 /** 270 * Media-type as defined in RFC 2046 [RFC 2046] 271 * 272 * @syscap SystemCapability.Communication.NFC.Tag 273 * @atomicservice 274 * @since 12 275 */ 276 TNF_MEDIA = 0x2, 277 278 /** 279 * Absolute URI as defined in RFC 3986 [RFC 3986] 280 * 281 * @syscap SystemCapability.Communication.NFC.Tag 282 * @since 9 283 */ 284 /** 285 * Absolute URI as defined in RFC 3986 [RFC 3986] 286 * 287 * @syscap SystemCapability.Communication.NFC.Tag 288 * @atomicservice 289 * @since 12 290 */ 291 TNF_ABSOLUTE_URI = 0x3, 292 293 /** 294 * NFC Forum external type [NFC RTD] 295 * 296 * @syscap SystemCapability.Communication.NFC.Tag 297 * @since 9 298 */ 299 /** 300 * NFC Forum external type [NFC RTD] 301 * 302 * @syscap SystemCapability.Communication.NFC.Tag 303 * @atomicservice 304 * @since 12 305 */ 306 TNF_EXT_APP = 0x4, 307 308 /** 309 * Unknown 310 * 311 * @syscap SystemCapability.Communication.NFC.Tag 312 * @since 9 313 */ 314 /** 315 * Unknown 316 * 317 * @syscap SystemCapability.Communication.NFC.Tag 318 * @atomicservice 319 * @since 12 320 */ 321 TNF_UNKNOWN = 0x5, 322 323 /** 324 * Unchanged (see section 2.3.3) 325 * 326 * @syscap SystemCapability.Communication.NFC.Tag 327 * @since 9 328 */ 329 /** 330 * Unchanged (see section 2.3.3) 331 * 332 * @syscap SystemCapability.Communication.NFC.Tag 333 * @atomicservice 334 * @since 12 335 */ 336 TNF_UNCHANGED = 0x6 337 } 338 339 /** 340 * NfcForum Type definition. The NDEF tag may use one of them. 341 * 342 * @enum { number } 343 * @syscap SystemCapability.Communication.NFC.Tag 344 * @since 9 345 */ 346 /** 347 * NfcForum Type definition. The NDEF tag may use one of them. 348 * 349 * @enum { number } 350 * @syscap SystemCapability.Communication.NFC.Tag 351 * @atomicservice 352 * @since 12 353 */ 354 enum NfcForumType { 355 /** 356 * NFC FORUM TYPE 1 357 * 358 * @syscap SystemCapability.Communication.NFC.Tag 359 * @since 9 360 */ 361 /** 362 * NFC FORUM TYPE 1 363 * 364 * @syscap SystemCapability.Communication.NFC.Tag 365 * @atomicservice 366 * @since 12 367 */ 368 NFC_FORUM_TYPE_1 = 1, 369 370 /** 371 * NFC FORUM TYPE 2 372 * 373 * @syscap SystemCapability.Communication.NFC.Tag 374 * @since 9 375 */ 376 /** 377 * NFC FORUM TYPE 2 378 * 379 * @syscap SystemCapability.Communication.NFC.Tag 380 * @atomicservice 381 * @since 12 382 */ 383 NFC_FORUM_TYPE_2 = 2, 384 385 /** 386 * NFC FORUM TYPE 3 387 * 388 * @syscap SystemCapability.Communication.NFC.Tag 389 * @since 9 390 */ 391 /** 392 * NFC FORUM TYPE 3 393 * 394 * @syscap SystemCapability.Communication.NFC.Tag 395 * @atomicservice 396 * @since 12 397 */ 398 NFC_FORUM_TYPE_3 = 3, 399 400 /** 401 * NFC FORUM TYPE 4 402 * 403 * @syscap SystemCapability.Communication.NFC.Tag 404 * @since 9 405 */ 406 /** 407 * NFC FORUM TYPE 4 408 * 409 * @syscap SystemCapability.Communication.NFC.Tag 410 * @atomicservice 411 * @since 12 412 */ 413 NFC_FORUM_TYPE_4 = 4, 414 415 /** 416 * Mifare Classic 417 * 418 * @syscap SystemCapability.Communication.NFC.Tag 419 * @since 9 420 */ 421 /** 422 * Mifare Classic 423 * 424 * @syscap SystemCapability.Communication.NFC.Tag 425 * @atomicservice 426 * @since 12 427 */ 428 MIFARE_CLASSIC = 101 429 } 430 431 /** 432 * RTD type TEXT, see NFC Record Type Definition (RTD) Specification. 433 * 434 * @constant 435 * @syscap SystemCapability.Communication.NFC.Tag 436 * @since 9 437 */ 438 /** 439 * RTD type TEXT, see NFC Record Type Definition (RTD) Specification. 440 * 441 * @constant 442 * @syscap SystemCapability.Communication.NFC.Tag 443 * @atomicservice 444 * @since 12 445 */ 446 const RTD_TEXT: number[]; 447 448 /** 449 * RTD type URI, see NFC Record Type Definition (RTD) Specification. 450 * 451 * @constant 452 * @syscap SystemCapability.Communication.NFC.Tag 453 * @since 9 454 */ 455 /** 456 * RTD type URI, see NFC Record Type Definition (RTD) Specification. 457 * 458 * @constant 459 * @syscap SystemCapability.Communication.NFC.Tag 460 * @atomicservice 461 * @since 12 462 */ 463 const RTD_URI: number[]; 464 465 /** 466 * MifareClassic Type definition 467 * 468 * @enum { number } 469 * @syscap SystemCapability.Communication.NFC.Tag 470 * @since 9 471 */ 472 /** 473 * MifareClassic Type definition 474 * 475 * @enum { number } 476 * @syscap SystemCapability.Communication.NFC.Tag 477 * @atomicservice 478 * @since 12 479 */ 480 enum MifareClassicType { 481 /** 482 * Mifare Type unknown 483 * 484 * @syscap SystemCapability.Communication.NFC.Tag 485 * @since 9 486 */ 487 /** 488 * Mifare Type unknown 489 * 490 * @syscap SystemCapability.Communication.NFC.Tag 491 * @atomicservice 492 * @since 12 493 */ 494 TYPE_UNKNOWN = 0, 495 496 /** 497 * Mifare Classic 498 * 499 * @syscap SystemCapability.Communication.NFC.Tag 500 * @since 9 501 */ 502 /** 503 * Mifare Classic 504 * 505 * @syscap SystemCapability.Communication.NFC.Tag 506 * @atomicservice 507 * @since 12 508 */ 509 TYPE_CLASSIC = 1, 510 511 /** 512 * Mifare Plus 513 * 514 * @syscap SystemCapability.Communication.NFC.Tag 515 * @since 9 516 */ 517 /** 518 * Mifare Plus 519 * 520 * @syscap SystemCapability.Communication.NFC.Tag 521 * @atomicservice 522 * @since 12 523 */ 524 TYPE_PLUS = 2, 525 526 /** 527 * Mifare Pro 528 * 529 * @syscap SystemCapability.Communication.NFC.Tag 530 * @since 9 531 */ 532 /** 533 * Mifare Pro 534 * 535 * @syscap SystemCapability.Communication.NFC.Tag 536 * @atomicservice 537 * @since 12 538 */ 539 TYPE_PRO = 3 540 } 541 542 /** 543 * MifareClassic Tag size. 544 * 545 * @enum { number } 546 * @syscap SystemCapability.Communication.NFC.Tag 547 * @since 9 548 */ 549 /** 550 * MifareClassic Tag size. 551 * 552 * @enum { number } 553 * @syscap SystemCapability.Communication.NFC.Tag 554 * @atomicservice 555 * @since 12 556 */ 557 enum MifareClassicSize { 558 /** 559 * 5 sectors per tag, 4 blocks per sector 560 * 561 * @syscap SystemCapability.Communication.NFC.Tag 562 * @since 9 563 */ 564 /** 565 * 5 sectors per tag, 4 blocks per sector 566 * 567 * @syscap SystemCapability.Communication.NFC.Tag 568 * @atomicservice 569 * @since 12 570 */ 571 MC_SIZE_MINI = 320, 572 573 /** 574 * 16 sectors per tag, 4 blocks per sector 575 * 576 * @syscap SystemCapability.Communication.NFC.Tag 577 * @since 9 578 */ 579 /** 580 * 16 sectors per tag, 4 blocks per sector 581 * 582 * @syscap SystemCapability.Communication.NFC.Tag 583 * @atomicservice 584 * @since 12 585 */ 586 MC_SIZE_1K = 1024, 587 588 /** 589 * 32 sectors per tag, 4 blocks per sector 590 * 591 * @syscap SystemCapability.Communication.NFC.Tag 592 * @since 9 593 */ 594 /** 595 * 32 sectors per tag, 4 blocks per sector 596 * 597 * @syscap SystemCapability.Communication.NFC.Tag 598 * @atomicservice 599 * @since 12 600 */ 601 MC_SIZE_2K = 2048, 602 603 /** 604 * 40 sectors per tag, 4 blocks per sector 605 * 606 * @syscap SystemCapability.Communication.NFC.Tag 607 * @since 9 608 */ 609 /** 610 * 40 sectors per tag, 4 blocks per sector 611 * 612 * @syscap SystemCapability.Communication.NFC.Tag 613 * @atomicservice 614 * @since 12 615 */ 616 MC_SIZE_4K = 4096 617 } 618 619 /** 620 * MifareUltralight Type definition 621 * 622 * @enum { number } 623 * @syscap SystemCapability.Communication.NFC.Tag 624 * @since 9 625 */ 626 /** 627 * MifareUltralight Type definition 628 * 629 * @enum { number } 630 * @syscap SystemCapability.Communication.NFC.Tag 631 * @atomicservice 632 * @since 12 633 */ 634 enum MifareUltralightType { 635 /** 636 * Mifare Type unknown 637 * 638 * @syscap SystemCapability.Communication.NFC.Tag 639 * @since 9 640 */ 641 /** 642 * Mifare Type unknown 643 * 644 * @syscap SystemCapability.Communication.NFC.Tag 645 * @atomicservice 646 * @since 12 647 */ 648 TYPE_UNKNOWN = 0, 649 650 /** 651 * Mifare Ultralight 652 * 653 * @syscap SystemCapability.Communication.NFC.Tag 654 * @since 9 655 */ 656 /** 657 * Mifare Ultralight 658 * 659 * @syscap SystemCapability.Communication.NFC.Tag 660 * @atomicservice 661 * @since 12 662 */ 663 TYPE_ULTRALIGHT = 1, 664 665 /** 666 * Mifare UltralightC 667 * 668 * @syscap SystemCapability.Communication.NFC.Tag 669 * @since 9 670 */ 671 /** 672 * Mifare UltralightC 673 * 674 * @syscap SystemCapability.Communication.NFC.Tag 675 * @atomicservice 676 * @since 12 677 */ 678 TYPE_ULTRALIGHT_C = 2 679 } 680 681 /** 682 * Obtains an {@link NfcATag} object based on the tag information. 683 * <p>During tag reading, if the tag supports the NFC-A technology, an {@link NfcATag} object 684 * will be created based on the tag information. 685 * 686 * @param { TagInfo } tagInfo Indicates the tag information. 687 * @returns { NfcATag } The {@link NfcATag} object. 688 * @syscap SystemCapability.Communication.NFC.Tag 689 * @since 7 690 * @deprecated since 9 691 * @useinstead ohos.nfc.tag/tag#getNfcA 692 */ 693 function getNfcATag(tagInfo: TagInfo): NfcATag; 694 695 /** 696 * Obtains an {@link NfcATag} object based on the tag information. 697 * During tag reading, if the tag supports the NFC-A technology, an {@link NfcATag} object 698 * will be created based on the tag information. 699 * 700 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 701 * @returns { NfcATag } {@link NfcATag} object. 702 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 703 * <br> 1. Mandatory parameters are left unspecified. 704 * <br> 2. Incorrect parameters types. 705 * <br> 3. Parameter verification failed. 706 * @throws { BusinessError } 801 - Capability not supported. 707 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 708 * @syscap SystemCapability.Communication.NFC.Tag 709 * @since 9 710 */ 711 /** 712 * Obtains an {@link NfcATag} object based on the tag information. 713 * During tag reading, if the tag supports the NFC-A technology, an {@link NfcATag} object 714 * will be created based on the tag information. 715 * 716 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 717 * @returns { NfcATag } {@link NfcATag} object. 718 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 719 * <br> 1. Mandatory parameters are left unspecified. 720 * <br> 2. Incorrect parameters types. 721 * <br> 3. Parameter verification failed. 722 * @throws { BusinessError } 801 - Capability not supported. 723 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 724 * @syscap SystemCapability.Communication.NFC.Tag 725 * @atomicservice 726 * @since 12 727 */ 728 function getNfcA(tagInfo: TagInfo): NfcATag; 729 730 /** 731 * Obtains an {@link NfcBTag} object based on the tag information. 732 * <p>During tag reading, if the tag supports the NFC-B technology, an {@link NfcBTag} object 733 * will be created based on the tag information. 734 * 735 * @param { TagInfo } tagInfo Indicates the tag information. 736 * @returns { NfcBTag } The {@link NfcBTag} object. 737 * @syscap SystemCapability.Communication.NFC.Tag 738 * @since 7 739 * @deprecated since 9 740 * @useinstead ohos.nfc.tag/tag#getNfcB 741 */ 742 function getNfcBTag(tagInfo: TagInfo): NfcBTag; 743 744 /** 745 * Obtains an {@link NfcBTag} object based on the tag information. 746 * During tag reading, if the tag supports the NFC-B technology, an {@link NfcBTag} object 747 * will be created based on the tag information. 748 * 749 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 750 * @returns { NfcBTag } The {@link NfcBTag} object. 751 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 752 * <br> 1. Mandatory parameters are left unspecified. 753 * <br> 2. Incorrect parameters types. 754 * <br> 3. Parameter verification failed. 755 * @throws { BusinessError } 801 - Capability not supported. 756 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 757 * @syscap SystemCapability.Communication.NFC.Tag 758 * @since 9 759 */ 760 /** 761 * Obtains an {@link NfcBTag} object based on the tag information. 762 * During tag reading, if the tag supports the NFC-B technology, an {@link NfcBTag} object 763 * will be created based on the tag information. 764 * 765 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 766 * @returns { NfcBTag } The {@link NfcBTag} object. 767 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 768 * <br> 1. Mandatory parameters are left unspecified. 769 * <br> 2. Incorrect parameters types. 770 * <br> 3. Parameter verification failed. 771 * @throws { BusinessError } 801 - Capability not supported. 772 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 773 * @syscap SystemCapability.Communication.NFC.Tag 774 * @atomicservice 775 * @since 12 776 */ 777 function getNfcB(tagInfo: TagInfo): NfcBTag; 778 779 /** 780 * Obtains an {@link NfcFTag} object based on the tag information. 781 * <p>During tag reading, if the tag supports the NFC-F technology, an {@link NfcFTag} object 782 * will be created based on the tag information. 783 * 784 * @param { TagInfo } tagInfo Indicates the tag information. 785 * @returns { NfcFTag } The {@link NfcFTag} object. 786 * @syscap SystemCapability.Communication.NFC.Tag 787 * @since 7 788 * @deprecated since 9 789 * @useinstead ohos.nfc.tag/tag#getNfcF 790 */ 791 function getNfcFTag(tagInfo: TagInfo): NfcFTag; 792 793 /** 794 * Obtains an {@link NfcFTag} object based on the tag information. 795 * During tag reading, if the tag supports the NFC-F technology, an {@link NfcFTag} object 796 * will be created based on the tag information. 797 * 798 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 799 * @returns { NfcFTag } The {@link NfcFTag} object. 800 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 801 * <br> 1. Mandatory parameters are left unspecified. 802 * <br> 2. Incorrect parameters types. 803 * <br> 3. Parameter verification failed. 804 * @throws { BusinessError } 801 - Capability not supported. 805 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 806 * @syscap SystemCapability.Communication.NFC.Tag 807 * @since 9 808 */ 809 /** 810 * Obtains an {@link NfcFTag} object based on the tag information. 811 * During tag reading, if the tag supports the NFC-F technology, an {@link NfcFTag} object 812 * will be created based on the tag information. 813 * 814 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 815 * @returns { NfcFTag } The {@link NfcFTag} object. 816 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 817 * <br> 1. Mandatory parameters are left unspecified. 818 * <br> 2. Incorrect parameters types. 819 * <br> 3. Parameter verification failed. 820 * @throws { BusinessError } 801 - Capability not supported. 821 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 822 * @syscap SystemCapability.Communication.NFC.Tag 823 * @atomicservice 824 * @since 12 825 */ 826 function getNfcF(tagInfo: TagInfo): NfcFTag; 827 828 /** 829 * Obtains an {@link NfcVTag} object based on the tag information. 830 * <p>During tag reading, if the tag supports the NFC-V technology, an {@link NfcVTag} object 831 * will be created based on the tag information. 832 * 833 * @param { TagInfo } tagInfo Indicates the tag information. 834 * @returns { NfcVTag } The {@link NfcVTag} object. 835 * @syscap SystemCapability.Communication.NFC.Tag 836 * @since 7 837 * @deprecated since 9 838 * @useinstead ohos.nfc.tag/tag#getNfcV 839 */ 840 function getNfcVTag(tagInfo: TagInfo): NfcVTag; 841 842 /** 843 * Obtains an {@link NfcVTag} object based on the tag information. 844 * During tag reading, if the tag supports the NFC-V technology, an {@link NfcVTag} object 845 * will be created based on the tag information. 846 * 847 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 848 * @returns { NfcVTag } The {@link NfcVTag} object. 849 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 850 * <br> 1. Mandatory parameters are left unspecified. 851 * <br> 2. Incorrect parameters types. 852 * <br> 3. Parameter verification failed. 853 * @throws { BusinessError } 801 - Capability not supported. 854 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 855 * @syscap SystemCapability.Communication.NFC.Tag 856 * @since 9 857 */ 858 /** 859 * Obtains an {@link NfcVTag} object based on the tag information. 860 * During tag reading, if the tag supports the NFC-V technology, an {@link NfcVTag} object 861 * will be created based on the tag information. 862 * 863 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 864 * @returns { NfcVTag } The {@link NfcVTag} object. 865 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 866 * <br> 1. Mandatory parameters are left unspecified. 867 * <br> 2. Incorrect parameters types. 868 * <br> 3. Parameter verification failed. 869 * @throws { BusinessError } 801 - Capability not supported. 870 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 871 * @syscap SystemCapability.Communication.NFC.Tag 872 * @atomicservice 873 * @since 12 874 */ 875 function getNfcV(tagInfo: TagInfo): NfcVTag; 876 877 /** 878 * Obtains an {@link IsoDepTag} object based on the tag information. 879 * During tag reading, if the tag supports the IsoDep technology, an {@link IsoDepTag} object 880 * will be created based on the tag information. 881 * 882 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 883 * @returns { IsoDepTag } The {@link IsoDepTag} object. 884 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 885 * <br> 1. Mandatory parameters are left unspecified. 886 * <br> 2. Incorrect parameters types. 887 * <br> 3. Parameter verification failed. 888 * @throws { BusinessError } 801 - Capability not supported. 889 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 890 * @syscap SystemCapability.Communication.NFC.Tag 891 * @since 9 892 */ 893 /** 894 * Obtains an {@link IsoDepTag} object based on the tag information. 895 * During tag reading, if the tag supports the IsoDep technology, an {@link IsoDepTag} object 896 * will be created based on the tag information. 897 * 898 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 899 * @returns { IsoDepTag } The {@link IsoDepTag} object. 900 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 901 * <br> 1. Mandatory parameters are left unspecified. 902 * <br> 2. Incorrect parameters types. 903 * <br> 3. Parameter verification failed. 904 * @throws { BusinessError } 801 - Capability not supported. 905 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 906 * @syscap SystemCapability.Communication.NFC.Tag 907 * @atomicservice 908 * @since 12 909 */ 910 function getIsoDep(tagInfo: TagInfo): IsoDepTag; 911 912 /** 913 * Obtains an {@link NdefTag} object based on the tag information. 914 * During tag reading, if the tag supports the NDEF technology, an {@link NdefTag} object 915 * will be created based on the tag information. 916 * 917 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 918 * @returns { NdefTag } The {@link NdefTag} object. 919 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 920 * <br> 1. Mandatory parameters are left unspecified. 921 * <br> 2. Incorrect parameters types. 922 * <br> 3. Parameter verification failed. 923 * @throws { BusinessError } 801 - Capability not supported. 924 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 925 * @syscap SystemCapability.Communication.NFC.Tag 926 * @since 9 927 */ 928 /** 929 * Obtains an {@link NdefTag} object based on the tag information. 930 * During tag reading, if the tag supports the NDEF technology, an {@link NdefTag} object 931 * will be created based on the tag information. 932 * 933 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 934 * @returns { NdefTag } The {@link NdefTag} object. 935 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 936 * <br> 1. Mandatory parameters are left unspecified. 937 * <br> 2. Incorrect parameters types. 938 * <br> 3. Parameter verification failed. 939 * @throws { BusinessError } 801 - Capability not supported. 940 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 941 * @syscap SystemCapability.Communication.NFC.Tag 942 * @atomicservice 943 * @since 12 944 */ 945 function getNdef(tagInfo: TagInfo): NdefTag; 946 947 /** 948 * Obtains an {@link MifareClassicTag} object based on the tag information. 949 * During tag reading, if the tag supports the MIFARE Classic technology, 950 * an {@link MifareClassicTag} object will be created based on the tag information. 951 * 952 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 953 * @returns { MifareClassicTag } The {@link MifareClassicTag} object. 954 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 955 * <br> 1. Mandatory parameters are left unspecified. 956 * <br> 2. Incorrect parameters types. 957 * <br> 3. Parameter verification failed. 958 * @throws { BusinessError } 801 - Capability not supported. 959 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 960 * @syscap SystemCapability.Communication.NFC.Tag 961 * @since 9 962 */ 963 /** 964 * Obtains an {@link MifareClassicTag} object based on the tag information. 965 * During tag reading, if the tag supports the MIFARE Classic technology, 966 * an {@link MifareClassicTag} object will be created based on the tag information. 967 * 968 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 969 * @returns { MifareClassicTag } The {@link MifareClassicTag} object. 970 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 971 * <br> 1. Mandatory parameters are left unspecified. 972 * <br> 2. Incorrect parameters types. 973 * <br> 3. Parameter verification failed. 974 * @throws { BusinessError } 801 - Capability not supported. 975 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 976 * @syscap SystemCapability.Communication.NFC.Tag 977 * @atomicservice 978 * @since 12 979 */ 980 function getMifareClassic(tagInfo: TagInfo): MifareClassicTag; 981 982 /** 983 * Obtains an {@link MifareUltralightTag} object based on the tag information. 984 * During tag reading, if the tag supports the MIFARE Ultralight technology, 985 * an {@link MifareUltralightTag} object will be created based on the tag information. 986 * 987 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 988 * @returns { MifareUltralightTag } The {@link MifareUltralightTag} object. 989 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 990 * <br> 1. Mandatory parameters are left unspecified. 991 * <br> 2. Incorrect parameters types. 992 * <br> 3. Parameter verification failed. 993 * @throws { BusinessError } 801 - Capability not supported. 994 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 995 * @syscap SystemCapability.Communication.NFC.Tag 996 * @since 9 997 */ 998 /** 999 * Obtains an {@link MifareUltralightTag} object based on the tag information. 1000 * During tag reading, if the tag supports the MIFARE Ultralight technology, 1001 * an {@link MifareUltralightTag} object will be created based on the tag information. 1002 * 1003 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 1004 * @returns { MifareUltralightTag } The {@link MifareUltralightTag} object. 1005 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1006 * <br> 1. Mandatory parameters are left unspecified. 1007 * <br> 2. Incorrect parameters types. 1008 * <br> 3. Parameter verification failed. 1009 * @throws { BusinessError } 801 - Capability not supported. 1010 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1011 * @syscap SystemCapability.Communication.NFC.Tag 1012 * @atomicservice 1013 * @since 12 1014 */ 1015 function getMifareUltralight(tagInfo: TagInfo): MifareUltralightTag; 1016 1017 /** 1018 * Obtains an {@link NdefFormatableTag} object based on the tag information. 1019 * During tag reading, if the tag supports the NDEF Formatable technology, 1020 * an {@link NdefFormatableTag} object will be created based on the tag information. 1021 * 1022 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 1023 * @returns { NdefFormatableTag } The {@link NdefFormatableTag} object. 1024 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1025 * <br> 1. Mandatory parameters are left unspecified. 1026 * <br> 2. Incorrect parameters types. 1027 * <br> 3. Parameter verification failed. 1028 * @throws { BusinessError } 801 - Capability not supported. 1029 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1030 * @syscap SystemCapability.Communication.NFC.Tag 1031 * @since 9 1032 */ 1033 /** 1034 * Obtains an {@link NdefFormatableTag} object based on the tag information. 1035 * During tag reading, if the tag supports the NDEF Formatable technology, 1036 * an {@link NdefFormatableTag} object will be created based on the tag information. 1037 * 1038 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 1039 * @returns { NdefFormatableTag } The {@link NdefFormatableTag} object. 1040 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1041 * <br> 1. Mandatory parameters are left unspecified. 1042 * <br> 2. Incorrect parameters types. 1043 * <br> 3. Parameter verification failed. 1044 * @throws { BusinessError } 801 - Capability not supported. 1045 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1046 * @syscap SystemCapability.Communication.NFC.Tag 1047 * @atomicservice 1048 * @since 12 1049 */ 1050 function getNdefFormatable(tagInfo: TagInfo): NdefFormatableTag; 1051 1052 /** 1053 * Obtains an {@link BarcodeTag} object based on the tag information. 1054 * During tag reading, if the tag supports the NfcBarcode technology, 1055 * an {@link BarcodeTag} object will be created. 1056 * 1057 * @param { TagInfo } tagInfo - Indicates the dispatched tag information. 1058 * @returns { BarcodeTag } The {@link BarcodeTag} object. 1059 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1060 * <br> 1. Mandatory parameters are left unspecified. 1061 * <br> 2. Incorrect parameters types. 1062 * <br> 3. Parameter verification failed. 1063 * @throws { BusinessError } 801 - Capability not supported. 1064 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1065 * @syscap SystemCapability.Communication.NFC.Tag 1066 * @atomicservice 1067 * @since 18 1068 */ 1069 function getBarcodeTag(tagInfo: TagInfo): BarcodeTag; 1070 1071 /** 1072 * Parse a {@link TagInfo} object from Want. 1073 * 1074 * @param { Want } want - The want object that contains the values of TagInfo. 1075 * @returns { TagInfo } The {@link TagInfo} object. 1076 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1077 * <br> 1. Mandatory parameters are left unspecified. 1078 * <br> 2. Incorrect parameters types. 1079 * <br> 3. Parameter verification failed. 1080 * @throws { BusinessError } 801 - Capability not supported. 1081 * @syscap SystemCapability.Communication.NFC.Tag 1082 * @since 9 1083 */ 1084 /** 1085 * Parse a {@link TagInfo} object from Want. 1086 * 1087 * @param { Want } want - The want object that contains the values of TagInfo. 1088 * @returns { TagInfo } The {@link TagInfo} object. 1089 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1090 * <br> 1. Mandatory parameters are left unspecified. 1091 * <br> 2. Incorrect parameters types. 1092 * <br> 3. Parameter verification failed. 1093 * @throws { BusinessError } 801 - Capability not supported. 1094 * @syscap SystemCapability.Communication.NFC.Tag 1095 * @atomicservice 1096 * @since 12 1097 */ 1098 function getTagInfo(want: Want): TagInfo; 1099 1100 /** 1101 * Register tag foreground dispatch. Dispatches to this application only if a tag discovered. 1102 * 1103 * @permission ohos.permission.NFC_TAG 1104 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1105 * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. 1106 * @param { AsyncCallback<TagInfo> } callback - The callback to dispatched the TagInfo object for application. 1107 * @throws { BusinessError } 201 - Permission denied. 1108 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1109 * <br> 1. Mandatory parameters are left unspecified. 1110 * <br> 2. Incorrect parameters types. 1111 * <br> 3. Parameter verification failed. 1112 * @throws { BusinessError } 801 - Capability not supported. 1113 * @syscap SystemCapability.Communication.NFC.Tag 1114 * @since 10 1115 */ 1116 /** 1117 * Register tag foreground dispatch. Dispatches to this application only if a tag discovered. 1118 * 1119 * @permission ohos.permission.NFC_TAG 1120 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1121 * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. 1122 * @param { AsyncCallback<TagInfo> } callback - The callback to dispatched the TagInfo object for application. 1123 * @throws { BusinessError } 201 - Permission denied. 1124 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1125 * <br> 1. Mandatory parameters are left unspecified. 1126 * <br> 2. Incorrect parameters types. 1127 * <br> 3. Parameter verification failed. 1128 * @throws { BusinessError } 801 - Capability not supported. 1129 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1130 * @throws { BusinessError } 3100202 - The element state is invalid. 1131 * @syscap SystemCapability.Communication.NFC.Tag 1132 * @atomicservice 1133 * @since 12 1134 */ 1135 function registerForegroundDispatch( 1136 elementName: ElementName, 1137 discTech: number[], 1138 callback: AsyncCallback<TagInfo> 1139 ): void; 1140 1141 /** 1142 * Unregister tag foreground dispatch. 1143 * 1144 * @permission ohos.permission.NFC_TAG 1145 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1146 * @throws { BusinessError } 201 - Permission denied. 1147 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1148 * <br> 1. Mandatory parameters are left unspecified. 1149 * <br> 2. Incorrect parameters types. 1150 * <br> 3. Parameter verification failed. 1151 * @throws { BusinessError } 801 - Capability not supported. 1152 * @syscap SystemCapability.Communication.NFC.Tag 1153 * @since 10 1154 */ 1155 /** 1156 * Unregister tag foreground dispatch. 1157 * 1158 * @permission ohos.permission.NFC_TAG 1159 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1160 * @throws { BusinessError } 201 - Permission denied. 1161 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1162 * <br> 1. Mandatory parameters are left unspecified. 1163 * <br> 2. Incorrect parameters types. 1164 * <br> 3. Parameter verification failed. 1165 * @throws { BusinessError } 801 - Capability not supported. 1166 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1167 * @syscap SystemCapability.Communication.NFC.Tag 1168 * @atomicservice 1169 * @since 12 1170 */ 1171 function unregisterForegroundDispatch(elementName: ElementName): void; 1172 1173 /** 1174 * Set reader mode enabled when the specific application is foreground. Dispatches to this application only if a tag discovered. 1175 * 1176 * @permission ohos.permission.NFC_TAG 1177 * @param { 'readerMode' } type - The callback type to be registered. 1178 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1179 * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. 1180 * @param { AsyncCallback<TagInfo> } callback - The callback to dispatched the TagInfo object for application. 1181 * @throws { BusinessError } 201 - Permission denied. 1182 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1183 * <br> 1. Mandatory parameters are left unspecified. 1184 * <br> 2. Incorrect parameters types. 1185 * <br> 3. Parameter verification failed. 1186 * @throws { BusinessError } 801 - Capability not supported. 1187 * @throws { BusinessError } 3100202 - The element state is invalid. 1188 * @syscap SystemCapability.Communication.NFC.Tag 1189 * @since 11 1190 */ 1191 /** 1192 * Set reader mode enabled when the specific application is foreground. Dispatches to this application only if a tag discovered. 1193 * 1194 * @permission ohos.permission.NFC_TAG 1195 * @param { 'readerMode' } type - The callback type to be registered. 1196 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1197 * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. 1198 * @param { AsyncCallback<TagInfo> } callback - The callback to dispatched the TagInfo object for application. 1199 * @throws { BusinessError } 201 - Permission denied. 1200 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1201 * <br> 1. Mandatory parameters are left unspecified. 1202 * <br> 2. Incorrect parameters types. 1203 * <br> 3. Parameter verification failed. 1204 * @throws { BusinessError } 801 - Capability not supported. 1205 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1206 * @throws { BusinessError } 3100202 - The element state is invalid. 1207 * @syscap SystemCapability.Communication.NFC.Tag 1208 * @atomicservice 1209 * @since 12 1210 */ 1211 function on(type: 'readerMode', elementName: ElementName, discTech: number[], callback: AsyncCallback<TagInfo>): void; 1212 1213 /** 1214 * Disable foreground reader mode settings explicitly. 1215 * 1216 * @permission ohos.permission.NFC_TAG 1217 * @param { 'readerMode' } type - The callback type to be unregistered. 1218 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1219 * @param { AsyncCallback<TagInfo> } [callback] - The callback to dispatched the TagInfo object for application. 1220 * @throws { BusinessError } 201 - Permission denied. 1221 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1222 * <br> 1. Mandatory parameters are left unspecified. 1223 * <br> 2. Incorrect parameters types. 1224 * <br> 3. Parameter verification failed. 1225 * @throws { BusinessError } 801 - Capability not supported. 1226 * @throws { BusinessError } 3100203 - The off() can be called only when the on() has been called. 1227 * @syscap SystemCapability.Communication.NFC.Tag 1228 * @since 11 1229 */ 1230 /** 1231 * Disable foreground reader mode settings explicitly. 1232 * 1233 * @permission ohos.permission.NFC_TAG 1234 * @param { 'readerMode' } type - The callback type to be unregistered. 1235 * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. 1236 * @param { AsyncCallback<TagInfo> } [callback] - The callback to dispatched the TagInfo object for application. 1237 * @throws { BusinessError } 201 - Permission denied. 1238 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1239 * <br> 1. Mandatory parameters are left unspecified. 1240 * <br> 2. Incorrect parameters types. 1241 * <br> 3. Parameter verification failed. 1242 * @throws { BusinessError } 801 - Capability not supported. 1243 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1244 * @throws { BusinessError } 3100203 - The off() API can be called only when the on() has been called. 1245 * @syscap SystemCapability.Communication.NFC.Tag 1246 * @atomicservice 1247 * @since 12 1248 */ 1249 function off(type: 'readerMode', elementName: ElementName, callback?: AsyncCallback<TagInfo>): void; 1250 1251 /** 1252 * Provides tag information. 1253 * <p>This class provides the technology a tag supports, for example, NFC-A. Applications can create 1254 * different tags based on the supported technology. 1255 * 1256 * @typedef TagInfo 1257 * @syscap SystemCapability.Communication.NFC.Tag 1258 * @since 7 1259 */ 1260 /** 1261 * Provides tag information. 1262 * <p>This class provides the technology a tag supports, for example, NFC-A. Applications can create 1263 * different tags based on the supported technology. 1264 * 1265 * @typedef TagInfo 1266 * @syscap SystemCapability.Communication.NFC.Tag 1267 * @atomicservice 1268 * @since 12 1269 */ 1270 export interface TagInfo { 1271 /** 1272 * The uid of this tag, it. 1273 * 1274 * @permission ohos.permission.NFC_TAG 1275 * @syscap SystemCapability.Communication.NFC.Tag 1276 * @since 9 1277 */ 1278 /** 1279 * The uid of this tag, it. 1280 * 1281 * @permission ohos.permission.NFC_TAG 1282 * @type { number[] } 1283 * @syscap SystemCapability.Communication.NFC.Tag 1284 * @atomicservice 1285 * @since 12 1286 */ 1287 uid: number[]; 1288 1289 /** 1290 * The supported technology list of this tag. 1291 * 1292 * @permission ohos.permission.NFC_TAG 1293 * @syscap SystemCapability.Communication.NFC.Tag 1294 * @since 9 1295 */ 1296 /** 1297 * The supported technology list of this tag. 1298 * 1299 * @permission ohos.permission.NFC_TAG 1300 * @type { number[] } 1301 * @syscap SystemCapability.Communication.NFC.Tag 1302 * @atomicservice 1303 * @since 12 1304 */ 1305 technology: number[]; 1306 1307 /** 1308 * The extra data for each technology of this tag. 1309 * 1310 * @permission ohos.permission.NFC_TAG 1311 * @type { PacMap[] } 1312 * @syscap SystemCapability.Communication.NFC.Tag 1313 * @systemapi hide for inner use. 1314 * @since 9 1315 */ 1316 extrasData: PacMap[]; 1317 1318 /** 1319 * The the RF discovery id of this tag. 1320 * 1321 * @permission ohos.permission.NFC_TAG 1322 * @type { number } 1323 * @syscap SystemCapability.Communication.NFC.Tag 1324 * @systemapi hide for inner use. 1325 * @since 9 1326 */ 1327 tagRfDiscId: number; 1328 1329 /** 1330 * The extra data for the technology of this tag. 1331 * 1332 * @permission ohos.permission.NFC_TAG 1333 * @type { rpc.RemoteObject } 1334 * @syscap SystemCapability.Communication.NFC.Tag 1335 * @systemapi hide for inner use. 1336 * @since 9 1337 */ 1338 remoteTagService: rpc.RemoteObject; 1339 1340 /** 1341 * The supported technology list of this tag. 1342 * 1343 * @permission ohos.permission.NFC_TAG 1344 * @syscap SystemCapability.Communication.NFC.Tag 1345 * @since 7 1346 * @deprecated since 9 1347 * @useinstead ohos.nfc.tag/tag.TagInfo#technology 1348 */ 1349 supportedProfiles: number[]; 1350 } 1351 1352 /** 1353 * NDEF records definition, see NFCForum-TS-NDEF_1.0. 1354 * 1355 * @typedef NdefRecord 1356 * @syscap SystemCapability.Communication.NFC.Tag 1357 * @since 9 1358 */ 1359 /** 1360 * NDEF records definition, see NFCForum-TS-NDEF_1.0. 1361 * 1362 * @typedef NdefRecord 1363 * @syscap SystemCapability.Communication.NFC.Tag 1364 * @atomicservice 1365 * @since 12 1366 */ 1367 export interface NdefRecord { 1368 /** 1369 * tnf of NdefRecord 1370 * 1371 * @syscap SystemCapability.Communication.NFC.Tag 1372 * @since 9 1373 */ 1374 /** 1375 * tnf of NdefRecord 1376 * 1377 * @type { number } 1378 * @syscap SystemCapability.Communication.NFC.Tag 1379 * @atomicservice 1380 * @since 12 1381 */ 1382 tnf: number; 1383 1384 /** 1385 * RTD type of NdefRecord 1386 * 1387 * @type { number[] } 1388 * @syscap SystemCapability.Communication.NFC.Tag 1389 * @since 9 1390 */ 1391 /** 1392 * RTD type of NdefRecord 1393 * 1394 * @type { number[] } 1395 * @syscap SystemCapability.Communication.NFC.Tag 1396 * @atomicservice 1397 * @since 12 1398 */ 1399 rtdType: number[]; 1400 1401 /** 1402 * id of NdefRecord 1403 * 1404 * @syscap SystemCapability.Communication.NFC.Tag 1405 * @since 9 1406 */ 1407 /** 1408 * id of NdefRecord 1409 * 1410 * @type { number[] } 1411 * @syscap SystemCapability.Communication.NFC.Tag 1412 * @atomicservice 1413 * @since 12 1414 */ 1415 id: number[]; 1416 1417 /** 1418 * payload of NdefRecord 1419 * 1420 * @syscap SystemCapability.Communication.NFC.Tag 1421 * @since 9 1422 */ 1423 /** 1424 * payload of NdefRecord 1425 * 1426 * @type { number[] } 1427 * @syscap SystemCapability.Communication.NFC.Tag 1428 * @atomicservice 1429 * @since 12 1430 */ 1431 payload: number[]; 1432 } 1433 1434 /** 1435 * Provides methods for accessing NDEF tag. 1436 * 1437 * @namespace ndef 1438 * @syscap SystemCapability.Communication.NFC.Tag 1439 * @since 9 1440 */ 1441 /** 1442 * Provides methods for accessing NDEF tag. 1443 * 1444 * @namespace ndef 1445 * @syscap SystemCapability.Communication.NFC.Tag 1446 * @atomicservice 1447 * @since 12 1448 */ 1449 namespace ndef { 1450 /** 1451 * Creates an NDEF record with uri data. 1452 * 1453 * @param { string } uri - Uri data for new NDEF record. 1454 * @returns { NdefRecord } The instance of NdefRecord. 1455 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1456 * <br> 1. Mandatory parameters are left unspecified. 1457 * <br> 2. Incorrect parameters types. 1458 * <br> 3. Parameter verification failed. 1459 * @syscap SystemCapability.Communication.NFC.Tag 1460 * @since 9 1461 */ 1462 /** 1463 * Creates an NDEF record with uri data. 1464 * 1465 * @param { string } uri - Uri data for new NDEF record. 1466 * @returns { NdefRecord } The instance of NdefRecord. 1467 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1468 * <br> 1. Mandatory parameters are left unspecified. 1469 * <br> 2. Incorrect parameters types. 1470 * <br> 3. Parameter verification failed. 1471 * @syscap SystemCapability.Communication.NFC.Tag 1472 * @atomicservice 1473 * @since 12 1474 */ 1475 function makeUriRecord(uri: string): NdefRecord; 1476 1477 /** 1478 * Creates an NDEF record with text data. 1479 * 1480 * @param { string } text - Text data for new an NDEF record. 1481 * @param { string } locale - Language code for the NDEF record. if locale is null, use default locale. 1482 * @returns { NdefRecord } The instance of NdefRecord. 1483 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1484 * <br> 1. Mandatory parameters are left unspecified. 1485 * <br> 2. Incorrect parameters types. 1486 * <br> 3. Parameter verification failed. 1487 * @syscap SystemCapability.Communication.NFC.Tag 1488 * @since 9 1489 */ 1490 /** 1491 * Creates an NDEF record with text data. 1492 * 1493 * @param { string } text - Text data for new an NDEF record. 1494 * @param { string } locale - Language code for the NDEF record. if locale is null, use default locale. 1495 * @returns { NdefRecord } The instance of NdefRecord. 1496 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1497 * <br> 1. Mandatory parameters are left unspecified. 1498 * <br> 2. Incorrect parameters types. 1499 * <br> 3. Parameter verification failed. 1500 * @syscap SystemCapability.Communication.NFC.Tag 1501 * @atomicservice 1502 * @since 12 1503 */ 1504 function makeTextRecord(text: string, locale: string): NdefRecord; 1505 1506 /** 1507 * Creates an NDEF Record with OpenHarmony application bundle name. 1508 * 1509 * @param { string } bundleName - The bundle name of application to make. 1510 * @returns { NdefRecord } The instance of NdefRecord. 1511 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1512 * <br> 1. Mandatory parameters are left unspecified. 1513 * <br> 2. Incorrect parameters types. 1514 * <br> 3. Parameter verification failed. 1515 * @syscap SystemCapability.Communication.NFC.Tag 1516 * @atomicservice 1517 * @since 18 1518 */ 1519 function makeApplicationRecord(bundleName: string): NdefRecord; 1520 1521 /** 1522 * Creates an NDEF record with mime data. 1523 * 1524 * @param { string } mimeType type of mime data for new an NDEF record. 1525 * @param { number[] } mimeData mime data for new an NDEF record. 1526 * @returns { NdefRecord } The instance of NdefRecord. 1527 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1528 * <br> 1. Mandatory parameters are left unspecified. 1529 * <br> 2. Incorrect parameters types. 1530 * <br> 3. Parameter verification failed. 1531 * @syscap SystemCapability.Communication.NFC.Tag 1532 * @since 9 1533 */ 1534 /** 1535 * Creates an NDEF record with mime data. 1536 * 1537 * @param { string } mimeType type of mime data for new an NDEF record. 1538 * @param { number[] } mimeData mime data for new an NDEF record. 1539 * @returns { NdefRecord } The instance of NdefRecord. 1540 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1541 * <br> 1. Mandatory parameters are left unspecified. 1542 * <br> 2. Incorrect parameters types. 1543 * <br> 3. Parameter verification failed. 1544 * @syscap SystemCapability.Communication.NFC.Tag 1545 * @atomicservice 1546 * @since 12 1547 */ 1548 function makeMimeRecord(mimeType: string, mimeData: number[]): NdefRecord; 1549 1550 /** 1551 * Creates an NDEF record with external data. 1552 * 1553 * @param { string } domainName - Domain name of issuing organization for the external data. 1554 * @param { string } type - Domain specific type of data for the external data. 1555 * @param { number[] } externalData - Data payload of an NDEF record. 1556 * @returns { NdefRecord } The instance of NdefRecord. 1557 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1558 * <br> 1. Mandatory parameters are left unspecified. 1559 * <br> 2. Incorrect parameters types. 1560 * <br> 3. Parameter verification failed. 1561 * @syscap SystemCapability.Communication.NFC.Tag 1562 * @since 9 1563 */ 1564 /** 1565 * Creates an NDEF record with external data. 1566 * 1567 * @param { string } domainName - Domain name of issuing organization for the external data. 1568 * @param { string } type - Domain specific type of data for the external data. 1569 * @param { number[] } externalData - Data payload of an NDEF record. 1570 * @returns { NdefRecord } The instance of NdefRecord. 1571 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1572 * <br> 1. Mandatory parameters are left unspecified. 1573 * <br> 2. Incorrect parameters types. 1574 * <br> 3. Parameter verification failed. 1575 * @syscap SystemCapability.Communication.NFC.Tag 1576 * @atomicservice 1577 * @since 12 1578 */ 1579 function makeExternalRecord(domainName: string, type: string, externalData: number[]): NdefRecord; 1580 /** 1581 * Creates an NDEF message with raw bytes. 1582 * 1583 * @param { number[] } data - The raw bytes to parse NDEF message. 1584 * @returns { NdefMessage } The instance of NdefMessage. 1585 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1586 * <br> 1. Mandatory parameters are left unspecified. 1587 * <br> 2. Incorrect parameters types. 1588 * <br> 3. Parameter verification failed. 1589 * @syscap SystemCapability.Communication.NFC.Tag 1590 * @since 9 1591 */ 1592 /** 1593 * Creates an NDEF message with raw bytes. 1594 * 1595 * @param { number[] } data - The raw bytes to parse NDEF message. 1596 * @returns { NdefMessage } The instance of NdefMessage. 1597 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1598 * <br> 1. Mandatory parameters are left unspecified. 1599 * <br> 2. Incorrect parameters types. 1600 * <br> 3. Parameter verification failed. 1601 * @syscap SystemCapability.Communication.NFC.Tag 1602 * @atomicservice 1603 * @since 12 1604 */ 1605 function createNdefMessage(data: number[]): NdefMessage; 1606 1607 /** 1608 * Creates an NDEF message with record list. 1609 * 1610 * @param { NdefRecord[] } ndefRecords - The NDEF records to parse NDEF message. 1611 * @returns { NdefMessage } The instance of NdefMessage. 1612 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1613 * <br> 1. Mandatory parameters are left unspecified. 1614 * <br> 2. Incorrect parameters types. 1615 * <br> 3. Parameter verification failed. 1616 * @syscap SystemCapability.Communication.NFC.Tag 1617 * @since 9 1618 */ 1619 /** 1620 * Creates an NDEF message with record list. 1621 * 1622 * @param { NdefRecord[] } ndefRecords - The NDEF records to parse NDEF message. 1623 * @returns { NdefMessage } The instance of NdefMessage. 1624 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1625 * <br> 1. Mandatory parameters are left unspecified. 1626 * <br> 2. Incorrect parameters types. 1627 * <br> 3. Parameter verification failed. 1628 * @syscap SystemCapability.Communication.NFC.Tag 1629 * @atomicservice 1630 * @since 12 1631 */ 1632 function createNdefMessage(ndefRecords: NdefRecord[]): NdefMessage; 1633 1634 /** 1635 * Parses an NDEF message into raw bytes. 1636 * 1637 * @param { NdefMessage } ndefMessage - An NDEF message to parse. 1638 * @returns { number[] } Returns the raw bytes of an NDEF message. 1639 * @throws { BusinessError } 401 - The parameter check failed. 1640 * @syscap SystemCapability.Communication.NFC.Tag 1641 * @since 9 1642 */ 1643 /** 1644 * Parses an NDEF message into raw bytes. 1645 * 1646 * @param { NdefMessage } ndefMessage - An NDEF message to parse. 1647 * @returns { number[] } Returns the raw bytes of an NDEF message. 1648 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1649 * <br> 1. Mandatory parameters are left unspecified. 1650 * <br> 2. Incorrect parameters types. 1651 * <br> 3. Parameter verification failed. 1652 * @syscap SystemCapability.Communication.NFC.Tag 1653 * @atomicservice 1654 * @since 12 1655 */ 1656 function messageToBytes(ndefMessage: NdefMessage): number[]; 1657 } 1658 1659 /** 1660 * Exports type NfcATag. 1661 * 1662 * @syscap SystemCapability.Communication.NFC.Tag 1663 * @since 7 1664 */ 1665 /** 1666 * Exports type NfcATag. 1667 * 1668 * @typedef { _NfcATag } 1669 * @syscap SystemCapability.Communication.NFC.Tag 1670 * @atomicservice 1671 * @since 12 1672 */ 1673 export type NfcATag = _NfcATag; 1674 1675 /** 1676 * Exports type NfcBTag. 1677 * 1678 * @syscap SystemCapability.Communication.NFC.Tag 1679 * @since 7 1680 */ 1681 /** 1682 * Exports type NfcBTag. 1683 * 1684 * @typedef { _NfcBTag } 1685 * @syscap SystemCapability.Communication.NFC.Tag 1686 * @atomicservice 1687 * @since 12 1688 */ 1689 export type NfcBTag = _NfcBTag; 1690 1691 /** 1692 * Exports type NfcFTag. 1693 * 1694 * @syscap SystemCapability.Communication.NFC.Tag 1695 * @since 7 1696 */ 1697 /** 1698 * Exports type NfcFTag. 1699 * 1700 * @typedef { _NfcFTag } 1701 * @syscap SystemCapability.Communication.NFC.Tag 1702 * @atomicservice 1703 * @since 12 1704 */ 1705 export type NfcFTag = _NfcFTag; 1706 1707 /** 1708 * Exports type NfcVTag. 1709 * 1710 * @syscap SystemCapability.Communication.NFC.Tag 1711 * @since 7 1712 */ 1713 /** 1714 * Exports type NfcVTag. 1715 * 1716 * @typedef { _NfcVTag } 1717 * @syscap SystemCapability.Communication.NFC.Tag 1718 * @atomicservice 1719 * @since 12 1720 */ 1721 export type NfcVTag = _NfcVTag; 1722 1723 /** 1724 * Exports type IsoDepTag. 1725 * 1726 * @syscap SystemCapability.Communication.NFC.Tag 1727 * @since 9 1728 */ 1729 /** 1730 * Exports type IsoDepTag. 1731 * 1732 * @typedef { _IsoDepTag } 1733 * @syscap SystemCapability.Communication.NFC.Tag 1734 * @atomicservice 1735 * @since 12 1736 */ 1737 export type IsoDepTag = _IsoDepTag; 1738 1739 /** 1740 * Exports type NdefTag. 1741 * 1742 * @syscap SystemCapability.Communication.NFC.Tag 1743 * @since 9 1744 */ 1745 /** 1746 * Exports type NdefTag. 1747 * 1748 * @typedef { _NdefTag } 1749 * @syscap SystemCapability.Communication.NFC.Tag 1750 * @atomicservice 1751 * @since 12 1752 */ 1753 export type NdefTag = _NdefTag; 1754 1755 /** 1756 * Exports type MifareClassicTag. 1757 * 1758 * @syscap SystemCapability.Communication.NFC.Tag 1759 * @since 9 1760 */ 1761 /** 1762 * Exports type MifareClassicTag. 1763 * 1764 * @typedef { _MifareClassicTag } 1765 * @syscap SystemCapability.Communication.NFC.Tag 1766 * @atomicservice 1767 * @since 12 1768 */ 1769 export type MifareClassicTag = _MifareClassicTag; 1770 1771 /** 1772 * Exports type MifareUltralightTag. 1773 * 1774 * @syscap SystemCapability.Communication.NFC.Tag 1775 * @since 9 1776 */ 1777 /** 1778 * Exports type MifareUltralightTag. 1779 * 1780 * @typedef { _MifareUltralightTag } 1781 * @syscap SystemCapability.Communication.NFC.Tag 1782 * @atomicservice 1783 * @since 12 1784 */ 1785 export type MifareUltralightTag = _MifareUltralightTag; 1786 1787 /** 1788 * Exports type NdefFormatableTag. 1789 * 1790 * @syscap SystemCapability.Communication.NFC.Tag 1791 * @since 9 1792 */ 1793 /** 1794 * Exports type NdefFormatableTag. 1795 * 1796 * @typedef { _NdefFormatableTag } 1797 * @syscap SystemCapability.Communication.NFC.Tag 1798 * @atomicservice 1799 * @since 12 1800 */ 1801 export type NdefFormatableTag = _NdefFormatableTag; 1802 1803 /** 1804 * Exports type BarcodeTag. 1805 * 1806 * @typedef { _BarcodeTag } 1807 * @syscap SystemCapability.Communication.NFC.Tag 1808 * @atomicservice 1809 * @since 18 1810 */ 1811 export type BarcodeTag = _BarcodeTag; 1812 1813 /** 1814 * Exports type NdefMessage. 1815 * 1816 * @syscap SystemCapability.Communication.NFC.Tag 1817 * @since 9 1818 */ 1819 /** 1820 * Exports type NdefMessage. 1821 * 1822 * @typedef { _NdefMessage } 1823 * @syscap SystemCapability.Communication.NFC.Tag 1824 * @atomicservice 1825 * @since 12 1826 */ 1827 export type NdefMessage = _NdefMessage; 1828 1829 /** 1830 * Exports type TagSession. 1831 * 1832 * @syscap SystemCapability.Communication.NFC.Tag 1833 * @since 7 1834 */ 1835 /** 1836 * Exports type TagSession. 1837 * 1838 * @typedef { _TagSession } 1839 * @syscap SystemCapability.Communication.NFC.Tag 1840 * @atomicservice 1841 * @since 12 1842 */ 1843 export type TagSession = _TagSession; 1844} 1845export default tag;