diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-03-07 13:16:00 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-03-07 23:23:39 +0200 |
commit | 75a75614a551c6f2db3cd74ce672248ca3a9fc74 (patch) | |
tree | 316237a89cd46f393f9b2ac8e44f961b84bcfcd9 /android/avrcp.c | |
parent | 29f45ef1da029f9fe8eaa6896f397102b6d6f7cf (diff) | |
download | bluez-75a75614a551c6f2db3cd74ce672248ca3a9fc74.tar.gz |
android/avrcp: Add support to set volume command
Diffstat (limited to 'android/avrcp.c')
-rw-r--r-- | android/avrcp.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/android/avrcp.c b/android/avrcp.c index 978e6c0d0..11a2614aa 100644 --- a/android/avrcp.c +++ b/android/avrcp.c @@ -332,10 +332,35 @@ done: static void handle_set_volume(const void *buf, uint16_t len) { + struct hal_cmd_avrcp_set_volume *cmd = (void *) buf; + struct avrcp_device *dev; + uint8_t status; + int ret; + DBG(""); + if (!devices) { + error("AVRCP: No device found to set volume"); + status = HAL_STATUS_FAILED; + goto done; + } + + /* Peek the first device since the HAL cannot really address a specific + * device it might mean there could only be one connected. + */ + dev = devices->data; + + ret = avrcp_set_volume(dev->session, cmd->value & 0x7f, NULL, NULL); + if (ret < 0) { + status = HAL_STATUS_FAILED; + goto done; + } + + status = HAL_STATUS_SUCCESS; + +done: ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_AVRCP, HAL_OP_AVRCP_SET_VOLUME, - HAL_STATUS_FAILED); + status); } static const struct ipc_handler cmd_handlers[] = { |