更改 Android 中的 NFCA 超时长度

发布于 2024-11-27 04:15:34 字数 142 浏览 3 评论 0原文

我想知道如何更改 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜柠檬 2024-12-04 04:15:34
  1. NfcA 只是 IsoDep 的子类型,因此 IsoDep 超时适用于 NfcA 和 NfcB。

  2. NFC-Stack 应与标签协商合适的超时值并使用它。但是,如果您连接到的智能卡上的应用程序超出了时间限制(警告:糟糕的程序员警报!),则可能需要提高超时才能使工作正常进行。

在这种情况下,请使用 IsoDep 命令并延长超时。

如果您联系了编写智能卡代码的人,您甚至可能会得到关于某些命令(加密哈希计算是一个常见问题)最多需要多长时间的答案。如果您没有联系,您只能进行实验。

另一件事:从 Android API 来看,您似乎可以完全控制超时值。这不是真的!如果您将其扩展超出高级协议允许的范围,您将遇到很多麻烦。在这种情况下,您可能会遇到从功能不可靠到 NFC 子系统完全崩溃等各种情况。 (只是说..)

  1. NfcA is just a subtype of IsoDep, so the IsoDep timeout will work for NfcA and NfcB.

  2. 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..)

百变从容 2024-12-04 04:15:34

从 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文