--- /dev/null
+#!/usr/bin/python
+
+import gobject
+
+import dbus
+import dbus.mainloop.glib
+
+from dbus.lowlevel import MethodCallMessage, HANDLER_RESULT_NOT_YET_HANDLED
+
+def extract_record(key, list):
+ j = 0
+ for i in list:
+ record = dbus.Interface(bus.get_object("org.neard", i),
+ "org.neard.Record")
+
+ properties = record.GetProperties()
+ print " Record #%d" % (j)
+ j += 1
+
+ for key in properties.keys():
+ val = str(properties[key])
+ print " %s = %s" % (key, val)
+
+def property_changed_device(name, value, path):
+ device = path[path.rfind("/") + 1:]
+ if name in ["Records"]:
+ extract_record(name, value)
+
+def property_changed_adapter(name, value, path):
+ adapter = path[path.rfind("/") + 1:]
+ if name in ["Devices"]:
+ for i in value:
+ print "New Device detected [%s]" % (i)
+
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
+
+ bus.add_signal_receiver(property_changed_adapter,
+ bus_name="org.neard",
+ dbus_interface="org.neard.Adapter",
+ signal_name = "PropertyChanged",
+ path_keyword="path")
+
+ bus.add_signal_receiver(property_changed_device,
+ bus_name="org.neard",
+ dbus_interface="org.neard.Device",
+ signal_name = "PropertyChanged",
+ path_keyword="path")
+
+
+ mainloop = gobject.MainLoop()
+ mainloop.run()