summaryrefslogtreecommitdiff
path: root/tests/amb-listen.py
blob: 1b28996ac689bba579c81da3b47e1f1fe86fe4b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python

import dbus
import sys
import argparse
import gobject
import json
from dbus.mainloop.glib import DBusGMainLoop

print "This application is deprecated.  It will disappear in the future.  Use ambctl"

def print_data(interface, properties, invalidated):
	print json.dumps(properties, indent=2)

parser = argparse.ArgumentParser()
parser.add_argument("get", help="get {objectName}")
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")

objects = managerInterface.FindObject(objectName);

for o in objects:
	bus.add_signal_receiver(print_data,
				dbus_interface="org.freedesktop.DBus.Properties",
				signal_name="PropertiesChanged",
																path=o)

loop = gobject.MainLoop()
loop.run()