From 3945307c8d27470aaf419712da84d388cafd6c63 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Wed, 10 Jun 2020 11:48:41 +0200 Subject: [PATCH] test/pts/avrcp_target_test : register set addressed player callback that verifies tat the player ID is in valid range, document player list items fields --- test/pts/avrcp_target_test.c | 54 +++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/test/pts/avrcp_target_test.c b/test/pts/avrcp_target_test.c index 51ba03e32..f6a092a4d 100644 --- a/test/pts/avrcp_target_test.c +++ b/test/pts/avrcp_target_test.c @@ -200,7 +200,53 @@ static const uint8_t subunit_info[] = { 7,7,7,7 }; -static uint8_t media_player_list[] = { 0x00, 0x02, 0x01, 0x00, 0x2A, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x00, 0x0E, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x64, 0x20, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72, 0x01, 0x00, 0x2C, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x00, 0x10, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72}; // 0x71, 0x00, 0x61,0x04, 0x5A, 0x73, + +static uint8_t media_player_list[] = { + // num players (2B) + 0x00, 0x02, + // item type: 0x01 (Media Player Item) + 0x01, + // Item Length (2B) + 0x00, 0x2A, + // Player ID (2B) + 0x00, 0x01, + // Major Player Type (1B) + 0x03, + // Player Sub Type (4B) + 0x00, 0x00, 0x00, 0x01, + // Play Status (1B) + 0x00, + // Feature Bit Mask (16B) + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Character Set Id (2B): 0x006A (UTF-8) + 0x00, 0x6A, + // Displayable Name Length (2B) + 0x00, 0x0E, + // Displayable Name + 0x42, 0x72, 0x6F, 0x77, 0x73, 0x65, 0x64, 0x20, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72, + + // item type: 0x01 (Media Player Item) + 0x01, + // Item Length (2B) + 0x00, 0x2C, + // Player ID (2B) + 0x00, 0x02, + // Major Player Type (1B) + 0x03, + // Player Sub Type (4B) + 0x00, 0x00, 0x00, 0x01, + // Play Status (1B) + 0x00, + // Feature Bit Mask (16B) + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Character Set Id (2B): 0x006A (UTF-8) + 0x00, 0x6A, + // Displayable Name Length (2B) + 0x00, 0x10, + // Displayable Name + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72}; + + static uint8_t virtual_filesystem_list[] ={ 0x00, 0x07, 0x02, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x6A, 0x00, 0x06, 0x41, 0x6C, 0x62, 0x75, 0x6D, 0x73, 0x02, 0x00, 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x6A, 0x00, 0x07, 0x41, 0x72, 0x74, 0x69, 0x73, 0x74, 0x73, 0x02, 0x00, 0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x6A, 0x00, 0x06, 0x47, 0x65, 0x6E, 0x72, 0x65, 0x73, 0x02, 0x00, 0x17, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x6A, 0x00, 0x09, 0x50, 0x6C, 0x61, 0x79, 0x6C, 0x69, 0x73, 0x74, 0x73, 0x02, 0x00, 0x13, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x01, 0x01, 0x00, 0x6A, 0x00, 0x05, 0x53, 0x6F, 0x6E, 0x67, 0x73, 0x02, 0x00, 0x13, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00}; // 0x71, 0x00, 0xA7, 0x04, 0x5A, 0x73, static uint8_t search_list[] = {}; static uint8_t now_playing_list[] = {}; @@ -839,6 +885,11 @@ static void stdin_process(char * cmd, int size){ #endif +static bool avrcp_set_addressed_player_handler(uint16_t player_id){ + if (player_id < 1 || player_id > 2) return false; + return true; +} + int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ (void)argc; @@ -869,6 +920,7 @@ int btstack_main(int argc, const char * argv[]){ // Initialize AVRCP Target. avrcp_target_init(); avrcp_target_register_packet_handler(&avrcp_target_packet_handler); + avrcp_target_register_set_addressed_player_handler(&avrcp_set_addressed_player_handler); avrcp_browsing_init(); avrcp_browsing_register_packet_handler(&avrcp_target_packet_handler);