Add test scripts for radio technology preference
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 6 Jun 2010 18:11:57 +0000 (11:11 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 6 Jun 2010 18:11:57 +0000 (11:11 -0700)
Makefile.am
test/get-tech-preference [new file with mode: 0755]
test/set-tech-preference [new file with mode: 0755]

index 539a900..bc021f4 100644 (file)
@@ -333,7 +333,9 @@ test_scripts = test/activate-context \
                test/test-ussd \
                test/test-voicecall \
                test/offline-modem \
-               test/online-modem
+               test/online-modem \
+               test/get-tech-preference \
+               test/set-tech-preference
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/get-tech-preference b/test/get-tech-preference
new file mode 100755 (executable)
index 0000000..d60dded
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import dbus, sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+       path = sys.argv[1]
+else:
+       manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                                               'org.ofono.Manager')
+       properties = manager.GetProperties()
+       path = properties["Modems"][0]
+
+radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
+                                               'org.ofono.RadioSettings')
+
+properties = radiosettings.GetProperties()
+
+print "Technology preference: %s" % (properties["TechnologyPreference"])
diff --git a/test/set-tech-preference b/test/set-tech-preference
new file mode 100755 (executable)
index 0000000..9f702d5
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 3:
+       path = sys.argv[1]
+       tech = sys.argv[2]
+elif len(sys.argv) == 2:
+       manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                                                'org.ofono.Manager')
+       properties = manager.GetProperties()
+       path = properties["Modems"][0]
+       tech = sys.argv[1]
+else:
+       print "%s [PATH] technology" % (sys.argv[0])
+
+print "Setting technology preference for modem %s..." % path
+radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
+                                           'org.ofono.RadioSettings')
+
+radiosettings.SetProperty("TechnologyPreference", tech);