This patch notifies the Agent implementation that it is no longer
registered to the service daemon.
---
 plugins/hfp_audio.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/plugins/hfp_audio.c b/plugins/hfp_audio.c
index ffc3138..a8e365c 100644
--- a/plugins/hfp_audio.c
+++ b/plugins/hfp_audio.c
@@ -35,6 +35,7 @@
 #include <ofono/log.h>
 
 #define HFP_AUDIO_MANAGER_INTERFACE            OFONO_SERVICE 
".HandsfreeAudioManager"
+#define HFP_AUDIO_AGENT_INTERFACE              OFONO_SERVICE 
".HandsfreeAudioAgent"
 
 struct agent {
        char *owner;
@@ -74,6 +75,17 @@ static int agent_cmp(gconstpointer a, gconstpointer b)
        return strcmp(agent->path, match->path);
 }
 
+static void agent_release(gpointer data, gpointer user_data)
+{
+       struct agent *agent = data;
+       DBusMessage *msg;
+
+       msg = dbus_message_new_method_call(agent->owner, agent->path,
+                                       HFP_AUDIO_AGENT_INTERFACE, "Release");
+
+       g_dbus_send_message(ofono_dbus_get_connection(), msg);
+}
+
 static DBusMessage *am_get_cards(DBusConnection *conn,
                                        DBusMessage *msg, void *user_data)
 {
@@ -169,6 +181,7 @@ static void hfp_audio_exit(void)
        g_dbus_unregister_interface(ofono_dbus_get_connection(), "/",
                                                HFP_AUDIO_MANAGER_INTERFACE);
 
+       g_slist_foreach(agents, agent_release, NULL);
        g_slist_free_full(agents, agent_free);
 }
 
-- 
1.7.11.7

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to