components/bt/host/bluedroid/stack/btm/btm_sec.c
/*******************************************************************************
**
** Function         btm_sec_link_key_request
**
** Description      This function is called when controller requests link key
**
** Returns          Pointer to the record or NULL
**
*******************************************************************************/
Function         btm_sec_link_key_request
Description      This function is called when controller requests link key

Returns          Pointer to the record or NULL
Function btm_sec_link_key_request Description This function is called when controller requests link key Returns Pointer to the record or NULL
void btm_sec_link_key_request (UINT8 *p_bda)
{
    tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (p_bda);
    BTM_TRACE_EVENT ("btm_sec_link_key_request()  BDA: %02x:%02x:%02x:%02x:%02x:%02x\n",
                     p_bda[0], p_bda[1], p_bda[2], p_bda[3], p_bda[4], p_bda[5]);
    if ( (btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_PIN_REQ) &&
            (btm_cb.collision_start_time != 0) &&
            (memcmp (btm_cb.p_collided_dev_rec->bd_addr, p_bda, BD_ADDR_LEN) == 0) ) {
        BTM_TRACE_EVENT ("btm_sec_link_key_request() rejecting link key req "
                         "State: %d START_TIMEOUT : %d\n",
                         btm_cb.pairing_state, btm_cb.collision_start_time);
        btsnd_hcic_link_key_neg_reply (p_bda);
        return;
    }
    if (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN) {
        btsnd_hcic_link_key_req_reply (p_bda, p_dev_rec->link_key);
        return;
    }
    l2c_pin_code_request (p_bda);
    btsnd_hcic_link_key_neg_reply (p_bda);
}
void btm_sec_link_key_request ( UINT8 * p_bda ) { tBTM_SEC_DEV_REC * p_dev_rec = btm_find_or_alloc_dev ( p_bda ) ; BTM_TRACE_EVENT ( " \n " , p_bda [ 0 ] , p_bda [ 1 ] , p_bda [ 2 ] , p_bda [ 3 ] , p_bda [ 4 ] , p_bda [ 5 ] ) ; if ( ( btm_cb . pairing_state == BTM_PAIR_STATE_WAIT_PIN_REQ ) && ( btm_cb . collision_start_time != 0 ) && ( memcmp ( btm_cb . p_collided_dev_rec -> bd_addr , p_bda , BD_ADDR_LEN ) == 0 ) ) { BTM_TRACE_EVENT ( " " " \n " , btm_cb . pairing_state , btm_cb . collision_start_time ) ; btsnd_hcic_link_key_neg_reply ( p_bda ) ; return ; } if ( p_dev_rec -> sec_flags & BTM_SEC_LINK_KEY_KNOWN ) { btsnd_hcic_link_key_req_reply ( p_bda , p_dev_rec -> link_key ) ; return ; } l2c_pin_code_request ( p_bda ) ; btsnd_hcic_link_key_neg_reply ( p_bda ) ; }
Function         btm_sec_link_key_request
Description      This function is called when controller requests link key
Function btm_sec_link_key_request Description This function is called when controller requests link key
/* Notify L2CAP to increase timeout */ /* The link key is not in the database and it is not known to the manager */