From f75930f859f1dd3512f7594048085d087062a749 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 18 Nov 2009 18:05:35 +0100 Subject: Add test script to deactivate a context --- test/deactivate-context | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 test/deactivate-context (limited to 'test/deactivate-context') diff --git a/test/deactivate-context b/test/deactivate-context new file mode 100755 index 00000000..2e119219 --- /dev/null +++ b/test/deactivate-context @@ -0,0 +1,36 @@ +#!/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) + + path = properties["PrimaryContexts"][0] + + context = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.PrimaryDataContext') + + context.SetProperty("Active", dbus.Boolean(0)) -- cgit v1.2.3