Add script for seleting networks
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 4 Apr 2008 06:12:26 +0000 (08:12 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 4 Apr 2008 06:12:26 +0000 (08:12 +0200)
test/Makefile.am
test/select-network [new file with mode: 0755]

index 0276029..21ceba6 100644 (file)
@@ -1,5 +1,5 @@
 
-EXTRA_DIST = list-interfaces start-scanning simple-agent \
-                               show-introspection test-supplicant
+EXTRA_DIST = list-interfaces start-scanning select-network simple-agent \
+                                       show-introspection test-supplicant
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/test/select-network b/test/select-network
new file mode 100755 (executable)
index 0000000..0d48ad3
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.freedesktop.connman', "/"),
+                                       'org.freedesktop.connman.Manager')
+
+interfaces = manager.ListInterfaces()
+
+for path in interfaces:
+       print "[ %s ]" % (path)
+
+       interface = dbus.Interface(bus.get_object('org.freedesktop.connman', path),
+                                       'org.freedesktop.connman.Interface')
+
+       properties = interface.GetProperties()
+
+       if (properties["Type"] == "80211"):
+               print "   Selecting network"
+               interface.SelectNetwork("ConnMan Testing")
+       else:
+               print "   No networks"
+
+       print