最近一直在了解关于NFC相关的技术实现,对相关的应用已经掌握。经过这段时间的操作,个人感觉要想实现近距离卡的读写,首先要先了解
NFC相关信息和自己要针对哪种卡进行操作,这个非常重要,能够避免少走弯路。
NFC(Near Field Communication)中文名:近距离无线通信技术,是一种短距高频的无线电技术,在13.56MHz频率运行于20厘米距离内。
其传输速度有106 Kbit/秒、212 Kbit/秒或者424 Kbit/秒三种。已通过成为ISO/IEC IS 18092国际标准、EMCA-340标准与ETSI TS 102 190
标准,其采用主动和被动两种读取模式。NFC常用的场景:1.读卡、2.写卡、3.分享内容。
跟NFC有关的常见的ISO标准有:
ISO 14443 RFID卡标准(非接触IC卡),该标准又有很多子标准
ISO 7816 接触式IC卡标准ISO 15693 射频卡标准
ISO 18092 NFC标准
所以说首先需要了解所要开发的卡的标准,其次,我们需要了解卡的数据格式,这个尤为重要,NFC的常见数据格式:
NfcA/NfcB/NfcF/NfcV/IsoDep/Ndef,
Table 1. Supported tag technologies
Class Description
TagTechnology The interface that all tag technology classes must implement.
NfcA Provides access to NFC-A (ISO 14443-3A) properties and I/O operations.
NfcB Provides access to NFC-B (ISO 14443-3B) properties and I/O operations.
NfcF Provides access to NFC-F (JIS 6319-4) properties and I/O operations.
NfcV Provides access to NFC-V (ISO 15693) properties and I/O operations.
IsoDep Provides access to ISO-DEP (ISO 14443-4) properties and I/O operations.
Ndef Provides access to NDEF data and operations on NFC tags that have been formatted as NDEF.
NdefFormatable Provides a format operations for tags that may be NDEF formattable.
Table 2. Optional supported tag technologies
Class Description
MifareClassic Provides access to MIFARE Classic properties and I/O operations, if this Android device supports MIFARE.
MifareUltralight Provides access to MIFARE Ultralight properties and I/O operations, if this Android device supports MIFARE.
不同的芯片(解决方案、采用不同的标准实现的)卡中数据格式是不一样的,通过这个表我们就能了解在Android开发中扫描的标签类型,源码实现部分:
对于我们常用的卡的数据格式:MIFARE DESFire数据格式是IsoDep,二代身份证用的就是NfcB,Felica用的就是NfcF,德州仪器的Vicinity Card卡用的是NfcV,而Android分享文件就是实用的Ndef格式传输数据。通过这个我们就能知道应该赋给mTechLists什么类型的标签。