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

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

Use tACL_CB::tACL_CONN::remote_version_info

Toward readable code

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

Change-Id: I0421cea1528b907e9b479e6b9d6489705cea0b22
parent d33e4638
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -70,8 +70,6 @@ typedef struct {
  uint16_t hci_handle;
  uint16_t link_policy;
  uint16_t link_super_tout;
  uint16_t lmp_subversion;
  uint16_t manufacturer;
  uint16_t pkt_types_mask;
  tBLE_ADDR_TYPE active_remote_addr_type;
  tBLE_ADDR_TYPE conn_addr_type;
@@ -102,7 +100,6 @@ typedef struct {
 public:
  bool is_encrypted = false;
  uint8_t link_role;
  uint8_t lmp_version;
  uint8_t switch_role_failed_attempts;

  struct {
+13 −7
Original line number Diff line number Diff line
@@ -734,10 +734,10 @@ void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
  }

  if (status == HCI_SUCCESS) {
    p_acl_cb->lmp_version = lmp_version;
    p_acl_cb->manufacturer = manufacturer;
    p_acl_cb->lmp_subversion = lmp_subversion;

    p_acl_cb->remote_version_info.lmp_version = lmp_version;
    p_acl_cb->remote_version_info.manufacturer = manufacturer;
    p_acl_cb->remote_version_info.lmp_subversion = lmp_subversion;
    p_acl_cb->remote_version_info.valid = true;
    bluetooth::common::LogRemoteVersionInfo(handle, status, lmp_version,
                                            manufacturer, lmp_subversion);
  } else {
@@ -1505,11 +1505,17 @@ bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
    }
  }

  if (lmp_version) *lmp_version = p_acl->lmp_version;
  if (!p_acl->remote_version_info.valid) {
    LOG_WARN("Remote version information is invalid");
    return false;
  }

  if (lmp_version) *lmp_version = p_acl->remote_version_info.lmp_version;

  if (manufacturer) *manufacturer = p_acl->manufacturer;
  if (manufacturer) *manufacturer = p_acl->remote_version_info.manufacturer;

  if (lmp_sub_version) *lmp_sub_version = p_acl->lmp_subversion;
  if (lmp_sub_version)
    *lmp_sub_version = p_acl->remote_version_info.lmp_subversion;

  return true;
}