NFC数据交换格式解码器和编码器。
ndeflib的Python项目详细描述
ndeflib是一个ISC许可的python包,用于分析和生成nfc数据交换格式(ndef)消息:
>>> importndef>>> hexstr='9101085402656e48656c6c6f5101085402656e576f726c64'>>> octets=bytearray.fromhex(hexstr)>>> forrecordinndef.message_decoder(octets):print(record)NDEF Text Record ID '' Text 'Hello' Language 'en' Encoding 'UTF-8' NDEF Text Record ID '' Text 'World' Language 'en' Encoding 'UTF-8' >>> message=[ndef.TextRecord("Hello"),ndef.TextRecord("World")]>>> b''.join(ndef.message_encoder(message))==octetsTrue
可以在Read the Docs上找到ndeflib文档,在GitHub上找到代码。python 2.7和3.5的continously tested非常完整。