public
final
class
NfcV
extends Object
implements
TagTechnology
java.lang.Object | |
↳ | 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(Tag)
.
The primary NFC-V 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 | |
---|---|
void
|
close()
Disable I/O operations to the tag from this |
void
|
connect()
Enable I/O operations to the tag from this |
static
NfcV
|
get(Tag tag)
Get an instance of |
byte
|
getDsfId()
Return the DSF ID bytes from tag discovery. |
int
|
getMaxTransceiveLength()
Return the maximum number of bytes that can be sent with |
byte
|
getResponseFlags()
Return the Response Flag bytes from tag discovery. |
Tag
|
getTag()
Get the |
boolean
|
isConnected()
Helper to indicate if I/O operations should be possible. |
byte[]
|
transceive(byte[] data)
Send raw NFC-V commands to the tag and receive the response. |
Inherited methods | |
---|---|
From
class
java.lang.Object
| |
From
interface
android.nfc.tech.TagTechnology
| |
From
interface
java.io.Closeable
| |
From
interface
java.lang.AutoCloseable
|
void close ()
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.
Throws | |
---|---|
IOException |
void connect ()
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.
Throws | |
---|---|
IOException |
NfcV get (Tag tag)
Get an instance of NfcV
for the given tag.
Returns null if NfcV
was not enumerated in 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 |
Returns | |
---|---|
NfcV |
NFC-V object |
byte getDsfId ()
Return the DSF ID bytes from tag discovery.
Does not cause any RF activity and does not block.
Returns | |
---|---|
byte |
DSF ID bytes |
int getMaxTransceiveLength ()
Return the maximum number of bytes that can be sent with transceive(byte[])
.
Returns | |
---|---|
int |
the maximum number of bytes that can be sent with transceive(byte[]) .
|
byte getResponseFlags ()
Return the Response Flag bytes from tag discovery.
Does not cause any RF activity and does not block.
Returns | |
---|---|
byte |
Response Flag bytes |
Tag getTag ()
Get the Tag
object backing this TagTechnology
object.
Returns | |
---|---|
Tag |
the Tag backing this TagTechnology object.
|
boolean isConnected ()
Helper to indicate if I/O operations should be possible.
Returns true if connect()
has completed, and close()
has not been
called, and the Tag
is not known to be out of range.
Does not cause RF activity, and does not block.
Returns | |
---|---|
boolean |
true if I/O operations should be possible |
byte[] transceive (byte[] data)
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(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.
Parameters | |
---|---|
data |
byte :
bytes to send |
Returns | |
---|---|
byte[] |
bytes received in response |
Throws | |
---|---|
|
if the tag leaves the field |
IOException |
if there is an I/O failure, or this operation is canceled |