summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc65
1 files changed, 33 insertions, 32 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index a0544ee444..55783be4cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -47,6 +47,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
AlertRequest::AlertRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -81,9 +83,9 @@ bool AlertRequest::Init() {
// If soft buttons are present, SDL will not use initiate timeout tracking for
// response.
if (msg_params.keyExists(strings::soft_buttons)) {
- LOG4CXX_INFO(logger_,
- "Request contains soft buttons - request timeout "
- "will be set to 0.");
+ SDL_LOG_INFO(
+ "Request contains soft buttons - request timeout "
+ "will be set to 0.");
default_timeout_ = 0;
}
@@ -91,7 +93,7 @@ bool AlertRequest::Init() {
}
void AlertRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
uint32_t app_id =
(*message_)[strings::params][strings::connection_key].asInt();
@@ -122,24 +124,24 @@ void AlertRequest::Run() {
}
void AlertRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::TTS_OnResetTimeout:
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_INFO(logger_,
- "Received UI_OnResetTimeout event "
- " or TTS_OnResetTimeout event"
- << awaiting_tts_speak_response_ << " "
- << awaiting_tts_stop_speaking_response_ << " "
- << awaiting_ui_alert_response_);
+ SDL_LOG_INFO(
+ "Received UI_OnResetTimeout event "
+ " or TTS_OnResetTimeout event "
+ << awaiting_tts_speak_response_ << " "
+ << awaiting_tts_stop_speaking_response_ << " "
+ << awaiting_ui_alert_response_);
application_manager_.updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::UI_Alert: {
- LOG4CXX_INFO(logger_, "Received UI_Alert event");
+ SDL_LOG_INFO("Received UI_Alert event");
// Unsubscribe from event to avoid unwanted messages
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
unsubscribe_from_event(hmi_apis::FunctionID::UI_Alert);
@@ -163,7 +165,7 @@ void AlertRequest::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");
// Unsubscribe from event to avoid unwanted messages
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak);
@@ -174,7 +176,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_StopSpeaking: {
- LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event");
+ SDL_LOG_INFO("Received TTS_StopSpeaking event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
// Unsubscribe from event to avoid unwanted messages
unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking);
@@ -182,7 +184,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ SDL_LOG_ERROR("Received unknown event " << event.id());
return;
}
}
@@ -238,11 +240,11 @@ bool AlertRequest::PrepareResponseParameters(
}
bool AlertRequest::Validate(uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "No application associated with session key");
+ SDL_LOG_ERROR("No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
@@ -252,7 +254,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::POLICY_TABLE)) {
- LOG4CXX_ERROR(logger_, "Alert frequency is too high.");
+ SDL_LOG_ERROR("Alert frequency is too high.");
SendResponse(false, mobile_apis::Result::REJECTED);
return false;
}
@@ -271,7 +273,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
application_manager_);
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ SDL_LOG_ERROR("INVALID_DATA!");
SendResponse(false, processing_result);
return false;
}
@@ -281,7 +283,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
(!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) &&
(!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) &&
(1 > (*message_)[strings::msg_params][strings::tts_chunks].length()))) {
- LOG4CXX_ERROR(logger_, "Mandatory parameters are missing");
+ SDL_LOG_ERROR("Mandatory parameters are missing");
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Mandatory parameters are missing");
@@ -295,9 +297,8 @@ bool AlertRequest::Validate(uint32_t app_id) {
MessageHelper::VerifyTtsFiles(tts_chunks, 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,
"One or more files needed for tts_chunks are not present");
@@ -309,7 +310,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
}
void AlertRequest::SendAlertRequest(int32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(app_id);
smart_objects::SmartObject msg_params =
@@ -364,7 +365,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
- LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SDL_LOG_ERROR("Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -401,7 +402,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
void AlertRequest::SendSpeakRequest(int32_t app_id,
bool tts_chunks_exists,
size_t length_tts_chunks) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace hmi_apis;
using namespace smart_objects;
// crate HMI speak request
@@ -423,13 +424,13 @@ void AlertRequest::SendSpeakRequest(int32_t app_id,
}
bool AlertRequest::CheckStrings() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const char* str = NULL;
if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) {
str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_1 syntax check failed");
return false;
}
}
@@ -437,7 +438,7 @@ bool AlertRequest::CheckStrings() {
if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) {
str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_2 syntax check failed");
return false;
}
}
@@ -445,7 +446,7 @@ bool AlertRequest::CheckStrings() {
if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) {
str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid alert_text_3 syntax check failed");
+ SDL_LOG_ERROR("Invalid alert_text_3 syntax check failed");
return false;
}
}
@@ -456,7 +457,7 @@ bool AlertRequest::CheckStrings() {
for (size_t i = 0; i < tts_chunks_array.length(); ++i) {
str = tts_chunks_array[i][strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_chunks text syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_chunks text syntax check failed");
return false;
}
}
@@ -465,7 +466,7 @@ bool AlertRequest::CheckStrings() {
}
bool AlertRequest::HasHmiResponsesToWait() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ ||
awaiting_tts_stop_speaking_response_;
}