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

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

Introduce tACL_CB_::Reset()

Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: Ib5b8a77eba21affbdbb17eb16d60cfc3b1a0c40d
parent 2db2e7bd
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -19,3 +19,30 @@
tBTM_PM_MODE sACL_CONN::sPolicy::Mode() const { return this->mode.mode_; }

hci_role_t sACL_CONN::sPolicy::Role() const { return this->role.role_; }

void sACL_CONN::Reset() {
  memset(peer_le_features, 0, sizeof(peer_le_features));
  peer_le_features_valid = false;
  memset(peer_lmp_feature_pages, 0, sizeof(peer_lmp_feature_pages));
  memset(peer_lmp_feature_valid, 0, sizeof(peer_lmp_feature_valid));
  active_remote_addr = RawAddress::kEmpty;
  conn_addr = RawAddress::kEmpty;
  remote_addr = RawAddress::kEmpty;
  link_up_issued = false;
  transport = BT_TRANSPORT_INVALID;
  flush_timeout_in_ticks = 0;
  hci_handle = 0;
  link_super_tout = 0;
  pkt_types_mask = 0;
  active_remote_addr_type = BLE_ADDR_PUBLIC;
  conn_addr_type = BLE_ADDR_PUBLIC;
  disconnect_reason = 0;
  encrypt_state_ = BTM_ACL_ENCRYPT_STATE_IDLE;
  is_encrypted = false;
  link_role = HCI_ROLE_CENTRAL;
  switch_role_failed_attempts = 0;
  memset(&remote_version_info, 0, sizeof(remote_version_info));
  rs_disc_pending = BTM_SEC_RS_NOT_PENDING;
  switch_role_state_ = BTM_ACL_SWKEY_STATE_IDLE;
  sca = 0;
}
+2 −0
Original line number Diff line number Diff line
@@ -298,6 +298,8 @@ struct sACL_CONN {
 public:
  uint8_t sca; /* Sleep clock accuracy */

  void Reset();

  struct sPolicy {
    tBTM_PM_MODE Mode() const;
    struct {
+1 −3
Original line number Diff line number Diff line
@@ -454,10 +454,8 @@ void btm_acl_removed(uint16_t handle) {
    return;
  }
  p_acl->in_use = false;

  NotifyAclLinkDown(*p_acl);

  memset(p_acl, 0, sizeof(tACL_CONN));
  p_acl->Reset();
}

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