mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 03:35:20 +00:00
avrcp: request can send now again for controller if both want to send
This commit is contained in:
parent
f4ab45812f
commit
bf67b2dbb0
@ -726,7 +726,8 @@ static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
|
||||
|
||||
avrcp_connection_t * connection_controller;
|
||||
avrcp_connection_t * connection_target;
|
||||
|
||||
bool can_send;
|
||||
|
||||
switch (packet_type) {
|
||||
case HCI_EVENT_PACKET:
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
@ -843,19 +844,23 @@ static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
|
||||
|
||||
case L2CAP_EVENT_CAN_SEND_NOW:
|
||||
local_cid = l2cap_event_can_send_now_get_local_cid(packet);
|
||||
|
||||
can_send = true;
|
||||
|
||||
connection_target = avrcp_get_connection_for_l2cap_signaling_cid_for_role(AVRCP_TARGET, local_cid);
|
||||
if ((connection_target != NULL) && connection_target->wait_to_send){
|
||||
connection_target->wait_to_send = false;
|
||||
(*avrcp_target_packet_handler)(HCI_EVENT_PACKET, channel, packet, size);
|
||||
break;
|
||||
can_send = false;
|
||||
}
|
||||
|
||||
connection_controller = avrcp_get_connection_for_l2cap_signaling_cid_for_role(AVRCP_CONTROLLER, local_cid);
|
||||
if ((connection_controller != NULL) && connection_controller->wait_to_send){
|
||||
connection_controller->wait_to_send = false;
|
||||
(*avrcp_controller_packet_handler)(HCI_EVENT_PACKET, channel, packet, size);
|
||||
break;
|
||||
if (can_send){
|
||||
connection_controller->wait_to_send = false;
|
||||
(*avrcp_controller_packet_handler)(HCI_EVENT_PACKET, channel, packet, size);
|
||||
} else {
|
||||
l2cap_request_can_send_now_event(local_cid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -325,7 +325,6 @@ static int avrcp_target_send_response(uint16_t cid, avrcp_connection_t * connect
|
||||
connection->cmd_operands_length);
|
||||
pos += connection->cmd_operands_length;
|
||||
|
||||
connection->wait_to_send = false;
|
||||
return l2cap_send_prepared(cid, pos);
|
||||
}
|
||||
|
||||
@ -1055,7 +1054,7 @@ static int avrcp_target_send_notification(uint16_t cid, avrcp_connection_t * con
|
||||
(void)memcpy(packet + pos, value, value_len);
|
||||
pos += value_len;
|
||||
}
|
||||
connection->wait_to_send = false;
|
||||
|
||||
return l2cap_send_prepared(cid, pos);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user