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

Commit 82ce535f authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge changes Id1063bdf,I144ec8c1

* changes:
  RootCanal: Implement LL tests for Phy update procedure
  RootCanal: Implement the LL phy update procedure
parents a8012172 b0b04a38
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -289,6 +289,8 @@ python_test_host {
        ":link_layer_packets_python3_gen",
        "py/bluetooth.py",
        "py/controller.py",
        "test/LL/CON_/CEN/*.py",
        "test/LL/CON_/PER/*.py",
        "test/LL/DDI/ADV/*.py",
        "test/LL/DDI/SCN/*.py",
        "test/main.py",
+0 −16
Original line number Diff line number Diff line
@@ -33,22 +33,6 @@ void AclConnection::Encrypt() { encrypted_ = true; };

bool AclConnection::IsEncrypted() const { return encrypted_; };

AddressWithType AclConnection::GetAddress() const { return address_; }

void AclConnection::SetAddress(AddressWithType address) { address_ = address; }

AddressWithType AclConnection::GetOwnAddress() const { return own_address_; }

AddressWithType AclConnection::GetResolvedAddress() const {
  return resolved_address_;
}

void AclConnection::SetOwnAddress(AddressWithType address) {
  own_address_ = address;
}

Phy::Type AclConnection::GetPhyType() const { return type_; }

uint16_t AclConnection::GetLinkPolicySettings() const {
  return link_policy_settings_;
};
+22 −22
Original line number Diff line number Diff line
@@ -35,44 +35,39 @@ class AclConnection {

  virtual ~AclConnection() = default;

  void Encrypt();

  bool IsEncrypted() const;

  AddressWithType GetAddress() const;

  void SetAddress(AddressWithType address);

  AddressWithType GetOwnAddress() const;
  Phy::Type GetPhyType() const { return type_; }

  void SetOwnAddress(AddressWithType address);
  AddressWithType GetAddress() const { return address_; }
  AddressWithType GetOwnAddress() const { return own_address_; }
  AddressWithType GetResolvedAddress() const { return resolved_address_; }

  AddressWithType GetResolvedAddress() const;

  Phy::Type GetPhyType() const;
  void Encrypt();
  bool IsEncrypted() const;

  uint16_t GetLinkPolicySettings() const;

  void SetLinkPolicySettings(uint16_t settings);

  bluetooth::hci::Role GetRole() const;

  void SetRole(bluetooth::hci::Role role);

  int8_t GetRssi() const;

  void SetRssi(int8_t rssi);

  void ResetLinkTimer();

  std::chrono::steady_clock::duration TimeUntilNearExpiring() const;

  bool IsNearExpiring() const;

  std::chrono::steady_clock::duration TimeUntilExpired() const;

  void ResetLinkTimer();
  bool IsNearExpiring() const;
  bool HasExpired() const;

  // LE-ACL state.
  void InitiatePhyUpdate() { initiated_phy_update_ = true; }
  void PhyUpdateComplete() { initiated_phy_update_ = false; }
  bool InitiatedPhyUpdate() const { return initiated_phy_update_; }
  bluetooth::hci::PhyType GetTxPhy() const { return tx_phy_; }
  bluetooth::hci::PhyType GetRxPhy() const { return rx_phy_; }
  void SetTxPhy(bluetooth::hci::PhyType phy) { tx_phy_ = phy; }
  void SetRxPhy(bluetooth::hci::PhyType phy) { rx_phy_ = phy; }

 private:
  AddressWithType address_;
  AddressWithType own_address_;
@@ -89,6 +84,11 @@ class AclConnection {
  bluetooth::hci::Role role_{bluetooth::hci::Role::CENTRAL};
  std::chrono::steady_clock::time_point last_packet_timestamp_;
  std::chrono::steady_clock::duration timeout_;

  // LE-ACL state.
  bluetooth::hci::PhyType tx_phy_{bluetooth::hci::PhyType::LE_1M};
  bluetooth::hci::PhyType rx_phy_{bluetooth::hci::PhyType::LE_1M};
  bool initiated_phy_update_{false};
};

}  // namespace rootcanal
+5 −0
Original line number Diff line number Diff line
@@ -197,6 +197,11 @@ uint16_t AclConnectionHandler::GetHandleOnlyAddress(
  return kReservedHandle;
}

AclConnection& AclConnectionHandler::GetAclConnection(uint16_t handle) {
  ASSERT_LOG(HasHandle(handle), "Unknown handle %d", handle);
  return acl_connections_.at(handle);
}

AddressWithType AclConnectionHandler::GetAddress(uint16_t handle) const {
  ASSERT_LOG(HasHandle(handle), "Unknown handle %hd", handle);
  return acl_connections_.at(handle).GetAddress();
+4 −0
Original line number Diff line number Diff line
@@ -91,6 +91,10 @@ class AclConnectionHandler {
  bluetooth::hci::AddressWithType GetOwnAddress(uint16_t handle) const;
  bluetooth::hci::AddressWithType GetResolvedAddress(uint16_t handle) const;

  // Return the AclConnection for the selected connection handle, asserts
  // if the handle is not currently used.
  AclConnection& GetAclConnection(uint16_t handle);

  void Encrypt(uint16_t handle);
  bool IsEncrypted(uint16_t handle) const;

Loading