ACR122 USB SDK - JNI calls to Winscard.dll
Asked Answered
G

1

8

we have bought the ACR122 USB SDK for NFC testing. We would like to build the test desktop application for the ACR122U-A2 NFC reader. We are developing it in Java on the Microsoft Windows 7 platform.

We expected that in order to use PC/SC from Winscard.dll we need to make JNI calls. In order to do that C/C++ wrapper library for JNI calls should be prepared.

I think this should be part of the SDK, because the example application references the JNI wrapper Jacspcsc.dll, but the library is not there. Has anybody similar experience? Are there any JNI wrappers available for Winscard.dll?

Thanks STeN

Galateah answered 3/6, 2011 at 12:18 Comment(0)
R
6

If you installed the PC/SC driver for the reader you can use the java smardcardio package (http://download.oracle.com/javase/6/docs/jre/api/security/smartcardio/spec/javax/smartcardio/package-summary.html) to communicate with the reader.

TerminalFactory terminalFactory = TerminalFactory.getDefault();
CardTerminal terminal = terminalFactory.terminals().list().get(0);
Card card = terminal.connect("T=0");
CardChannel channel = card.getBasicChannel();

// Construct a command and transmit it
CommandAPDU command = new CommandAPDU(new byte[]{(byte)0x01, (byte)0x02, ...})
ResponseAPDU response = channel.transmit(command)
Reunionist answered 14/6, 2011 at 7:40 Comment(4)
Hi, I already use the java smardcardio package. I received also the library for JNI calls, but I prefer Java native way... Just now I finalized all the initialization, made GUI and I get the ATR. Now I am going to program the tag. Do you know if the CommandAPDU can be used for sending non-APDU commands, i.e. how to proceed with tags (e.g. Mifare Classic 1K), which do not understand APDU, but only proprietary commands? Thx PetrGalateah
To send tag specific commands to the tag you need to go through some steps to establish a logical connection to the tag; You need to poll for a tag and once you received a response, use the direct transmit command to send commands to the tag. The documentation for the ACR122U reader provides examples on how to do this.Reunionist
You need to wrap commands for the contactless card (as opposed to the internal contact SAM card) inside 'pseudo APDUs'. We've implemented a smartcardio based provider for this over here.Vail
A JNI wrapper around libnfc might work, and would make your app work with other NXP-PN53x based NFC readers.Vail

© 2022 - 2024 — McMap. All rights reserved.