[pulseaudio-discuss] [RFC 08/24] bluetooth: Implement Handsfree Audio Agent Release()
jprvita at gmail.com
jprvita at gmail.com
Tue Mar 26 22:16:47 PDT 2013
From: João Paulo Rechi Vita <jprvita at openbossa.org>
This method is used to revoke the agent registration with the manager.
It can only be called by the manager that the agent has previously
registered with, it will be ignored if called by any other process.
---
src/modules/bluetooth/bluetooth-util.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 21501f8..2ed7eb6 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -2175,6 +2175,27 @@ fail:
return r;
}
+static DBusMessage *hfagent_release(DBusConnection *c, DBusMessage *m, void *userdata) {
+ DBusMessage *r;
+ const char *sender;
+ pa_bluetooth_discovery *y = userdata;
+
+ pa_assert(y);
+
+ sender = dbus_message_get_sender(m);
+ if (!pa_streq(y->ofono_bus_id, sender)) {
+ pa_assert_se(r = dbus_message_new_error(m, "org.ofono.Error.NotAllowed", "Operation is not allowed by this sender"));
+ return r;
+ }
+
+ pa_log_debug("HF audio agent has been unregistered by oFono (%s)", y->ofono_bus_id);
+ ofono_done(y);
+
+ pa_assert_se(r = dbus_message_new_method_return(m));
+
+ return r;
+}
+
static DBusHandlerResult dbus_msg_handler(DBusConnection *c, DBusMessage *m, void *userdata) {
struct pa_bluetooth_discovery *y = userdata;
DBusMessage *r = NULL;
@@ -2214,7 +2235,7 @@ static DBusHandlerResult dbus_msg_handler(DBusConnection *c, DBusMessage *m, voi
else if (dbus_message_is_method_call(m, interface, "ClearConfiguration"))
r = endpoint_clear_configuration(c, m, userdata);
else if (dbus_message_is_method_call(m, "org.ofono.HandsfreeAudioAgent", "Release"))
- pa_assert_se(r = dbus_message_new_method_return(m));
+ r = hfagent_release(c, m, userdata);
else if (dbus_message_is_method_call(m, "org.ofono.HandsfreeAudioAgent", "NewConnection"))
pa_assert_se(r = dbus_message_new_method_return(m));
else
--
1.7.11.7
More information about the pulseaudio-discuss
mailing list