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

Commit 5dfaf87a authored by Chris Manton's avatar Chris Manton
Browse files

Use tBTM_SEC_BLE::tADDRESS_TYPE

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: I5b67eba668a3bb458bf058da80b2dc08e033bd44
parent 032c7fa7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -59,8 +59,8 @@ void acl_ble_enhanced_connection_complete(
                                                local_rpa);

  if (peer_addr_type & BLE_ADDR_TYPE_ID_BIT)
    btm_ble_refresh_peer_resolvable_private_addr(address_with_type.bda,
                                                 peer_rpa, BLE_ADDR_RANDOM);
    btm_ble_refresh_peer_resolvable_private_addr(
        address_with_type.bda, peer_rpa, tBTM_SEC_BLE::BTM_BLE_ADDR_RRA);
  btm_ble_update_mode_operation(role, &address_with_type.bda, HCI_SUCCESS);

  if (role == HCI_ROLE_SLAVE)
+4 −4
Original line number Diff line number Diff line
@@ -243,17 +243,17 @@ bool btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC* p_dev_rec,
  }

  switch (p_dev_rec->ble.active_addr_type) {
    case BTM_BLE_ADDR_PSEUDO:
    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;
      break;

    case BTM_BLE_ADDR_RRA:
    case tBTM_SEC_BLE::BTM_BLE_ADDR_RRA:
      conn_addr = p_dev_rec->ble.cur_rand_addr;
      *p_addr_type = BLE_ADDR_RANDOM;
      break;

    case BTM_BLE_ADDR_STATIC:
    case tBTM_SEC_BLE::BTM_BLE_ADDR_STATIC:
      conn_addr = p_dev_rec->ble.identity_addr;
      *p_addr_type = p_dev_rec->ble.identity_addr_type;
      break;
@@ -2432,7 +2432,7 @@ bool acl_refresh_remote_address(const tBTM_SEC_DEV_REC* p_sec_rec,
    return false;
  }

  if (rra_type == BTM_BLE_ADDR_PSEUDO) {
  if (rra_type == tBTM_SEC_BLE::BTM_BLE_ADDR_PSEUDO) {
    /* use identity address, resolvable_private_addr is empty */
    if (rpa.IsEmpty()) {
      p_acl->active_remote_addr_type = p_sec_rec->ble.identity_addr_type;
+1 −1
Original line number Diff line number Diff line
@@ -1750,7 +1750,7 @@ void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode,
  p_dev_rec->role_master = (role == HCI_ROLE_MASTER) ? true : false;

  if (!addr_matched) {
    p_dev_rec->ble.active_addr_type = BTM_BLE_ADDR_PSEUDO;
    p_dev_rec->ble.active_addr_type = tBTM_SEC_BLE::BTM_BLE_ADDR_PSEUDO;
  }
  if (!addr_matched && p_dev_rec->ble.ble_addr_type == BLE_ADDR_RANDOM) {
    p_dev_rec->ble.cur_rand_addr = bda;
+7 −7
Original line number Diff line number Diff line
@@ -313,9 +313,9 @@ bool btm_random_pseudo_to_identity_addr(RawAddress* random_pseudo,
 *                  connection address.
 *
 ******************************************************************************/
void btm_ble_refresh_peer_resolvable_private_addr(const RawAddress& pseudo_bda,
                                                  const RawAddress& rpa,
                                                  uint8_t rra_type) {
void btm_ble_refresh_peer_resolvable_private_addr(
    const RawAddress& pseudo_bda, const RawAddress& rpa,
    tBTM_SEC_BLE::tADDRESS_TYPE rra_type) {
  tBTM_SEC_DEV_REC* p_sec_rec = btm_find_dev(pseudo_bda);
  if (p_sec_rec == nullptr) {
    LOG_WARN("%s No matching known device in record", __func__);
@@ -324,9 +324,10 @@ void btm_ble_refresh_peer_resolvable_private_addr(const RawAddress& pseudo_bda,

  p_sec_rec->ble.cur_rand_addr = rpa;

  if (rra_type == BTM_BLE_ADDR_PSEUDO) {
    p_sec_rec->ble.active_addr_type =
        rpa.IsEmpty() ? BTM_BLE_ADDR_STATIC : BTM_BLE_ADDR_RRA;
  if (rra_type == tBTM_SEC_BLE::BTM_BLE_ADDR_PSEUDO) {
    p_sec_rec->ble.active_addr_type = rpa.IsEmpty()
                                          ? tBTM_SEC_BLE::BTM_BLE_ADDR_STATIC
                                          : tBTM_SEC_BLE::BTM_BLE_ADDR_RRA;
  } else {
    p_sec_rec->ble.active_addr_type = rra_type;
  }
@@ -341,4 +342,3 @@ void btm_ble_refresh_peer_resolvable_private_addr(const RawAddress& pseudo_bda,
    }
  }
}
+3 −3
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len,
      if (match_rec) {
        LOG(INFO) << __func__ << ": matched and resolved random address";
        match = true;
        match_rec->ble.active_addr_type = BTM_BLE_ADDR_RRA;
        match_rec->ble.active_addr_type = tBTM_SEC_BLE::BTM_BLE_ADDR_RRA;
        match_rec->ble.cur_rand_addr = bda;
        if (!btm_ble_init_pseudo_addr(match_rec, bda)) {
          /* assign the original address to be the current report address */
@@ -176,8 +176,8 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len,
      btm_ble_refresh_local_resolvable_private_addr(bda, local_rpa);

      if (peer_addr_type & BLE_ADDR_TYPE_ID_BIT)
        btm_ble_refresh_peer_resolvable_private_addr(bda, peer_rpa,
                                                     BLE_ADDR_RANDOM);
        btm_ble_refresh_peer_resolvable_private_addr(
            bda, peer_rpa, tBTM_SEC_BLE::BTM_BLE_ADDR_RRA);
    }
  } else {
    // Log for non HCI success case
Loading