This section describes two types of NFC contactless applets:
- Card emulation applets
- Reader emulation applets
Card Emulation Applets
These applets are very similar to classic Javacard applets. All commands (APDUs) are sent by the RF reader. At the reception of each Contactless APDU the process() method is called with the APDU header in parameter. The applet computes the response and sends it back using the classic Javacard API. It is the responsibility of the (U)SIM operating System and the NFC chip to forward the response back to the contactless reader.
The following differences should however be underlined:
- APDUs are received on logical channel 3 (Proximera 0.5 specific)
- The getProtocol() method always returns protocol T=0 even in Contactless mode (Proximera 0.5 specific)
- The waitExtension() method should not be used
Reader Emulation Applets
In Reader mode, the behavior is more complex because the applet needs to send commands and there is no existing adapted interface to do that.
First, there is a new package to start and stop the reader mode (it must not be always activated for consumption issues. When reader mode is activated, the NFC chip generates a Contactless field, and it consumes power from the phone battery).
The package is com.axalto.contactless.readermode and it contains two main native functions ReaderModeStart() and ReaderModeStop() to respectively start and stop the reader emulation mode. You can find the source code of this package here.
The data flow is the following:
- An APDU 0328000100 is received by the applet when a card or a tag is detected in the field. In response to this APDU, the applet should send its first command in the outgoing data.
- When the Card or tag responds to the first command, the response data is encapsulated in a new APDU whose format is 03280000xx<response data>. The applet processes the response data from the card/tag and sends its next command in the APDU outgoing data.
- The communication between “reader” and “card” repeats the above process.
- When there are no more commands to send, the applet does not return any outgoing data. In this case, the SIM/USIM OS will automatically stop the reader mode.

