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

Commit 3e934607 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "bt HCI: Make sure the device numbers match"

parents c236c1f8 4e1a5a65
Loading
Loading
Loading
Loading
+22 −17
Original line number Diff line number Diff line
@@ -164,8 +164,17 @@ Return<void> BluetoothHci::initialize_impl(
      [this](AsyncTaskId task) { async_manager_.CancelAsyncTask(task); });

  test_model_.Reset();

  // Add the controller as a device in the model.
  test_model_.Add(controller_);
  size_t controller_index = test_model_.Add(controller_);
  size_t low_energy_phy_index =
      test_model_.AddPhy(test_vendor_lib::Phy::Type::LOW_ENERGY);
  size_t classic_phy_index =
      test_model_.AddPhy(test_vendor_lib::Phy::Type::BR_EDR);
  test_model_.AddDeviceToPhy(controller_index, low_energy_phy_index);
  test_model_.AddDeviceToPhy(controller_index, classic_phy_index);
  test_model_.SetTimerPeriod(std::chrono::milliseconds(10));
  test_model_.StartTimer();

  // Send responses to logcat if the test channel is not configured.
  test_channel_.RegisterSendResponse([](const std::string& response) {
@@ -178,23 +187,19 @@ Return<void> BluetoothHci::initialize_impl(
                   [this](int fd) { test_model_.IncomingHciConnection(fd); });
    SetUpLinkLayerServer(
        6311, [this](int fd) { test_model_.IncomingLinkLayerConnection(fd); });
  }

  // Add some default devices for easier debugging
  test_channel_.AddDefaults();

  } else {
    // This should be configurable in the future.
    LOG_INFO("Adding Beacons so the scan list is not empty.");
    test_channel_.Add({"beacon", "be:ac:10:00:00:01", "1000"});
  test_channel_.AddDeviceToPhy({"2", "1"});
    test_model_.AddDeviceToPhy(controller_index + 1, low_energy_phy_index);
    test_channel_.Add({"beacon", "be:ac:10:00:00:02", "1000"});
  test_channel_.AddDeviceToPhy({"3", "1"});
    test_model_.AddDeviceToPhy(controller_index + 2, low_energy_phy_index);
    test_channel_.Add(
        {"scripted_beacon", "5b:ea:c1:00:00:03",
       "/data/vendor/bluetooth/bluetooth_sim_ble_playback_file",
       "/data/vendor/bluetooth/bluetooth_sim_ble_playback_events"});
  test_channel_.AddDeviceToPhy({"4", "1"});
         "/data/vendor/bluetooth/bluetooth_sim_ble_playback_file"});
    test_model_.AddDeviceToPhy(controller_index + 3, low_energy_phy_index);
    test_channel_.List({});
  }

  unlink_cb_ = [this, cb](sp<BluetoothDeathRecipient>& death_recipient) {
    if (death_recipient->getHasDied())