MIFARE超轻3C认证的安卓(2.3.6) - 关闭超轻、MIFARE

2023-09-05 07:38:36 作者:丑得让爹操碎了心

我试图来验证的Mifare超轻C(ISO / IEC 14443-2和14443-3 A型兼容)的标签。

我发送的验证命令,在安卓提供的MifareUltralight.transceive()函数。我还检查NfcA.transceive()(IsoDep似乎不是用这种标签的兼容,因为这个对象是处理ISO / IEC 14443-4的标签,这就是为什么我不使用IsoDep.transceive())。

所以,当我第一次发送的验证请求命令的标签应答收发()与AFxxxx .....我的处理标签的答案,然后我再派收发()与应对这个问题的答案,但.. 。之前发送的收发()标签相连,当它送到我得到一个标签丢失警告,收发失败。

另外,如果我尝试用NFCA了同样的问题发生。

最后,如果我尝试的第一个响应后发送一个验证命令我得到的也是一个标签丢失与收发警告失败。

所以我的问题是:

       

为什么NFC标签获取,当我发送第二个收发丢失()<?<

  

(它似乎并不被超时问题,因为刚刚发送第二收发()连接是打开的标签之前) 我从UI一个不同的主题把所有的东西。

在此先感谢!

解决方案

您的做法似乎是正确的。然而,标签的行为表明您回应标签的答案是不正确的。在这种情况下,标签拒绝回答。但从手机的角度来看,这是无法区分的标签已经消失了,所以你得到一个 TagLostException

I'm trying to authenticate a Mifare Ultralight C (ISO/IEC 14443-2 and 14443-3 type A compatible) tag.

为什么iphone6存储空间不足500m会一直提醒,怎么关闭

I send the authentication command with the MifareUltralight.transceive() function provided in Android. I have also checked NfcA.transceive() (IsoDep seems not to be compatible with this kind of tag because this object is for dealing with ISO/IEC 14443-4 tags and that's why I don't use IsoDep.transceive()).

So, when I first send the authentication request command the tag answers the transceive() with AFxxxx..... where I process the tag answer and then I send another transceive() with the response to that answer but... just before sending the transceive() the tag is connected, when it's sent I get a "tag was lost" warning and a "transceive failed".

Also, if I try it with NfcA the same problem happens.

Finally, if I try to send one authentication command after the first one response I get also a "Tag was lost" warning with the transceive fail.

So my question is:

Why does the NFC tag get lost when I send the second transceive()?<<

(It doesn't seem to be a timeout problem because just before sending the second transceive() the connection is open with the tag) I made all the stuff in a different Thread from the UI one.

Thanks in advance!

解决方案

Your approach seems to be correct. However, the tag's behaviour indicates that your response to the tag's answer was incorrect. In that case, the tag refuses to answer. From the phone's point of view this is indistinguishable from the tag having disappeared, so you get a TagLostException.

 
精彩推荐
图片推荐