-5

我正在尝试使用 NFC 非接触式读卡器 ACR122U Android SDK 读取 Mifare Ultralight 卡的内容。

我能够得到以下十六进制值

01 03 A0 0C 44 03 15 D1 01 11 54 02 65 6E 33 34

但我无法获得我的实际数据。请指导我如何从以上十六进制值中提取字节数组。

4

1 回答 1

5

因此,您似乎从这个 MIFARE Ultralight 标记的第 4 页开始阅读了 4 页。此外,标签似乎是根据 NFC 论坛类型 2 标签操作规范(可从NFC 论坛网站获得)进行格式化的。

类型 2 标记包含一系列标记长度值 (TLV) 结构:

01 (Tag: Lock Control TLV)
  03 (Length: 3 bytes)
  A0 0C 44 (Value: Information on position and function of lock bytes)
03 (Tag: NDEF Message TLV)
  15 (Length: 21 bytes)
  D101115402656E3334... (Value: NDEF message)

您必须为接下来的 4 页发出读取命令才能获取 NDEF 消息的剩余数据。

现在,我们知道,该标签包含一个以开头的 NDEF 消息

D101115402656E3334

这转化为

D1 (Header byte of record 1)
    - Message begin is set (= first record of an NDEF message)
    - Message end is set (= last record of an NDEF message)
    - Short record flag is set (= Payload length field consists of 1 byte only)
    - Type Name Format = 0x1 (= Type field contains an NFC Forum well-known type)
  01 (Type length: 1 byte)
  11 (Payload length: 17 bytes)
  54 (Type: "T")
  02656E3334... (Payload field)

NFC 论坛文本记录的有效负载字段解码如下:

02 (Status byte: Text is UTF-8 encoded, Language code has a length of 2 bytes)
656E (Language code: "en")
3334... (Text: "34"...)
于 2015-02-08T07:42:43.943 回答