Reading text payload (2 records)
Stephen,
Again this is my lack of understanding of nfc.ndef module. The data below is a tagtool show of a simple 2 text record NDEF card.
pi@raspberrypi:
[nfc.clf] searching for reader on path usb
[nfc.clf] using SONY RC-S380/P NFC Port-100 v1.11 at usb:001:005
** waiting for a tag **
Type3Tag 'FeliCa Lite-S (RC-S966)' ID=012E34E829CE1E71 PMM=00F10000000
[nfc.tag.tt3] got ndef attributes {'ver': 16, 'ln': 36, 'nbr': 4, 'nmaxb': 13, 'nbw': 1, 'rwflag': 0, 'writef': 0}
[nfc.tag.tt3] got 36 byte ndef data 9d000f027431496
NDEF Capabilities:
readable = yes
writeable = no
capacity = 208 byte
message = 36 byte
NDEF Message:
record 1
type = 'unknown'
name = 't1'
data = 'Ian W Johnston\n'
record 2
type = 'unknown'
name = 't2'
data = '12345678\n'
What I want to do is simply parse the two text payload records to be payload text only. (not the NDEF flags etc). See my mangled code below which fails. BTW I do not want to use print.pretty() here at all.
#!/usr/
import nfc.ndef
import time
while True:
print "Awaiting Tag"
with nfc.Contactless
def connected(tag): return False
tag = clf.connect(
if tag.ndef is not None:
print name
print
print mob
else:
print "Empty Record"
Thx in advance for any help,
Ian
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- nfcpy Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 2016-12-21
- Last reply:
- 2016-12-22
I think the problem is that you do not have two text records on the tag but they are both type "unknown". NDEF Text records must have type "urn:nfc:wkt:T".
Can you help with this problem?
Provide an answer of your own, or ask ian@iwjohnston.com for more information if necessary.