Add script for selecting connections
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 15 Dec 2008 07:50:11 +0000 (08:50 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 15 Dec 2008 07:50:11 +0000 (08:50 +0100)
test/Makefile.am
test/select-connection [new file with mode: 0755]

index e4ea64f75d1afbc6c547d0cc7ab2c3d49f03f3f9..2087e881c240db7502a5e3bd1cbc7be5e4fdcbdd 100644 (file)
@@ -1,5 +1,5 @@
 
-EXTRA_DIST = get-state list-profiles list-connections \
+EXTRA_DIST = get-state list-profiles list-connections select-connection \
                list-devices enable-device disable-device start-scanning \
                list-networks select-network disable-network create-network \
                set-passphrase simple-agent show-introspection \
diff --git a/test/select-connection b/test/select-connection
new file mode 100755 (executable)
index 0000000..34d1f93
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
+                                       "org.moblin.connman.Manager")
+
+properties = manager.GetProperties()
+
+for path in properties["Connections"]:
+       connection = dbus.Interface(bus.get_object("org.moblin.connman", path),
+                                               "org.moblin.connman.Connection")
+
+       properties = connection.GetProperties()
+
+       if (properties["Default"] == dbus.Boolean(1)):
+               continue
+
+       print "[ %s ]" % (path)
+
+       connection.SetProperty("Default", dbus.Boolean(1))