diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-10-25 00:57:32 +0900 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-10-25 00:57:32 +0900 |
commit | ecc542195757083478035414cb6aa47cfef2aa1d (patch) | |
tree | 1731cb8d3efb65515116bba61eb5cdefa8ba83e0 /test/create-context | |
parent | 6cefd2e69330be619dd8c7a1ece1582e8db7c429 (diff) | |
download | ofono-ecc542195757083478035414cb6aa47cfef2aa1d.tar.bz2 |
Add simple test script for creating a context and setting APN
Diffstat (limited to 'test/create-context')
-rwxr-xr-x | test/create-context | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/create-context b/test/create-context new file mode 100755 index 00000000..138efd15 --- /dev/null +++ b/test/create-context @@ -0,0 +1,37 @@ +#!/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"] == []): + path = connmgr.CreateContext() + else: + path = properties["PrimaryContexts"][0] + + context = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.PrimaryDataContext') + + context.SetProperty("AccessPointName", sys.argv[1]) + + print "Setting APN of %s to %s" % (path, sys.argv[1]) |