Reading text payload (2 records)

Asked by


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:~/nfcpy/trunk/examples $ python show
[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=00F1000000014300 SYS=88B4
[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 9d000f02743149616e2057204a6f686e73746f6e0a5d00090274323132333435...
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.


import nfc.ndef
import time

while True:
    print "Awaiting Tag"
    with nfc.ContactlessFrontend('usb') as clf:
        def connected(tag): return False
        tag = clf.connect(rdwr={'on-connect':connected})
        if tag.ndef is not None:



            print name
            print mob

            print "Empty Record"


Thx in advance for any help,

Question information

English Edit question
nfcpy Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :

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 for more information if necessary.

To post a message you must log in.