summaryrefslogtreecommitdiff
path: root/android/hal-avrcp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-19 18:58:54 +0200
committerSzymon Janc <szymon.janc@gmail.com>2014-02-19 19:17:16 +0100
commit96b14998e64784074ba3c8e88d9b08cf12f68fa7 (patch)
tree913490f7defa8bdfe254c744795a60840c03c1de /android/hal-avrcp.c
parent3656c6fb14f7b3c4b6cd8c0504dc123e59a404ce (diff)
downloadbluez-96b14998e64784074ba3c8e88d9b08cf12f68fa7.tar.gz
android/hal-avrcp: Add .get_element_attr_rsp implementation
Diffstat (limited to 'android/hal-avrcp.c')
-rw-r--r--android/hal-avrcp.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/android/hal-avrcp.c b/android/hal-avrcp.c
index df32e2fda..3a399185e 100644
--- a/android/hal-avrcp.c
+++ b/android/hal-avrcp.c
@@ -256,6 +256,47 @@ static bt_status_t get_player_app_value_text_rsp(int num_val,
len, cmd, 0, NULL, NULL);
}
+static uint8_t write_element_attr_text(uint8_t *ptr, uint8_t num_attr,
+ btrc_element_attr_val_t *p_attrs,
+ size_t *len)
+{
+ int i;
+
+ for (i = 0; i < num_attr && *len < BLUEZ_HAL_MTU; i++) {
+ int ret;
+
+ ret = write_text(ptr, p_attrs[i].attr_id, p_attrs[i].text, len);
+ if (ret == 0)
+ break;
+
+ ptr += ret;
+ }
+
+ return i;
+}
+
+static bt_status_t get_element_attr_rsp(uint8_t num_attr,
+ btrc_element_attr_val_t *p_attrs)
+{
+ char buf[BLUEZ_HAL_MTU];
+ struct hal_cmd_avrcp_get_element_attrs_text *cmd = (void *) buf;
+ size_t len;
+ uint8_t *ptr;
+
+ DBG("");
+
+ if (!interface_ready())
+ return BT_STATUS_NOT_READY;
+
+ len = sizeof(*cmd);
+ ptr = (uint8_t *) &cmd->values[0];
+ cmd->number = write_element_attr_text(ptr, num_attr, p_attrs, &len);
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_AVRCP,
+ HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT,
+ len, cmd, 0, NULL, NULL);
+}
+
static void cleanup()
{
struct hal_cmd_unregister_module cmd;
@@ -284,6 +325,7 @@ static btrc_interface_t iface = {
.get_player_app_value_rsp = get_player_app_value_rsp,
.get_player_app_attr_text_rsp = get_player_app_attr_text_rsp,
.get_player_app_value_text_rsp = get_player_app_value_text_rsp,
+ .get_element_attr_rsp = get_element_attr_rsp,
.cleanup = cleanup
};