From: Marcel Holtmann Date: Wed, 12 Mar 2008 13:53:14 +0000 (+0100) Subject: Add simple test script for D-Bus supplicant X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~4883 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7294e829c825e0f7b56b4fdb83dbc2939c33ca71;p=profile%2Fivi%2Fconnman.git Add simple test script for D-Bus supplicant --- diff --git a/test/Makefile.am b/test/Makefile.am index f3ae183..0276029 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,5 @@ -EXTRA_DIST = list-interfaces start-scanning simple-agent show-introspection +EXTRA_DIST = list-interfaces start-scanning simple-agent \ + show-introspection test-supplicant MAINTAINERCLEANFILES = Makefile.in diff --git a/test/test-supplicant b/test/test-supplicant new file mode 100755 index 0000000..e79228d --- /dev/null +++ b/test/test-supplicant @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import dbus +import time + +WPA_NAME='fi.epitest.hostap.WPASupplicant' +WPA_INTF='fi.epitest.hostap.WPASupplicant' +WPA_PATH='/fi/epitest/hostap/WPASupplicant' + +bus = dbus.SystemBus() + +dummy = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH), + 'org.freedesktop.DBus.Introspectable') + +#print dummy.Introspect() + +manager = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH), WPA_INTF) + +try: + path = manager.getInterface("wlan0") +except: + path = manager.addInterface("wlan0") + +interface = dbus.Interface(bus.get_object(WPA_NAME, path), + WPA_INTF + ".Interface") + +print interface.state() + +print interface.scan() + +print "[ %s ]" % (path) + +capabilities = interface.capabilities() + +for key in capabilities.keys(): + list = "" + for value in capabilities[key]: + list += " " + value + print " %s =%s" % (key, list) + +time.sleep(2) + +print interface.state() + +results = interface.scanResults() + +print results + +path = results[0] + +print "[ %s ]" % (path) + +bssid = dbus.Interface(bus.get_object(WPA_NAME, path), + WPA_INTF + ".BSSID") + +properties = bssid.properties() + +for key in properties.keys(): + print " %s = %s" % (key, properties[key])