summaryrefslogtreecommitdiffstats
path: root/test/test-ss
blob: 4cd873225a0bbbdca84c952dbddada7588c2417d (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
36
37
38
39
40
41
42
#!/usr/bin/python3

import sys
import dbus

bus = dbus.SystemBus()

manager = dbus.Interface(bus.get_object('org.ofono', '/'),
						'org.ofono.Manager')

modems = manager.GetModems()
modem = modems[0][0]

if (len(sys.argv) == 2):
	ss_code = sys.argv[1]
else:
	modem = sys.argv[1]
	ss_code = sys.argv[2]

ss = dbus.Interface(bus.get_object('org.ofono', modem),
				'org.ofono.SupplementaryServices')

try:
	ss_type, properties = ss.Initiate(ss_code, timeout=100)
except dbus.DBusException as e:
	print("Unable to perform operation: %s" % e)
	sys.exit(1);

if (ss_type == "CallBarring"):
	print("%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]))
	for key in properties[2]:
		print("%s : %s" % (key, properties[2][key]))
elif (ss_type == "CallForwarding"):
	print("%s : Operation [ %s ] Service Type [ %s ]" % (ss_type, properties[0], properties[1]))
	for key in properties[2]:
		print("%s : %s" % (key, properties[2][key]))
elif (ss_type == "CallWaiting"):
	print("%s : Operation [ %s ]" % (ss_type, properties[0]))
	for key in properties[1]:
		print("%s : %s" % (key, properties[1][key]))
else:
	print("%s : Operation [ %s ] Status [ %s ]" % (ss_type, properties[0], properties[1]))