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

Commit e8610f8c authored by Chris Manton's avatar Chris Manton
Browse files

Move BTM_ReadConnectionAddr from btm to acl

Working towards encapsulation of tACL_CONN

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I1520d792855357ba9a08a17d0cf7acf712e73009
parent a9975185
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -2469,6 +2469,36 @@ bool acl_peer_supports_ble_connection_parameters_request(
  return HCI_LE_CONN_PARAM_REQ_SUPPORTED(p_acl->peer_le_features);
}

/*******************************************************************************
 *
 * Function         BTM_ReadConnectionAddr
 *
 * Description      This function is called to get the local device address
 *                  information.
 *
 * Returns          void
 *
 ******************************************************************************/
void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
                            RawAddress& local_conn_addr,
                            tBLE_ADDR_TYPE* p_addr_type) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::BTM_ReadConnectionAddr(remote_bda, local_conn_addr,
                                                   p_addr_type);
  }
  tACL_CONN* p_acl = btm_bda_to_acl(remote_bda, BT_TRANSPORT_LE);

  if (p_acl == NULL) {
    BTM_TRACE_ERROR("No connection exist!");
    return;
  }
  local_conn_addr = p_acl->conn_addr;
  *p_addr_type = p_acl->conn_addr_type;

  BTM_TRACE_DEBUG("BTM_ReadConnectionAddr address type: %d addr: 0x%02x",
                  p_acl->conn_addr_type, p_acl->conn_addr.address[0]);
}

/*******************************************************************************
 *
 * Function         BTM_IsBleConnection
+0 −30
Original line number Diff line number Diff line
@@ -229,36 +229,6 @@ const Octet16& BTM_GetDeviceDHK() {
  return btm_cb.devcb.id_keys.dhk;
}

/*******************************************************************************
 *
 * Function         BTM_ReadConnectionAddr
 *
 * Description      This function is called to get the local device address
 *                  information.
 *
 * Returns          void
 *
 ******************************************************************************/
void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
                            RawAddress& local_conn_addr,
                            tBLE_ADDR_TYPE* p_addr_type) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::BTM_ReadConnectionAddr(remote_bda, local_conn_addr,
                                                   p_addr_type);
  }
  tACL_CONN* p_acl = btm_bda_to_acl(remote_bda, BT_TRANSPORT_LE);

  if (p_acl == NULL) {
    BTM_TRACE_ERROR("No connection exist!");
    return;
  }
  local_conn_addr = p_acl->conn_addr;
  *p_addr_type = p_acl->conn_addr_type;

  BTM_TRACE_DEBUG("BTM_ReadConnectionAddr address type: %d addr: 0x%02x",
                  p_acl->conn_addr_type, p_acl->conn_addr.address[0]);
}

/*******************************************************************************
 *
 * Function       BTM_ReadRemoteConnectionAddr
+0 −13
Original line number Diff line number Diff line
@@ -279,19 +279,6 @@ extern bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig,
                                   uint16_t len, uint32_t counter,
                                   uint8_t* p_comp);

/*******************************************************************************
 *
 * Function         BTM_ReadConnectionAddr
 *
 * Description      Read the local device random address.
 *
 * Returns          void
 *
 ******************************************************************************/
extern void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
                                   RawAddress& local_conn_addr,
                                   tBLE_ADDR_TYPE* p_addr_type);

/*******************************************************************************
 *
 * Function         BTM_IsBleConnection
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "p_256_ecc_pp.h"
#include "smp_int.h"
#include "stack/crypto_toolbox/crypto_toolbox.h"
#include "stack/include/acl_api.h"

#include <algorithm>

+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "l2c_api.h"
#include "osi/include/osi.h"
#include "smp_int.h"
#include "stack/include/acl_api.h"

#define SMP_PAIRING_REQ_SIZE 7
#define SMP_CONFIRM_CMD_SIZE (OCTET16_LEN + 1)