summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
index 2f3d38f0b0..5918c05f2d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -43,6 +43,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
namespace str = strings;
PerformAudioPassThruRequest::PerformAudioPassThruRequest(
@@ -64,7 +66,7 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest(
PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {}
void PerformAudioPassThruRequest::onTimeOut() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
FinishTTSSpeak();
CommandRequestImpl::onTimeOut();
@@ -77,28 +79,28 @@ bool PerformAudioPassThruRequest::Init() {
}
void PerformAudioPassThruRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED");
+ SDL_LOG_ERROR("APPLICATION_NOT_REGISTERED");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if (mobile_api::HMILevel::HMI_NONE ==
app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
- LOG4CXX_ERROR(logger_, "application isn't activated");
+ SDL_LOG_ERROR("application isn't activated");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming perform audio pass thru has contains "
- "\\t\\n \\\\t \\\\n"
- " text contains only whitespace in initialPrompt");
+ SDL_LOG_ERROR(
+ "Incoming perform audio pass thru has contains "
+ "\\t\\n \\\\t \\\\n"
+ " text contains only whitespace in initialPrompt");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -114,9 +116,8 @@ void PerformAudioPassThruRequest::Run() {
initial_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(
- logger_,
- "MessageHelper::VerifyTtsFiles return " << verification_result);
+ SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return "
+ << verification_result);
SendResponse(
false,
mobile_apis::Result::FILE_NOT_FOUND,
@@ -135,14 +136,14 @@ void PerformAudioPassThruRequest::Run() {
}
void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_PerformAudioPassThru: {
- LOG4CXX_TRACE(logger_, "Received UI_PerformAudioPassThru");
+ SDL_LOG_TRACE("Received UI_PerformAudioPassThru");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
result_ui_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -151,7 +152,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
// in case perform audio is started by other request skip stopping
if (hmi_apis::Common_Result::REJECTED == result_ui_) {
- LOG4CXX_ERROR(logger_, "Request was rejected");
+ SDL_LOG_ERROR("Request was rejected");
SendResponse(false,
MessageHelper::HMIToMobileResult(result_ui_),
NULL,
@@ -162,7 +163,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
- LOG4CXX_INFO(logger_, "Received TTS_Speak event");
+ SDL_LOG_INFO("Received TTS_Speak event");
result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, tts_info_);
@@ -188,14 +189,14 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event");
+ SDL_LOG_INFO("Received TTS_OnResetTimeout event");
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
@@ -214,7 +215,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
const PerformAudioPassThruRequest::ResponseParams&
PerformAudioPassThruRequest::PrepareResponseParameters() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
app_mngr::commands::ResponseInfo ui_perform_info(
result_ui_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_);
@@ -252,7 +253,7 @@ PerformAudioPassThruRequest::PrepareResponseParameters() {
}
void PerformAudioPassThruRequest::SendSpeakRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace smart_objects;
@@ -274,7 +275,7 @@ void PerformAudioPassThruRequest::SendSpeakRequest() {
}
void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -321,7 +322,7 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
}
void PerformAudioPassThruRequest::SendRecordStartNotification() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -331,7 +332,7 @@ void PerformAudioPassThruRequest::SendRecordStartNotification() {
}
void PerformAudioPassThruRequest::StartMicrophoneRecording() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id = connection_key();
application_manager_.BeginAudioPassThru(app_id);
@@ -346,7 +347,7 @@ void PerformAudioPassThruRequest::StartMicrophoneRecording() {
}
bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) {
@@ -359,7 +360,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
for (; it_ip != it_ip_end; ++it_ip) {
str = (*it_ip)[strings::text].asCharArray();
if (std::strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed");
+ SDL_LOG_ERROR("Invalid initial_prompt syntax check failed");
return true;
}
}
@@ -370,8 +371,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::audio_pass_display_text1]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Invalid audio_pass_display_text1 value syntax check failed");
return true;
}
@@ -382,8 +382,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::audio_pass_display_text2]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(
- logger_,
+ SDL_LOG_ERROR(
"Invalid audio_pass_display_text2 value syntax check failed");
return true;
}
@@ -392,14 +391,14 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
}
void PerformAudioPassThruRequest::FinishTTSSpeak() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id = connection_key();
if (application_manager_.EndAudioPassThru(app_id)) {
- LOG4CXX_DEBUG(logger_, "Stop AudioPassThru.");
+ SDL_LOG_DEBUG("Stop AudioPassThru.");
application_manager_.StopAudioPassThru(app_id);
}
if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) {
- LOG4CXX_WARN(logger_, "TTS Speak is inactive.");
+ SDL_LOG_WARN("TTS Speak is inactive.");
return;
}
SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL);
@@ -446,7 +445,7 @@ PerformAudioPassThruRequest::PrepareAudioPassThruResultCodeForResponse(
}
bool PerformAudioPassThruRequest::IsWaitingHMIResponse() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) ||
IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI);
}