summaryrefslogtreecommitdiffstats
path: root/audio/headset.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-06-06 09:35:31 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-06-06 09:35:31 +0000
commitd951ee9dae5061b8db7ef875e2f477d4445557a4 (patch)
treeb53318d422f07881319b018333bf843d3ca7351c /audio/headset.c
parent826d4fe2b75a00acf8c0ac2dcf62e66b8a34f535 (diff)
Add more HFP support
Diffstat (limited to 'audio/headset.c')
-rw-r--r--audio/headset.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 5fc33c43..0b6d4e51 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -301,7 +301,12 @@ static void send_cancel_auth(audio_device_t *device)
{
DBusMessage *cancel;
char addr[18], *address = addr;
- const char *uuid = HSP_AG_UUID;
+ const char *uuid;
+
+ if (device->headset->type == SVC_HEADSET)
+ uuid = HSP_AG_UUID;
+ else
+ uuid = HFP_AG_UUID;
cancel = dbus_message_new_method_call("org.bluez", "/org/bluez",
"org.bluez.Database",
@@ -527,8 +532,6 @@ static int rfcomm_connect(audio_device_t *device, int *err)
assert(hs->pending_connect != NULL);
assert(hs->state == HEADSET_STATE_CONNECT_IN_PROGRESS);
- hs->type = hs->hfp_handle ? SVC_HANDSFREE : SVC_HEADSET;
-
ba2str(&device->bda, address);
debug("Connecting to %s channel %d", address, hs->rfcomm_ch);
@@ -1158,7 +1161,7 @@ static DBusHandlerResult hs_connect(DBusConnection *conn, DBusMessage *msg,
DBusPendingCall *pending;
audio_device_t *device = data;
struct headset *hs = device->headset;
- const char *hs_svc = "hsp";
+ const char *hs_svc;
const char *addr_ptr;
char hs_address[18];
int err;
@@ -1178,6 +1181,8 @@ static DBusHandlerResult hs_connect(DBusConnection *conn, DBusMessage *msg,
hs->pending_connect->msg = msg ? dbus_message_ref(msg) : NULL;
+ hs->type = hs->hfp_handle ? SVC_HANDSFREE : SVC_HEADSET;
+
if (hs->rfcomm_ch > 0) {
if (rfcomm_connect(device, &err) < 0) {
error("Unable to connect");
@@ -1200,6 +1205,11 @@ static DBusHandlerResult hs_connect(DBusConnection *conn, DBusMessage *msg,
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
+ if (hs->type == SVC_HEADSET)
+ hs_svc = "hsp";
+ else
+ hs_svc = "hfp";
+
ba2str(&device->bda, hs_address);
addr_ptr = hs_address;
dbus_message_append_args(msg, DBUS_TYPE_STRING, &addr_ptr,
@@ -1576,7 +1586,7 @@ static gboolean headset_server_io_cb(GIOChannel *chan, GIOCondition cond, void *
struct sockaddr_rc addr;
socklen_t size;
char hs_address[18], *address = hs_address;
- const char *uuid = HSP_AG_UUID;
+ const char *uuid;
audio_device_t *device;
struct headset *hs;
DBusMessage *auth;
@@ -1622,10 +1632,13 @@ static gboolean headset_server_io_cb(GIOChannel *chan, GIOCondition cond, void *
return TRUE;
}
- if (chan == hs_server)
+ if (chan == hs_server) {
hs->type = SVC_HEADSET;
- else
+ uuid = HSP_AG_UUID;
+ } else {
hs->type = SVC_HANDSFREE;
+ uuid = HFP_AG_UUID;
+ }
auth = dbus_message_new_method_call("org.bluez", "/org/bluez", "org.bluez.Database",
"RequestAuthorization");