mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 21:35:16 +00:00
allow to send connection encryption command
This commit is contained in:
parent
34d2123c9e
commit
dce7800923
@ -82,7 +82,6 @@ typedef enum {
|
||||
void gap_set_bondable_mode(int enabled);
|
||||
|
||||
gap_security_level_t gap_security_level_for_link_key_type(link_key_type_t link_key_type);
|
||||
gap_security_level_t gap_security_level_for_connection(hci_connection_t * connection);
|
||||
gap_security_level_t gap_security_level(hci_con_handle_t con_handle);
|
||||
|
||||
void gap_request_security_level(hci_con_handle_t con_handle, gap_security_level_t level);
|
||||
|
23
src/hci.c
23
src/hci.c
@ -705,15 +705,15 @@ static void event_handler(uint8_t *packet, int size){
|
||||
}
|
||||
break;
|
||||
|
||||
case HCI_EVENT_AUTHENTICATION_COMPLETE:
|
||||
handle = READ_BT_16(packet, 3);
|
||||
conn = hci_connection_for_handle(handle);
|
||||
if (!conn) break;
|
||||
if (conn->bonding_flags->BONDING_REQUESTED){
|
||||
gap_security_level_t level = gap_security_level_for_connection(conn);
|
||||
hci_emit_security_level(handle, packet[2], level);
|
||||
}
|
||||
break;
|
||||
// case HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT:
|
||||
// handle = READ_BT_16(packet, 3);
|
||||
// conn = hci_connection_for_handle(handle);
|
||||
// if (!conn) break;
|
||||
// if (conn->bonding_flags & BONDING_REQUESTED){
|
||||
// gap_security_level_t level = gap_security_level_for_connection(conn);
|
||||
// hci_emit_security_level(handle, packet[2], level);
|
||||
// }
|
||||
// break;
|
||||
|
||||
#ifndef EMBEDDED
|
||||
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
||||
@ -1297,6 +1297,11 @@ void hci_run(){
|
||||
hci_send_cmd(&hci_authentication_requested, connection->con_handle);
|
||||
return;
|
||||
}
|
||||
if (connection->bonding_flags & BONDING_SEND_ENCRYPTION_REQUEST){
|
||||
connection->bonding_flags &= ~BONDING_SEND_ENCRYPTION_REQUEST;
|
||||
hci_send_cmd(&hci_set_connection_encryption, connection->con_handle, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (hci_stack.state){
|
||||
|
Loading…
x
Reference in New Issue
Block a user