Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebcb0f54 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I169239c0,I7029221c,If1d05a00,I669acfed

* changes:
  Add stack/include/acl_api for LE parameter request
  Use new ACL API for btm_establish_continue
  Add stack/acl/btm_acl.cc::btm_establish_continue_from_address
  This is why we encapsulate stack/l2cap/l2c_ble.cc
parents e0575bcd 13670a46
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1056,6 +1056,17 @@ void btm_establish_continue(tACL_CONN* p_acl_cb) {
                p_acl_cb->hci_handle);
}

void btm_establish_continue_from_address(const RawAddress& bda,
                                         tBT_TRANSPORT transport) {
  tACL_CONN* p_acl = btm_bda_to_acl(bda, transport);
  if (p_acl == nullptr) {
    BTM_TRACE_ERROR("%s Unable to find acl control block to continue",
                    __func__);
    return;
  }
  btm_establish_continue(p_acl);
}

/*******************************************************************************
 *
 * Function         BTM_SetDefaultLinkSuperTout
@@ -2384,3 +2395,12 @@ bool acl_refresh_remote_address(const tBTM_SEC_DEV_REC* p_sec_rec,
                  p_acl->active_remote_addr_type);
  return true;
}

bool acl_peer_supports_ble_connection_parameters_request(
    const RawAddress& remote_bda) {
  tACL_CONN* p_acl = btm_bda_to_acl(remote_bda, BT_TRANSPORT_LE);
  if (p_acl == nullptr) {
    return false;
  }
  return HCI_LE_CONN_PARAM_REQ_SUPPORTED(p_acl->peer_le_features);
}
+6 −0
Original line number Diff line number Diff line
@@ -247,3 +247,9 @@ bool acl_refresh_remote_address(const tBTM_SEC_DEV_REC* p_dev_rec,
                                const RawAddress& remote_bda,
                                tBT_TRANSPORT transport, uint8_t rra_type,
                                const RawAddress& rpa);

void btm_establish_continue_from_address(const RawAddress& remote_bda,
                                         tBT_TRANSPORT transport);

bool acl_peer_supports_ble_connection_parameters_request(
    const RawAddress& remote_bda);
+6 −7
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "main/shim/shim.h"
#include "osi/include/osi.h"
#include "stack/gatt/connection_manager.h"
#include "stack/include/acl_api.h"
#include "stack_config.h"

using base::StringPrintf;
@@ -56,8 +57,7 @@ static void l2cble_start_conn_update(tL2C_LCB* p_lcb);
bool L2CA_CancelBleConnectReq(const RawAddress& rem_bda) {
  tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(rem_bda, BT_TRANSPORT_LE);

  tACL_CONN* p_acl = btm_bda_to_acl(rem_bda, BT_TRANSPORT_LE);
  if (p_acl) {
  if (BTM_IsAclConnectionUp(rem_bda, BT_TRANSPORT_LE)) {
    if (p_lcb != NULL && p_lcb->link_state == LST_CONNECTING) {
      L2CAP_TRACE_WARNING("%s - disconnecting the LE link", __func__);
      L2CA_RemoveFixedChnl(L2CAP_ATT_CID, rem_bda);
@@ -93,13 +93,12 @@ bool L2CA_UpdateBleConnParams(const RawAddress& rem_bda, uint16_t min_int,
                              uint16_t timeout, uint16_t min_ce_len,
                              uint16_t max_ce_len) {
  tL2C_LCB* p_lcb;
  tACL_CONN* p_acl_cb = btm_bda_to_acl(rem_bda, BT_TRANSPORT_LE);

  /* See if we have a link control block for the remote device */
  p_lcb = l2cu_find_lcb_by_bd_addr(rem_bda, BT_TRANSPORT_LE);

  /* If we don't have one, create one and accept the connection. */
  if (!p_lcb || !p_acl_cb) {
  if (!p_lcb || !BTM_IsAclConnectionUp(rem_bda, BT_TRANSPORT_LE)) {
    LOG(WARNING) << __func__ << " - unknown BD_ADDR " << rem_bda;
    return (false);
  }
@@ -235,12 +234,12 @@ uint16_t L2CA_GetDisconnectReason(const RawAddress& remote_bda,
 ******************************************************************************/
void l2cble_notify_le_connection(const RawAddress& bda) {
  tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);
  tACL_CONN* p_acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE);
  tL2C_CCB* p_ccb;

  if (p_lcb != NULL && p_acl != NULL && p_lcb->link_state != LST_CONNECTED) {
  if (p_lcb != NULL && BTM_IsAclConnectionUp(bda, BT_TRANSPORT_LE) &&
      p_lcb->link_state != LST_CONNECTED) {
    /* update link status */
    btm_establish_continue(p_acl);
    btm_establish_continue_from_address(bda, BT_TRANSPORT_LE);
    /* update l2cap link status and send callback */
    p_lcb->link_state = LST_CONNECTED;
    l2cu_process_fixed_chnl_resp(p_lcb);