dbus: Update example scripts to use PropertiesChanged

The StateChanged signal was removed, to use PropertiesChanged instead.
This commit is contained in:
Jouni Malinen 2010-01-04 16:34:06 +02:00 committed by Jouni Malinen
parent 27f43d8de5
commit 777f07b62d
2 changed files with 10 additions and 8 deletions

View file

@ -13,8 +13,9 @@ WPAS_DBUS_OPATH = "/fi/w1/wpa_supplicant1"
WPAS_DBUS_INTERFACES_INTERFACE = "fi.w1.wpa_supplicant1.Interface" WPAS_DBUS_INTERFACES_INTERFACE = "fi.w1.wpa_supplicant1.Interface"
WPAS_DBUS_WPS_INTERFACE = "fi.w1.wpa_supplicant1.Interface.WPS" WPAS_DBUS_WPS_INTERFACE = "fi.w1.wpa_supplicant1.Interface.WPS"
def stateChanged(newState, oldState): def propertiesChanged(properties):
print "StateChanged(%s -> %s)" % (oldState, newState) if properties.has_key("State"):
print "PropertiesChanged: State: %s" % (properties["State"])
def scanDone(success): def scanDone(success):
print "Scan done: success=%s" % success print "Scan done: success=%s" % success
@ -52,9 +53,9 @@ def main():
bus.add_signal_receiver(bssRemoved, bus.add_signal_receiver(bssRemoved,
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE, dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
signal_name="BSSRemoved") signal_name="BSSRemoved")
bus.add_signal_receiver(stateChanged, bus.add_signal_receiver(propertiesChanged,
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE, dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
signal_name="StateChanged") signal_name="PropertiesChanged")
bus.add_signal_receiver(wpsEvent, bus.add_signal_receiver(wpsEvent,
dbus_interface=WPAS_DBUS_WPS_INTERFACE, dbus_interface=WPAS_DBUS_WPS_INTERFACE,
signal_name="Event") signal_name="Event")

View file

@ -33,8 +33,9 @@ def list_interfaces(wpas_obj):
dbus_interface=dbus.PROPERTIES_IFACE) dbus_interface=dbus.PROPERTIES_IFACE)
print ifname print ifname
def stateChanged(newState, oldState): def propertiesChanged(properties):
print "StateChanged(%s -> %s)" % (oldState, newState) if properties.has_key("State"):
print "PropertiesChanged: State: %s" % (properties["State"])
def showBss(bss): def showBss(bss):
net_obj = bus.get_object(WPAS_DBUS_SERVICE, bss) net_obj = bus.get_object(WPAS_DBUS_SERVICE, bss)
@ -110,9 +111,9 @@ def main():
bus.add_signal_receiver(bssRemoved, bus.add_signal_receiver(bssRemoved,
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE, dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
signal_name="BSSRemoved") signal_name="BSSRemoved")
bus.add_signal_receiver(stateChanged, bus.add_signal_receiver(propertiesChanged,
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE, dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
signal_name="StateChanged") signal_name="PropertiesChanged")
ifname = sys.argv[1] ifname = sys.argv[1]