summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-05-09 08:31:05 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-05-09 08:31:05 +0000
commit36b30565da2a137e3b0ae0012d846bce6c4c7457 (patch)
tree9ba7b6abe8eac3138282ead6c90e4348bd110281 /audio
parent417cc26f37a47ab773a3c57d7c185db94b3602b6 (diff)
Make use of FinishRemoteServiceTransaction method
Diffstat (limited to 'audio')
-rw-r--r--audio/headset.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 04a24ca0..56677f3f 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -955,6 +955,41 @@ int headset_remove_ag_record(uint32_t rec_id)
return 0;
}
+static void finish_sdp_transaction(bdaddr_t *dba)
+{
+ char address[18], *addr_ptr = address;
+ DBusMessage *msg, *reply;
+ DBusError derr;
+
+ ba2str(dba, address);
+
+ msg = dbus_message_new_method_call("org.bluez", "/org/bluez/hci0",
+ "org.bluez.Adapter",
+ "FinishRemoteServiceTransaction");
+ if (!msg) {
+ error("Unable to allocate new method call");
+ return;
+ }
+
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &addr_ptr,
+ DBUS_TYPE_INVALID);
+
+ dbus_error_init(&derr);
+ reply = dbus_connection_send_with_reply_and_block(connection, msg,
+ -1, &derr);
+
+ dbus_message_unref(msg);
+
+ if (dbus_error_is_set(&derr) || dbus_set_error_from_message(&derr, reply)) {
+ error("FinishRemoteServiceTransaction(%s) failed: %s",
+ address, derr.message);
+ dbus_error_free(&derr);
+ return;
+ }
+
+ dbus_message_unref(reply);
+}
+
static void get_record_reply(DBusPendingCall *call, void *data)
{
DBusMessage *reply;
@@ -1042,6 +1077,8 @@ static void get_record_reply(DBusPendingCall *call, void *data)
sdp_record_free(record);
dbus_message_unref(reply);
+ finish_sdp_transaction(&hs->bda);
+
return;
failed_not_supported:
@@ -1057,6 +1094,7 @@ failed:
pending_connect_free(hs->pending_connect);
hs->pending_connect = NULL;
hs->state = HEADSET_STATE_DISCONNECTED;
+ finish_sdp_transaction(&hs->bda);
}
static DBusHandlerResult hs_stop(struct headset *hs, DBusMessage *msg)