amb-listen works. zone attribute included in all signals.
authorKevron Rees <tripzero.kev@gmail.com>
Thu, 27 Feb 2014 16:41:23 +0000 (08:41 -0800)
committerKevron Rees <tripzero.kev@gmail.com>
Thu, 27 Feb 2014 16:43:48 +0000 (08:43 -0800)
plugins/dbus/dbussignaller.h
tests/CMakeLists.txt
tests/amb-listen

index 0d80de5..b5ddcd4 100644 (file)
@@ -72,6 +72,7 @@ private:
                                g_variant_builder_add(&builder, "{sv}", property->name().c_str(), val);
                                g_variant_builder_add(&builder, "{sv}", std::string(property->name() + "Sequence").c_str(), g_variant_new("i", property->sequence()));
                                g_variant_builder_add(&builder, "{sv}", "Time", g_variant_new("d", property->timestamp()) );
+                               g_variant_builder_add(&builder, "{sv}", "Zone", g_variant_new("i", property->value()->zone) );
 
                                g_dbus_connection_emit_signal(signal.connection, NULL, signal.objectPath.c_str(), "org.freedesktop.DBus.Properties", signal.signalName.c_str(), g_variant_new("(sa{sv}as)",
                                                                                                                                                                                                                                                                                                                                         signal.interface.c_str(),
index b7588c2..ee5a3de 100644 (file)
@@ -1,3 +1,3 @@
-set(amb_tests amb-get amb-set amb-get-history)
+set(amb_tests amb-get amb-set amb-get-history amb-listen)
 install (PROGRAMS ${amb_tests} DESTINATION bin)
 
index 0835a64..bfb24e4 100755 (executable)
@@ -3,6 +3,13 @@
 import dbus
 import sys
 import argparse
+import gobject
+import json
+from dbus.mainloop.glib import DBusGMainLoop
+
+
+def print_data(interface, properties, invalidated):
+       print json.dumps(properties, indent=2)
 
 parser = argparse.ArgumentParser()
 parser.add_argument("get", help="get {objectName}")
@@ -10,6 +17,7 @@ args = parser.parse_args()
 
 objectName = args.get
 
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 bus = dbus.SystemBus()
 managerObject = bus.get_object("org.automotive.message.broker", "/");
 managerInterface = dbus.Interface(managerObject, "org.automotive.Manager")
@@ -18,4 +26,9 @@ objects = managerInterface.FindObject(objectName);
 
 for o in objects:
        propertiesInterface = dbus.Interface(bus.get_object("org.automotive.message.broker", o),"org.freedesktop.DBus.Properties")
-       print propertiesInterface.GetAll("org.automotive."+objectName)
+       bus.add_signal_receiver(print_data,
+                               dbus_interface="org.freedesktop.DBus.Properties",
+                               signal_name="PropertiesChanged")
+
+loop = gobject.MainLoop()
+loop.run()