diff --git a/profiles/alert/server.c b/profiles/alert/server.c
index 7e4c379..35f5004 100644
--- a/profiles/alert/server.c
+++ b/profiles/alert/server.c
g_free(alert);
}
+static void alert_release(gpointer user_data)
+{
+ struct alert_data *alert = user_data;
+ DBusMessage *msg;
+
+ msg = dbus_message_new_method_call(alert->srv, alert->path,
+ ALERT_AGENT_INTERFACE,
+ "Release");
+ if (msg)
+ g_dbus_send_message(btd_get_dbus_connection(), msg);
+
+ alert_data_destroy(alert);
+}
+
static void alert_destroy(gpointer user_data)
{
- g_slist_free_full(registered_alerts, alert_data_destroy);
+ DBG("");
+
+ g_slist_free_full(registered_alerts, alert_release);
registered_alerts = NULL;
}
diff --git a/test/test-alert b/test/test-alert
index c92a719..1e241a3 100755
--- a/test/test-alert
+++ b/test/test-alert
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='')
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
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)