summaryrefslogtreecommitdiff
path: root/android/handsfree-client.c
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-11-09 01:24:15 +0100
committerSzymon Janc <szymon.janc@tieto.com>2014-11-10 20:30:35 +0100
commitf230d1c3a55199d6f1a9f9b40851c9b463cf72eb (patch)
tree52d5e817c686e100f4366393eaa61b9c1953889a /android/handsfree-client.c
parent8e71a9f2ee4ec52f52b7ff7c8ac2cdb3e16fc70d (diff)
downloadbluez-f230d1c3a55199d6f1a9f9b40851c9b463cf72eb.tar.gz
android/handsfree-client: Add devices queue
This patch adds devices queue eventhough we are going to support only one HF device at once
Diffstat (limited to 'android/handsfree-client.c')
-rw-r--r--android/handsfree-client.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/android/handsfree-client.c b/android/handsfree-client.c
index b63aa1380..aa3912b5b 100644
--- a/android/handsfree-client.c
+++ b/android/handsfree-client.c
@@ -35,6 +35,7 @@
#include "lib/sdp.h"
#include "lib/sdp_lib.h"
#include "src/sdp-client.h"
+#include "src/shared/queue.h"
#include "ipc.h"
#include "ipc-common.h"
#include "src/log.h"
@@ -69,6 +70,7 @@ static struct ipc *hal_ipc = NULL;
static uint32_t hfp_hf_features = 0;
static uint32_t hfp_hf_record_id = 0;
+static struct queue *devices = NULL;
static void handle_connect(const void *buf, uint16_t len)
{
@@ -334,16 +336,28 @@ bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
{
DBG("");
+ devices = queue_new();
+ if (!devices) {
+ error("hf-client: Could not create devices list");
+ goto failed;
+ }
+
bacpy(&adapter_addr, addr);
if (!enable_hf_client())
- return false;
+ goto failed;
hal_ipc = ipc;
ipc_register(hal_ipc, HAL_SERVICE_ID_HANDSFREE_CLIENT, cmd_handlers,
G_N_ELEMENTS(cmd_handlers));
return true;
+
+failed:
+ queue_destroy(devices, free);
+ devices = NULL;
+
+ return false;
}
void bt_hf_client_unregister(void)
@@ -352,6 +366,9 @@ void bt_hf_client_unregister(void)
cleanup_hfp_hf();
+ queue_destroy(devices, free);
+ devices = NULL;
+
ipc_unregister(hal_ipc, HAL_SERVICE_ID_HANDSFREE);
hal_ipc = NULL;
}