Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 定义NDEF消息_Python_Raspberry Pi_Nfc_Rfid_Ndef - Fatal编程技术网

Python 定义NDEF消息

Python 定义NDEF消息,python,raspberry-pi,nfc,rfid,ndef,Python,Raspberry Pi,Nfc,Rfid,Ndef,我正在用我的Raspberry Pi和RFID-RC522板进行Python项目。作为NFC标签,我使用NXP NTAG213。我现在的计划是在标签上存储链接。我可以毫无问题地读/写它们。但我不明白如何为标记上存储的数据定义NDEF头 当我用智能手机在标签上写链接并用程序读取时,标签上存储的数据如下所示: URL“”的NDEF标头为 我认识到,当我编写另一个链接时,其中一些参数会发生变化,但有些参数仍然保持不变 我发现它描述了NDEF头的不同字段,但我仍然不知道如何设置它们来存储指向网站的链接

我正在用我的Raspberry Pi和RFID-RC522板进行Python项目。作为NFC标签,我使用NXP NTAG213。我现在的计划是在标签上存储链接。我可以毫无问题地读/写它们。但我不明白如何为标记上存储的数据定义NDEF头

当我用智能手机在标签上写链接并用程序读取时,标签上存储的数据如下所示:

URL“”的NDEF标头为

我认识到,当我编写另一个链接时,其中一些参数会发生变化,但有些参数仍然保持不变

我发现它描述了NDEF头的不同字段,但我仍然不知道如何设置它们来存储指向网站的链接


如果有人能描述我需要如何正确计算/定义链接的参数,我将非常高兴。

为了理解NDEF格式以及NDEF格式的数据如何存储在NFC Forum Type 2标签(NTAG213实现的标签平台)上,我建议您阅读以下NFC论坛规范:

从标记中读取的数据是一个NDEF消息TLV对象,其中包含一条NDEF消息,该消息由一条URI记录组成

  • NDEF消息TLV:

    0x03 TLV tag = NDEF Message TLV 0x0B TLV length = 11 bytes 0xD1 ... 0x74 TLV value = NDEF message 这意味着NDEF消息由URI记录类型定义后面的一个URI记录(类型名称urn:nfc:wkt:U)组成

  • URI记录有效负载:

    0x01 Identifier byte = URI prefix "http://www." 0x67 ... 0x74 URI field (UTF-8 encoded) = "gmx.at" 0x01标识符字节=URI前缀“http://www." 0x67。。。0x74 URI字段(UTF-8编码)=“gmx.at” 这意味着URI记录指向URI“”

0xD1 Record header Bit 7 = MB = 1: first record of NDEF message Bit 6 = ME = 1: last record of NDEF message Bit 5 = CF = 0: last or only record of chain Bit 4 = SR = 1: short record length field Bit 3 = IL = 0: no ID/ID length fields Bit 2..0 = TNF = 0x1: Type field represents an NFC Forum well-known type name 0x01 Type length = 1 byte 0x07 Payload length = 7 bytes 0x55 Type field = "U" (in US-ASCII) = binary form of type name urn:nfc:wkt:U 0x01 ... 0x74 Payload field = URI record payload 0x01 Identifier byte = URI prefix "http://www." 0x67 ... 0x74 URI field (UTF-8 encoded) = "gmx.at"