NfcV
class NfcV : TagTechnology
kotlin.Any | |
↳ | android.nfc.tech.NfcV |
Provides access to NFC-V (ISO 15693) properties and I/O operations on a Tag
.
Acquire a NfcV
object using get
.
The primary NFC-V I/O operation is transceive
. Applications must implement their own protocol stack on top of transceive
.
Note: Methods that perform I/O operations require the android.Manifest.permission#NFC
permission.
Summary
Public methods | |
---|---|
Unit |
close() |
Unit |
connect() |
static NfcV! |
Get an instance of |
Byte |
getDsfId() Return the DSF ID bytes from tag discovery. |
Int |
Return the maximum number of bytes that can be sent with |
Byte |
Return the Response Flag bytes from tag discovery. |
Tag! |
getTag() |
Boolean | |
ByteArray! |
transceive(data: ByteArray!) Send raw NFC-V commands to the tag and receive the response. |
Public methods
close
fun close(): Unit
Exceptions | |
---|---|
java.lang.Exception |
if this resource cannot be closed |
java.io.IOException |
if an I/O error occurs |
java.lang.SecurityException |
if the tag object is reused after the tag has left the field |
connect
fun connect(): Unit
Exceptions | |
---|---|
TagLostException |
if the tag leaves the field |
java.io.IOException |
if there is an I/O failure, or connect is canceled |
java.lang.SecurityException |
if the tag object is reused after the tag has left the field |
get
static fun get(tag: Tag!): NfcV!
Get an instance of NfcV
for the given tag.
Returns null if NfcV
was not enumerated in Tag#getTechList
. This indicates the tag does not support NFC-V.
Does not cause any RF activity and does not block.
Parameters | |
---|---|
tag |
Tag!: an NFC-V compatible tag |
Return | |
---|---|
NfcV! |
NFC-V object |
getDsfId
fun getDsfId(): Byte
Return the DSF ID bytes from tag discovery.
Does not cause any RF activity and does not block.
Return | |
---|---|
Byte |
DSF ID bytes |
getMaxTransceiveLength
fun getMaxTransceiveLength(): Int
Return the maximum number of bytes that can be sent with transceive
.
Return | |
---|---|
Int |
the maximum number of bytes that can be sent with transceive . |
getResponseFlags
fun getResponseFlags(): Byte
Return the Response Flag bytes from tag discovery.
Does not cause any RF activity and does not block.
Return | |
---|---|
Byte |
Response Flag bytes |
getTag
fun getTag(): Tag!
Return | |
---|---|
Tag! |
the Tag backing this TagTechnology object. |
isConnected
fun isConnected(): Boolean
Return | |
---|---|
Boolean |
true if I/O operations should be possible |
transceive
fun transceive(data: ByteArray!): ByteArray!
Send raw NFC-V commands to the tag and receive the response.
Applications must not append the CRC to the payload, it will be automatically calculated. The application does provide FLAGS, CMD and PARAMETER bytes.
Use getMaxTransceiveLength
to retrieve the maximum amount of bytes that can be sent with transceive
.
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 android.Manifest.permission#NFC
permission.
Parameters | |
---|---|
data |
ByteArray!: bytes to send |
Return | |
---|---|
ByteArray! |
bytes received in response |
Exceptions | |
---|---|
TagLostException |
if the tag leaves the field |
java.io.IOException |
if there is an I/O failure, or this operation is canceled |