hci: fix gap_connect_cancel for gap_connect_with_whitelist

This commit is contained in:
Matthias Ringwald 2022-05-21 15:29:22 +02:00
parent e57898c743
commit 14f2d8f08a
2 changed files with 32 additions and 14 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- HFP HF: emit HFP_SUBEVENT_TRANSMIT_DTMF_CODES after sending DTMF command
### Fixed
- GAP: fix gap_connect_cancel for gap_connect_with_whitelist
- L2CAP: Fix accept incoming ERTM connection when Information Request already complete
- HFP AG: activate all AG indicators upon service level connection establishment

View File

@ -7113,25 +7113,42 @@ static hci_connection_t * gap_get_outgoing_connection(void){
}
uint8_t gap_connect_cancel(void){
hci_connection_t * conn = gap_get_outgoing_connection();
if (!conn) return 0;
switch (conn->state){
case SEND_CREATE_CONNECTION:
// skip sending create connection and emit event instead
hci_connection_t * conn;
switch (hci_stack->le_connecting_request){
case LE_CONNECTING_IDLE:
break;
case LE_CONNECTING_WHITELIST:
hci_stack->le_connecting_request = LE_CONNECTING_IDLE;
hci_emit_le_connection_complete(conn->address_type, conn->address, 0, ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER);
btstack_linked_list_remove(&hci_stack->connections, (btstack_linked_item_t *) conn);
btstack_memory_hci_connection_free( conn );
break;
case SENT_CREATE_CONNECTION:
// request to send cancel connection
conn->state = SEND_CANCEL_CONNECTION;
hci_run();
break;
default:
case LE_CONNECTING_DIRECT:
hci_stack->le_connecting_request = LE_CONNECTING_IDLE;
conn = gap_get_outgoing_connection();
if (conn == NULL){
hci_run();
} else {
switch (conn->state){
case SEND_CREATE_CONNECTION:
// skip sending create connection and emit event instead
hci_emit_le_connection_complete(conn->address_type, conn->address, 0, ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER);
btstack_linked_list_remove(&hci_stack->connections, (btstack_linked_item_t *) conn);
btstack_memory_hci_connection_free( conn );
break;
case SENT_CREATE_CONNECTION:
// request to send cancel connection
conn->state = SEND_CANCEL_CONNECTION;
hci_run();
break;
default:
break;
}
}
break;
case LE_CONNECTING_CANCEL:
btstack_unreachable();
break;
}
return 0;
return ERROR_CODE_SUCCESS;
}
/**