Add example for showing interfaces
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Feb 2008 06:15:00 +0000 (07:15 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Feb 2008 06:15:00 +0000 (07:15 +0100)
test/Makefile.am
test/list-interfaces [new file with mode: 0755]

index 0274292..0649dab 100644 (file)
@@ -1,2 +1,4 @@
 
+EXTRA_DIST = list-interfaces
+
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/test/list-interfaces b/test/list-interfaces
new file mode 100755 (executable)
index 0000000..2cd0424
--- /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()
+       for key in properties.keys():
+               print "    %s = %s" % (key, properties[key])
+
+       ipv4 = interface.GetIPv4()
+       for key in ipv4.keys():
+               print "    IPv4.%s = %s" % (key, ipv4[key])
+
+       print