Initial HAL test AVRCP api support
cover Initial HAL test AVRCP api support
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(+)
Signature · 1 line
1.8.3.2
PATCH 1/6 android/client: Add AVRCP get_play_status_rsp support
--- android/client/if-rc.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
android/client/if-rc.c +58 -0
@@ -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 };
Signature · 1 line
1.8.3.2
PATCH 2/6 android/client: Add AVRCP get_element_attr_rsp support
In reply to Ravi kumar Veeramally--- android/client/if-rc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
android/client/if-rc.c +46 -0
@@ -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 };
Signature · 1 line
1.8.3.2
PATCH 3/6 android/client: Add AVRCP set_volume support
In reply to Ravi kumar Veeramally--- android/client/if-rc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
android/client/if-rc.c +24 -0
@@ -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 };
Signature · 1 line
1.8.3.2
PATCH 4/6 android/client: Add AVRCP get_play_status_cb support
In reply to Ravi kumar Veeramally--- android/client/if-rc.c | 6 ++++++ 1 file changed, 6 insertions(+)
android/client/if-rc.c +6 -0
@@ -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 */
Signature · 1 line
1.8.3.2
PATCH 5/6 android/client: Add AVRCP get_element_attr_cb support
In reply to Ravi kumar Veeramally--- android/client/if-rc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
android/client/if-rc.c +11 -0
@@ -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 */
Signature · 1 line
1.8.3.2
PATCH 6/6 android/client: Add AVRCP volume_change_cb support
In reply to Ravi kumar Veeramally--- android/client/if-rc.c | 6 ++++++ 1 file changed, 6 insertions(+)
android/client/if-rc.c +6 -0
@@ -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 */
Signature · 1 line
1.8.3.2
Luiz Augusto von Dentz
maintainerHi Ravi,
Quoted 10 lines · Ravi kumar Veeramally
Patchset contains initial AVRCP api support for HAL test.
Ravi kumar Veeramally (6):
android/client: Add AVRCPget_play_status_rspsupport android/client: Add AVRCPget_element_attr_rspsupport android/client: Add AVRCPset_volumesupport android/client: Add AVRCPget_play_status_cbsupport android/client: Add AVRCPget_element_attr_cbsupport android/client: Add AVRCPvolume_change_cbsupport
Quoted 5 lines
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.
Signature · 1 line
Luiz Augusto von Dentz
Luiz Augusto von Dentz
maintainerHi Ravi,
Quoted 17 lines · Luiz Augusto von Dentz
Hi Ravi,
Quoted 13 lines · Ravi kumar Veeramally
Patchset contains initial AVRCP api support for HAL test.
Ravi kumar Veeramally (6):
android/client: Add AVRCPget_play_status_rspsupport android/client: Add AVRCPget_element_attr_rspsupport android/client: Add AVRCPset_volumesupport android/client: Add AVRCPget_play_status_cbsupport android/client: Add AVRCPget_element_attr_cbsupport android/client: Add AVRCPvolume_change_cbsupportandroid/client/if-rc.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+)
Quoted 6 lines
Quoted 2 lines
--
1.8.3.2This 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.
Signature · 1 line
Luiz Augusto von Dentz