avrcp: use PANEL as default unit + subunit info

This commit is contained in:
Matthias Ringwald 2021-07-18 13:12:24 +02:00
parent fda344fc0d
commit f0af2234e6
5 changed files with 13 additions and 32 deletions

View File

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- HFP: event HFP_SUBEVENT_VOICE_RECOGNITION_STATUS emitted on (enhanced) voice recognition status change. Field "activated" replaced with "state". Added additional "status" field that indicates if the command was successful.
- HFP: streamlined enhanced voice recognition function names
- AVDTP: media config validator is called with preview of media codec configuration event and configured separately for sink/source
- AVRCP: use PANEL as default unit + subunit info
- Run Loop: new functionality for HCI transport drivers and inter-process communication
- *btstack_run_loop_poll_data_sources_from_irq*: used to transfer control from IRQ handler to main thread/run loop
- *btstack_run_loop_execute_on_main_thread*: schedule code execution on main thread from other thread

View File

@ -200,18 +200,6 @@ static modcontext mod_context;
static tracker_buffer_state trkbuf;
/* AVRCP Target context START */
static const uint8_t subunit_info[] = {
0,0,0,0,
1,1,1,1,
2,2,2,2,
3,3,3,3,
4,4,4,4,
5,5,5,5,
6,6,6,6,
7,7,7,7
};
static uint32_t company_id = 0x112233;
static uint8_t companies_num = 1;
static uint8_t companies[] = {
0x00, 0x19, 0x58 //BT SIG registered CompanyID
@ -765,9 +753,7 @@ static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
avrcp_subevent_connection_established_get_bd_addr(packet, event_addr);
avrcp_target_set_now_playing_info(media_tracker.avrcp_cid, NULL, sizeof(tracks)/sizeof(avrcp_track_t));
avrcp_target_set_unit_info(media_tracker.avrcp_cid, AVRCP_SUBUNIT_TYPE_AUDIO, company_id);
avrcp_target_set_subunit_info(media_tracker.avrcp_cid, AVRCP_SUBUNIT_TYPE_AUDIO, (uint8_t *)subunit_info, sizeof(subunit_info));
avrcp_controller_get_supported_events(media_tracker.avrcp_cid);
printf("AVRCP: Channel successfully opened: media_tracker.avrcp_cid 0x%02x\n", media_tracker.avrcp_cid);

View File

@ -71,6 +71,9 @@ static const char * default_avrcp_controller_service_provider_name = "BTstack AV
static const char * default_avrcp_target_service_name = "BTstack AVRCP Target Service";
static const char * default_avrcp_target_service_provider_name = "BTstack AVRCP Target Service Provider";
// default subunit info: single PANEL subunit
static const uint8_t avrcp_default_subunit_info[] = { AVRCP_SUBUNIT_TYPE_PANEL << 3};
static uint16_t avrcp_cid_counter;
static btstack_context_callback_registration_t avrcp_handle_sdp_client_query_request;
@ -415,7 +418,6 @@ uint16_t avrcp_get_next_cid(avrcp_role_t role){
return avrcp_cid_counter;
}
static avrcp_connection_t * avrcp_create_connection(avrcp_role_t role, bd_addr_t remote_addr){
avrcp_connection_t * connection = btstack_memory_avrcp_connection_get();
if (!connection){
@ -430,6 +432,13 @@ static avrcp_connection_t * avrcp_create_connection(avrcp_role_t role, bd_addr_t
connection->transaction_id_counter = 0;
connection->max_num_fragments = 0xFF;
// setup default unit / subunit info
connection->company_id = 0xffffff;
connection->unit_type = AVRCP_SUBUNIT_TYPE_PANEL;
connection->subunit_info_data_size = sizeof(avrcp_default_subunit_info);
connection->subunit_info_data = avrcp_default_subunit_info;
log_info("avrcp_create_connection, role %d", role);
(void)memcpy(connection->remote_addr, remote_addr, 6);
btstack_linked_list_add(&connections, (btstack_linked_item_t *) connection);

View File

@ -528,7 +528,7 @@ static uint8_t avrcp_target_subunit_info(avrcp_connection_t * connection, uint8_
connection->cmd_operands_length = 5;
connection->cmd_operands[0] = (page << 4) | extension_code;
// mark non-existant entry with 0xff
// mark non-existent entries with 0xff
memset(&connection->cmd_operands[1], 0xff, 4);
if ((connection->subunit_info_data != NULL) && (offset < connection->subunit_info_data_size)){
uint8_t bytes_to_copy = btstack_min(connection->subunit_info_data_size - offset, 4);

View File

@ -234,18 +234,6 @@ typedef struct {
static uint8_t ertm_buffer[10000];
static const uint8_t subunit_info[] = {
0,0,0,0,
1,1,1,1,
2,2,2,2,
3,3,3,3,
4,4,4,4,
5,5,5,5,
6,6,6,6,
7,7,7,7
};
static uint8_t media_player_list[] = {
// num players (2B)
0x00, 0x02,
@ -317,7 +305,6 @@ static uint8_t virtual_filesystem_list[] ={ 0x00, 0x07, 0x02, 0x00, 0x14, 0x00,
static uint8_t search_list[] = {};
static uint8_t now_playing_list[] = {};
static uint32_t company_id = 0x112233;
static uint8_t companies_num = 1;
static uint8_t companies[] = {
0x00, 0x19, 0x58 //BT SIG registered CompanyID
@ -625,8 +612,6 @@ static void avrcp_connection_establishment_packet_handler(uint8_t packet_type, u
printf("AVRCP connection established: avrcp_cid 0x%02x.\n", avrcp_cid);
avrcp_target_set_now_playing_info(avrcp_cid, NULL, sizeof(tracks)/sizeof(avrcp_track_t));
avrcp_target_set_unit_info(avrcp_cid, AVRCP_SUBUNIT_TYPE_AUDIO, company_id);
avrcp_target_set_subunit_info(avrcp_cid, AVRCP_SUBUNIT_TYPE_AUDIO, (uint8_t *)subunit_info, sizeof(subunit_info));
// Set PTS default TSPX_max_avc_fragments = 10
avrcp_controller_set_max_num_fragments(avrcp_cid, 10);