summaryrefslogtreecommitdiff
path: root/android/hal-handsfree.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2014-11-05 16:38:49 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-11-06 12:08:06 +0100
commit2e2514c502356ba567e19bec4e219d315483e9dc (patch)
treea52778bffef9665d819090640417c669fd0edcb7 /android/hal-handsfree.c
parentb0ba2f3432c938e542c4829c4e1cc58f03fc3c89 (diff)
downloadbluez-2e2514c502356ba567e19bec4e219d315483e9dc.tar.gz
android/handsfree: Add support for new API for cops_response
cops_response has new parameter bdaddr in new Android API.
Diffstat (limited to 'android/hal-handsfree.c')
-rw-r--r--android/hal-handsfree.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c
index c1d87021f..708d7908b 100644
--- a/android/hal-handsfree.c
+++ b/android/hal-handsfree.c
@@ -462,7 +462,7 @@ static bt_status_t device_status_notification(bthf_network_state_t state,
sizeof(cmd), &cmd, NULL, NULL, NULL);
}
-static bt_status_t cops_response(const char *cops)
+static bt_status_t cops_response_real(const char *cops, bt_bdaddr_t *bd_addr)
{
char buf[IPC_MTU];
struct hal_cmd_handsfree_cops_response *cmd = (void *) buf;
@@ -476,6 +476,12 @@ static bt_status_t cops_response(const char *cops)
if (!cops)
return BT_STATUS_PARM_INVALID;
+ memset(cmd, 0, sizeof(*cmd));
+
+ if (bd_addr)
+ memcpy(cmd->bdaddr, bd_addr, sizeof(cmd->bdaddr));
+
+ /* Size of cmd.buf */
cmd->len = strlen(cops) + 1;
memcpy(cmd->buf, cops, cmd->len);
@@ -486,6 +492,18 @@ static bt_status_t cops_response(const char *cops)
len, cmd, NULL, NULL, NULL);
}
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static bt_status_t cops_response(const char *cops, bt_bdaddr_t *bd_addr)
+{
+ return cops_response_real(cops, bd_addr);
+}
+#else
+static bt_status_t cops_response(const char *cops)
+{
+ return cops_response_real(cops, NULL);
+}
+#endif
+
static bt_status_t cind_response(int svc, int num_active, int num_held,
bthf_call_state_t state, int signal,
int roam, int batt_chg)