Initial commit to Gerrit
[profile/ivi/ofono.git] / test / set-roaming-allowed
1 #!/usr/bin/python
2
3 import sys
4 import dbus
5
6 bus = dbus.SystemBus()
7
8 manager = dbus.Interface(bus.get_object('org.ofono', '/'),
9                                                 'org.ofono.Manager')
10
11 modems = manager.GetModems()
12
13 for path, properties in modems:
14         if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
15                 continue
16
17         connman = dbus.Interface(bus.get_object('org.ofono', path),
18                                         'org.ofono.ConnectionManager')
19
20         if len(sys.argv) > 1:
21                 allowed = dbus.Boolean(int(sys.argv[1]))
22         else:
23                 allowed = dbus.Boolean(1)
24
25         connman.SetProperty("RoamingAllowed", allowed)
26
27         print "Setting %s to RoamingAllowed=%d" % (path, allowed)