bluetooth: handle Acquire API change

Acquire now return input and output MTU of the file descriptor so it is
no longer necessary to get those after acquiring the fd, which less round
trips and faster response time when switching profiles.
This commit is contained in:
Luiz Augusto von Dentz 2010-12-02 14:11:13 +02:00
parent dda564f50b
commit 8c982a4afe
3 changed files with 12 additions and 47 deletions

View file

@ -934,10 +934,11 @@ const pa_bluetooth_transport* pa_bluetooth_device_get_transport(const pa_bluetoo
return NULL;
}
int pa_bluetooth_transport_acquire(const pa_bluetooth_transport *t, const char *accesstype) {
int pa_bluetooth_transport_acquire(const pa_bluetooth_transport *t, const char *accesstype, size_t *imtu, size_t *omtu) {
DBusMessage *m, *r;
DBusError err;
int ret;
uint16_t i, o;
pa_assert(t);
pa_assert(t->y);
@ -955,7 +956,7 @@ int pa_bluetooth_transport_acquire(const pa_bluetooth_transport *t, const char *
}
#ifdef DBUS_TYPE_UNIX_FD
if (!dbus_message_get_args(r, &err, DBUS_TYPE_UNIX_FD, &ret, DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(r, &err, DBUS_TYPE_UNIX_FD, &ret, DBUS_TYPE_UINT16, &i, DBUS_TYPE_UINT16, &o, DBUS_TYPE_INVALID)) {
pa_log("Failed to parse org.bluez.MediaTransport.Acquire(): %s", err.message);
ret = -1;
dbus_error_free(&err);
@ -963,6 +964,12 @@ int pa_bluetooth_transport_acquire(const pa_bluetooth_transport *t, const char *
}
#endif
if (imtu)
*imtu = i;
if (omtu)
*omtu = o;
fail:
dbus_message_unref(r);
return ret;