IsoDepTag, MifareClassicTag, MifareUltralightTag, NdefTag, NfcATag, NfcBTag, NfcFTag, NfcVTagpublic abstract class TagManager extends Object
Classes for different types of tags inherit from this abstract class to control connections to tags, read data from tags, and write data to tags.
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ISO_DEP |
Indicates an ISO-DEP tag.
|
static int |
MIFARE_CLASSIC |
Indicates a MifareClassic tag.
|
static int |
MIFARE_ULTRALIGHT |
Indicates a MifareUltralight tag.
|
static int |
NDEF |
Indicated an NDEF tag.
|
static int |
NFC_A |
Indicates an NFC-A tag.
|
static int |
NFC_B |
Indicates an NFC-B tag.
|
static int |
NFC_F |
Indicates an NFC-F tag.
|
static int |
NFC_V |
Indicates an NFC-V tag.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
checkConnected() |
Checks whether this tag is connected or not.
|
boolean |
connectTag() |
Connects to a tag.
|
int |
getMaxSendLength() |
Queries the maximum length of data that can be sent to a tag.
|
int |
getSendDataTimeout() |
Queries the timeout duration (ms) for sending data to a tag.
|
TagInfo |
getTagInfo() |
Obtains the tag information.
|
boolean |
isTagConnected() |
Checks whether a connection has been set up with a tag.
|
void |
reset() |
Resets a connection with a tag and restores the default timeout duration for writing data to the tag.
|
byte[] |
sendData(byte[] data) |
Writes data to a tag.
|
boolean |
setSendDataTimeout(int timeout) |
Sets the timeout duration (ms) for sending data to a tag.
|
public static final int ISO_DEP
public static final int MIFARE_CLASSIC
public static final int MIFARE_ULTRALIGHT
public static final int NDEF
public static final int NFC_A
public static final int NFC_B
public static final int NFC_F
public static final int NFC_V
public TagInfo getTagInfo()
TagInfo object.public boolean connectTag()
This method must be called before data is read from or written to the tag.
true if the connection is set up; returns false otherwise.public void reset()
public boolean isTagConnected()
true if a connection has been set up with the tag;
returns false otherwise.public boolean setSendDataTimeout(int timeout)
If data is not sent to the tag within the duration, data sending fails.
timeout - Indicates the timeout duration to be set.true if the setting is successful; returns false otherwise.public int getSendDataTimeout()
public byte[] sendData(byte[] data)
data - Indicates the data to be written to the tag.public int getMaxSendLength()
public void checkConnected()
IllegalStateException - if tag is not connected.