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

Commit 897ea80e authored by Chris Manton's avatar Chris Manton
Browse files

stack/acl/btm_acl::BTM_GetRole

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I6dfd3908bbbfe236457d8b629e02e231b407485e
parent c6929b25
Loading
Loading
Loading
Loading
+10 −20
Original line number Diff line number Diff line
@@ -506,29 +506,19 @@ void btm_acl_update_inquiry_status(uint8_t status) {
  BTIF_dm_report_inquiry_status_change(status);
}

/*******************************************************************************
 *
 * Function         BTM_GetRole
 *
 * Description      This function is called to get the role of the local device
 *                  for the ACL connection with the specified remote device
 *
 * Returns          BTM_SUCCESS if connection exists.
 *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
 *
 ******************************************************************************/
tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role) {
  tACL_CONN* p;
  BTM_TRACE_DEBUG("BTM_GetRole");
  p = internal_.btm_bda_to_acl(remote_bd_addr, BT_TRANSPORT_BR_EDR);
  if (p == NULL) {
    *p_role = HCI_ROLE_UNKNOWN;
    return (BTM_UNKNOWN_ADDR);
  if (p_role == nullptr) {
    return BTM_ILLEGAL_VALUE;
  }
  *p_role = HCI_ROLE_UNKNOWN;

  /* Get the current role */
  *p_role = p->link_role;
  return (BTM_SUCCESS);
  tACL_CONN* p_acl =
      internal_.btm_bda_to_acl(remote_bd_addr, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    return BTM_UNKNOWN_ADDR;
  }
  *p_role = p_acl->link_role;
  return BTM_SUCCESS;
}

/*******************************************************************************