2.IsoDep类

IsoDep

类概述:

Provides access to ISO-DEP (ISO 14443-4) properties and I/O operations on a Tag.

Acquire an IsoDep object using get(Tag).

The primary ISO-DEP I/O operation is transceive(byte[]). Applications must implement their own protocol stack on top of transceive(byte[]).

Tags that enumerate the IsoDep technology in getTechList() will also enumerate NfcA or NfcB (since IsoDep builds on top of either of these).

Note: Methods that perform I/O operations require the NFC permission.

该类提供了访问ISO-DEP(ISO 14443 - 4)标记属性和I / O操作。

使用 get(Tag) 函数可以获得一个IsoDep对象。

主要的ISO-DEP I / O操作是 transceive(byte[]) 函数(核心函数)。应用程序必须他们自己的实现协议栈之上使用 transceive(byte[]) 函数。

使用 getTechList() 函数会列举IsoDep还将列举NfcA或NfcB(因为IsoDep构建在这两种技术其中一种之上的)。

注意:执行I / O操作的方法需要获取NFC权限。

核心函数:public byte[] transceive (byte[] data)

Send raw ISO-DEP data to the tag and receive the response.

Applications must only send the INF payload, and not the start of frame and end of frame indicators. Applications do not need to fragment the payload, it will be automatically fragmented and defragmented by transceive(byte[]) if it exceeds FSD/FSC limits.

Use getMaxTransceiveLength() to retrieve the maximum number 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.

向标签 tag发送原始ISO-DEP数据和接收响应。

应用程序必须只发送the INF payload,而不是payload的开始碎片和payload的结束碎片。应用程序不需要拆分payload,使用transceive(byte[])函数将自动分散和整理payload,如果它超过FSD / FSC的限制。

使用getMaxTransceiveLength()函数来检索transceive(byte[])能发送的最大字节数。

这是一个I / O操作,将阻塞,直到操作完成。在主应用程序线程,它不能被调用。如果在另一个线程调用close()函数,该操作调用将被取消并抛出IOException异常。


 

原文地址:https://www.cnblogs.com/H-BolinBlog/p/5362431.html