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

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

Replace return tBTM_STATUS=>bool BTM_ReadRemoteVersion

Toward readable code

Bug: 163134718
Tag: #refactor
Test: Paired 2 phones using LE/nRF

Change-Id: I5a1cd8ee552e6277a77fa3eef52becbe5a4a7401
parent ae0d2fe3
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -478,16 +478,17 @@ static void btif_update_remote_version_property(RawAddress* p_bd) {
  uint8_t lmp_ver = 0;
  uint16_t lmp_subver = 0;
  uint16_t mfct_set = 0;
  tBTM_STATUS btm_status;
  bool version_info_valid = false;
  bt_remote_version_t info;
  bt_status_t status;

  btm_status = BTM_ReadRemoteVersion(*p_bd, &lmp_ver, &mfct_set, &lmp_subver);
  version_info_valid =
      BTM_ReadRemoteVersion(*p_bd, &lmp_ver, &mfct_set, &lmp_subver);

  LOG_INFO("remote version info [%s]: %x, %x, %x", p_bd->ToString().c_str(),
           lmp_ver, mfct_set, lmp_subver);

  if (btm_status == BTM_SUCCESS) {
  if (version_info_valid) {
    // Always update cache to ensure we have availability whenever BTM API is
    // not populated
    info.manufacturer = mfct_set;
+3 −4
Original line number Diff line number Diff line
@@ -1031,12 +1031,11 @@ tBTM_STATUS BTM_EnableTestMode(void);
 *
 * Description      This function is called to read a remote device's version
 *
 * Returns          BTM_SUCCESS if successful, otherwise an error
 * Returns          true if valid, false otherwise
 *
 ******************************************************************************/
tBTM_STATUS BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
                                  uint16_t* manufacturer,
                                  uint16_t* lmp_sub_version);
bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
                           uint16_t* manufacturer, uint16_t* lmp_sub_version);

/*******************************************************************************
 *
+4 −12
Original line number Diff line number Diff line
@@ -1494,20 +1494,12 @@ uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) {
  return (pkt_size);
}

/*******************************************************************************
 *
 * Function         BTM_ReadRemoteVersion
 *
 * Returns          If connected report peer device info
 *
 ******************************************************************************/
tBTM_STATUS BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
                                  uint16_t* manufacturer,
                                  uint16_t* lmp_sub_version) {
bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
                           uint16_t* manufacturer, uint16_t* lmp_sub_version) {
  tACL_CONN* p = internal_.btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
  if (p == NULL) {
    LOG_WARN("Unable to find active acl");
    return (BTM_UNKNOWN_ADDR);
    return false;
  }

  if (lmp_version) *lmp_version = p->lmp_version;
@@ -1516,7 +1508,7 @@ tBTM_STATUS BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,

  if (lmp_sub_version) *lmp_sub_version = p->lmp_subversion;

  return (BTM_SUCCESS);
  return true;
}

/*******************************************************************************
+3 −4
Original line number Diff line number Diff line
@@ -401,12 +401,11 @@ tBTM_STATUS BTM_CancelRemoteDeviceName(void);
 *
 * Description      This function is called to read a remote device's version
 *
 * Returns          BTM_SUCCESS if successful, otherwise an error
 * Returns          true if data valid, false otherwise
 *
 ******************************************************************************/
tBTM_STATUS BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
                                  uint16_t* manufacturer,
                                  uint16_t* lmp_sub_version);
bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
                           uint16_t* manufacturer, uint16_t* lmp_sub_version);

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