Merge pull request #58 from tripzero/master
[profile/ivi/automotive-message-broker.git] / tests / amb-get-history.py
1 #!/usr/bin/python
2
3 import dbus
4 import sys
5 import argparse
6 import json
7
8 print "This application is deprecated.  It will disappear in the future.  Use ambctl"
9
10 parser = argparse.ArgumentParser()
11 parser.add_argument("get", help="{objectName}")
12 parser.add_argument("start", help="{startTime}")
13 parser.add_argument("end", help="{endTime}")
14 parser.add_argument("zone", help="{zone}")
15
16 args = parser.parse_args()
17
18 objectName = args.get
19 start = float(args.start)
20 end = float(args.end)
21 zone = int(args.zone)
22
23 bus = dbus.SystemBus()
24 managerObject = bus.get_object("org.automotive.message.broker", "/");
25 managerInterface = dbus.Interface(managerObject, "org.automotive.Manager")
26
27 object = managerInterface.FindObjectForZone(objectName, zone);
28
29 propertiesInterface = dbus.Interface(bus.get_object("org.automotive.message.broker", object),"org.automotive."+objectName)
30 print json.dumps(propertiesInterface.GetHistory(start,end),indent=2)