编辑:请阅读 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[]
是一个命令,我想找到在哪里可以找到这些命令的列表。我试图自己查一下,但空手而归。
(详细转储)
<?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 & 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 & 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<<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 & 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 和我提交的答案以获得完整的解释
对于专门寻找 NFC 命令的人(因为这些命令很难找到)
我为你做了一些挖掘(用henrycjc指向正确方向的指针)
资料来源:http://www.nxp.com/documents/data_sheet/NTAG213_215_216.pdf
文档可以在Android官方文档中找到。具体来说,收发在这里:
https://developer.android.com/reference/android/nfc/tech/NfcA.html#transceive(byte[])
至于你的其他疑问,我会看看以前的这些问题:
Android nfcA.connect()、nfcA.transceive()、nfcA.setTimeout() 和 nfcA.getMaxTransceiveLength()
对于遇到此问题的其他人,这是一个包含适用于不同 ISO 的所有命令的 PDF: