mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-15 22:20:59 +00:00
hci: allow to defer disconnect on dedicated bonding complete
This commit is contained in:
parent
67718330f1
commit
ab0c69a9cf
17
src/hci.c
17
src/hci.c
@ -6996,7 +6996,7 @@ static bool hci_run_general_pending_commands(void){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (connection->bonding_flags & BONDING_DISCONNECT_DEDICATED_DONE){
|
||||
if ((connection->bonding_flags & (BONDING_DISCONNECT_DEDICATED_DONE | BONDING_DEDICATED_DEFER_DISCONNECT)) == BONDING_DISCONNECT_DEDICATED_DONE){
|
||||
connection->bonding_flags &= ~BONDING_DISCONNECT_DEDICATED_DONE;
|
||||
connection->bonding_flags |= BONDING_EMIT_COMPLETE_ON_DISCONNECT;
|
||||
connection->state = SENT_DISCONNECT;
|
||||
@ -7972,6 +7972,21 @@ int gap_dedicated_bonding(bd_addr_t device, int mitm_protection_required){
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t hci_dedicated_bonding_defer_disconenct(hci_con_handle_t con_handle, bool defer){
|
||||
hci_connection_t * connection = hci_connection_for_handle(con_handle);
|
||||
if (connection == NULL){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
if (defer){
|
||||
connection->bonding_flags |= BONDING_DEDICATED_DEFER_DISCONNECT;
|
||||
} else {
|
||||
connection->bonding_flags &= ~BONDING_DEDICATED_DEFER_DISCONNECT;
|
||||
// trigger disconnect
|
||||
hci_run();
|
||||
}
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void gap_set_local_name(const char * local_name){
|
||||
hci_stack->local_name = local_name;
|
||||
hci_stack->gap_tasks_classic |= GAP_TASK_SET_LOCAL_NAME;
|
||||
|
18
src/hci.h
18
src/hci.h
@ -270,7 +270,8 @@ enum {
|
||||
BONDING_SEND_ENCRYPTION_REQUEST = 0x2000,
|
||||
BONDING_SEND_READ_ENCRYPTION_KEY_SIZE = 0x4000,
|
||||
BONDING_DEDICATED = 0x8000,
|
||||
BONDING_EMIT_COMPLETE_ON_DISCONNECT = 0x10000,
|
||||
BONDING_DEDICATED_DEFER_DISCONNECT = 0x10000,
|
||||
BONDING_EMIT_COMPLETE_ON_DISCONNECT = 0x20000,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@ -1727,13 +1728,6 @@ uint8_t gap_periodic_advertising_terminate_sync(uint16_t sync_handle);
|
||||
*/
|
||||
uint16_t hci_get_manufacturer(void);
|
||||
|
||||
// Only for PTS testing
|
||||
|
||||
/**
|
||||
* Disable automatic L2CAP disconnect if no L2CAP connection is established
|
||||
*/
|
||||
void hci_disable_l2cap_timeout_check(void);
|
||||
|
||||
/**
|
||||
* Get Classic Allow Role Switch param
|
||||
*/
|
||||
@ -1749,6 +1743,14 @@ HCI_STATE hci_get_state(void);
|
||||
*/
|
||||
void hci_deinit(void);
|
||||
|
||||
// defer disconnect on dedicated bonding complete, used internally for CTKD
|
||||
uint8_t hci_dedicated_bonding_defer_disconenct(hci_con_handle_t con_handle, bool defer);
|
||||
|
||||
// Only for PTS testing
|
||||
|
||||
// Disable automatic L2CAP disconnect if no L2CAP connection is established
|
||||
void hci_disable_l2cap_timeout_check(void);
|
||||
|
||||
// setup test connections, used for fuzzing
|
||||
void hci_setup_test_connections_fuzz(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user