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 tag from '../@ohos.nfc.tag'; 22import { TagSession } from './tagSession'; 23import { AsyncCallback, Callback } from '../@ohos.base'; 24 25/** 26 * Provides interfaces to control the read and write of tags that support the NFC-A technology. 27 * <p>This class is inherited from the {@link TagSession} abstract class, and provides methods to create 28 * {@code NfcATag} objects and obtain the ATQA and SAK. 29 * 30 * @typedef NfcATag 31 * @syscap SystemCapability.Communication.NFC.Tag 32 * @since 7 33 */ 34/** 35 * Provides interfaces to control the read and write of tags that support the NFC-A technology. 36 * <p>This class is inherited from the {@link TagSession} abstract class, and provides methods to create 37 * {@code NfcATag} objects and obtain the ATQA and SAK. 38 * 39 * @typedef NfcATag 40 * @syscap SystemCapability.Communication.NFC.Tag 41 * @atomicservice 42 * @since 12 43 */ 44export interface NfcATag extends TagSession { 45 /** 46 * Obtains the SAK of an NFC-A tag. 47 * 48 * @returns { number } Returns the SAK of the NFC-A tag. 49 * @syscap SystemCapability.Communication.NFC.Tag 50 * @since 7 51 */ 52 /** 53 * Obtains the SAK of an NFC-A tag. 54 * 55 * @returns { number } Returns the SAK of the NFC-A tag. 56 * @syscap SystemCapability.Communication.NFC.Tag 57 * @atomicservice 58 * @since 12 59 */ 60 getSak(): number; 61 62 /** 63 * Obtains the ATQA of an NFC-A tag. 64 * 65 * @returns { number[] } Returns the ATQA of the NFC-A tag. 66 * @syscap SystemCapability.Communication.NFC.Tag 67 * @since 7 68 */ 69 /** 70 * Obtains the ATQA of an NFC-A tag. 71 * 72 * @returns { number[] } Returns the ATQA of the NFC-A tag. 73 * @syscap SystemCapability.Communication.NFC.Tag 74 * @atomicservice 75 * @since 12 76 */ 77 getAtqa(): number[]; 78} 79 80/** 81 * Provides interfaces to create an {@code NfcBTag} and perform I/O operations on the tag. 82 * <p>This class inherits from the {@link TagSession} abstract class and provides interfaces to create an 83 * {@code NfcBTag} and obtain the tag information. 84 * 85 * @typedef NfcBTag 86 * @syscap SystemCapability.Communication.NFC.Tag 87 * @since 7 88 */ 89/** 90 * Provides interfaces to create an {@code NfcBTag} and perform I/O operations on the tag. 91 * <p>This class inherits from the {@link TagSession} abstract class and provides interfaces to create an 92 * {@code NfcBTag} and obtain the tag information. 93 * 94 * @typedef NfcBTag 95 * @syscap SystemCapability.Communication.NFC.Tag 96 * @atomicservice 97 * @since 12 98 */ 99export interface NfcBTag extends TagSession { 100 /** 101 * Obtains the application data of a tag. 102 * 103 * @returns { number[] } Returns the application data of the tag. 104 * @syscap SystemCapability.Communication.NFC.Tag 105 * @since 7 106 */ 107 /** 108 * Obtains the application data of a tag. 109 * 110 * @returns { number[] } Returns the application data of the tag. 111 * @syscap SystemCapability.Communication.NFC.Tag 112 * @atomicservice 113 * @since 12 114 */ 115 getRespAppData(): number[]; 116 117 /** 118 * Obtains the protocol information of a tag. 119 * 120 * @returns { number[] } Returns the protocol information of the tag. 121 * @syscap SystemCapability.Communication.NFC.Tag 122 * @since 7 123 */ 124 /** 125 * Obtains the protocol information of a tag. 126 * 127 * @returns { number[] } Returns the protocol information of the tag. 128 * @syscap SystemCapability.Communication.NFC.Tag 129 * @atomicservice 130 * @since 12 131 */ 132 getRespProtocol(): number[]; 133} 134 135/** 136 * Provides methods for creating an NFC-F tag, obtaining tag information, and controlling tag read and write. 137 * <p>This class inherits from the {@link TagSession} abstract class and provides interfaces to create an 138 * {@code NfcFTag} and obtain the tag information. 139 * 140 * @typedef NfcFTag 141 * @syscap SystemCapability.Communication.NFC.Tag 142 * @since 7 143 */ 144/** 145 * Provides methods for creating an NFC-F tag, obtaining tag information, and controlling tag read and write. 146 * <p>This class inherits from the {@link TagSession} abstract class and provides interfaces to create an 147 * {@code NfcFTag} and obtain the tag information. 148 * 149 * @typedef NfcFTag 150 * @syscap SystemCapability.Communication.NFC.Tag 151 * @atomicservice 152 * @since 12 153 */ 154export interface NfcFTag extends TagSession { 155 /** 156 * Obtains the system code from this {@code NfcFTag} instance. 157 * 158 * @returns { number[] } Returns the system code. 159 * @syscap SystemCapability.Communication.NFC.Tag 160 * @since 7 161 */ 162 /** 163 * Obtains the system code from this {@code NfcFTag} instance. 164 * 165 * @returns { number[] } Returns the system code. 166 * @syscap SystemCapability.Communication.NFC.Tag 167 * @atomicservice 168 * @since 12 169 */ 170 getSystemCode(): number[]; 171 172 /** 173 * Obtains the PMm (consisting of the IC code and manufacturer parameters) from this {@code NfcFTag} instance. 174 * 175 * @returns { number[] } Returns the PMm. 176 * @syscap SystemCapability.Communication.NFC.Tag 177 * @since 7 178 */ 179 /** 180 * Obtains the PMm (consisting of the IC code and manufacturer parameters) from this {@code NfcFTag} instance. 181 * 182 * @returns { number[] } Returns the PMm. 183 * @syscap SystemCapability.Communication.NFC.Tag 184 * @atomicservice 185 * @since 12 186 */ 187 getPmm(): number[]; 188} 189 190/** 191 * Provides methods for creating an NFC-V tag, obtaining tag information, and controlling tag read and write. 192 * <p>This class inherits from the {@link TagSession} abstract class and provides interfaces to create an 193 * {@code NfcVTag} and obtain the tag information. 194 * 195 * @typedef NfcVTag 196 * @syscap SystemCapability.Communication.NFC.Tag 197 * @since 7 198 */ 199/** 200 * Provides methods for creating an NFC-V tag, obtaining tag information, and controlling tag read and write. 201 * <p>This class inherits from the {@link TagSession} abstract class and provides interfaces to create an 202 * {@code NfcVTag} and obtain the tag information. 203 * 204 * @typedef NfcVTag 205 * @syscap SystemCapability.Communication.NFC.Tag 206 * @atomicservice 207 * @since 12 208 */ 209export interface NfcVTag extends TagSession { 210 /** 211 * Obtains the response flags from this {@code NfcVTag} instance. 212 * 213 * @returns { number } Returns the response flags. 214 * @syscap SystemCapability.Communication.NFC.Tag 215 * @since 7 216 */ 217 /** 218 * Obtains the response flags from this {@code NfcVTag} instance. 219 * 220 * @returns { number } Returns the response flags. 221 * @syscap SystemCapability.Communication.NFC.Tag 222 * @atomicservice 223 * @since 12 224 */ 225 getResponseFlags(): number; 226 227 /** 228 * Obtains the response flags from this {@code NfcVTag} instance. 229 * 230 * @returns { number } Returns the response flags. 231 * @syscap SystemCapability.Communication.NFC.Tag 232 * @since 7 233 */ 234 /** 235 * Obtains the response flags from this {@code NfcVTag} instance. 236 * 237 * @returns { number } Returns the response flags. 238 * @syscap SystemCapability.Communication.NFC.Tag 239 * @atomicservice 240 * @since 12 241 */ 242 getDsfId(): number; 243} 244 245/** 246 * Provides methods for accessing IsoDep tag. 247 * 248 * @typedef IsoDepTag 249 * @syscap SystemCapability.Communication.NFC.Tag 250 * @since 9 251 */ 252/** 253 * Provides methods for accessing IsoDep tag. 254 * 255 * @typedef IsoDepTag 256 * @syscap SystemCapability.Communication.NFC.Tag 257 * @atomicservice 258 * @since 12 259 */ 260export interface IsoDepTag extends TagSession { 261 /** 262 * Gets IsoDep Historical bytes of the tag, which is based on NfcA RF technology. 263 * It could be null if not based on NfcA. 264 * 265 * @returns { number[] } Returns the Historical bytes, the length could be 0. 266 * @syscap SystemCapability.Communication.NFC.Tag 267 * @since 9 268 */ 269 /** 270 * Gets IsoDep Historical bytes of the tag, which is based on NfcA RF technology. 271 * It could be null if not based on NfcA. 272 * 273 * @returns { number[] } Returns the Historical bytes, the length could be 0. 274 * @syscap SystemCapability.Communication.NFC.Tag 275 * @atomicservice 276 * @since 12 277 */ 278 getHistoricalBytes(): number[]; 279 280 /** 281 * Gets IsoDep HiLayer Response bytes of the tag, which is based on NfcB RF technology. 282 * It could be null if not based on NfcB. 283 * 284 * @returns { number[] } Returns HiLayer Response bytes, the length could be 0. 285 * @syscap SystemCapability.Communication.NFC.Tag 286 * @since 9 287 */ 288 /** 289 * Gets IsoDep HiLayer Response bytes of the tag, which is based on NfcB RF technology. 290 * It could be null if not based on NfcB. 291 * 292 * @returns { number[] } Returns HiLayer Response bytes, the length could be 0. 293 * @syscap SystemCapability.Communication.NFC.Tag 294 * @atomicservice 295 * @since 12 296 */ 297 getHiLayerResponse(): number[]; 298 299 /** 300 * Checks if extended apdu length supported or not. 301 * 302 * @permission ohos.permission.NFC_TAG 303 * @returns { Promise<boolean> } Returns true if extended apdu length supported, otherwise false. 304 * @throws { BusinessError } 201 - Permission denied. 305 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 306 * <br> 1. Mandatory parameters are left unspecified. 307 * <br> 2. Incorrect parameters types. 308 * <br> 3. Parameter verification failed. 309 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 310 * @syscap SystemCapability.Communication.NFC.Tag 311 * @since 9 312 */ 313 /** 314 * Checks if extended apdu length supported or not. 315 * 316 * @permission ohos.permission.NFC_TAG 317 * @returns { Promise<boolean> } Returns true if extended apdu length supported, otherwise false. 318 * @throws { BusinessError } 201 - Permission denied. 319 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 320 * <br> 1. Mandatory parameters are left unspecified. 321 * <br> 2. Incorrect parameters types. 322 * <br> 3. Parameter verification failed. 323 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 324 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 325 * @syscap SystemCapability.Communication.NFC.Tag 326 * @atomicservice 327 * @since 12 328 */ 329 isExtendedApduSupported(): Promise<boolean>; 330 331 /** 332 * Checks if extended apdu length supported or not. 333 * 334 * @permission ohos.permission.NFC_TAG 335 * @param { AsyncCallback<boolean> } callback The callback. 336 * @throws { BusinessError } 201 - Permission denied. 337 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 338 * <br> 1. Mandatory parameters are left unspecified. 339 * <br> 2. Incorrect parameters types. 340 * <br> 3. Parameter verification failed. 341 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 342 * @syscap SystemCapability.Communication.NFC.Tag 343 * @since 9 344 */ 345 /** 346 * Checks if extended apdu length supported or not. 347 * 348 * @permission ohos.permission.NFC_TAG 349 * @param { AsyncCallback<boolean> } callback The callback. 350 * @throws { BusinessError } 201 - Permission denied. 351 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 352 * <br> 1. Mandatory parameters are left unspecified. 353 * <br> 2. Incorrect parameters types. 354 * <br> 3. Parameter verification failed. 355 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 356 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 357 * @syscap SystemCapability.Communication.NFC.Tag 358 * @atomicservice 359 * @since 12 360 */ 361 isExtendedApduSupported(callback: AsyncCallback<boolean>): void; 362} 363 364/** 365 * Provides methods for Message of NDEF. 366 * 367 * @typedef NdefMessage 368 * @syscap SystemCapability.Communication.NFC.Tag 369 * @since 9 370 */ 371/** 372 * Provides methods for Message of NDEF. 373 * 374 * @typedef NdefMessage 375 * @syscap SystemCapability.Communication.NFC.Tag 376 * @atomicservice 377 * @since 12 378 */ 379export interface NdefMessage { 380 /** 381 * Obtains all records of an NDEF message. 382 * 383 * @returns { tag.NdefRecord[] } Records the list of NDEF records. 384 * @syscap SystemCapability.Communication.NFC.Tag 385 * @since 9 386 */ 387 /** 388 * Obtains all records of an NDEF message. 389 * 390 * @returns { tag.NdefRecord[] } Records the list of NDEF records. 391 * @syscap SystemCapability.Communication.NFC.Tag 392 * @atomicservice 393 * @since 12 394 */ 395 getNdefRecords(): tag.NdefRecord[]; 396} 397 398/** 399 * Provides methods for accessing NDEF tag. 400 * 401 * @typedef NdefTag 402 * @syscap SystemCapability.Communication.NFC.Tag 403 * @since 9 404 */ 405/** 406 * Provides methods for accessing NDEF tag. 407 * 408 * @typedef NdefTag 409 * @syscap SystemCapability.Communication.NFC.Tag 410 * @atomicservice 411 * @since 12 412 */ 413export interface NdefTag extends TagSession { 414 /** 415 * Gets the type of NDEF tag. 416 * 417 * @returns { tag.NfcForumType } The type of NDEF tag. 418 * @syscap SystemCapability.Communication.NFC.Tag 419 * @since 9 420 */ 421 /** 422 * Gets the type of NDEF tag. 423 * 424 * @returns { tag.NfcForumType } The type of NDEF tag. 425 * @syscap SystemCapability.Communication.NFC.Tag 426 * @atomicservice 427 * @since 12 428 */ 429 getNdefTagType(): tag.NfcForumType; 430 431 /** 432 * Gets the NDEF message that was read from NDEF tag when tag discovery. 433 * 434 * @returns { NdefMessage } The instance of NdefMessage. 435 * @syscap SystemCapability.Communication.NFC.Tag 436 * @since 9 437 */ 438 /** 439 * Gets the NDEF message that was read from NDEF tag when tag discovery. 440 * 441 * @returns { NdefMessage } The instance of NdefMessage. 442 * @syscap SystemCapability.Communication.NFC.Tag 443 * @atomicservice 444 * @since 12 445 */ 446 getNdefMessage(): NdefMessage; 447 448 /** 449 * Checks if NDEF tag is writable. 450 * 451 * @returns { boolean } Returns true if the tag is writable, otherwise returns false. 452 * @syscap SystemCapability.Communication.NFC.Tag 453 * @since 9 454 */ 455 /** 456 * Checks if NDEF tag is writable. 457 * 458 * @returns { boolean } Returns true if the tag is writable, otherwise returns false. 459 * @syscap SystemCapability.Communication.NFC.Tag 460 * @atomicservice 461 * @since 12 462 */ 463 isNdefWritable(): boolean; 464 465 /** 466 * Reads NDEF message on this tag. 467 * 468 * @permission ohos.permission.NFC_TAG 469 * @returns { Promise<NdefMessage> } The NDEF message in tag. 470 * @throws { BusinessError } 201 - Permission denied. 471 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 472 * <br> 1. Mandatory parameters are left unspecified. 473 * <br> 2. Incorrect parameters types. 474 * <br> 3. Parameter verification failed. 475 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 476 * @syscap SystemCapability.Communication.NFC.Tag 477 * @since 9 478 */ 479 /** 480 * Reads NDEF message on this tag. 481 * 482 * @permission ohos.permission.NFC_TAG 483 * @returns { Promise<NdefMessage> } The NDEF message in tag. 484 * @throws { BusinessError } 201 - Permission denied. 485 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 486 * <br> 1. Mandatory parameters are left unspecified. 487 * <br> 2. Incorrect parameters types. 488 * <br> 3. Parameter verification failed. 489 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 490 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 491 * @syscap SystemCapability.Communication.NFC.Tag 492 * @atomicservice 493 * @since 12 494 */ 495 readNdef(): Promise<NdefMessage>; 496 497 /** 498 * Reads NDEF message on this tag. 499 * 500 * @permission ohos.permission.NFC_TAG 501 * @param { AsyncCallback<NdefMessage> } callback The callback. 502 * @throws { BusinessError } 201 - Permission denied. 503 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 504 * <br> 1. Mandatory parameters are left unspecified. 505 * <br> 2. Incorrect parameters types. 506 * <br> 3. Parameter verification failed. 507 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 508 * @syscap SystemCapability.Communication.NFC.Tag 509 * @since 9 510 */ 511 /** 512 * Reads NDEF message on this tag. 513 * 514 * @permission ohos.permission.NFC_TAG 515 * @param { AsyncCallback<NdefMessage> } callback The callback. 516 * @throws { BusinessError } 201 - Permission denied. 517 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 518 * <br> 1. Mandatory parameters are left unspecified. 519 * <br> 2. Incorrect parameters types. 520 * <br> 3. Parameter verification failed. 521 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 522 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 523 * @syscap SystemCapability.Communication.NFC.Tag 524 * @atomicservice 525 * @since 12 526 */ 527 readNdef(callback: AsyncCallback<NdefMessage>): void; 528 529 /** 530 * Writes NDEF message into this tag. 531 * 532 * @permission ohos.permission.NFC_TAG 533 * @param { NdefMessage } msg - The NDEF message to be written. 534 * @returns { Promise<void> } The void 535 * @throws { BusinessError } 201 - Permission denied. 536 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 537 * <br> 1. Mandatory parameters are left unspecified. 538 * <br> 2. Incorrect parameters types. 539 * <br> 3. Parameter verification failed. 540 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 541 * @syscap SystemCapability.Communication.NFC.Tag 542 * @since 9 543 */ 544 /** 545 * Writes NDEF message into this tag. 546 * 547 * @permission ohos.permission.NFC_TAG 548 * @param { NdefMessage } msg - The NDEF message to be written. 549 * @returns { Promise<void> } The void 550 * @throws { BusinessError } 201 - Permission denied. 551 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 552 * <br> 1. Mandatory parameters are left unspecified. 553 * <br> 2. Incorrect parameters types. 554 * <br> 3. Parameter verification failed. 555 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 556 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 557 * @syscap SystemCapability.Communication.NFC.Tag 558 * @atomicservice 559 * @since 12 560 */ 561 writeNdef(msg: NdefMessage): Promise<void>; 562 563 /** 564 * Writes NDEF message into this tag. 565 * 566 * @permission ohos.permission.NFC_TAG 567 * @param { NdefMessage } msg - The NDEF message to be written. 568 * @param { AsyncCallback<void> } callback The callback. 569 * @throws { BusinessError } 201 - Permission denied. 570 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 571 * <br> 1. Mandatory parameters are left unspecified. 572 * <br> 2. Incorrect parameters types. 573 * <br> 3. Parameter verification failed. 574 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 575 * @syscap SystemCapability.Communication.NFC.Tag 576 * @since 9 577 */ 578 /** 579 * Writes NDEF message into this tag. 580 * 581 * @permission ohos.permission.NFC_TAG 582 * @param { NdefMessage } msg - The NDEF message to be written. 583 * @param { AsyncCallback<void> } callback The callback. 584 * @throws { BusinessError } 201 - Permission denied. 585 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 586 * <br> 1. Mandatory parameters are left unspecified. 587 * <br> 2. Incorrect parameters types. 588 * <br> 3. Parameter verification failed. 589 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 590 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 591 * @syscap SystemCapability.Communication.NFC.Tag 592 * @atomicservice 593 * @since 12 594 */ 595 writeNdef(msg: NdefMessage, callback: AsyncCallback<void>): void; 596 597 /** 598 * Checks NDEF tag can be set read-only. 599 * 600 * @permission ohos.permission.NFC_TAG 601 * @returns { boolean } Returns true if the tag can be set readonly, otherwise returns false. 602 * @throws { BusinessError } 201 - Permission denied. 603 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 604 * @syscap SystemCapability.Communication.NFC.Tag 605 * @since 9 606 */ 607 /** 608 * Checks NDEF tag can be set read-only. 609 * 610 * @permission ohos.permission.NFC_TAG 611 * @returns { boolean } Returns true if the tag can be set readonly, otherwise returns false. 612 * @throws { BusinessError } 201 - Permission denied. 613 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 614 * @syscap SystemCapability.Communication.NFC.Tag 615 * @atomicservice 616 * @since 12 617 */ 618 canSetReadOnly(): boolean; 619 620 /** 621 * Sets the NDEF tag read-only. 622 * 623 * @permission ohos.permission.NFC_TAG 624 * @returns { Promise<void> } The void 625 * @throws { BusinessError } 201 - Permission denied. 626 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 627 * <br> 1. Mandatory parameters are left unspecified. 628 * <br> 2. Incorrect parameters types. 629 * <br> 3. Parameter verification failed. 630 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 631 * @syscap SystemCapability.Communication.NFC.Tag 632 * @since 9 633 */ 634 /** 635 * Sets the NDEF tag read-only. 636 * 637 * @permission ohos.permission.NFC_TAG 638 * @returns { Promise<void> } The void 639 * @throws { BusinessError } 201 - Permission denied. 640 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 641 * <br> 1. Mandatory parameters are left unspecified. 642 * <br> 2. Incorrect parameters types. 643 * <br> 3. Parameter verification failed. 644 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 645 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 646 * @syscap SystemCapability.Communication.NFC.Tag 647 * @atomicservice 648 * @since 12 649 */ 650 setReadOnly(): Promise<void>; 651 652 /** 653 * Sets the NDEF tag read-only. 654 * 655 * @permission ohos.permission.NFC_TAG 656 * @param { AsyncCallback<void> } callback The callback. 657 * @throws { BusinessError } 201 - Permission denied. 658 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 659 * <br> 1. Mandatory parameters are left unspecified. 660 * <br> 2. Incorrect parameters types. 661 * <br> 3. Parameter verification failed. 662 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 663 * @syscap SystemCapability.Communication.NFC.Tag 664 * @since 9 665 */ 666 /** 667 * Sets the NDEF tag read-only. 668 * 669 * @permission ohos.permission.NFC_TAG 670 * @param { AsyncCallback<void> } callback The callback. 671 * @throws { BusinessError } 201 - Permission denied. 672 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 673 * <br> 1. Mandatory parameters are left unspecified. 674 * <br> 2. Incorrect parameters types. 675 * <br> 3. Parameter verification failed. 676 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 677 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 678 * @syscap SystemCapability.Communication.NFC.Tag 679 * @atomicservice 680 * @since 12 681 */ 682 setReadOnly(callback: AsyncCallback<void>): void; 683 684 /** 685 * Converts the NFC forum type into string defined in NFC forum. 686 * 687 * @param { tag.NfcForumType } type - NFC forum type of NDEF tag. 688 * @returns { string } The NFC forum string type. 689 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 690 * <br> 1. Mandatory parameters are left unspecified. 691 * <br> 2. Incorrect parameters types. 692 * <br> 3. Parameter verification failed. 693 * @syscap SystemCapability.Communication.NFC.Tag 694 * @since 9 695 */ 696 /** 697 * Converts the NFC forum type into string defined in NFC forum. 698 * 699 * @param { tag.NfcForumType } type - NFC forum type of NDEF tag. 700 * @returns { string } The NFC forum string type. 701 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 702 * <br> 1. Mandatory parameters are left unspecified. 703 * <br> 2. Incorrect parameters types. 704 * <br> 3. Parameter verification failed. 705 * @syscap SystemCapability.Communication.NFC.Tag 706 * @atomicservice 707 * @since 12 708 */ 709 getNdefTagTypeString(type: tag.NfcForumType): string; 710} 711 712/** 713 * Provides methods for accessing MifareClassic tag. 714 * 715 * @typedef MifareClassicTag 716 * @syscap SystemCapability.Communication.NFC.Tag 717 * @since 9 718 */ 719/** 720 * Provides methods for accessing MifareClassic tag. 721 * 722 * @typedef MifareClassicTag 723 * @syscap SystemCapability.Communication.NFC.Tag 724 * @atomicservice 725 * @since 12 726 */ 727export interface MifareClassicTag extends TagSession { 728 /** 729 * Authenticates a sector with the key.Only successful authentication sector can be operated. 730 * 731 * @permission ohos.permission.NFC_TAG 732 * @param { number } sectorIndex - Index of sector to authenticate. 733 * @param { number[] } key - The key(6-bytes) to authenticate. 734 * @param { boolean } isKeyA - KeyA flag. true means KeyA, otherwise KeyB. 735 * @returns { Promise<void> } The void 736 * @throws { BusinessError } 201 - Permission denied. 737 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 738 * <br> 1. Mandatory parameters are left unspecified. 739 * <br> 2. Incorrect parameters types. 740 * <br> 3. Parameter verification failed. 741 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 742 * @syscap SystemCapability.Communication.NFC.Tag 743 * @since 9 744 */ 745 /** 746 * Authenticates a sector with the key. Only successful authentication sector can be operated. 747 * 748 * @permission ohos.permission.NFC_TAG 749 * @param { number } sectorIndex - Index of sector to authenticate. 750 * @param { number[] } key - The key(6-bytes) to authenticate. 751 * @param { boolean } isKeyA - KeyA flag. true means KeyA, otherwise KeyB. 752 * @returns { Promise<void> } The void 753 * @throws { BusinessError } 201 - Permission denied. 754 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 755 * <br> 1. Mandatory parameters are left unspecified. 756 * <br> 2. Incorrect parameters types. 757 * <br> 3. Parameter verification failed. 758 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 759 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 760 * @syscap SystemCapability.Communication.NFC.Tag 761 * @atomicservice 762 * @since 12 763 */ 764 authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean): Promise<void>; 765 766 /** 767 * Authenticates a sector with the key.Only successful authentication sector can be operated. 768 * 769 * @permission ohos.permission.NFC_TAG 770 * @param { number } sectorIndex - Index of sector to authenticate. 771 * @param { number[] } key - The key(6-bytes) to authenticate. 772 * @param { boolean } isKeyA - KeyA flag. true means KeyA, otherwise KeyB. 773 * @param { AsyncCallback<void> } callback The callback. 774 * @throws { BusinessError } 201 - Permission denied. 775 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 776 * <br> 1. Mandatory parameters are left unspecified. 777 * <br> 2. Incorrect parameters types. 778 * <br> 3. Parameter verification failed. 779 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 780 * @syscap SystemCapability.Communication.NFC.Tag 781 * @since 9 782 */ 783 /** 784 * Authenticates a sector with the key. Only successful authentication sector can be operated. 785 * 786 * @permission ohos.permission.NFC_TAG 787 * @param { number } sectorIndex - Index of sector to authenticate. 788 * @param { number[] } key - The key(6-bytes) to authenticate. 789 * @param { boolean } isKeyA - KeyA flag. true means KeyA, otherwise KeyB. 790 * @param { AsyncCallback<void> } callback The callback. 791 * @throws { BusinessError } 201 - Permission denied. 792 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 793 * <br> 1. Mandatory parameters are left unspecified. 794 * <br> 2. Incorrect parameters types. 795 * <br> 3. Parameter verification failed. 796 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 797 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 798 * @syscap SystemCapability.Communication.NFC.Tag 799 * @atomicservice 800 * @since 12 801 */ 802 authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean, callback: AsyncCallback<void>): void; 803 804 /** 805 * Reads a block, one block size is 16 bytes. 806 * 807 * @permission ohos.permission.NFC_TAG 808 * @param { number } blockIndex - The index of block to read. 809 * @returns { Promise<number[]> } Returns the block data. 810 * @throws { BusinessError } 201 - Permission denied. 811 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 812 * <br> 1. Mandatory parameters are left unspecified. 813 * <br> 2. Incorrect parameters types. 814 * <br> 3. Parameter verification failed. 815 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 816 * @syscap SystemCapability.Communication.NFC.Tag 817 * @since 9 818 */ 819 /** 820 * Reads a block, one block size is 16 bytes. 821 * 822 * @permission ohos.permission.NFC_TAG 823 * @param { number } blockIndex - The index of block to read. 824 * @returns { Promise<number[]> } Returns the block data. 825 * @throws { BusinessError } 201 - Permission denied. 826 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 827 * <br> 1. Mandatory parameters are left unspecified. 828 * <br> 2. Incorrect parameters types. 829 * <br> 3. Parameter verification failed. 830 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 831 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 832 * @syscap SystemCapability.Communication.NFC.Tag 833 * @atomicservice 834 * @since 12 835 */ 836 readSingleBlock(blockIndex: number): Promise<number[]>; 837 838 /** 839 * Reads a block, one block size is 16 bytes. 840 * 841 * @permission ohos.permission.NFC_TAG 842 * @param { number } blockIndex - The index of block to read. 843 * @param { AsyncCallback<number[]> } callback The callback. 844 * @throws { BusinessError } 201 - Permission denied. 845 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 846 * <br> 1. Mandatory parameters are left unspecified. 847 * <br> 2. Incorrect parameters types. 848 * <br> 3. Parameter verification failed. 849 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 850 * @syscap SystemCapability.Communication.NFC.Tag 851 * @since 9 852 */ 853 /** 854 * Reads a block, one block size is 16 bytes. 855 * 856 * @permission ohos.permission.NFC_TAG 857 * @param { number } blockIndex - The index of block to read. 858 * @param { AsyncCallback<number[]> } callback The callback. 859 * @throws { BusinessError } 201 - Permission denied. 860 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 861 * <br> 1. Mandatory parameters are left unspecified. 862 * <br> 2. Incorrect parameters types. 863 * <br> 3. Parameter verification failed. 864 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 865 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 866 * @syscap SystemCapability.Communication.NFC.Tag 867 * @atomicservice 868 * @since 12 869 */ 870 readSingleBlock(blockIndex: number, callback: AsyncCallback<number[]>): void; 871 872 /** 873 * Writes a block, one block size is 16 bytes. 874 * 875 * @permission ohos.permission.NFC_TAG 876 * @param { number } blockIndex - The index of block to write. 877 * @param { number[] } data - The block data to write. 878 * @returns { Promise<void> } The void 879 * @throws { BusinessError } 201 - Permission denied. 880 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 881 * <br> 1. Mandatory parameters are left unspecified. 882 * <br> 2. Incorrect parameters types. 883 * <br> 3. Parameter verification failed. 884 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 885 * @syscap SystemCapability.Communication.NFC.Tag 886 * @since 9 887 */ 888 /** 889 * Writes a block, one block size is 16 bytes. 890 * 891 * @permission ohos.permission.NFC_TAG 892 * @param { number } blockIndex - The index of block to write. 893 * @param { number[] } data - The block data to write. 894 * @returns { Promise<void> } The void 895 * @throws { BusinessError } 201 - Permission denied. 896 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 897 * <br> 1. Mandatory parameters are left unspecified. 898 * <br> 2. Incorrect parameters types. 899 * <br> 3. Parameter verification failed. 900 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 901 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 902 * @syscap SystemCapability.Communication.NFC.Tag 903 * @atomicservice 904 * @since 12 905 */ 906 writeSingleBlock(blockIndex: number, data: number[]): Promise<void>; 907 908 /** 909 * Writes a block, one block size is 16 bytes. 910 * 911 * @permission ohos.permission.NFC_TAG 912 * @param { number } blockIndex - The index of block to write. 913 * @param { number[] } data - The block data to write. 914 * @param { AsyncCallback<void> } callback The callback. 915 * @throws { BusinessError } 201 - Permission denied. 916 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 917 * <br> 1. Mandatory parameters are left unspecified. 918 * <br> 2. Incorrect parameters types. 919 * <br> 3. Parameter verification failed. 920 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 921 * @syscap SystemCapability.Communication.NFC.Tag 922 * @since 9 923 */ 924 /** 925 * Writes a block, one block size is 16 bytes. 926 * 927 * @permission ohos.permission.NFC_TAG 928 * @param { number } blockIndex - The index of block to write. 929 * @param { number[] } data - The block data to write. 930 * @param { AsyncCallback<void> } callback The callback. 931 * @throws { BusinessError } 201 - Permission denied. 932 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 933 * <br> 1. Mandatory parameters are left unspecified. 934 * <br> 2. Incorrect parameters types. 935 * <br> 3. Parameter verification failed. 936 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 937 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 938 * @syscap SystemCapability.Communication.NFC.Tag 939 * @atomicservice 940 * @since 12 941 */ 942 writeSingleBlock(blockIndex: number, data: number[], callback: AsyncCallback<void>): void; 943 944 /** 945 * Increments the contents of a block, and stores the result in the internal transfer buffer. 946 * 947 * @permission ohos.permission.NFC_TAG 948 * @param { number } blockIndex - The index of block to increment. 949 * @param { number } value - The value to increment, none-negative. 950 * @returns { Promise<void> } The void 951 * @throws { BusinessError } 201 - Permission denied. 952 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 953 * <br> 1. Mandatory parameters are left unspecified. 954 * <br> 2. Incorrect parameters types. 955 * <br> 3. Parameter verification failed. 956 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 957 * @syscap SystemCapability.Communication.NFC.Tag 958 * @since 9 959 */ 960 /** 961 * Increments the contents of a block, and stores the result in the internal transfer buffer. 962 * 963 * @permission ohos.permission.NFC_TAG 964 * @param { number } blockIndex - The index of block to increment. 965 * @param { number } value - The value to increment, none-negative. 966 * @returns { Promise<void> } The void 967 * @throws { BusinessError } 201 - Permission denied. 968 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 969 * <br> 1. Mandatory parameters are left unspecified. 970 * <br> 2. Incorrect parameters types. 971 * <br> 3. Parameter verification failed. 972 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 973 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 974 * @syscap SystemCapability.Communication.NFC.Tag 975 * @atomicservice 976 * @since 12 977 */ 978 incrementBlock(blockIndex: number, value: number): Promise<void>; 979 980 /** 981 * Increments the contents of a block, and stores the result in the internal transfer buffer. 982 * 983 * @permission ohos.permission.NFC_TAG 984 * @param { number } blockIndex - The index of block to increment. 985 * @param { number } value - The value to increment, none-negative. 986 * @param { AsyncCallback<void> } callback The callback. 987 * @throws { BusinessError } 201 - Permission denied. 988 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 989 * <br> 1. Mandatory parameters are left unspecified. 990 * <br> 2. Incorrect parameters types. 991 * <br> 3. Parameter verification failed. 992 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 993 * @syscap SystemCapability.Communication.NFC.Tag 994 * @since 9 995 */ 996 /** 997 * Increments the contents of a block, and stores the result in the internal transfer buffer. 998 * 999 * @permission ohos.permission.NFC_TAG 1000 * @param { number } blockIndex - The index of block to increment. 1001 * @param { number } value - The value to increment, none-negative. 1002 * @param { AsyncCallback<void> } callback The callback. 1003 * @throws { BusinessError } 201 - Permission denied. 1004 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1005 * <br> 1. Mandatory parameters are left unspecified. 1006 * <br> 2. Incorrect parameters types. 1007 * <br> 3. Parameter verification failed. 1008 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1009 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1010 * @syscap SystemCapability.Communication.NFC.Tag 1011 * @atomicservice 1012 * @since 12 1013 */ 1014 incrementBlock(blockIndex: number, value: number, callback: AsyncCallback<void>): void; 1015 1016 /** 1017 * Decreases the contents of a block, and stores the result in the internal transfer buffer. 1018 * 1019 * @permission ohos.permission.NFC_TAG 1020 * @param { number } blockIndex - The index of block to decrease. 1021 * @param { number } value - The value to decrease, none-negative. 1022 * @returns { Promise<void> } The void 1023 * @throws { BusinessError } 201 - Permission denied. 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 } 3100201 - Tag running state is abnormal in service. 1029 * @syscap SystemCapability.Communication.NFC.Tag 1030 * @since 9 1031 */ 1032 /** 1033 * Decreases the contents of a block, and stores the result in the internal transfer buffer. 1034 * 1035 * @permission ohos.permission.NFC_TAG 1036 * @param { number } blockIndex - The index of block to decrease. 1037 * @param { number } value - The value to decrease, none-negative. 1038 * @returns { Promise<void> } The void 1039 * @throws { BusinessError } 201 - Permission denied. 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 } 3100201 - The tag running state is abnormal in the service. 1045 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1046 * @syscap SystemCapability.Communication.NFC.Tag 1047 * @atomicservice 1048 * @since 12 1049 */ 1050 decrementBlock(blockIndex: number, value: number): Promise<void>; 1051 1052 /** 1053 * Decreases the contents of a block, and stores the result in the internal transfer buffer. 1054 * 1055 * @permission ohos.permission.NFC_TAG 1056 * @param { number } blockIndex - The index of block to decrease. 1057 * @param { number } value - The value to decrease, none-negative. 1058 * @param { AsyncCallback<void> } callback The callback. 1059 * @throws { BusinessError } 201 - Permission denied. 1060 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1061 * <br> 1. Mandatory parameters are left unspecified. 1062 * <br> 2. Incorrect parameters types. 1063 * <br> 3. Parameter verification failed. 1064 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1065 * @syscap SystemCapability.Communication.NFC.Tag 1066 * @since 9 1067 */ 1068 /** 1069 * Decreases the contents of a block, and stores the result in the internal transfer buffer. 1070 * 1071 * @permission ohos.permission.NFC_TAG 1072 * @param { number } blockIndex - The index of block to decrease. 1073 * @param { number } value - The value to decrease, none-negative. 1074 * @param { AsyncCallback<void> } callback The callback. 1075 * @throws { BusinessError } 201 - Permission denied. 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 } 3100201 - The tag running state is abnormal in the service. 1081 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1082 * @syscap SystemCapability.Communication.NFC.Tag 1083 * @atomicservice 1084 * @since 12 1085 */ 1086 decrementBlock(blockIndex: number, value: number, callback: AsyncCallback<void>): void; 1087 1088 /** 1089 * Writes the contents of the internal transfer buffer to a value block. 1090 * 1091 * @permission ohos.permission.NFC_TAG 1092 * @param { number } blockIndex - The index of value block to be written. 1093 * @returns { Promise<void> } The void 1094 * @throws { BusinessError } 201 - Permission denied. 1095 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1096 * <br> 1. Mandatory parameters are left unspecified. 1097 * <br> 2. Incorrect parameters types. 1098 * <br> 3. Parameter verification failed. 1099 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1100 * @syscap SystemCapability.Communication.NFC.Tag 1101 * @since 9 1102 */ 1103 /** 1104 * Writes the contents of the internal transfer buffer to a value block. 1105 * 1106 * @permission ohos.permission.NFC_TAG 1107 * @param { number } blockIndex - The index of value block to be written. 1108 * @returns { Promise<void> } The void 1109 * @throws { BusinessError } 201 - Permission denied. 1110 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1111 * <br> 1. Mandatory parameters are left unspecified. 1112 * <br> 2. Incorrect parameters types. 1113 * <br> 3. Parameter verification failed. 1114 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1115 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1116 * @syscap SystemCapability.Communication.NFC.Tag 1117 * @atomicservice 1118 * @since 12 1119 */ 1120 transferToBlock(blockIndex: number): Promise<void>; 1121 1122 /** 1123 * Writes the contents of the internal transfer buffer to a value block. 1124 * 1125 * @permission ohos.permission.NFC_TAG 1126 * @param { number } blockIndex - The index of value block to be written. 1127 * @param { AsyncCallback<void> } callback The callback. 1128 * @throws { BusinessError } 201 - Permission denied. 1129 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1130 * <br> 1. Mandatory parameters are left unspecified. 1131 * <br> 2. Incorrect parameters types. 1132 * <br> 3. Parameter verification failed. 1133 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1134 * @syscap SystemCapability.Communication.NFC.Tag 1135 * @since 9 1136 */ 1137 /** 1138 * Writes the contents of the internal transfer buffer to a value block. 1139 * 1140 * @permission ohos.permission.NFC_TAG 1141 * @param { number } blockIndex - The index of value block to be written. 1142 * @param { AsyncCallback<void> } callback The callback. 1143 * @throws { BusinessError } 201 - Permission denied. 1144 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1145 * <br> 1. Mandatory parameters are left unspecified. 1146 * <br> 2. Incorrect parameters types. 1147 * <br> 3. Parameter verification failed. 1148 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1149 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1150 * @syscap SystemCapability.Communication.NFC.Tag 1151 * @atomicservice 1152 * @since 12 1153 */ 1154 transferToBlock(blockIndex: number, callback: AsyncCallback<void>): void; 1155 1156 /** 1157 * Moves the contents of a block into the internal transfer buffer. 1158 * 1159 * @permission ohos.permission.NFC_TAG 1160 * @param { number } blockIndex - The index of value block to be moved from. 1161 * @returns { Promise<void> } The void 1162 * @throws { BusinessError } 201 - Permission denied. 1163 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1164 * <br> 1. Mandatory parameters are left unspecified. 1165 * <br> 2. Incorrect parameters types. 1166 * <br> 3. Parameter verification failed. 1167 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1168 * @syscap SystemCapability.Communication.NFC.Tag 1169 * @since 9 1170 */ 1171 /** 1172 * Moves the contents of a block into the internal transfer buffer. 1173 * 1174 * @permission ohos.permission.NFC_TAG 1175 * @param { number } blockIndex - The index of value block to be moved from. 1176 * @returns { Promise<void> } The void 1177 * @throws { BusinessError } 201 - Permission denied. 1178 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1179 * <br> 1. Mandatory parameters are left unspecified. 1180 * <br> 2. Incorrect parameters types. 1181 * <br> 3. Parameter verification failed. 1182 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1183 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1184 * @syscap SystemCapability.Communication.NFC.Tag 1185 * @atomicservice 1186 * @since 12 1187 */ 1188 restoreFromBlock(blockIndex: number): Promise<void>; 1189 1190 /** 1191 * Moves the contents of a block into the internal transfer buffer. 1192 * 1193 * @permission ohos.permission.NFC_TAG 1194 * @param { number } blockIndex - The index of value block to be moved from. 1195 * @param { AsyncCallback<void> } callback The callback. 1196 * @throws { BusinessError } 201 - Permission denied. 1197 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1198 * <br> 1. Mandatory parameters are left unspecified. 1199 * <br> 2. Incorrect parameters types. 1200 * <br> 3. Parameter verification failed. 1201 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1202 * @syscap SystemCapability.Communication.NFC.Tag 1203 * @since 9 1204 */ 1205 /** 1206 * Moves the contents of a block into the internal transfer buffer. 1207 * 1208 * @permission ohos.permission.NFC_TAG 1209 * @param { number } blockIndex - The index of value block to be moved from. 1210 * @param { AsyncCallback<void> } callback The callback. 1211 * @throws { BusinessError } 201 - Permission denied. 1212 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1213 * <br> 1. Mandatory parameters are left unspecified. 1214 * <br> 2. Incorrect parameters types. 1215 * <br> 3. Parameter verification failed. 1216 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1217 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1218 * @syscap SystemCapability.Communication.NFC.Tag 1219 * @atomicservice 1220 * @since 12 1221 */ 1222 restoreFromBlock(blockIndex: number, callback: AsyncCallback<void>): void; 1223 1224 /** 1225 * Gets the number of sectors in MifareClassic tag. 1226 * 1227 * @returns { number } Returns the number of sectors. 1228 * @syscap SystemCapability.Communication.NFC.Tag 1229 * @since 9 1230 */ 1231 /** 1232 * Gets the number of sectors in MifareClassic tag. 1233 * 1234 * @returns { number } Returns the number of sectors. 1235 * @syscap SystemCapability.Communication.NFC.Tag 1236 * @atomicservice 1237 * @since 12 1238 */ 1239 getSectorCount(): number; 1240 1241 /** 1242 * Gets the number of blocks in the sector. 1243 * 1244 * @param { number } sectorIndex - The index of sector. 1245 * @returns { number } Returns the number of blocks. 1246 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1247 * <br> 1. Mandatory parameters are left unspecified. 1248 * <br> 2. Incorrect parameters types. 1249 * <br> 3. Parameter verification failed. 1250 * @syscap SystemCapability.Communication.NFC.Tag 1251 * @since 9 1252 */ 1253 /** 1254 * Gets the number of blocks in the sector. 1255 * 1256 * @param { number } sectorIndex - The index of sector. 1257 * @returns { number } Returns the number of blocks. 1258 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1259 * <br> 1. Mandatory parameters are left unspecified. 1260 * <br> 2. Incorrect parameters types. 1261 * <br> 3. Parameter verification failed. 1262 * @syscap SystemCapability.Communication.NFC.Tag 1263 * @atomicservice 1264 * @since 12 1265 */ 1266 getBlockCountInSector(sectorIndex: number): number; 1267 1268 /** 1269 * Gets the type of the MifareClassic tag. 1270 * 1271 * @returns { tag.MifareClassicType } Returns type of MifareClassic tag. 1272 * @syscap SystemCapability.Communication.NFC.Tag 1273 * @since 9 1274 */ 1275 /** 1276 * Gets the type of the MifareClassic tag. 1277 * 1278 * @returns { tag.MifareClassicType } Returns type of MifareClassic tag. 1279 * @syscap SystemCapability.Communication.NFC.Tag 1280 * @atomicservice 1281 * @since 12 1282 */ 1283 getType(): tag.MifareClassicType; 1284 1285 /** 1286 * Gets size of the tag in bytes. 1287 * 1288 * @returns { number } Returns the size of the tag. 1289 * @syscap SystemCapability.Communication.NFC.Tag 1290 * @since 9 1291 */ 1292 /** 1293 * Gets size of the tag in bytes. 1294 * 1295 * @returns { number } Returns the size of the tag. 1296 * @syscap SystemCapability.Communication.NFC.Tag 1297 * @atomicservice 1298 * @since 12 1299 */ 1300 getTagSize(): number; 1301 1302 /** 1303 * Checks if the tag is emulated or not. 1304 * 1305 * @returns { boolean } Returns true if tag is emulated, otherwise false. 1306 * @syscap SystemCapability.Communication.NFC.Tag 1307 * @since 9 1308 */ 1309 /** 1310 * Checks if the tag is emulated or not. 1311 * 1312 * @returns { boolean } Returns true if tag is emulated, otherwise false. 1313 * @syscap SystemCapability.Communication.NFC.Tag 1314 * @atomicservice 1315 * @since 12 1316 */ 1317 isEmulatedTag(): boolean; 1318 1319 /** 1320 * Gets the first block of the specific sector. 1321 * 1322 * @param { number } sectorIndex - The index of sector. 1323 * @returns { number } Returns index of first block in the sector. 1324 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1325 * <br> 1. Mandatory parameters are left unspecified. 1326 * <br> 2. Incorrect parameters types. 1327 * <br> 3. Parameter verification failed. 1328 * @syscap SystemCapability.Communication.NFC.Tag 1329 * @since 9 1330 */ 1331 /** 1332 * Gets the first block of the specific sector. 1333 * 1334 * @param { number } sectorIndex - The index of sector. 1335 * @returns { number } Returns index of first block in the sector. 1336 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1337 * <br> 1. Mandatory parameters are left unspecified. 1338 * <br> 2. Incorrect parameters types. 1339 * <br> 3. Parameter verification failed. 1340 * @syscap SystemCapability.Communication.NFC.Tag 1341 * @atomicservice 1342 * @since 12 1343 */ 1344 getBlockIndex(sectorIndex: number): number; 1345 1346 /** 1347 * Gets the sector index, that the sector contains the specific block. 1348 * 1349 * @param { number } blockIndex - The index of block. 1350 * @returns { number } Returns the sector index. 1351 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1352 * <br> 1. Mandatory parameters are left unspecified. 1353 * <br> 2. Incorrect parameters types. 1354 * <br> 3. Parameter verification failed. 1355 * @syscap SystemCapability.Communication.NFC.Tag 1356 * @since 9 1357 */ 1358 /** 1359 * Gets the sector index, that the sector contains the specific block. 1360 * 1361 * @param { number } blockIndex - The index of block. 1362 * @returns { number } Returns the sector index. 1363 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1364 * <br> 1. Mandatory parameters are left unspecified. 1365 * <br> 2. Incorrect parameters types. 1366 * <br> 3. Parameter verification failed. 1367 * @syscap SystemCapability.Communication.NFC.Tag 1368 * @atomicservice 1369 * @since 12 1370 */ 1371 getSectorIndex(blockIndex: number): number; 1372} 1373 1374/** 1375 * Provides methods for accessing MifareUltralight tag. 1376 * 1377 * @typedef MifareUltralightTag 1378 * @syscap SystemCapability.Communication.NFC.Tag 1379 * @since 9 1380 */ 1381/** 1382 * Provides methods for accessing MifareUltralight tag. 1383 * 1384 * @typedef MifareUltralightTag 1385 * @syscap SystemCapability.Communication.NFC.Tag 1386 * @atomicservice 1387 * @since 12 1388 */ 1389export interface MifareUltralightTag extends TagSession { 1390 /** 1391 * Reads 4 pages, total is 16 bytes. Page size is 4 bytes. 1392 * 1393 * @permission ohos.permission.NFC_TAG 1394 * @param { number } pageIndex - The index of page to read. 1395 * @returns { Promise<number[]> } Returns 4 pages data. 1396 * @throws { BusinessError } 201 - Permission denied. 1397 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1398 * <br> 1. Mandatory parameters are left unspecified. 1399 * <br> 2. Incorrect parameters types. 1400 * <br> 3. Parameter verification failed. 1401 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1402 * @syscap SystemCapability.Communication.NFC.Tag 1403 * @since 9 1404 */ 1405 /** 1406 * Reads 4 pages, total is 16 bytes. Page size is 4 bytes. 1407 * 1408 * @permission ohos.permission.NFC_TAG 1409 * @param { number } pageIndex - The index of page to read. 1410 * @returns { Promise<number[]> } Returns 4 pages data. 1411 * @throws { BusinessError } 201 - Permission denied. 1412 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1413 * <br> 1. Mandatory parameters are left unspecified. 1414 * <br> 2. Incorrect parameters types. 1415 * <br> 3. Parameter verification failed. 1416 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1417 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1418 * @syscap SystemCapability.Communication.NFC.Tag 1419 * @atomicservice 1420 * @since 12 1421 */ 1422 readMultiplePages(pageIndex: number): Promise<number[]>; 1423 1424 /** 1425 * Reads 4 pages, total is 16 bytes. Page size is 4 bytes. 1426 * 1427 * @permission ohos.permission.NFC_TAG 1428 * @param { number } pageIndex - The index of page to read. 1429 * @param { AsyncCallback<number[]> } callback The callback. 1430 * @throws { BusinessError } 201 - Permission denied. 1431 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1432 * <br> 1. Mandatory parameters are left unspecified. 1433 * <br> 2. Incorrect parameters types. 1434 * <br> 3. Parameter verification failed. 1435 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1436 * @syscap SystemCapability.Communication.NFC.Tag 1437 * @since 9 1438 */ 1439 /** 1440 * Reads 4 pages, total is 16 bytes. Page size is 4 bytes. 1441 * 1442 * @permission ohos.permission.NFC_TAG 1443 * @param { number } pageIndex - The index of page to read. 1444 * @param { AsyncCallback<number[]> } callback The callback. 1445 * @throws { BusinessError } 201 - Permission denied. 1446 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1447 * <br> 1. Mandatory parameters are left unspecified. 1448 * <br> 2. Incorrect parameters types. 1449 * <br> 3. Parameter verification failed. 1450 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1451 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1452 * @syscap SystemCapability.Communication.NFC.Tag 1453 * @atomicservice 1454 * @since 12 1455 */ 1456 readMultiplePages(pageIndex: number, callback: AsyncCallback<number[]>): void; 1457 1458 /** 1459 * Writes a page, total 4 bytes. 1460 * 1461 * @permission ohos.permission.NFC_TAG 1462 * @param { number } pageIndex - The index of page to write. 1463 * @param { number[] } data - The page data to write. 1464 * @returns { Promise<void> } The void 1465 * @throws { BusinessError } 201 - Permission denied. 1466 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1467 * <br> 1. Mandatory parameters are left unspecified. 1468 * <br> 2. Incorrect parameters types. 1469 * <br> 3. Parameter verification failed. 1470 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1471 * @syscap SystemCapability.Communication.NFC.Tag 1472 * @since 9 1473 */ 1474 /** 1475 * Writes a page, total 4 bytes. 1476 * 1477 * @permission ohos.permission.NFC_TAG 1478 * @param { number } pageIndex - The index of page to write. 1479 * @param { number[] } data - The page data to write. 1480 * @returns { Promise<void> } The void 1481 * @throws { BusinessError } 201 - Permission denied. 1482 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1483 * <br> 1. Mandatory parameters are left unspecified. 1484 * <br> 2. Incorrect parameters types. 1485 * <br> 3. Parameter verification failed. 1486 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1487 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1488 * @syscap SystemCapability.Communication.NFC.Tag 1489 * @atomicservice 1490 * @since 12 1491 */ 1492 writeSinglePage(pageIndex: number, data: number[]): Promise<void>; 1493 1494 /** 1495 * Writes a page, total 4 bytes. 1496 * 1497 * @permission ohos.permission.NFC_TAG 1498 * @param { number } pageIndex - The index of page to write. 1499 * @param { number[] } data - The page data to write. 1500 * @param { AsyncCallback<void> } callback The callback. 1501 * @throws { BusinessError } 201 - Permission denied. 1502 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1503 * <br> 1. Mandatory parameters are left unspecified. 1504 * <br> 2. Incorrect parameters types. 1505 * <br> 3. Parameter verification failed. 1506 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1507 * @syscap SystemCapability.Communication.NFC.Tag 1508 * @since 9 1509 */ 1510 /** 1511 * Writes a page, total 4 bytes. 1512 * 1513 * @permission ohos.permission.NFC_TAG 1514 * @param { number } pageIndex - The index of page to write. 1515 * @param { number[] } data - The page data to write. 1516 * @param { AsyncCallback<void> } callback The callback. 1517 * @throws { BusinessError } 201 - Permission denied. 1518 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1519 * <br> 1. Mandatory parameters are left unspecified. 1520 * <br> 2. Incorrect parameters types. 1521 * <br> 3. Parameter verification failed. 1522 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1523 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1524 * @syscap SystemCapability.Communication.NFC.Tag 1525 * @atomicservice 1526 * @since 12 1527 */ 1528 writeSinglePage(pageIndex: number, data: number[], callback: AsyncCallback<void>): void; 1529 1530 /** 1531 * Gets the type of the MifareUltralight tag. 1532 * 1533 * @returns { tag.MifareUltralightType } Returns the type of MifareUltralight tag. 1534 * @syscap SystemCapability.Communication.NFC.Tag 1535 * @since 9 1536 */ 1537 /** 1538 * Gets the type of the MifareUltralight tag. 1539 * 1540 * @returns { tag.MifareUltralightType } Returns the type of MifareUltralight tag. 1541 * @syscap SystemCapability.Communication.NFC.Tag 1542 * @atomicservice 1543 * @since 12 1544 */ 1545 getType(): tag.MifareUltralightType; 1546} 1547 1548/** 1549 * Provides methods for accessing NdefFormatable tag. 1550 * 1551 * @typedef NdefFormatableTag 1552 * @syscap SystemCapability.Communication.NFC.Tag 1553 * @since 9 1554 */ 1555/** 1556 * Provides methods for accessing NdefFormatable tag. 1557 * 1558 * @typedef NdefFormatableTag 1559 * @syscap SystemCapability.Communication.NFC.Tag 1560 * @atomicservice 1561 * @since 12 1562 */ 1563export interface NdefFormatableTag extends TagSession { 1564 /** 1565 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag. 1566 * 1567 * @permission ohos.permission.NFC_TAG 1568 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1569 * @returns { Promise<void> } The void 1570 * @throws { BusinessError } 201 - Permission denied. 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 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1576 * @syscap SystemCapability.Communication.NFC.Tag 1577 * @since 9 1578 */ 1579 /** 1580 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag. 1581 * 1582 * @permission ohos.permission.NFC_TAG 1583 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1584 * @returns { Promise<void> } The void 1585 * @throws { BusinessError } 201 - Permission denied. 1586 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1587 * <br> 1. Mandatory parameters are left unspecified. 1588 * <br> 2. Incorrect parameters types. 1589 * <br> 3. Parameter verification failed. 1590 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1591 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1592 * @syscap SystemCapability.Communication.NFC.Tag 1593 * @atomicservice 1594 * @since 12 1595 */ 1596 format(message: NdefMessage): Promise<void>; 1597 1598 /** 1599 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag. 1600 * 1601 * @permission ohos.permission.NFC_TAG 1602 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1603 * @param { AsyncCallback<void> } callback The callback. 1604 * @throws { BusinessError } 201 - Permission denied. 1605 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1606 * <br> 1. Mandatory parameters are left unspecified. 1607 * <br> 2. Incorrect parameters types. 1608 * <br> 3. Parameter verification failed. 1609 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1610 * @syscap SystemCapability.Communication.NFC.Tag 1611 * @since 9 1612 */ 1613 /** 1614 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag. 1615 * 1616 * @permission ohos.permission.NFC_TAG 1617 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1618 * @param { AsyncCallback<void> } callback The callback. 1619 * @throws { BusinessError } 201 - Permission denied. 1620 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1621 * <br> 1. Mandatory parameters are left unspecified. 1622 * <br> 2. Incorrect parameters types. 1623 * <br> 3. Parameter verification failed. 1624 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1625 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1626 * @syscap SystemCapability.Communication.NFC.Tag 1627 * @atomicservice 1628 * @since 12 1629 */ 1630 format(message: NdefMessage, callback: AsyncCallback<void>): void; 1631 1632 /** 1633 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag, then sets the tag readonly. 1634 * 1635 * @permission ohos.permission.NFC_TAG 1636 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1637 * @returns { Promise<void> } The void 1638 * @throws { BusinessError } 201 - Permission denied. 1639 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1640 * <br> 1. Mandatory parameters are left unspecified. 1641 * <br> 2. Incorrect parameters types. 1642 * <br> 3. Parameter verification failed. 1643 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1644 * @syscap SystemCapability.Communication.NFC.Tag 1645 * @since 9 1646 */ 1647 /** 1648 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag, then sets the tag readonly. 1649 * 1650 * @permission ohos.permission.NFC_TAG 1651 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1652 * @returns { Promise<void> } The void 1653 * @throws { BusinessError } 201 - Permission denied. 1654 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1655 * <br> 1. Mandatory parameters are left unspecified. 1656 * <br> 2. Incorrect parameters types. 1657 * <br> 3. Parameter verification failed. 1658 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1659 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1660 * @syscap SystemCapability.Communication.NFC.Tag 1661 * @atomicservice 1662 * @since 12 1663 */ 1664 formatReadOnly(message: NdefMessage): Promise<void>; 1665 1666 /** 1667 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag, then sets the tag readonly. 1668 * 1669 * @permission ohos.permission.NFC_TAG 1670 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1671 * @param { AsyncCallback<void> } callback The callback. 1672 * @throws { BusinessError } 201 - Permission denied. 1673 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1674 * <br> 1. Mandatory parameters are left unspecified. 1675 * <br> 2. Incorrect parameters types. 1676 * <br> 3. Parameter verification failed. 1677 * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. 1678 * @syscap SystemCapability.Communication.NFC.Tag 1679 * @since 9 1680 */ 1681 /** 1682 * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag, then sets the tag readonly. 1683 * 1684 * @permission ohos.permission.NFC_TAG 1685 * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. 1686 * @param { AsyncCallback<void> } callback The callback. 1687 * @throws { BusinessError } 201 - Permission denied. 1688 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1689 * <br> 1. Mandatory parameters are left unspecified. 1690 * <br> 2. Incorrect parameters types. 1691 * <br> 3. Parameter verification failed. 1692 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1693 * @throws { BusinessError } 3100204 - The Tag I/O operation failed. 1694 * @syscap SystemCapability.Communication.NFC.Tag 1695 * @atomicservice 1696 * @since 12 1697 */ 1698 formatReadOnly(message: NdefMessage, callback: AsyncCallback<void>): void; 1699} 1700 1701/** 1702 * Provides methods for accessing Barcode tag. 1703 * 1704 * @extends TagSession 1705 * @typedef BarcodeTag 1706 * @syscap SystemCapability.Communication.NFC.Tag 1707 * @atomicservice 1708 * @since 18 1709 */ 1710export interface BarcodeTag extends TagSession { 1711 /** 1712 * Returns the barcode of a Barcode tag. 1713 * 1714 * @permission ohos.permission.NFC_TAG 1715 * @returns { Promise<ArrayBuffer> } The barcode of tag. 1716 * @throws { BusinessError } 201 - Permission denied. 1717 * @throws { BusinessError } 3100201 - The tag running state is abnormal in the service. 1718 * @throws { BusinessError } 3100204 - The tag I/O operation failed. 1719 * @syscap SystemCapability.Communication.NFC.Tag 1720 * @atomicservice 1721 * @since 18 1722 */ 1723 getBarcode(): Promise<ArrayBuffer>; 1724}