mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-18 19:21:54 +00:00
gap: trigger IO Capabilites (Negative) Reply with gap_ssp_io_capabilities_response/gap_ssp_io_capabilities_negative if ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
This commit is contained in:
parent
9c2de2bcd6
commit
44565b0c35
16
src/gap.h
16
src/gap.h
@ -754,6 +754,22 @@ void gap_ssp_generate_oob_data(void);
|
||||
*/
|
||||
uint8_t gap_ssp_remote_oob_data(const bd_addr_t addr, const uint8_t * c_192, const uint8_t * r_192, const uint8_t * c_256, const uint8_t * r_256);
|
||||
|
||||
/**
|
||||
* Send SSP IO Capabilities Reply
|
||||
* @note IO Capabilities (Negative) Reply is sent automatically unless ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
|
||||
* @param addr
|
||||
* @return 0 if ok
|
||||
*/
|
||||
uint8_t gap_ssp_io_capabilities_response(const bd_addr_t addr);
|
||||
|
||||
/**
|
||||
* Send SSP IO Capabilities Negative Reply
|
||||
* @note IO Capabilities (Negative) Reply is sent automatically unless ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
|
||||
* @param addr
|
||||
* @return 0 if ok
|
||||
*/
|
||||
uint8_t gap_ssp_io_capabilities_negative(const bd_addr_t addr);
|
||||
|
||||
/**
|
||||
* @brief Enter Sniff mode
|
||||
* @param con_handle
|
||||
|
21
src/hci.c
21
src/hci.c
@ -2576,11 +2576,13 @@ static void event_handler(uint8_t *packet, uint16_t size){
|
||||
case HCI_EVENT_IO_CAPABILITY_REQUEST:
|
||||
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], RECV_IO_CAPABILITIES_REQUEST);
|
||||
log_info("IO Capability Request received, stack bondable %u, io cap %u", hci_stack->bondable, hci_stack->ssp_io_capability);
|
||||
#ifndef ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
|
||||
if (hci_stack->bondable && (hci_stack->ssp_io_capability != SSP_IO_CAPABILITY_UNKNOWN)){
|
||||
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], SEND_IO_CAPABILITIES_REPLY);
|
||||
} else {
|
||||
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], SEND_IO_CAPABILITIES_NEGATIVE_REPLY);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_CLASSIC_PAIRING_OOB
|
||||
@ -5945,6 +5947,25 @@ int gap_ssp_confirmation_negative(const bd_addr_t addr){
|
||||
return gap_pairing_set_state_and_run(addr, GAP_PAIRING_STATE_SEND_CONFIRMATION_NEGATIVE);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_EXPLICIT_IO_CAPABILITIES_REPLY
|
||||
|
||||
static uint8_t gap_set_auth_flag_and_run(const bd_addr_t addr, hci_authentication_flags_t flag){
|
||||
hci_connection_t * conn = hci_connection_for_bd_addr_and_type(addr, BD_ADDR_TYPE_ACL);
|
||||
if (!conn) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
connectionSetAuthenticationFlags(conn, flag);
|
||||
hci_run();
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
uint8_t gap_ssp_io_capabilities_response(const bd_addr_t addr){
|
||||
return gap_set_auth_flag_and_run(addr, SEND_IO_CAPABILITIES_REPLY);
|
||||
}
|
||||
|
||||
uint8_t gap_ssp_io_capabilities_negative(const bd_addr_t addr){
|
||||
return gap_set_auth_flag_and_run(addr, SEND_IO_CAPABILITIES_NEGATIVE_REPLY);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CLASSIC_PAIRING_OOB
|
||||
/**
|
||||
* @brief Report Remote OOB Data
|
||||
|
Loading…
x
Reference in New Issue
Block a user