test: Add script for enabling/disabling RoamingAllowed property

This commit is contained in:
Marcel Holtmann 2010-10-05 16:11:09 +02:00
parent 907e14e4ae
commit da54398fa5
2 changed files with 28 additions and 0 deletions

View File

@ -368,6 +368,7 @@ test_scripts = test/backtrace \
test/enter-pin \
test/hangup-all \
test/hangup-active \
test/set-roaming-allowed \
test/set-context \
test/list-contexts \
test/list-modems \

27
test/set-roaming-allowed Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/python
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')
if len(sys.argv) > 1:
allowed = dbus.Boolean(int(sys.argv[1]))
else:
allowed = dbus.Boolean(1)
connman.SetProperty("RoamingAllowed", allowed)
print "Setting %s to RoamingAllowed=%d" % (path, allowed)