NfcA收发命令文档NFC-A(ISO 14443-3A)

时间:2017-03-15 19:30:00

标签: android nfc mifare

编辑:请阅读henrycjc和我提交的两个答案以获得完整的解释

在哪里可以找到android.nfc.tech.NfcA中使用的文档?

/**
 * Provides access to NFC-A (ISO 14443-3A) properties and I/O operations on a {@link Tag}.
 *
 * <p>Acquire a {@link NfcA} object using {@link #get}.
 * <p>The primary NFC-A I/O operation is {@link #transceive}. Applications must
 * implement their own protocol stack on top of {@link #transceive}.
 *
 * <p class="note"><strong>Note:</strong> Methods that perform I/O operations
 * require the {@link android.Manifest.permission#NFC} permission.
 */
public byte[] transceive(byte[] data) throws IOException

我不太确定tranceive语法是如何工作的,我目前的理解是byte中的第一个byte[]是一个命令,我想找到在哪里找到它们的列表。我试着自己查一下,但空手而归。

我正在尝试与之互动的卡片: (转储的形象) Image of dump

(详细转储)

<?xml version="1.0" encoding="UTF-8"?>
    <scan>
        <version>4.21.171</version>
        <date>2017-03-15 20:12:20</date>
        <title>NXP Semiconductors NTAG213 tag as Type 2 Tag</title>
        <uid nxp="true">04:39:F5:B2:95:3C:81</uid>
        <hasndef>true</hasndef>
        <ndef>D00000</ndef>
        <section>
            <subsection title="IC manufacturer">
                <block type="text">
        <content>NXP Semiconductors</content>
    </block>
            </subsection>
            <subsection title="IC type">
                <block type="text">
        <content>NTAG213</content>
    </block>
            </subsection>
            <subsection title="NFC Forum NDEF-compliant tag">
                <block type="text">
        <content>Type 2 Tag</content>
    </block>
            </subsection>
        </section>
        <section>
            <subsection title="NFC data set information">
                <block type="text">
        <content>NDEF message containing 1 record
    Current message size: 3 bytes
    Maximum message size: 137 bytes
    NFC data set access: Read &amp; Write
    Can be made Read-Only</content>
    </block>
            </subsection>
            <subsection title="Record #1: Empty record">
                <block type="text">
        <content><size size="12">Type Name Format: Empty<hexoutput> (0)</hexoutput>
    Short Record</size></content>
    </block><block type="text">
        <content><mono>type: [NULL]
    </mono></content>
    </block>
    <block type="text">
        <content>Payload length: 0 bytes</content>
    </block>
            </subsection>
            <subsection title="NDEF message">
                <block type="File">
        <address>0</address>
        <data>D0 00 00</data>
    </block>
            </subsection>
            <subsection title="NDEF Capability Container (CC)">
                <block type="text">
        <content>Mapping version: 1.0
    Maximum NDEF data size: 144 bytes<hexoutput> (0x12)</hexoutput>
    NDEF access: Read &amp; Write<hexoutput> (0x00)</hexoutput></content>
    </block><block type="File">
        <address>-1</address>
        <data>E1 10 12 00</data>
    </block>
            </subsection>
            <subsection title="Control TLVs">
                <block type="text">
        <content>Lock Control TLV at address 0x04, offset 0
    ‣ Dynamic lock bytes at address 0x28, offset 0
        • 12 lock bits<hexoutput> (0x0C)</hexoutput>
        • 8 bytes locked per lock bit<hexoutput> (0x3)
        • Address calculation:
            ◦ page address: 0xA
            ◦ byte offset: 0x0
            ◦ 16 bytes per page (1&lt;&lt;0x4)</hexoutput></content>
    </block>
    <block type="File">
        <address>-1</address>
        <data>01 03 A0 0C 34</data>
    </block>
            </subsection>
        </section>
        <section>
            <subsection title="Memory size">
                <block type="text">
        <content>144 bytes user memory
    ‣ 36 pages, with 4 bytes per page</content>
    </block>
            </subsection>
            <subsection title="IC detailed information">
                <block type="text">
        <content>Full product name: NT2H1311G0DUx
    Capacitance: 50 pF</content>
    </block>
            </subsection>
            <subsection title="Version information">
                <block type="text">
        <content>Vendor ID: NXP<hexoutput> (0x04)</hexoutput>
    Type: NTAG<hexoutput> (0x04)</hexoutput>
    Subtype: 50 pF<hexoutput> (0x02)</hexoutput>
    Major version: 1<hexoutput> (0x01)</hexoutput>
    Minor version: V0<hexoutput> (0x00)</hexoutput>
    Storage size: 144 bytes<hexoutput> (0x0F)</hexoutput>
    Protocol: ISO/IEC 14443-3<hexoutput> (0x03)</hexoutput></content>
    </block>
            </subsection>
            <subsection title="Configuration information">
                <block type="text">
        <content>ASCII mirror disabled
    NFC counter: disabled
    No limit on wrong password attempts
    Strong load modulation enabled</content>
    </block>
            </subsection>
            <subsection title="Originality check">
                <block type="text">
        <content>Signature verified with NXP public key<hexoutput>
    Public key:
    ‣ 0x04494E1A386D3D3CFE3DC10E5DE68A499B1C202DB5B132393E89ED19FE5BE8BC61
    </hexoutput><hexoutput>ECDSA signature:
    ‣ r: 0xDBD6E5FD688FA25BDF05B508911743E2
    ‣ s: 0x8271C6D1D7110F0350E191ED2C3FAE85</hexoutput></content>
    </block>
            </subsection>
        </section>
        <section>
            <subsection title="Technologies supported">
                <block type="text">
        <content>ISO/IEC 14443-3 (Type A) compatible
    ISO/IEC 14443-2 (Type A) compatible</content>
    </block>
            </subsection>
            <subsection title="Android technology information">
                <block type="text">
        <content>Tag description:
    ‣ TAG: Tech [android.nfc.tech.NfcA, android.nfc.tech.MifareUltralight, android.nfc.tech.Ndef]
    android.nfc.tech.Ndef
    android.nfc.tech.MifareUltralight
    android.nfc.tech.NfcA
    ‣ Maximum transceive length: 253 bytes
    ‣ Default maximum transceive time-out: 618 ms
    <hexoutput>No MIFARE Classic support present in Android</hexoutput></content>
    </block>
            </subsection>
            <subsection title="Detailed protocol information">
                <block type="text">
        <content>ID: 04:39:F5:B2:95:3C:81
    ATQA: 0x4400
    SAK: 0x00</content>
    </block>
            </subsection>
            <subsection title="Memory content">
                <block type="Ultralight">
        <address>0</address>
        <data access="* " comment="(UID0-UID2, BCC0)">04 39 F5 40</data>
    </block>
    <block type="Ultralight">
        <address>1</address>
        <data access="* " comment="(UID3-UID6)">B2 95 3C 81</data>
    </block>
    <block type="Ultralight">
        <address>2</address>
        <data access=". " comment="(BCC1, INT, LOCK0-LOCK1)">9A 48 00 00</data>
    </block>
    <block type="Ultralight">
        <address>3</address>
        <data access=". " comment="(OTP0-OTP3)">E1 10 12 00</data>
    </block>
    <block type="Ultralight">
        <address>4</address>
        <data access=". ">01 03 A0 0C</data>
    </block>
    <block type="Ultralight">
        <address>5</address>
        <data access=". ">34 03 03 D0</data>
    </block>
    <block type="Ultralight">
        <address>6</address>
        <data access=". ">00 00 FE 00</data>
    </block>
    <block type="Ultralight">
        <address>7</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>8</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>9</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>10</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>11</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>12</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>13</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>14</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>15</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>16</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>17</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>18</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>19</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>20</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>21</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>22</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>23</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>24</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>25</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>26</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>27</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>28</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>29</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>30</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>31</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>32</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>33</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>34</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>35</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>36</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>37</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>38</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>39</address>
        <data access=". ">00 00 00 00</data>
    </block>
    <block type="Ultralight">
        <address>40</address>
        <data access=". " comment="(LOCK2-LOCK4, CHK)">00 00 00 BD</data>
    </block>
    <block type="Ultralight">
        <address>41</address>
        <data access=". " comment="(CFG, MIRROR, AUTH0)">04 00 00 FF</data>
    </block>
    <block type="Ultralight">
        <address>42</address>
        <data access=". " comment="(ACCESS)" length="2">00 05</data>
    </block>
    <block type="Ultralight">
        <address>43</address>
        <data access="+P" comment="(PWD0-PWD3)">FF FF FF FF</data>
    </block>
    <block type="Ultralight">
        <address>44</address>
        <data access="+P" comment="(PACK0-PACK1)" length="2">00 00</data>
    </block>
    <block type="text">
        <content>
      *:locked &amp; blocked, x:locked,
      +:blocked, .:un(b)locked, ?:unknown
      r:readable (write-protected),
      p:password protected, -:write-only
      P:password protected write-only</content>
    </block>
            </subsection>
        </section>
    </scan>

提前致谢。

编辑:请阅读henrycjc和我提交的两个答案以获得完整的解释

2 个答案:

答案 0 :(得分:3)

对于那些专门寻找NFC命令的人(因为那些很难找到)

我为你做了一些挖掘(用henrycjc指示了正确的方向)

enter image description here 资料来源:http://www.nxp.com/documents/data_sheet/NTAG213_215_216.pdf

答案 1 :(得分:0)

该文档可在官方Android文档中找到。具体来说,收发就在这里:

https://developer.android.com/reference/android/nfc/tech/NfcA.html#transceive(byte[])

至于你的其他问题,我会看看以前的SO问题:

Android nfcA.connect(), nfcA.transceive(), nfcA.setTimeout() and nfcA.getMaxTransceiveLength()

How send NfcA command to the MIFARE card?