mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 10:21:49 +00:00
avrcp_target: implement UIDS changed
This commit is contained in:
parent
ef99ca1e18
commit
6a2e66bec5
@ -735,9 +735,11 @@ typedef struct {
|
||||
const uint32_t * target_supported_companies;
|
||||
uint8_t target_supported_companies_num;
|
||||
|
||||
|
||||
bool target_addressed_player_changed;
|
||||
uint16_t target_addressed_player_id;
|
||||
uint16_t target_uid_counter;
|
||||
bool target_uids_changed;
|
||||
|
||||
bool target_accept_response;
|
||||
|
||||
|
@ -841,6 +841,21 @@ uint8_t avrcp_target_addressed_player_changed(uint16_t avrcp_cid, uint16_t playe
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
uint8_t avrcp_target_uids_changed(uint16_t avrcp_cid, uint16_t uid_counter){
|
||||
avrcp_connection_t * connection = avrcp_get_connection_for_avrcp_cid_for_role(AVRCP_TARGET, avrcp_cid);
|
||||
if (!connection){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
connection->target_uid_counter = uid_counter;
|
||||
|
||||
if (connection->notifications_enabled & (1 << AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED)) {
|
||||
connection->target_uids_changed = true;
|
||||
avrcp_request_can_send_now(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
uint8_t avrcp_target_battery_status_changed(uint16_t avrcp_cid, avrcp_battery_status_t battery_status){
|
||||
avrcp_connection_t * connection = avrcp_get_connection_for_avrcp_cid_for_role(AVRCP_TARGET, avrcp_cid);
|
||||
if (!connection){
|
||||
@ -1167,7 +1182,6 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
|
||||
switch (event_id){
|
||||
case AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED:
|
||||
case AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED:
|
||||
case AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED:
|
||||
case AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END:
|
||||
case AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START:
|
||||
case AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED:
|
||||
@ -1183,6 +1197,16 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
|
||||
connection->notifications_enabled |= event_mask;
|
||||
|
||||
switch (event_id){
|
||||
case AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED:{
|
||||
if (connection->target_uid_counter == 0){
|
||||
connection->target_uid_counter = 1;
|
||||
}
|
||||
uint8_t value[2];
|
||||
big_endian_store_16(value, 0, connection->target_uid_counter);
|
||||
avrcp_target_response_vendor_dependent_interim(connection, pdu_id, event_id, value, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
case AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED:
|
||||
if (connection->target_track_selected){
|
||||
if (connection->target_total_tracks > 0){
|
||||
@ -1395,6 +1419,14 @@ static void avrcp_target_packet_handler(uint8_t packet_type, uint16_t channel, u
|
||||
break;
|
||||
}
|
||||
|
||||
if (connection->target_uids_changed){
|
||||
connection->target_uids_changed = false;
|
||||
notification_id = AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED;
|
||||
uint8_t value[2];
|
||||
big_endian_store_16(value, 0, connection->target_uid_counter);
|
||||
avrcp_target_notification_init(connection, notification_id, value, 2);
|
||||
break;
|
||||
}
|
||||
// nothing to send, exit
|
||||
return;
|
||||
|
||||
|
@ -237,6 +237,8 @@ uint8_t avrcp_target_operation_accepted(uint16_t avrcp_cid, avrcp_operation_id_t
|
||||
*/
|
||||
uint8_t avrcp_target_operation_not_implemented(uint16_t avrcp_cid, avrcp_operation_id_t opid, uint8_t operands_length, uint8_t operand);
|
||||
|
||||
uint8_t avrcp_target_uids_changed(uint16_t avrcp_cid, uint16_t uid_counter);
|
||||
|
||||
/**
|
||||
* @brief De-Init AVRCP Browsing Target
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user