diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-10-25 01:06:45 +0900 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-10-25 01:06:45 +0900 |
commit | dde6f9440666663fb79d75f78d5648bd376b49d7 (patch) | |
tree | 515ce652cefe50ac105ee31f597d856eeaa74828 /test/activate-context | |
parent | ecc542195757083478035414cb6aa47cfef2aa1d (diff) | |
download | ofono-dde6f9440666663fb79d75f78d5648bd376b49d7.tar.bz2 |
Add test script for activating the first context
Diffstat (limited to 'test/activate-context')
-rwxr-xr-x | test/activate-context | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/activate-context b/test/activate-context new file mode 100755 index 00000000..7ee60e54 --- /dev/null +++ b/test/activate-context @@ -0,0 +1,38 @@ +#!/usr/bin/python + +import sys +import dbus + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + +properties = manager.GetProperties() + +for path in properties["Modems"]: + modem = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.Modem') + + properties = modem.GetProperties() + + if "org.ofono.DataConnectionManager" not in properties["Interfaces"]: + continue + + connmgr = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.DataConnectionManager') + + properties = connmgr.GetProperties() + + if (properties["PrimaryContexts"] == []): + print "No context available" + sys.exit(1) + + connmgr.SetProperty("Powered", dbus.Boolean(1)) + + path = properties["PrimaryContexts"][0] + + context = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.PrimaryDataContext') + + context.SetProperty("Active", dbus.Boolean(1)) |