mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +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);
|
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_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);
|
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);
|
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;
|
break;
|
||||||
|
|
||||||
case HCI_EVENT_AUTHENTICATION_COMPLETE:
|
// case HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT:
|
||||||
handle = READ_BT_16(packet, 3);
|
// handle = READ_BT_16(packet, 3);
|
||||||
conn = hci_connection_for_handle(handle);
|
// conn = hci_connection_for_handle(handle);
|
||||||
if (!conn) break;
|
// if (!conn) break;
|
||||||
if (conn->bonding_flags->BONDING_REQUESTED){
|
// if (conn->bonding_flags & BONDING_REQUESTED){
|
||||||
gap_security_level_t level = gap_security_level_for_connection(conn);
|
// gap_security_level_t level = gap_security_level_for_connection(conn);
|
||||||
hci_emit_security_level(handle, packet[2], level);
|
// hci_emit_security_level(handle, packet[2], level);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
#ifndef EMBEDDED
|
#ifndef EMBEDDED
|
||||||
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
||||||
@ -1297,6 +1297,11 @@ void hci_run(){
|
|||||||
hci_send_cmd(&hci_authentication_requested, connection->con_handle);
|
hci_send_cmd(&hci_authentication_requested, connection->con_handle);
|
||||||
return;
|
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){
|
switch (hci_stack.state){
|
||||||
|
@ -239,6 +239,7 @@ typedef enum {
|
|||||||
BONDING_DISCONNECT_SECURITY_BLOCK = 0x08,
|
BONDING_DISCONNECT_SECURITY_BLOCK = 0x08,
|
||||||
BONDING_REQUESTED = 0x10,
|
BONDING_REQUESTED = 0x10,
|
||||||
BONDING_SEND_AUTHENTICATE_REQUEST = 0x20,
|
BONDING_SEND_AUTHENTICATE_REQUEST = 0x20,
|
||||||
|
BONDING_SEND_ENCRYPTION_REQUEST = 0x40,
|
||||||
} bonding_flags_t;
|
} bonding_flags_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user