summaryrefslogtreecommitdiffstats
path: root/test/set-mms-details
blob: 6ee59face21be107c1aa1626d8853ebb2f36fba3 (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
43
#!/usr/bin/python3

import sys
import dbus

bus = dbus.SystemBus()

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

modems = manager.GetModems()

for path, properties in modems:
	if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
		continue

	connman = dbus.Interface(bus.get_object('org.ofono', path),
					'org.ofono.ConnectionManager')

	contexts = connman.GetContexts()
	path = "";

	for i, properties in contexts:
		if properties["Type"] == "mms":
			path = i
			break

	if path == "":
		print("No MMS context")
		exit(1)

	context = dbus.Interface(bus.get_object('org.ofono', path),
					'org.ofono.ConnectionContext')

	if len(sys.argv) < 3:
		print("Usage: %s <proxy> <center>" % (sys.argv[0]))
		exit(1)

	context.SetProperty("MessageProxy", sys.argv[1])
	print("Setting MMS Proxy to %s" % (sys.argv[1]))

	context.SetProperty("MessageCenter", sys.argv[2])
	print("Setting MMSC to %s" % (sys.argv[2]))