java.lang.Object | |
↳ | android.nfc.tech.NfcF |
Provides access to NFC-F (JIS 6319-4) properties and I/O operations on a Tag
.
Acquire a NfcF
object using get(Tag)
.
The primary NFC-F I/O operation is transceive(byte[])
. Applications must
implement their own protocol stack on top of transceive(byte[])
.
Note: Methods that perform I/O operations
require the NFC
permission.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Disable I/O operations to the tag from this
TagTechnology object, and release resources. | |||||||||||
Enable I/O operations to the tag from this
TagTechnology object. | |||||||||||
Get an instance of
NfcF for the given tag. | |||||||||||
Return the Manufacturer bytes from tag discovery.
| |||||||||||
Return the maximum number of bytes that can be sent with
transceive(byte[]) . | |||||||||||
Return the System Code bytes from tag discovery.
| |||||||||||
Get the
Tag object backing this TagTechnology object. | |||||||||||
Get the current
transceive(byte[]) timeout in milliseconds. | |||||||||||
Helper to indicate if I/O operations should be possible.
| |||||||||||
Set the
transceive(byte[]) timeout in milliseconds. | |||||||||||
Send raw NFC-F commands to the tag and receive the response.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.nfc.tech.TagTechnology
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.lang.AutoCloseable
|
Disable I/O operations to the tag from this TagTechnology
object, and release resources.
Also causes all blocked I/O operations on other thread to be canceled and
return with IOException
.
Requires the NFC
permission.
IOException |
---|
Enable I/O operations to the tag from this TagTechnology
object.
May cause RF activity and may block. Must not be called
from the main application thread. A blocked call will be canceled with
IOException
by calling close()
from another thread.
Only one TagTechnology
object can be connected to a Tag
at a time.
Applications must call close()
when I/O operations are complete.
Requires the NFC
permission.
IOException |
---|
Get an instance of NfcF
for the given tag.
Returns null if NfcF
was not enumerated in getTechList()
.
This indicates the tag does not support NFC-F.
Does not cause any RF activity and does not block.
tag | an NFC-F compatible tag |
---|
Return the Manufacturer bytes from tag discovery.
Does not cause any RF activity and does not block.
Return the maximum number of bytes that can be sent with transceive(byte[])
.
transceive(byte[])
.
Return the System Code bytes from tag discovery.
Does not cause any RF activity and does not block.
Get the Tag
object backing this TagTechnology
object.
Tag
backing this TagTechnology
object.
Get the current transceive(byte[])
timeout in milliseconds.
Requires the NFC
permission.
Set the transceive(byte[])
timeout in milliseconds.
The timeout only applies to transceive(byte[])
on this object,
and is reset to a default value when close()
is called.
Setting a longer timeout may be useful when performing transactions that require a long processing time on the tag such as key generation.
Requires the NFC
permission.
timeout | timeout value in milliseconds |
---|
Send raw NFC-F commands to the tag and receive the response.
Applications must not append the SoD (length) or EoD (CRC) to the payload, it will be automatically calculated.
Use getMaxTransceiveLength()
to retrieve the maximum amount of bytes
that can be sent with transceive(byte[])
.
This is an I/O operation and will block until complete. It must
not be called from the main application thread. A blocked call will be canceled with
IOException
if close()
is called from another thread.
Requires the NFC
permission.
data | bytes to send |
---|
if the tag leaves the field | |
IOException | if there is an I/O failure, or this operation is canceled |