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

Commit 489f0590 authored by Chris Manton's avatar Chris Manton
Browse files

Move btm_pm_find_acl_ind() into stack/btm/btm_acl

Acl indices should not be exposed

Working towards encapsulation of tACL_CONN

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

Change-Id: I4281a4f0ba840bef055760b8976c7a3b549556f4
parent 45ebba69
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2536,3 +2536,30 @@ tBTM_PM_MCB* acl_power_mode_from_handle(uint16_t hci_handle) {
  }
  return &btm_cb.pm_mode_db[index];
}

/*******************************************************************************
 *
 * Function         btm_pm_find_acl_ind
 *
 * Description      This function initializes the control block of an ACL link.
 *                  It is called when an ACL connection is created.
 *
 * Returns          void
 *
 ******************************************************************************/
int btm_pm_find_acl_ind(const RawAddress& remote_bda) {
  tACL_CONN* p = &btm_cb.acl_cb_.acl_db[0];
  uint8_t xx;

  for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++) {
    if (p->in_use && p->remote_addr == remote_bda &&
        p->transport == BT_TRANSPORT_BR_EDR) {
#if (BTM_PM_DEBUG == TRUE)
      BTM_TRACE_DEBUG("btm_pm_find_acl_ind ind:%d, st:%d", xx,
                      btm_cb.pm_mode_db[xx].state);
#endif  // BTM_PM_DEBUG
      break;
    }
  }
  return xx;
}
+0 −28
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ const uint8_t
        BTM_PM_GET_MD1,  BTM_PM_GET_MD2,  BTM_PM_GET_COMP};

/* function prototype */
static int btm_pm_find_acl_ind(const RawAddress& remote_bda);
static tBTM_STATUS btm_pm_snd_md_req(uint8_t pm_id, int link_ind,
                                     const tBTM_PM_PWR_MD* p_mode);
static const char* mode_to_string(const tBTM_PM_MODE mode);
@@ -365,33 +364,6 @@ void btm_pm_reset(void) {
  btm_cb.acl_cb_.pm_pend_link = MAX_L2CAP_LINKS;
}

/*******************************************************************************
 *
 * Function         btm_pm_find_acl_ind
 *
 * Description      This function initializes the control block of an ACL link.
 *                  It is called when an ACL connection is created.
 *
 * Returns          void
 *
 ******************************************************************************/
static int btm_pm_find_acl_ind(const RawAddress& remote_bda) {
  tACL_CONN* p = &btm_cb.acl_cb_.acl_db[0];
  uint8_t xx;

  for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++) {
    if (p->in_use && p->remote_addr == remote_bda &&
        p->transport == BT_TRANSPORT_BR_EDR) {
#if (BTM_PM_DEBUG == TRUE)
      BTM_TRACE_DEBUG("btm_pm_find_acl_ind ind:%d, st:%d", xx,
                      btm_cb.pm_mode_db[xx].state);
#endif  // BTM_PM_DEBUG
      break;
    }
  }
  return xx;
}

/*******************************************************************************
 *
 * Function     btm_pm_compare_modes
+1 −0
Original line number Diff line number Diff line
@@ -270,3 +270,4 @@ bool BTM_IsBleConnection(uint16_t hci_handle);

const RawAddress acl_address_from_handle(uint16_t hci_handle);
tBTM_PM_MCB* acl_power_mode_from_handle(uint16_t hci_handle);
int btm_pm_find_acl_ind(const RawAddress& remote_bda);