test: add deactivate-all
authorDenis Kenzior <denkenz@gmail.com>
Mon, 25 Oct 2010 20:48:55 +0000 (15:48 -0500)
committerDenis Kenzior <denkenz@gmail.com>
Mon, 25 Oct 2010 21:32:49 +0000 (16:32 -0500)
Uses ConnectionManager DeactivateAll

Makefile.am
test/deactivate-all [new file with mode: 0755]

index 159c13c..17797ae 100644 (file)
@@ -409,7 +409,8 @@ test_scripts = test/backtrace \
                test/unlock-pin \
                test/enable-gprs \
                test/disable-gprs \
-               test/get-icon
+               test/get-icon \
+               test/deactivate-all
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/deactivate-all b/test/deactivate-all
new file mode 100755 (executable)
index 0000000..427009e
--- /dev/null
@@ -0,0 +1,20 @@
+#!/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')
+
+       connman.DeactivateAll()