更改 Android 中的 NFCA 超时长度
我想知道如何更改 Android 中从 NfcA 类型卡接收回复的超时长度。我看到了如何在 Iso-Dep 类型卡上更改它,但没有在 NfcA 类型卡上更改它。另外,有人知道NFCA卡的超时时间是多长吗? 我正在使用自定义卡,并且想知道在回复之前我对该卡有多少处理时间。
I was wondering how to change the length of the timeout for receiving a reply from a NfcA type card in Android. I saw how to change it on a Iso-Dep type card, but not on the NfcA type card. Also, does anyone know how long the timeout is for a NfcA card?
I am using a custom card and want to know how much processing time I have on the card before I have to reply.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NfcA 只是 IsoDep 的子类型,因此 IsoDep 超时适用于 NfcA 和 NfcB。
NFC-Stack 应与标签协商合适的超时值并使用它。但是,如果您连接到的智能卡上的应用程序超出了时间限制(警告:糟糕的程序员警报!),则可能需要提高超时才能使工作正常进行。
在这种情况下,请使用 IsoDep 命令并延长超时。
如果您联系了编写智能卡代码的人,您甚至可能会得到关于某些命令(加密哈希计算是一个常见问题)最多需要多长时间的答案。如果您没有联系,您只能进行实验。
另一件事:从 Android API 来看,您似乎可以完全控制超时值。这不是真的!如果您将其扩展超出高级协议允许的范围,您将遇到很多麻烦。在这种情况下,您可能会遇到从功能不可靠到 NFC 子系统完全崩溃等各种情况。 (只是说..)
NfcA is just a subtype of IsoDep, so the IsoDep timeout will work for NfcA and NfcB.
The NFC-Stack should negotiate a suitable time-out values with the tag and use it. However, if you connect to a smartcard that has an applications which exceed the timing constraints (Warning: bad programmer alert!) raising the time-out may be necessary to get things working.
In this case use the IsoDep command and extend the time-out.
If you have contact to the guys who wrote the smartcard code you may even get an answer about how long certain commands (cryptographic hash calculation is one common problem) may take at max.. If you don't have contact you can only experiment.
Another thing: Judging from the Android API it looks like you have full control about the time-out value. This is not true! If you extend it beyond what is allowed by the high level protocols you will run into lots of trouble. In this case you can expect anything from unreliable functionality to a total crash of the NFC-subsystem. (Just saying..)
从 API 级别 14 开始,还有一个用于 NfcA 的 setTimeout()。在该 API 级别之前,超时是固定的,约为 300 毫秒。
Since API level 14, there is also a setTimeout() for NfcA. Before that API level, the timeout is fixed and is about 300ms.