summaryrefslogtreecommitdiff
path: root/android/hal-handsfree-client.c
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-09-15 13:51:19 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-09-18 16:36:04 +0200
commit9cce589b9a515e2187784e9e2cfa896399e032a1 (patch)
tree3ecdf0cadd030ebb6f241e0c358c641ab72390e2 /android/hal-handsfree-client.c
parent795af24596a7da39fb2f14212c4ca97687d36730 (diff)
downloadbluez-9cce589b9a515e2187784e9e2cfa896399e032a1.tar.gz
android/handsfree-client: Add Connect/Disconnect commands
Diffstat (limited to 'android/hal-handsfree-client.c')
-rw-r--r--android/hal-handsfree-client.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/android/hal-handsfree-client.c b/android/hal-handsfree-client.c
index 9422e0f2e..441d2b4f0 100644
--- a/android/hal-handsfree-client.c
+++ b/android/hal-handsfree-client.c
@@ -70,6 +70,44 @@ static bt_status_t init(bthf_client_callbacks_t *callbacks)
return ret;
}
+static bt_status_t hf_client_connect(bt_bdaddr_t *bd_addr)
+{
+ struct hal_cmd_hf_client_connect cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ if (!bd_addr)
+ return BT_STATUS_PARM_INVALID;
+
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HANDSFREE_CLIENT,
+ HAL_OP_HF_CLIENT_CONNECT, sizeof(cmd), &cmd,
+ NULL, NULL, NULL);
+}
+
+static bt_status_t disconnect(bt_bdaddr_t *bd_addr)
+{
+ struct hal_cmd_hf_client_disconnect cmd;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ if (!bd_addr)
+ return BT_STATUS_PARM_INVALID;
+
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HANDSFREE_CLIENT,
+ HAL_OP_HF_CLIENT_DISCONNECT, sizeof(cmd), &cmd,
+ NULL, NULL, NULL);
+}
+
static void cleanup(void)
{
struct hal_cmd_unregister_module cmd;
@@ -92,6 +130,8 @@ static void cleanup(void)
static bthf_client_interface_t iface = {
.size = sizeof(iface),
.init = init,
+ .connect = hf_client_connect,
+ .disconnect = disconnect,
.cleanup = cleanup
};