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

Commit 8ad455fa authored by Chris Manton's avatar Chris Manton
Browse files

[23/24] Canonical form tBTM_STATUS::BTM_UNKNOWN_ADDR

Prepare for class enum-ify tBTM_STATUS

Bug: 358402071
Test: m .
Flag: EXEMPT, Mechanical Refactor

Change-Id: I9b368a916321893fb71fcc64499ee52d3a10daac
parent eee8b748
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -325,7 +325,8 @@ static bool bta_ag_remove_sco(tBTA_AG_SCB* p_scb, bool only_active) {
        /* SCO is connected; set current control block */
        bta_ag_cb.sco.p_curr_scb = p_scb;
        return true;
      } else if ((status == tBTM_STATUS::BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
      } else if ((status == tBTM_STATUS::BTM_SUCCESS) ||
                 (status == tBTM_STATUS::BTM_UNKNOWN_ADDR)) {
        /* If no connection reset the SCO handle */
        p_scb->sco_idx = BTM_INVALID_SCO_INDEX;
      }
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static bool bta_hf_client_sco_remove(tBTA_HF_CLIENT_CB* client_cb) {
      removed_started = true;
    }
    /* If no connection reset the SCO handle */
    else if ((status == tBTM_STATUS::BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
    else if ((status == tBTM_STATUS::BTM_SUCCESS) || (status == tBTM_STATUS::BTM_UNKNOWN_ADDR)) {
      client_cb->sco_idx = BTM_INVALID_SCO_INDEX;
    }
  }
+12 −12
Original line number Diff line number Diff line
@@ -513,7 +513,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) {
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(remote_bd_addr, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    log::warn("Unable to find active acl");
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }
  *p_role = p_acl->link_role;
  return tBTM_STATUS::BTM_SUCCESS;
@@ -530,7 +530,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, tHCI_ROLE* p_role) {
 *                  tBTM_STATUS::BTM_CMD_STARTED if command issued to controller.
 *                  tBTM_STATUS::BTM_NO_RESOURCES if couldn't allocate memory to issue
 *                                   command
 *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
 *                  tBTM_STATUS::BTM_UNKNOWN_ADDR if no active link with bd addr specified
 *                  tBTM_STATUS::BTM_MODE_UNSUPPORTED if local device does not support role
 *                                       switching
 *                  tBTM_STATUS::BTM_BUSY if the previous command is not completed
@@ -545,7 +545,7 @@ tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) {
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(remote_bd_addr, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    log::warn("Unable to find active acl");
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }

  if (p_acl->link_role == HCI_ROLE_CENTRAL) {
@@ -578,7 +578,7 @@ tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) {
    log::warn(
            "Unable to find device to read current power mode prior to role "
            "switch");
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  };

  if (pwr_mode == BTM_PM_MD_PARK || pwr_mode == BTM_PM_MD_SNIFF) {
@@ -1033,7 +1033,7 @@ tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda, uint16_t* p_timeo
  const tACL_CONN* p_acl = internal_.btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    log::warn("Unable to find active acl");
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }
  *p_timeout = p_acl->link_super_tout;
  return tBTM_STATUS::BTM_SUCCESS;
@@ -1052,7 +1052,7 @@ tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda, uint16_t timeout)
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    log::warn("Unable to find active acl");
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }

  /* Only send if current role is Central; 2.0 spec requires this */
@@ -1596,7 +1596,7 @@ tBTM_STATUS BTM_ReadRSSI(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb) {
  log::warn("Unable to find active acl");

  /* If here, no BD Addr found */
  return BTM_UNKNOWN_ADDR;
  return tBTM_STATUS::BTM_UNKNOWN_ADDR;
}

/*******************************************************************************
@@ -1638,7 +1638,7 @@ tBTM_STATUS BTM_ReadFailedContactCounter(const RawAddress& remote_bda, tBTM_CMPL
  log::warn("Unable to find active acl");

  /* If here, no BD Addr found */
  return BTM_UNKNOWN_ADDR;
  return tBTM_STATUS::BTM_UNKNOWN_ADDR;
}

/*******************************************************************************
@@ -1685,7 +1685,7 @@ tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda, tBT_TRANSPORT transpor
  log::warn("Unable to find active acl");

  /* If here, no BD Addr found */
  return BTM_UNKNOWN_ADDR;
  return tBTM_STATUS::BTM_UNKNOWN_ADDR;
}

/*******************************************************************************
@@ -1955,20 +1955,20 @@ void btm_read_automatic_flush_timeout_complete(uint8_t* p) {
 * Description      This function is called to disconnect an ACL connection
 *
 * Returns          tBTM_STATUS::BTM_SUCCESS if successfully initiated, otherwise
 *                  BTM_UNKNOWN_ADDR.
 *                  tBTM_STATUS::BTM_UNKNOWN_ADDR.
 *
 ******************************************************************************/
tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(bd_addr, transport);
  if (p_acl == nullptr) {
    log::warn("Unable to find active acl");
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }

  if (p_acl->Handle() == HCI_INVALID_HANDLE) {
    log::warn("Cannot remove unknown acl bd_addr:{} transport:{}", bd_addr,
              bt_transport_text(transport));
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }

  if (p_acl->rs_disc_pending == BTM_SEC_RS_PENDING) {
+4 −4
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ void BTM_PM_OnDisconnected(uint16_t handle) {
 *                  alter ACL connection behavior.
 *
 * Returns          tBTM_STATUS::BTM_SUCCESS if successful,
 *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
 *                  tBTM_STATUS::BTM_UNKNOWN_ADDR if bd addr is not active or bad
 *
 ******************************************************************************/
tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,
@@ -193,7 +193,7 @@ tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,
  auto* p_cb = btm_pm_get_power_manager_from_address(remote_bda);
  if (p_cb == nullptr) {
    log::warn("Unable to find power manager for peer: {}", remote_bda);
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }
  uint16_t handle = p_cb->handle_;

@@ -308,7 +308,7 @@ bool BTM_ReadPowerMode(const RawAddress& remote_bda, tBTM_PM_MODE* p_mode) {
 *
 *
 * Returns          tBTM_STATUS::BTM_SUCCESS if the HCI command is issued successful,
 *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
 *                  tBTM_STATUS::BTM_UNKNOWN_ADDR if bd addr is not active or bad
 *                  tBTM_STATUS::BTM_CMD_STORED if the command is stored
 *
 ******************************************************************************/
@@ -317,7 +317,7 @@ tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat, uin
  tBTM_PM_MCB* p_cb = btm_pm_get_power_manager_from_address(remote_bda);
  if (p_cb == nullptr) {
    log::warn("Unable to find power manager for peer:{}", remote_bda);
    return BTM_UNKNOWN_ADDR;
    return tBTM_STATUS::BTM_UNKNOWN_ADDR;
  }

  if (!bluetooth::shim::GetController()->SupportsSniffSubrating()) {
+1 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ void BTM_BleAdvFilterParamSetup(tBTM_BLE_SCAN_COND_OP action, tBTM_BLE_PF_FILT_I
    p_bda_filter = btm_ble_find_addr_filter_counter(nullptr);
    if (NULL == p_bda_filter) {
      log::error("BD Address not found!");
      cb.Run(0, BTM_BLE_PF_ENABLE, BTM_UNKNOWN_ADDR);
      cb.Run(0, BTM_BLE_PF_ENABLE, tBTM_STATUS::BTM_UNKNOWN_ADDR);
      return;
    }

Loading