From 0473ce49b10a3625d83735fbe3c3aa38f2bbc7fd Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Thu, 6 Nov 2014 10:31:56 +0200 Subject: [PATCH] android/handsfree: Add support for new API for vr_cmd_cb Voice Recognition Command notification callback has new parameter bdaddr. --- android/hal-handsfree.c | 4 ++++ android/hal-ipc-api.txt | 1 + android/hal-msg.h | 1 + android/handsfree.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c index dfa37e79b..c465277b1 100644 --- a/android/hal-handsfree.c +++ b/android/hal-handsfree.c @@ -58,7 +58,11 @@ static void handle_vr_state(void *buf, uint16_t len, int fd) struct hal_ev_handsfree_vr_state *ev = buf; if (cbs->vr_cmd_cb) +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) + cbs->vr_cmd_cb(ev->state, (bt_bdaddr_t *) (ev->bdaddr)); +#else cbs->vr_cmd_cb(ev->state); +#endif } static void handle_answer(void *buf, uint16_t len, int fd) diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt index 72677d2ab..c0e9a39a3 100644 --- a/android/hal-ipc-api.txt +++ b/android/hal-ipc-api.txt @@ -1008,6 +1008,7 @@ Notifications: Opcode 0x83 - Voice Recognition Command notification Notification parameters: Voice recognition state (1 octet) + Remote address (6 octets) Valid voice recognition states: 0x00 = Stopped 0x01 = Started diff --git a/android/hal-msg.h b/android/hal-msg.h index 9b089667b..4ea30dac4 100644 --- a/android/hal-msg.h +++ b/android/hal-msg.h @@ -1346,6 +1346,7 @@ struct hal_ev_handsfree_audio_state { #define HAL_EV_HANDSFREE_VR 0x83 struct hal_ev_handsfree_vr_state { uint8_t state; + uint8_t bdaddr[6]; } __attribute__((packed)); #define HAL_EV_HANDSFREE_ANSWER 0x84 diff --git a/android/handsfree.c b/android/handsfree.c index 2c325b1ce..d6579ba29 100644 --- a/android/handsfree.c +++ b/android/handsfree.c @@ -822,6 +822,8 @@ static void at_cmd_bvra(struct hfp_context *context, else ev.state = HAL_HANDSFREE_VR_STOPPED; + bdaddr2android(&dev->bdaddr, ev.bdaddr); + ipc_send_notif(hal_ipc, HAL_SERVICE_ID_HANDSFREE, HAL_EV_HANDSFREE_VR, sizeof(ev), &ev); return; -- 2.47.3