gap: write supervision timeout after connection complete [a2349]

This commit is contained in:
Matthias Ringwald 2019-11-15 14:03:47 +01:00
parent 0c3eb48d98
commit 6909f06401
2 changed files with 15 additions and 0 deletions

View File

@ -2155,8 +2155,15 @@ static void event_handler(uint8_t *packet, int size){
if (!packet[2]){
conn->state = OPEN;
conn->con_handle = little_endian_read_16(packet, 3);
// queue get remote feature
conn->bonding_flags |= BONDING_REQUEST_REMOTE_FEATURES;
// queue set supervision timeout
if (hci_stack->link_supervision_timeout != 0){
connectionSetAuthenticationFlags(conn, WRITE_SUPERVISION_TIMEOUT);
}
// restart timer
btstack_run_loop_set_timer(&conn->timeout, HCI_CONNECTION_TIMEOUT_MS);
btstack_run_loop_add_timer(&conn->timeout);
@ -3601,6 +3608,12 @@ static void hci_run(void){
return;
}
if (connection->authentication_flags & WRITE_SUPERVISION_TIMEOUT){
connectionClearAuthenticationFlags(connection, WRITE_SUPERVISION_TIMEOUT);
hci_send_cmd(&hci_write_link_supervision_timeout, connection->con_handle, hci_stack->link_supervision_timeout);
return;
}
#ifdef ENABLE_CLASSIC
if (connection->authentication_flags & HANDLE_LINK_KEY_REQUEST){
log_info("responding to link key request");

View File

@ -209,6 +209,8 @@ typedef enum {
// errands
READ_RSSI = 0x10000,
WRITE_SUPERVISION_TIMEOUT = 0x20000,
} hci_authentication_flags_t;
/**