aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/examples
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-01-01 11:10:09 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-01 11:10:09 (GMT)
commit70993cd8e2d6f650a028ed492d61f92fba5f5a9b (patch)
tree32aca6103155c7b2a93db82ca1349b714439771d /wpa_supplicant/examples
parentdb9133acb2d7fbaab880863e363bbb570c02948f (diff)
downloadhostap-70993cd8e2d6f650a028ed492d61f92fba5f5a9b.zip
hostap-70993cd8e2d6f650a028ed492d61f92fba5f5a9b.tar.gz
hostap-70993cd8e2d6f650a028ed492d61f92fba5f5a9b.tar.bz2
dbus: Update example script to use the new API
Diffstat (limited to 'wpa_supplicant/examples')
-rwxr-xr-xwpa_supplicant/examples/wpas-dbus-new.py38
1 files changed, 21 insertions, 17 deletions
diff --git a/wpa_supplicant/examples/wpas-dbus-new.py b/wpa_supplicant/examples/wpas-dbus-new.py
index 70c80bb..934243b 100755
--- a/wpa_supplicant/examples/wpas-dbus-new.py
+++ b/wpa_supplicant/examples/wpas-dbus-new.py
@@ -35,33 +35,37 @@ def stateChanged(newState, oldState):
def showBss(bss):
net_obj = bus.get_object(WPAS_DBUS_SERVICE, bss)
net = dbus.Interface(net_obj, WPAS_DBUS_BSS_INTERFACE)
- props = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'Properties',
- dbus_interface=dbus.PROPERTIES_IFACE)
- #print props
# Convert the byte-array for SSID and BSSID to printable strings
+ val = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'BSSID',
+ dbus_interface=dbus.PROPERTIES_IFACE)
bssid = ""
- for item in props['BSSID']:
+ for item in val:
bssid = bssid + ":%02x" % item
bssid = bssid[1:]
- ssid = byte_array_to_string(props["SSID"])
+ val = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'SSID',
+ dbus_interface=dbus.PROPERTIES_IFACE)
+ ssid = byte_array_to_string(val)
+ val = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'WPAIE',
+ dbus_interface=dbus.PROPERTIES_IFACE)
wpa = "no"
- if props.has_key("WPAIE"):
+ if val != None:
wpa = "yes"
+ val = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'RSNIE',
+ dbus_interface=dbus.PROPERTIES_IFACE)
wpa2 = "no"
- if props.has_key("RSNIE"):
+ if val != None:
wpa2 = "yes"
- freq = 0
- if props.has_key("Frequency"):
- freq = props["Frequency"]
- caps = props["Capabilities"]
- qual = props["Quality"]
- level = props["Level"]
- noise = props["Noise"]
- maxrate = props["MaxRate"] / 1000000
+ freq = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'Frequency',
+ dbus_interface=dbus.PROPERTIES_IFACE)
+ signal = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'Signal',
+ dbus_interface=dbus.PROPERTIES_IFACE)
+ val = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'MaxRate',
+ dbus_interface=dbus.PROPERTIES_IFACE)
+ maxrate = val / 1000000
- print " %s :: ssid='%s' wpa=%s wpa2=%s quality=%d%% rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, qual, maxrate, freq)
+ print " %s :: ssid='%s' wpa=%s wpa2=%s signal=%d rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, signal, maxrate, freq)
def scanDone(success):
gobject.MainLoop().quit()
@@ -75,7 +79,7 @@ def scanDone(success):
print opath
showBss(opath)
-def bssAdded(bss):
+def bssAdded(bss, properties):
print "BSS added: %s" % (bss)
showBss(bss)