ACR122 - 安卓/如何提取UID [英] ACR122 - Android / How to extract the UID

查看:303
本文介绍了ACR122 - 安卓/如何提取UID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将ACR122集成到我的Andr​​oid应用程序。我使用了Android库(的http:// www.acs.com.hk/en/products/3/acr122u-usb-nfc-reader/ )可从ACS。

I try to integrate an ACR122 to my android app. I'm using the ANDROID Library (http://www.acs.com.hk/en/products/3/acr122u-usb-nfc-reader/) available from ACS.

一切工作,我可检测卡的presence,但我想提取卡的UID / ID。有人知道函数来做到这一点?

Everything work, I can detect the presence of a card but I want to extract the UID/ID of the card. Someone know the function to do that?

你有这种类型的集成的例子吗?

Do you have an example of this type of integration?

推荐答案

在情况Mifare卡,你需要发送这个APDU字节数组卡:(字节)0xFF的,(字节)0xCA,(字节)为0x00,(字节)为0x00,(字节)×00。我不知道有关ACR122的API,但可能你需要用这个APDU到特定的API方法类似发射()

In case of Mifare card you need to send this APDU byte array to the card: (byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x00 . I'm not sure about ACR122 API but probably you need to wrap this APDU into specific API method like transmit()

更新

样品code:

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

Reader是com.acs.smartcard.Reader对象 和slotNum是一个插槽号。我不知道如何找到它,因为我没有ACR测试。但是,如果你说,你是能够建立与读者基本的沟通也许你知道slotNum。

Reader is com.acs.smartcard.Reader object and slotNum is a the slot number. I’m not sure how to find it because I don’t have ACR to test. But if you told that you was able to establish basic communication with reader probably you know slotNum.

这篇关于ACR122 - 安卓/如何提取UID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆