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 16import { NfcATag, NfcBTag, NfcFTag, NfcVTag } from './tag/nfctech'; 17 18/** 19 * Provides methods to operate or manage NFC tag. 20 * 21 * @import import tag from '@ohos.nfc.tag'; 22 * 23 * @since 7 24 * @syscap SystemCapability.Communication.NFC.Core 25 */ 26declare namespace tag { 27 /** Indicates an NFC-A tag. */ 28 const NFC_A = 1; 29 30 /** Indicates an NFC-B tag. */ 31 const NFC_B = 2; 32 33 /** Indicates an ISO-DEP tag. */ 34 const ISO_DEP = 3; 35 36 /** Indicates an NFC-F tag. */ 37 const NFC_F = 4; 38 39 /** Indicates an NFC-V tag. */ 40 const NFC_V = 5; 41 42 /** Indicated an NDEF tag. */ 43 const NDEF = 6; 44 45 /** Indicates a MifareClassic tag. */ 46 const MIFARE_CLASSIC = 8; 47 48 /** Indicates a MifareUltralight tag. */ 49 const MIFARE_ULTRALIGHT = 9; 50 51 /** 52 * Obtains an {@code NfcATag} object based on the tag information. 53 * 54 * <p>During tag reading, if the tag supports the NFC-A technology, an {@code NfcATag} object 55 * will be created based on the tag information. 56 * 57 * @param tagInfo Indicates the tag information. 58 * @permission ohos.permission.NFC_TAG 59 * 60 * @since 7 61 */ 62 function getNfcATag(tagInfo: TagInfo): NfcATag 63 64 /** 65 * Obtains an {@code NfcBTag} object based on the tag information. 66 * 67 * <p>During tag reading, if the tag supports the NFC-B technology, an {@code NfcBTag} object 68 * will be created based on the tag information. 69 * 70 * @param tagInfo Indicates the tag information. 71 * @permission ohos.permission.NFC_TAG 72 * 73 * @since 7 74 */ 75 function getNfcBTag(tagInfo: TagInfo): NfcBTag 76 77 /** 78 * Obtains an {@code NfcFTag} object based on the tag information. 79 * 80 * <p>During tag reading, if the tag supports the NFC-F technology, an {@code NfcFTag} object 81 * will be created based on the tag information. 82 * 83 * @param tagInfo Indicates the tag information. 84 * @permission ohos.permission.NFC_TAG 85 * 86 * @since 7 87 */ 88 function getNfcFTag(tagInfo: TagInfo): NfcFTag 89 90 /** 91 * Obtains an {@code NfcVTag} object based on the tag information. 92 * 93 * <p>During tag reading, if the tag supports the NFC-V technology, an {@code NfcVTag} object 94 * will be created based on the tag information. 95 * 96 * @param tagInfo Indicates the tag information. 97 * @permission ohos.permission.NFC_TAG 98 * 99 * @since 7 100 */ 101 function getNfcVTag(tagInfo: TagInfo): NfcVTag 102 103 104 /** 105 * Provides tag information. 106 * 107 * <p>This class provides the technology a tag supports, for example, NFC-A. Applications can create 108 * different tags based on the supported technology. 109 * 110 * @since 7 111 * @syscap SystemCapability.Communication.NFC.Core 112 * @permission ohos.permission.NFC_TAG 113 */ 114 export interface TagInfo { 115 supportedProfiles: number[]; 116 } 117} 118export default tag;