#!/usr/bin/python import sys import dbus if len(sys.argv) < 2: print "Usage: %s /org/neard/nfcX" % (sys.argv[0]) sys.exit(1) bus = dbus.SystemBus() def extract_ndef(list): val = "[" for i in list: val += " 0x%x" % i val += " ]" return val def extract_record(key, list): for i in list: record = dbus.Interface(bus.get_object("org.neard", i), "org.neard.Record") properties = record.GetProperties() print " Record = [ %s ]" % (str(i)) for key in properties.keys(): val = str(properties[key]) print " %s = %s" % (key, val) device = dbus.Interface(bus.get_object("org.neard", sys.argv[1]), "org.neard.Device") properties = device.GetProperties() raw_ndef = device.DumpRawNDEF() print "[ %s ]" % (sys.argv[1]) print " Raw NDEF = %s" % (extract_ndef(raw_ndef)) for key in properties.keys(): if key in ["Records"]: extract_record(key, properties[key])