From 9d5d36d8f73dcf43fa562c327b33653ef7f7cdf9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 26 Feb 2008 07:15:00 +0100 Subject: [PATCH] Add example for showing interfaces --- test/Makefile.am | 2 ++ test/list-interfaces | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 test/list-interfaces diff --git a/test/Makefile.am b/test/Makefile.am index 02742923..0649dab2 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 index 00000000..2cd0424d --- /dev/null +++ b/test/list-interfaces @@ -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 -- 2.34.1