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

Commit 3559e872 authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge "Move find_in_device_record to ACL" into main

parents b686a16e bc9fa80d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -866,7 +866,7 @@ void bta_gattc_start_discover(tBTA_GATTC_CLCB* p_clcb,
}

void bta_gattc_continue_discovery_if_needed(const RawAddress& bd_addr,
                                            uint16_t acl_handle) {
                                            uint16_t /* acl_handle */) {
  tBTA_GATTC_SERV* p_srcb = bta_gattc_find_srvr_cache(bd_addr);
  if (!p_srcb || !p_srcb->disc_blocked_waiting_on_version) {
    return;
+23 −3
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ using bluetooth::legacy::hci::GetInterface;
void BTM_update_version_info(const RawAddress& bd_addr,
                             const remote_version_info& remote_version_info);

void gatt_find_in_device_record(const RawAddress& bd_addr,
static void find_in_device_record(const RawAddress& bd_addr,
                                  tBLE_BD_ADDR* address_with_type);
void l2c_link_hci_conn_comp(tHCI_STATUS status, uint16_t handle,
                            const RawAddress& p_bda);
@@ -2676,7 +2676,7 @@ bool acl_create_le_connection_with_id(uint8_t id, const RawAddress& bd_addr,
      .bda = bd_addr,
  };

  gatt_find_in_device_record(bd_addr, &address_with_type);
  find_in_device_record(bd_addr, &address_with_type);

  LOG_DEBUG("Creating le direct connection to:%s type:%s (initial type: %s)",
            ADDRESS_TO_LOGGABLE_CSTR(address_with_type),
@@ -2854,3 +2854,23 @@ tACL_CONN* btm_acl_for_bda(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  }
  return p_acl;
}

void find_in_device_record(const RawAddress& bd_addr,
                           tBLE_BD_ADDR* address_with_type) {
  const tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
  if (p_dev_rec == nullptr) {
    return;
  }

  if (p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) {
    if (p_dev_rec->ble.identity_address_with_type.bda.IsEmpty()) {
      *address_with_type = {.type = p_dev_rec->ble.AddressType(),
                            .bda = bd_addr};
      return;
    }
    *address_with_type = p_dev_rec->ble.identity_address_with_type;
    return;
  }
  *address_with_type = {.type = BLE_ADDR_PUBLIC, .bda = bd_addr};
  return;
}
+0 −20
Original line number Diff line number Diff line
@@ -198,26 +198,6 @@ void gatt_free(void) {
  EattExtension::GetInstance()->Stop();
}

void gatt_find_in_device_record(const RawAddress& bd_addr,
                                tBLE_BD_ADDR* address_with_type) {
  const tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr);
  if (p_dev_rec == nullptr) {
    return;
  }

  if (p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) {
    if (p_dev_rec->ble.identity_address_with_type.bda.IsEmpty()) {
      *address_with_type = {.type = p_dev_rec->ble.AddressType(),
                            .bda = bd_addr};
      return;
    }
    *address_with_type = p_dev_rec->ble.identity_address_with_type;
    return;
  }
  *address_with_type = {.type = BLE_ADDR_PUBLIC, .bda = bd_addr};
  return;
}

/*******************************************************************************
 *
 * Function         gatt_connect
+0 −5
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
 */

#include "l2c_api.h"
#include "stack/btm/btm_dev.h"
#include "stack/gatt/gatt_int.h"
#include "stack/include/bt_hdr.h"
#include "test/common/mock_functions.h"
@@ -63,10 +62,6 @@ void gatt_data_process(tGATT_TCB& tcb, uint16_t cid, BT_HDR* p_buf) {
void gatt_consolidate(const RawAddress& identity_addr, const RawAddress& rpa) {
  inc_func_call_count(__func__);
}
void gatt_find_in_device_record(const RawAddress& bd_addr,
                                tBLE_BD_ADDR* address_with_type) {
  inc_func_call_count(__func__);
}
void gatt_free(void) { inc_func_call_count(__func__); }
void gatt_init_srv_chg(void) { inc_func_call_count(__func__); }
void gatt_l2cif_config_cfm_cback(uint16_t lcid, uint16_t initiator,