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

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

legacy: Encapsulate tBTM_SEC_DEV_REC::tBTM_SEC_BLE::ble_addr_type

Bug: 224999611
Tag: #refactor
Test: gd/cert/run
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: Iaa85fe156bd911721f7ce707e0313c6c901d9bd2
parent 4df50dd3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -678,7 +678,7 @@ hci::AddressWithType Btm::GetAddressAndType(const RawAddress& bd_addr) {
                               p_dev_rec->ble.identity_address_with_type.type);
    } else {
      return ToAddressWithType(p_dev_rec->ble.pseudo_addr,
                               p_dev_rec->ble.ble_addr_type);
                               p_dev_rec->ble.AddressType());
    }
  }
  LOG(ERROR) << "Unknown bd_addr. Use public address";
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) {
      if (!btm_ble_init_pseudo_addr(match_rec, *bda)) {
        /* assign the original address to be the current report address */
        *bda = match_rec->ble.pseudo_addr;
        *bda_type = match_rec->ble.ble_addr_type;
        *bda_type = match_rec->ble.AddressType();
      } else {
        *bda = match_rec->bd_addr;
      }
+9 −9
Original line number Diff line number Diff line
@@ -89,12 +89,12 @@ void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
  memset(p_dev_rec->sec_bd_name, 0, sizeof(tBTM_BD_NAME));

  p_dev_rec->device_type |= dev_type;
  p_dev_rec->ble.ble_addr_type = addr_type;
  p_dev_rec->ble.SetAddressType(addr_type);

  /* sync up with the Inq Data base*/
  tBTM_INQ_INFO* p_info = BTM_InqDbRead(bd_addr);
  if (p_info) {
    p_info->results.ble_addr_type = p_dev_rec->ble.ble_addr_type;
    p_info->results.ble_addr_type = p_dev_rec->ble.AddressType();
    p_info->results.device_type = p_dev_rec->device_type;
    BTM_TRACE_DEBUG("InqDb  device_type =0x%x  addr_type=0x%x",
                    p_info->results.device_type, p_info->results.ble_addr_type);
@@ -364,7 +364,7 @@ void BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr,
  oob.peer_oob_data.present = true;
  memcpy(&oob.peer_oob_data.randomizer, p_r, OCTET16_LEN);
  memcpy(&oob.peer_oob_data.commitment, p_c, OCTET16_LEN);
  oob.peer_oob_data.addr_rcvd_from.type = p_dev_rec->ble.ble_addr_type;
  oob.peer_oob_data.addr_rcvd_from.type = p_dev_rec->ble.AddressType();
  oob.peer_oob_data.addr_rcvd_from.bda = bd_addr;

  SMP_SecureConnectionOobDataReply((uint8_t*)&oob);
@@ -481,16 +481,16 @@ void BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type,
    /* new inquiry result, overwrite device type in security device record */
    if (p_inq_info) {
      p_dev_rec->device_type = p_inq_info->results.device_type;
      p_dev_rec->ble.ble_addr_type = p_inq_info->results.ble_addr_type;
      p_dev_rec->ble.SetAddressType(p_inq_info->results.ble_addr_type);
    }

    if (p_dev_rec->bd_addr == remote_bda &&
        p_dev_rec->ble.pseudo_addr == remote_bda) {
      *p_dev_type = p_dev_rec->device_type;
      *p_addr_type = p_dev_rec->ble.ble_addr_type;
      *p_addr_type = p_dev_rec->ble.AddressType();
    } else if (p_dev_rec->ble.pseudo_addr == remote_bda) {
      *p_dev_type = BT_DEVICE_TYPE_BLE;
      *p_addr_type = p_dev_rec->ble.ble_addr_type;
      *p_addr_type = p_dev_rec->ble.AddressType();
    } else /* matching static adddress only */ {
      if (p_dev_rec->device_type != BT_DEVICE_TYPE_UNKNOWN) {
        *p_dev_type = p_dev_rec->device_type;
@@ -1713,7 +1713,7 @@ void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode,
    p_dev_rec->timestamp = btm_cb.dev_rec_count++;
  }

  p_dev_rec->ble.ble_addr_type = addr_type;
  p_dev_rec->ble.SetAddressType(addr_type);
  p_dev_rec->ble.pseudo_addr = bda;
  p_dev_rec->ble_hci_handle = handle;
  p_dev_rec->device_type |= BT_DEVICE_TYPE_BLE;
@@ -1721,7 +1721,7 @@ void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode,

  if (!addr_matched) {
    p_dev_rec->ble.active_addr_type = tBTM_SEC_BLE::BTM_BLE_ADDR_PSEUDO;
    if (p_dev_rec->ble.ble_addr_type == BLE_ADDR_RANDOM) {
    if (p_dev_rec->ble.AddressType() == BLE_ADDR_RANDOM) {
      p_dev_rec->ble.cur_rand_addr = bda;
    }
  }
@@ -2097,7 +2097,7 @@ bool btm_ble_get_acl_remote_addr(uint16_t hci_handle, RawAddress& conn_addr,
  switch (p_dev_rec->ble.active_addr_type) {
    case tBTM_SEC_BLE::BTM_BLE_ADDR_PSEUDO:
      conn_addr = p_dev_rec->bd_addr;
      *p_addr_type = p_dev_rec->ble.ble_addr_type;
      *p_addr_type = p_dev_rec->ble.AddressType();
      break;

    case tBTM_SEC_BLE::BTM_BLE_ADDR_RRA:
+1 −1
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ bool btm_identity_addr_to_random_pseudo(RawAddress* bd_addr,
    *bd_addr = p_dev_rec->ble.pseudo_addr;
  }

  *p_addr_type = p_dev_rec->ble.ble_addr_type;
  *p_addr_type = p_dev_rec->ble.AddressType();
  return true;
}

+2 −2
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ const tBLE_BD_ADDR convert_to_address_with_type(

  if (p_dev_rec->ble.identity_address_with_type.bda.IsEmpty()) {
    return {
        .type = p_dev_rec->ble.ble_addr_type,
        .type = p_dev_rec->ble.AddressType(),
        .bda = bd_addr,
    };
  } else {
@@ -203,7 +203,7 @@ bool BTM_BackgroundConnectAddressKnown(const RawAddress& address) {
  }

  // Public address, Random Static, or Random Non-Resolvable Address known
  if (p_dev_rec->ble.ble_addr_type == BLE_ADDR_PUBLIC ||
  if (p_dev_rec->ble.AddressType() == BLE_ADDR_PUBLIC ||
      !BTM_BLE_IS_RESOLVE_BDA(address)) {
    return true;
  }
Loading