mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-20 10:20:48 +00:00
hfp: fix state management when hf + ag are active
This commit is contained in:
parent
d4dd47ff43
commit
22387625cf
@ -1610,6 +1610,11 @@ static void hfp_run_for_context(hfp_connection_t *hfp_connection){
|
|||||||
if (!hfp_connection) return;
|
if (!hfp_connection) return;
|
||||||
if (!hfp_connection->rfcomm_cid) return;
|
if (!hfp_connection->rfcomm_cid) return;
|
||||||
|
|
||||||
|
if (hfp_connection->local_role != HFP_ROLE_AG) {
|
||||||
|
log_info("HFP AG%p, wrong role %u", hfp_connection, hfp_connection->local_role);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!rfcomm_can_send_packet_now(hfp_connection->rfcomm_cid)) {
|
if (!rfcomm_can_send_packet_now(hfp_connection->rfcomm_cid)) {
|
||||||
log_info("hfp_run_for_context: request can send for 0x%02x", hfp_connection->rfcomm_cid);
|
log_info("hfp_run_for_context: request can send for 0x%02x", hfp_connection->rfcomm_cid);
|
||||||
rfcomm_request_can_send_now_event(hfp_connection->rfcomm_cid);
|
rfcomm_request_can_send_now_event(hfp_connection->rfcomm_cid);
|
||||||
@ -2000,6 +2005,7 @@ static void hfp_run(void){
|
|||||||
btstack_linked_list_iterator_init(&it, hfp_get_connections());
|
btstack_linked_list_iterator_init(&it, hfp_get_connections());
|
||||||
while (btstack_linked_list_iterator_has_next(&it)){
|
while (btstack_linked_list_iterator_has_next(&it)){
|
||||||
hfp_connection_t * hfp_connection = (hfp_connection_t *)btstack_linked_list_iterator_next(&it);
|
hfp_connection_t * hfp_connection = (hfp_connection_t *)btstack_linked_list_iterator_next(&it);
|
||||||
|
if (hfp_connection->local_role != HFP_ROLE_AG) continue;
|
||||||
hfp_run_for_context(hfp_connection);
|
hfp_run_for_context(hfp_connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,6 +552,11 @@ static void hfp_run_for_context(hfp_connection_t * hfp_connection){
|
|||||||
if (!hfp_connection) return;
|
if (!hfp_connection) return;
|
||||||
if (!hfp_connection->rfcomm_cid) return;
|
if (!hfp_connection->rfcomm_cid) return;
|
||||||
|
|
||||||
|
if (hfp_connection->local_role != HFP_ROLE_HF) {
|
||||||
|
log_info("HFP HF%p, wrong role %u", hfp_connection, hfp_connection->local_role);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hfp_connection->hf_accept_sco && hci_can_send_command_packet_now()){
|
if (hfp_connection->hf_accept_sco && hci_can_send_command_packet_now()){
|
||||||
|
|
||||||
hfp_connection->hf_accept_sco = 0;
|
hfp_connection->hf_accept_sco = 0;
|
||||||
@ -1066,6 +1071,7 @@ static void hfp_run(void){
|
|||||||
btstack_linked_list_iterator_init(&it, hfp_get_connections());
|
btstack_linked_list_iterator_init(&it, hfp_get_connections());
|
||||||
while (btstack_linked_list_iterator_has_next(&it)){
|
while (btstack_linked_list_iterator_has_next(&it)){
|
||||||
hfp_connection_t * hfp_connection = (hfp_connection_t *)btstack_linked_list_iterator_next(&it);
|
hfp_connection_t * hfp_connection = (hfp_connection_t *)btstack_linked_list_iterator_next(&it);
|
||||||
|
if (hfp_connection->local_role != HFP_ROLE_HF) continue;
|
||||||
hfp_run_for_context(hfp_connection);
|
hfp_run_for_context(hfp_connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user