kh4*_*4ZE 1 android nfc acr122
我尝试将ACR122集成到我的Android应用程序中.我正在使用ACS提供的ANDROID库(http://www.acs.com.hk/en/products/3/acr122u-usb-nfc-reader/).
一切正常,我可以检测到卡的存在,但我想提取卡的UID/ID.有人知道这样做的功能吗?
你有这种集成的例子吗?
对于Mifare卡,您需要将此APDU字节数组发送到卡:(byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x00.我不确定ACR122 API,但可能需要将此APDU包装到特定的API方法中,如transmit()
UPDATE
示例代码:
byte[] command = { (byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
byte[] response = new byte[300];
int responseLength;
responseLength = reader.transmit(slotNum, command, command.length, response,response.length);
System.out.println(new String(response));
Run Code Online (Sandbox Code Playgroud)
Reader是com.acs.smartcard.Reader对象,slotNum是一个插槽号.我不确定如何找到它因为我没有ACR来测试.但如果你告诉你能够与读者建立基本的沟通,你可能知道slotNum.
| 归档时间: |
|
| 查看次数: |
1747 次 |
| 最近记录: |