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

Commit adab7c25 authored by Henri Chataing's avatar Henri Chataing
Browse files

RootCanal: Pass the device identifier to GenerateBluetoothAddress()

Bug: 279665786
Test: m root-canal
Change-Id: I58a7f18f3b5ed86fba5d72d5013ac0c76718bec4
parent 38fe8978
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -96,9 +96,9 @@ std::shared_ptr<PhyDevice> TestModel::CreatePhyDevice(
  return std::make_shared<PhyDevice>(std::move(type), std::move(device));
}

Address TestModel::GenerateBluetoothAddress() const {
Address TestModel::GenerateBluetoothAddress(uint32_t device_id) const {
  Address address({
      0xff,
      static_cast<uint8_t>(device_id),
      bluetooth_address_prefix_[4],
      bluetooth_address_prefix_[3],
      bluetooth_address_prefix_[2],
@@ -206,7 +206,7 @@ void TestModel::AddRemote(const std::string& server, int port, Phy::Type type) {
PhyDevice::Identifier TestModel::AddHciConnection(
    std::shared_ptr<HciDevice> device, std::optional<Address> address) {
  // clients can specify BD_ADDR or have it set based on device_id.
  device->SetAddress(address.value_or(GenerateBluetoothAddress()));
  device->SetAddress(address.value_or(GenerateBluetoothAddress(device->id_)));
  AddDevice(std::static_pointer_cast<Device>(device));

  INFO(device->id_, "Initialized device with address {}", device->GetAddress());
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ class TestModel {
  void Reset();

 private:
  Address GenerateBluetoothAddress() const;
  Address GenerateBluetoothAddress(uint32_t device_id) const;

  std::map<PhyLayer::Identifier, std::shared_ptr<PhyLayer>> phy_layers_;
  std::map<PhyDevice::Identifier, std::shared_ptr<PhyDevice>> phy_devices_;