Tag: smartcard reader

使用JAVA智能卡API读取NFC标签不适用于MAC OS

我正在开发一个从NFC读卡器(ACR122U-A9)设备读取NFC标签UID的应用程序。 我使用JAVA和javax.smartcardio API来检测NFC阅读器和阅读NFC标签。 该应用程序的function是在NFC读取器设备与PC连接或断开连接时显示通知。 然后,如果设备已连接且显示NFC标签,则显示NFC标签显示的通知。 我试图找到基于事件的api来实现上述function但我找不到所以我使用Java Timer和Polling来获取NFC读取器设备和NFC标签。 以下是我的示例JAVA代码,用于轮询NFC设备和标签。 import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.List; import java.util.Timer; import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; import javax.smartcardio.CardTerminal; import javax.smartcardio.TerminalFactory; /** * * @author sa */ public class NFC_Test { /** * @param args the command line arguments */ static Timer timer; public static void main(String[] args) { try […]

使用SCL010获取Mifare Ultralight的UID

我想获得Mifare Ultralight NFC标签的UID。 在Java中我有这个代码: TerminalFactory factory = TerminalFactory.getDefault(); List terminals = factory.terminals().list(); System.out.println(“Terminals: ” + terminals); CardTerminal terminal = terminals.get(0); Card card = terminal.connect(“*”); System.out.println(“card: ” + card); CardChannel channel = card.getBasicChannel(); ResponseAPDU answer = channel.transmit(new CommandAPDU(0xFF, 0xCA, 0x00, 0x00, 0x00)); byte[] uid = answer.getBytes(); 问题是我收到两个字节而不是UID。 有什么问题? APDU是否正确?