Class IsoDep
java.lang.Object
com.codename1.nfc.TagTechnology
com.codename1.nfc.IsoDep
ISO 14443-4 / ISO 7816-4 technology view: send APDU command-response
pairs to a contactless smart card (EMV payment, ePassport, government
ID, transit). Backed by IsoDep on Android and by NFCISO7816Tag on
iOS.
A typical SELECT-then-READ exchange:
IsoDep iso = tag.getIsoDep();
if (iso == null) {
// tag is not ISO-DEP capable
return;
}
byte[] selectAid = new byte[] {
0x00, (byte) 0xA4, 0x04, 0x00, 0x07,
(byte) 0xA0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10
};
iso.transceive(selectAid).onResult((sw, err) -> {
// last two bytes of sw are the ISO 7816 SW1/SW2 status word
});
All response bytes (including the terminating SW1/SW2 status word) are
returned verbatim. Use [#isSuccess(byte[])] to test for the canonical
90 00 success word without slicing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Historical bytes returned during ISO-DEP activation (AndroidIsoDep.getHistoricalBytes()).intLargest single transceive payload the underlying transport accepts.final TagTypegetType()The technology variant this view represents.booleantruewhen this view exchanges extended-length APDUs (Lc / Le up to 65535).static booleanisSuccess(byte[] response) Returnstruewhen the last two bytes ofresponseare the ISO 7816 success status word (90 00).AsyncResource<byte[]> transceive(byte[] apdu) Sends the given raw bytes to the tag and resolves with the response.
-
Constructor Details
-
IsoDep
public IsoDep()
-
-
Method Details
-
getHistoricalBytes
public byte[] getHistoricalBytes()Historical bytes returned during ISO-DEP activation (AndroidIsoDep.getHistoricalBytes()). Empty when the platform does not surface them. -
getMaxTransceiveLength
public int getMaxTransceiveLength()Largest single transceive payload the underlying transport accepts. Some Android implementations top out at 253 bytes for short APDU frames; Core NFC fragments at 256. Use as an upper bound when chunking largeREAD BINARYexchanges. -
isExtendedLengthSupported
public boolean isExtendedLengthSupported()truewhen this view exchanges extended-length APDUs (Lc / Le up to 65535). Most Android devices reporttrue; iOS Core NFC reportsfalse. -
getType
Description copied from class:TagTechnologyThe technology variant this view represents.- Specified by:
getTypein classTagTechnology
-
isSuccess
public static boolean isSuccess(byte[] response) Returnstruewhen the last two bytes ofresponseare the ISO 7816 success status word (90 00). Useful as a quick check after [#transceive(byte[])]. -
transceive
Description copied from class:TagTechnologySends the given raw bytes to the tag and resolves with the response. The base class reportsNfcError.UNSUPPORTED_TAG-- ports override per technology.- Overrides:
transceivein classTagTechnology
-