安卓4.4.2,PN532 NFC读写器和NFC卡模拟 [英] Android 4.4.2, PN532 NFC reader and NFC Card emulation

查看:5190
本文介绍了安卓4.4.2,PN532 NFC读写器和NFC卡模拟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发出一种系统,可以使用读者PN532芯片读取NFC标签。它的工作原理确定。我能读MIFARE经典和Mifare超轻标签。

I have developed a system that can read NFC tag using a reader with PN532 chip. It works ok. I can read Mifare Classic and Mifare Ultralight tag.

现在我想用一台Nexus平板电脑采用Android 4.4.2来模拟标记。我有一个Android开发没有经验,但我认为这是可能的。

Now I'd like to use a Nexus Tablet with Android 4.4.2 to emulate a tag. I have no experience with android development but I think it is possible.

我已将NFC通信在Nexus平板电脑,但我想我已经下载或写一些程序来模拟一个标签和一个NDEF沟通。

I have set NFC communication in the Nexus Tablet but I think I have to download or write some application to emulate a Tag and an NDEF communication.

什么是最简单的方法是什么?

What is the easiest way?

推荐答案

这取决于什么的Nexus平板电脑,你有:

That depends on what Nexus tablet you have:

  • 的Nexus 7(第一代/ 2012版本):该设备采用了恩智浦PN544 NFC控制器。看来,它目前无法对这些设备进行基于主机卡仿真与Android 4.4+(见这个问题我的答案这里)。

的Nexus 7(第二代/ 2013版)和Nexus 10:这些器件采用Broadcom公司的NFC控制器。因此,你可以使用Android 4.4系统的HCE API来模拟接触式智能卡。

Nexus 7 (second generation/2013 version) and Nexus 10: These devices use Broadcom's NFC controller. Therefore, you can use Android 4.4's HCE API to emulate a contactless smartcard.

使用Android的HCE API,您将仿真ISO 14443-4智能卡,你只能与使用ISO 7816-4定义的应用选择和APDU格式。你会首先创建并注册一个HCE服务(请参见 API指南)。然后你就可以使用该服务的 processCommandApdu()方法处理传入的APDU(见这个答案)。

With Android's HCE API you will emulate an ISO 14443-4 smartcard and you can only communicate using the application selection and APDU format defined in ISO 7816-4. You would first create and register a HCE service (see the API guide). Then you can process incoming APDUs using the service's processCommandApdu() method (see this answer).

如果您的阅读器端应用程序目前仅处理MIFARE经典和超轻,你就必须把它扩大到也符合ISO 14443-4 / APDU为基础的智能卡进行通信。 (如MIFARE经典和超轻型为主的非APDU的仿真卡无法对Android的HCE API之上。)的PN532通常会处理这个更大的部分给你,所以一旦你发现这样的智能卡(例如,使用 InListPassiveTarget )应该自动处理ISO 14443-4传输协议,您可以直接发送邮件使用 InDataExchange 命令APDU命令。

If your reader-side application currently only processes MIFARE Classic and Ultralight, you would have to extend it to also communicate with ISO 14443-4/APDU-based smartcards. (Emulation of non-APDU based cards like MIFARE Classic and Ultralight is not possible on top of ANdroid's HCE API.) The PN532 will typically handle the bigger part of this for you, so once you discover such a smartcard (e.g. with InListPassiveTarget) it should automatically handle the ISO 14443-4 transport protocol and you can directly send APDU commands using the InDataExchange command.

如果你想在HCE交换NDEF消息,一旦你有APDU为基础的通信启动和运行,你可以实现NFC论坛的第4类标签操作规范(从的 NFC论坛的网站)Android的HCE服务中来模拟类型4 NDEF标签。

If you want to exchange NDEF messages over HCE, once you have APDU-based communication up and running, you could implement the NFC Forum's Type 4 Tag Operation specification (get it from the NFC Forum's website) within the Android HCE service to emulate a Type 4 NDEF tag.

这篇关于安卓4.4.2,PN532 NFC读写器和NFC卡模拟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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