diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-11-28 10:37:21 +0100 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-12-01 17:12:40 +0100 |
commit | 529ce62586e0a91575b4e1d215baae47d22c57d3 (patch) | |
tree | 0710747567c0cc1aa40f0d8eac39320b536ced1d /android/handsfree-client.c | |
parent | 730c94647230f4a7aeb378ceafaf8299ebc025f4 (diff) | |
download | bluez-529ce62586e0a91575b4e1d215baae47d22c57d3.tar.gz |
android/handsfree-client: Add SCO to handsfree client
Diffstat (limited to 'android/handsfree-client.c')
-rw-r--r-- | android/handsfree-client.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/android/handsfree-client.c b/android/handsfree-client.c index 283519f8f..9e67c7f04 100644 --- a/android/handsfree-client.c +++ b/android/handsfree-client.c @@ -47,6 +47,7 @@ #include "bluetooth.h" #include "hal-msg.h" #include "handsfree-client.h" +#include "sco.h" #define HFP_HF_CHANNEL 7 @@ -139,6 +140,8 @@ static uint32_t hfp_hf_record_id = 0; static struct queue *devices = NULL; static GIOChannel *hfp_hf_server = NULL; +static struct bt_sco *sco = NULL; + static struct device *find_default_device(void) { return queue_peek_head(devices); @@ -1999,6 +2002,11 @@ static void cleanup_hfp_hf(void) bt_adapter_remove_record(hfp_hf_record_id); hfp_hf_record_id = 0; } + + if (sco) { + bt_sco_unref(sco); + sco = NULL; + } } bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr) @@ -2016,6 +2024,12 @@ bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr) if (!enable_hf_client()) goto failed; + sco = bt_sco_new(addr); + if (!sco) { + error("hf-client: Cannot create SCO. HFP AG is in use ?"); + goto failed; + } + hal_ipc = ipc; ipc_register(hal_ipc, HAL_SERVICE_ID_HANDSFREE_CLIENT, cmd_handlers, G_N_ELEMENTS(cmd_handlers)); @@ -2023,6 +2037,7 @@ bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr) return true; failed: + cleanup_hfp_hf(); queue_destroy(devices, free); devices = NULL; |