Patchset contains initial AVRCP api support for HAL test.
Ravi kumar Veeramally (6):
android/client: Add AVRCP get_play_status_rsp support
android/client: Add AVRCP get_element_attr_rsp support
android/client: Add AVRCP set_volume support
android/client: Add AVRCP get_play_status_cb support
android/client: Add AVRCP get_element_attr_cb support
android/client: Add AVRCP volume_change_cb support
android/client/if-rc.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 151 insertions(+)
--
1.8.3.2
---
android/client/if-rc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 57f7082..02e1de3 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -61,10 +61,16 @@ static void get_element_attr_cb(uint8_t num_attr, btrc_media_attr_t *attrs)
haltest_info("attr id=%s", btrc_media_attr_t2str(attrs[i]));
}
+static void volume_change_cb(uint8_t volume, uint8_t ctype)
+{
+ haltest_info("%s, volume=%d ctype=%d", __func__, volume, ctype);
+}
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
.get_play_status_cb = get_play_status_cb,
.get_element_attr_cb = get_element_attr_cb,
+ .volume_change_cb = volume_change_cb,
};
/* init */
--
1.8.3.2
---
android/client/if-rc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index b8174dd..57f7082 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -51,9 +51,20 @@ static void get_play_status_cb(void)
haltest_info("%s", __func__);
}
+static void get_element_attr_cb(uint8_t num_attr, btrc_media_attr_t *attrs)
+{
+ uint8_t i;
+
+ haltest_info("%s, num_of_attributes=%d", __func__, num_attr);
+
+ for (i = 0; i < num_attr; i++)
+ haltest_info("attr id=%s", btrc_media_attr_t2str(attrs[i]));
+}
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
.get_play_status_cb = get_play_status_cb,
+ .get_element_attr_cb = get_element_attr_cb,
};
/* init */
--
1.8.3.2
---
android/client/if-rc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 5aab8e0..b8174dd 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -46,8 +46,14 @@ SINTMAP(btrc_media_attr_t, -1, "(unknown)")
DELEMENT(BTRC_MEDIA_ATTR_PLAYING_TIME),
ENDMAP
+static void get_play_status_cb(void)
+{
+ haltest_info("%s", __func__);
+}
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
+ .get_play_status_cb = get_play_status_cb,
};
/* init */
--
1.8.3.2
---
android/client/if-rc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 5625e56..5aab8e0 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -134,6 +134,29 @@ static void get_element_attr_rsp_p(int argc, const char **argv)
EXEC(if_rc->get_element_attr_rsp, num_attr, &attrs);
}
+/* set_volume */
+
+static void set_volume_c(int argc, const char **argv,
+ enum_func *enum_func, void **user)
+{
+}
+
+static void set_volume_p(int argc, const char **argv)
+{
+ uint8_t volume;
+
+ RETURN_IF_NULL(if_rc);
+
+ if (argc <= 2) {
+ haltest_error("No volume specified");
+ return;
+ }
+
+ volume = (uint8_t) atoi(argv[2]);
+
+ EXEC(if_rc->set_volume, volume);
+}
+
/* cleanup */
static void cleanup_p(int argc, const char **argv)
@@ -149,6 +172,7 @@ static struct method methods[] = {
STD_METHODCH(get_play_status_rsp,
"<play_status> <song_len> <song_pos>"),
STD_METHODCH(get_element_attr_rsp, "<num_attr> <attrs_id> <value>"),
+ STD_METHODCH(set_volume, "<volume>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2
---
android/client/if-rc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 7da26e6..5625e56 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -36,6 +36,16 @@ SINTMAP(btrc_play_status_t, -1, "(unknown)")
DELEMENT(BTRC_PLAYSTATE_ERROR),
ENDMAP
+SINTMAP(btrc_media_attr_t, -1, "(unknown)")
+ DELEMENT(BTRC_MEDIA_ATTR_TITLE),
+ DELEMENT(BTRC_MEDIA_ATTR_ARTIST),
+ DELEMENT(BTRC_MEDIA_ATTR_ALBUM),
+ DELEMENT(BTRC_MEDIA_ATTR_TRACK_NUM),
+ DELEMENT(BTRC_MEDIA_ATTR_NUM_TRACKS),
+ DELEMENT(BTRC_MEDIA_ATTR_GENRE),
+ DELEMENT(BTRC_MEDIA_ATTR_PLAYING_TIME),
+ENDMAP
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
};
@@ -89,6 +99,41 @@ static void get_play_status_rsp_p(int argc, const char **argv)
EXEC(if_rc->get_play_status_rsp, play_status, song_len, song_pos);
}
+/* get_element_attr_rsp */
+
+static void get_element_attr_rsp_c(int argc, const char **argv,
+ enum_func *enum_func, void **user)
+{
+ if (argc == 4) {
+ *user = TYPE_ENUM(btrc_media_attr_t);
+ *enum_func = enum_defines;
+ }
+}
+
+static void get_element_attr_rsp_p(int argc, const char **argv)
+{
+ uint8_t num_attr;
+ btrc_element_attr_val_t attrs;
+
+ RETURN_IF_NULL(if_rc);
+
+ if (argc <= 2) {
+ haltest_error("No number of attributes specified");
+ return;
+ }
+
+ if (argc <= 4) {
+ haltest_error("No attr id and value specified");
+ return;
+ }
+
+ num_attr = (uint8_t) atoi(argv[2]);
+ attrs.attr_id = str2btrc_media_attr_t(argv[3]);
+ strcpy((char *)attrs.text, argv[4]);
+
+ EXEC(if_rc->get_element_attr_rsp, num_attr, &attrs);
+}
+
/* cleanup */
static void cleanup_p(int argc, const char **argv)
@@ -103,6 +148,7 @@ static struct method methods[] = {
STD_METHOD(init),
STD_METHODCH(get_play_status_rsp,
"<play_status> <song_len> <song_pos>"),
+ STD_METHODCH(get_element_attr_rsp, "<num_attr> <attrs_id> <value>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2
---
android/client/if-rc.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 58fb892..7da26e6 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -15,11 +15,27 @@
*
*/
+#include<stdio.h>
+#include<ctype.h>
+
+#include<hardware/bluetooth.h>
+#include<hardware/bt_hh.h>
+
#include "if-main.h"
+#include "pollhandler.h"
#include "../hal-utils.h"
const btrc_interface_t *if_rc = NULL;
+SINTMAP(btrc_play_status_t, -1, "(unknown)")
+ DELEMENT(BTRC_PLAYSTATE_STOPPED),
+ DELEMENT(BTRC_PLAYSTATE_PLAYING),
+ DELEMENT(BTRC_PLAYSTATE_PAUSED),
+ DELEMENT(BTRC_PLAYSTATE_FWD_SEEK),
+ DELEMENT(BTRC_PLAYSTATE_REV_SEEK),
+ DELEMENT(BTRC_PLAYSTATE_ERROR),
+ENDMAP
+
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
};
@@ -33,6 +49,46 @@ static void init_p(int argc, const char **argv)
EXEC(if_rc->init, &rc_cbacks);
}
+/* get_play_status_rsp */
+
+static void get_play_status_rsp_c(int argc, const char **argv,
+ enum_func *enum_func, void **user)
+{
+ if (argc == 3) {
+ *user = TYPE_ENUM(btrc_play_status_t);
+ *enum_func = enum_defines;
+ }
+}
+
+static void get_play_status_rsp_p(int argc, const char **argv)
+{
+ btrc_play_status_t play_status;
+ uint32_t song_len, song_pos;
+
+ RETURN_IF_NULL(if_rc);
+
+ if (argc <= 2) {
+ haltest_error("No play status specified");
+ return;
+ }
+
+ if (argc <= 3) {
+ haltest_error("No song length specified");
+ return;
+ }
+
+ if (argc <= 4) {
+ haltest_error("No song position specified");
+ return;
+ }
+
+ play_status = str2btrc_play_status_t(argv[2]);
+ song_len = (uint32_t) atoi(argv[3]);
+ song_pos = (uint32_t) atoi(argv[4]);
+
+ EXEC(if_rc->get_play_status_rsp, play_status, song_len, song_pos);
+}
+
/* cleanup */
static void cleanup_p(int argc, const char **argv)
@@ -45,6 +101,8 @@ static void cleanup_p(int argc, const char **argv)
static struct method methods[] = {
STD_METHOD(init),
+ STD_METHODCH(get_play_status_rsp,
+ "<play_status> <song_len> <song_pos>"),
STD_METHOD(cleanup),
END_METHOD
};
--
1.8.3.2
Hi Ravi,
On Sun, Mar 2, 2014 at 8:57 PM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi Ravi,
>
> On Fri, Feb 28, 2014 at 8:58 PM, Ravi kumar Veeramally
> <[email protected]> wrote:
>> Patchset contains initial AVRCP api support for HAL test.
>>
>> Ravi kumar Veeramally (6):
>> android/client: Add AVRCP get_play_status_rsp support
>> android/client: Add AVRCP get_element_attr_rsp support
>> android/client: Add AVRCP set_volume support
>> android/client: Add AVRCP get_play_status_cb support
>> android/client: Add AVRCP get_element_attr_cb support
>> android/client: Add AVRCP volume_change_cb support
>>
>> android/client/if-rc.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 151 insertions(+)
>>
>> --
>> 1.8.3.2
>
> This doesn't help much with AVRCP since the requests need to be
> responded rather quickly we might need to have them auto responded if
> we really want hal-tester to be usable.
Applied, it turn out to be useful while testing but I did need to add
\n in a few places.
--
Luiz Augusto von Dentz
Hi Ravi,
On Fri, Feb 28, 2014 at 8:58 PM, Ravi kumar Veeramally
<[email protected]> wrote:
> Patchset contains initial AVRCP api support for HAL test.
>
> Ravi kumar Veeramally (6):
> android/client: Add AVRCP get_play_status_rsp support
> android/client: Add AVRCP get_element_attr_rsp support
> android/client: Add AVRCP set_volume support
> android/client: Add AVRCP get_play_status_cb support
> android/client: Add AVRCP get_element_attr_cb support
> android/client: Add AVRCP volume_change_cb support
>
> android/client/if-rc.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 151 insertions(+)
>
> --
> 1.8.3.2
This doesn't help much with AVRCP since the requests need to be
responded rather quickly we might need to have them auto responded if
we really want hal-tester to be usable.
--
Luiz Augusto von Dentz