Methods Summary |
---|
public static android.nfc.tech.IsoDep | get(android.nfc.Tag tag)Get an instance of {@link IsoDep} for the given tag.
Does not cause any RF activity and does not block.
Returns null if {@link IsoDep} was not enumerated in {@link Tag#getTechList}.
This indicates the tag does not support ISO-DEP.
if (!tag.hasTech(TagTechnology.ISO_DEP)) return null;
try {
return new IsoDep(tag);
} catch (RemoteException e) {
return null;
}
|
public byte[] | getHiLayerResponse()Return the higher layer response bytes for {@link NfcB} tags.
Does not cause any RF activity and does not block.
The higher layer response bytes can be used to help identify a tag.
They are present only on {@link IsoDep} tags that are based on {@link NfcB}
RF technology. If this tag is not {@link NfcB} then null is returned.
In ISO 14443-4 terminology, the higher layer bytes are a subset of the
ATTRIB response.
return mHiLayerResponse;
|
public byte[] | getHistoricalBytes()Return the ISO-DEP historical bytes for {@link NfcA} tags.
Does not cause any RF activity and does not block.
The historical bytes can be used to help identify a tag. They are present
only on {@link IsoDep} tags that are based on {@link NfcA} RF technology.
If this tag is not {@link NfcA} then null is returned.
In ISO 14443-4 terminology, the historical bytes are a subset of the RATS
response.
return mHistBytes;
|
public int | getMaxTransceiveLength()Return the maximum number of bytes that can be sent with {@link #transceive}.
return getMaxTransceiveLengthInternal();
|
public int | getTimeout()Get the current timeout for {@link #transceive} in milliseconds.
Requires the {@link android.Manifest.permission#NFC} permission.
try {
return mTag.getTagService().getTimeout(TagTechnology.ISO_DEP);
} catch (RemoteException e) {
Log.e(TAG, "NFC service dead", e);
return 0;
}
|
public boolean | isExtendedLengthApduSupported()Standard APDUs have a 1-byte length field, allowing a maximum of
255 payload bytes, which results in a maximum APDU length of 261 bytes.
Extended length APDUs have a 3-byte length field, allowing 65535
payload bytes.
Some NFC adapters, like the one used in the Nexus S and the Galaxy Nexus
do not support extended length APDUs. They are expected to be well-supported
in the future though. Use this method to check for extended length APDU
support.
try {
return mTag.getTagService().getExtendedLengthApdusSupported();
} catch (RemoteException e) {
Log.e(TAG, "NFC service dead", e);
return false;
}
|
public void | setTimeout(int timeout)Set the timeout of {@link #transceive} in milliseconds.
The timeout only applies to ISO-DEP {@link #transceive}, and is
reset to a default value when {@link #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 {@link android.Manifest.permission#NFC} permission.
try {
int err = mTag.getTagService().setTimeout(TagTechnology.ISO_DEP, timeout);
if (err != ErrorCodes.SUCCESS) {
throw new IllegalArgumentException("The supplied timeout is not valid");
}
} catch (RemoteException e) {
Log.e(TAG, "NFC service dead", e);
}
|
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 {@link #transceive} if
it exceeds FSD/FSC limits.
Use {@link #getMaxTransceiveLength} to retrieve the maximum number of bytes
that can be sent with {@link #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
{@link IOException} if {@link #close} is called from another thread.
Requires the {@link android.Manifest.permission#NFC} permission.
return transceive(data, true);
|