的Nexus 4的读取MIFARE经典卡的UID [英] Nexus 4 read Mifare Classic card UID
问题描述
目前,我们正在开发NFC应用为Android。我们的经验
Currently we are developing NFC applications for Android. Our experience
-
采用恩智浦PN5xx芯片MIFARE经典(1K)和CEPAS标准的控制开发POS NFC控制系统
Developed POS NFC control system using NXP PN5xx chips for control of Mifare Classic (1K) and CEPAS standard
有关MiFareClassic和超轻℃的Galaxy Nexus的(采用恩智浦NFC芯片)开发的Android NFC控制系统
Developed Android NFC control system for MiFareClassic and Ultralight C in Galaxy Nexus (using NXP NFC chipset)
有关超轻℃下的Nexus 4的Android开发NFC控制系统
Developed Android NFC control system for Ultralight C in Nexus 4
我们的挑战:我们想控制我们的POS机MiFareClassic 1K卡(NXP芯片),并在新的Android平板电脑(博通芯片),我们已经拥有了安装卡基并不能取代它们。
Our challenge: we want to control MiFareClassic 1K card in our POS machine (with NXP chip) and in new Android tablets (with Broadcom chip), we already have the installed card base and can not replace them.
- 我们知道的Nexus 4已经改变了NFC芯片,现在却无法读/写任何MIFARE经典卡块以外UID
- We know Nexus 4 has changed the NFC chip, now it can not read/write any Mifare classic card block except UID.
- 我们code检测MIFARE经典卡NFCA类型。 NFCA有一个方法叫收发(字节[]数据)发送原始NFC-A命令标签和接收响应。
- Our code detects Mifare classic card as NfcA type. NfcA has a method called transceive(byte[] data) to Send raw NFC-A commands to the tag and receive the response.
- 我们的问题是,我们需要知道什么code发送到设备来读取UID,其他人在网上说,他们能做到这一点,但没有方法可以找到
- Our problem is we need to know what code to send to the device to read the UID, other people online say they can do it but no methodology can be found
目前,我们总是得到一个错误:android.nfc.TagLostException:标签丢失
Currently we always get an error: android.nfc.TagLostException: Tag was lost.
谢谢您的回答。
推荐答案
您可以调用的 的getId()
。这将返回该标记(其中,在MIFARE经典的情况下,可以是4-或7字节的唯一ID,随机ID或固定非唯一4字节ID的ID;根据确切的MIFARE经典产品)。
有没有需要调用连接()
在 NFCA
(没有可能性做任何有意义)。
You can call getId()
on the Tag object in the Intent. This will return the ID of the tag (which, in the case of MIFARE Classic, may be a 4- or 7-byte unique ID, a random ID or a fixed non-unique 4-byte ID; depending on the exact MIFARE Classic product).
There is no need to call connect()
on NfcA
(and no possibility to do anything meaningful).
请注意,这不会对三星Galaxy S4工作。当MIFARE标签被窃听的电话不会分派NFC意图。相反,它会显示在屏幕,说明该手机与此不兼容标签上的错误消息,然后忽略这个标签。
Please, note that this will not work on the Samsung Galaxy S4. That phone will not dispatch an NFC intent when a MIFARE tag is tapped. Instead, it will display an error message on the screen stating that the phone is incompatible with this tag and then ignore the tag.
更新:
在运行Android 4.4奇巧的S4,您可以使用NFC阅读器模式来获得访问这些细节作为卡的UID,也为MIFARE经典标签。
UPDATE: On an S4 running Android 4.4 KitKat, you can use the NFC Reader Mode to get access to such details as card UID, also for MIFARE Classic tags.
这篇关于的Nexus 4的读取MIFARE经典卡的UID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!