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

Commit e5957b5b authored by Myles Watson's avatar Myles Watson Committed by Automerger Merge Worker
Browse files

Add responses for timer commands am: 5dfa9686 am: 6ffe5f18

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1353225

Change-Id: Ibd9b81cd7bc3e5b1374bad2d43e4046bee95e535
parents 0e354ab7 6ffe5f18
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -148,14 +148,14 @@ int TestEnvironment::ConnectToRemoteServer(const std::string& server, int port)

void TestEnvironment::SetUpTestChannel() {
  int socket_fd = test_channel_transport_.SetUp(test_port_);
  test_channel_.RegisterSendResponse([](const std::string& response) {
    LOG_INFO("No test channel: %s", response.c_str());
  });
  test_channel_.AddPhy({"BR_EDR"});
  test_channel_.AddPhy({"LOW_ENERGY"});
  test_channel_.SetTimerPeriod({"5"});
  test_channel_.StartTimer({});

  test_channel_.RegisterSendResponse(
      [](const std::string& response) { LOG_INFO("No test channel: %s", response.c_str()); });

  if (socket_fd == -1) {
    LOG_ERROR("Test channel SetUp(%d) failed.", test_port_);
    return;
+13 −1
Original line number Diff line number Diff line
@@ -234,7 +234,15 @@ void TestCommandHandler::SetTimerPeriod(const vector<std::string>& args) {
    LOG_INFO("SetTimerPeriod takes 1 argument");
  }
  size_t period = std::stoi(args[0]);
  if (period != 0) {
    response_string_ = "set timer period to ";
    response_string_ += args[0];
    model_.SetTimerPeriod(std::chrono::milliseconds(period));
  } else {
    response_string_ = "invalid timer period ";
    response_string_ += args[0];
  }
  send_response_(response_string_);
}

void TestCommandHandler::StartTimer(const vector<std::string>& args) {
@@ -242,6 +250,8 @@ void TestCommandHandler::StartTimer(const vector<std::string>& args) {
    LOG_INFO("Unused args: arg[0] = %s", args[0].c_str());
  }
  model_.StartTimer();
  response_string_ = "timer started";
  send_response_(response_string_);
}

void TestCommandHandler::StopTimer(const vector<std::string>& args) {
@@ -249,6 +259,8 @@ void TestCommandHandler::StopTimer(const vector<std::string>& args) {
    LOG_INFO("Unused args: arg[0] = %s", args[0].c_str());
  }
  model_.StopTimer();
  response_string_ = "timer stopped";
  send_response_(response_string_);
}

}  // namespace test_vendor_lib