Search code examples
javajava-native-interfacenfcrfidpcsc

ACR122 USB SDK - JNI calls to Winscard.dll


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


Solution

  • 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)