monitor-near: Monitor Tags and Devices properties
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 15 Feb 2013 15:24:48 +0000 (16:24 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 15 Feb 2013 15:28:10 +0000 (16:28 +0100)
test/monitor-near

index fef307e..a8cf948 100755 (executable)
@@ -22,6 +22,20 @@ def extract_bool(b):
        return val      
 
 
+def property_changed_tag(name, value, path):
+    tag = path[path.rfind("/") + 1:]
+    if name in ["Records"]:
+           val = extract_list(value)
+
+    print "[Tag] [%s] %s = %s" % (tag, name, val)
+
+def property_changed_device(name, value, path):
+    device = path[path.rfind("/") + 1:]
+    if name in ["Records"]:
+           val = extract_list(value)
+
+    print "[Device] [%s] %s = %s" % (device, name, val)
+
 def property_changed_adapter(name, value, path):
     adapter = path[path.rfind("/") + 1:]
     if name in ["Polling"]:
@@ -58,5 +72,17 @@ if __name__ == '__main__':
                                signal_name = "PropertyChanged",
                                path_keyword="path")
 
+       bus.add_signal_receiver(property_changed_tag,
+                               bus_name="org.neard",
+                               dbus_interface="org.neard.Tag",
+                               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()