diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2012-10-02 16:24:49 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-10-03 22:29:34 +0300 |
commit | 2983d07c6d96d255b7c49c59046270e61357bb7d (patch) | |
tree | 1cf763d889f0df7b1874174729ff3c5dd1f3939a /test/test-alert | |
parent | cd9370f87454dcb1cb0512786b086cea63e6489c (diff) | |
download | bluez-2983d07c6d96d255b7c49c59046270e61357bb7d.tar.gz |
alert: Implement Release() agent method
This method allows BlueZ to notify the agent that it will not be used
anymore, and can thus cleanup itself (e.g. deallocate D-Bus object, or
exit).
Diffstat (limited to 'test/test-alert')
-rwxr-xr-x | test/test-alert | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/test-alert b/test/test-alert index c92a71994..1e241a3c7 100755 --- a/test/test-alert +++ b/test/test-alert @@ -15,9 +15,10 @@ BLUEZ_OBJECT_PATH = '/org/bluez' TEST_OBJECT_PATH = '/org/bluez/test' class AlertAgent(dbus.service.Object): - def __init__(self, bus, object_path, alert): + def __init__(self, bus, object_path, alert, mainloop): dbus.service.Object.__init__(self, bus, object_path) self.alert = alert + self.mainloop = mainloop @dbus.service.method(ALERT_AGENT_INTERFACE, in_signature='', out_signature='') @@ -31,6 +32,12 @@ class AlertAgent(dbus.service.Object): print('method SetRinger(%s) was called' % mode) self.alert.NewAlert('ringer', 1, mode) + @dbus.service.method(ALERT_AGENT_INTERFACE, in_signature='', + out_signature='') + def Release(self): + print('method Release() was called') + self.mainloop.quit() + def print_command_line(options): if not options.verbose: return False @@ -145,7 +152,7 @@ bus = dbus.SystemBus() mainloop = gobject.MainLoop() alert = dbus.Interface(bus.get_object(BUS_NAME, BLUEZ_OBJECT_PATH), ALERT_INTERFACE) -alert_agent = AlertAgent(bus, TEST_OBJECT_PATH, alert) +alert_agent = AlertAgent(bus, TEST_OBJECT_PATH, alert, mainloop) print_command_line(options) |