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

Commit 9d3894a0 authored by Yuyang Huang's avatar Yuyang Huang Committed by Gerrit Code Review
Browse files

Merge "keep PENDING status while waiting for connectAudio's result" into main

parents af67965e 9a2f6b03
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -82,16 +82,22 @@ BluetoothAudioCtrlAck HfpTransport::StartRequest() {


  /* Post start SCO event and wait for sco to open */
  /* Post start SCO event and wait for sco to open */
  hfp_pending_cmd_ = HFP_CTRL_CMD_START;
  hfp_pending_cmd_ = HFP_CTRL_CMD_START;
  // as ConnectAudio only queues the command into main thread, keep PENDING
  // status
  auto status =
  auto status =
      bluetooth::headset::GetInterface()->ConnectAudio(&cb->peer_addr, 0);
      bluetooth::headset::GetInterface()->ConnectAudio(&cb->peer_addr, 0);
  hfp_pending_cmd_ = HFP_CTRL_CMD_NONE;
  LOG(INFO) << __func__ << ": ConnectAudio status = " << status << " - "
  LOG(INFO) << __func__ << ": ConnectAudio status = " << status << " - "
            << bt_status_text(status).c_str();
            << bt_status_text(status).c_str();
  auto ctrl_ack = status_to_ack_map.find(status);
  auto ctrl_ack = status_to_ack_map.find(status);
  if (ctrl_ack == status_to_ack_map.end())
  if (ctrl_ack == status_to_ack_map.end()) {
    LOG_WARN("Unmapped status=%d", status);
    return BluetoothAudioCtrlAck::FAILURE;
    return BluetoothAudioCtrlAck::FAILURE;
  }
  if (ctrl_ack->second != BluetoothAudioCtrlAck::SUCCESS_FINISHED) {
    return ctrl_ack->second;
    return ctrl_ack->second;
  }
  }
  return BluetoothAudioCtrlAck::PENDING;
}


void HfpTransport::StopRequest() {
void HfpTransport::StopRequest() {
  LOG(INFO) << __func__ << ": handling";
  LOG(INFO) << __func__ << ": handling";