summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc90
1 files changed, 42 insertions, 48 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
index 27cac83fad..8e13110515 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
@@ -59,6 +59,8 @@ using namespace application_manager;
namespace commands {
+SDL_CREATE_LOG_VARIABLE("Commands")
+
ChangeRegistrationRequest::ChangeRegistrationRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -144,19 +146,18 @@ void ChangeRegistrationRequest::SendUIRequest(
}
void ChangeRegistrationRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace smart_objects;
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_INFO(logger_,
- "Incoming request contains \t\n \\t \\n or whitespace");
+ SDL_LOG_INFO("Incoming request contains \t\n \\t \\n or whitespace");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -176,14 +177,14 @@ void ChangeRegistrationRequest::Run() {
if (false == (IsLanguageSupportedByUI(hmi_language) &&
IsLanguageSupportedByVR(language) &&
IsLanguageSupportedByTTS(language))) {
- LOG4CXX_ERROR(logger_, "Language is not supported");
+ SDL_LOG_ERROR("Language is not supported");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
if (msg_params.keyExists(strings::app_name) &&
!IsNicknameAllowed(msg_params[strings::app_name].asCustomString())) {
- LOG4CXX_ERROR(logger_, "Nickname is not allowed.");
+ SDL_LOG_ERROR("Nickname is not allowed.");
SendResponse(false, mobile_apis::Result::DISALLOWED);
return;
}
@@ -195,9 +196,8 @@ void ChangeRegistrationRequest::Run() {
MessageHelper::VerifyTtsFiles(tts_name, 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_name are not present");
@@ -244,14 +244,14 @@ void ChangeRegistrationRequest::Run() {
}
void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& message = event.smart_object();
hmi_apis::FunctionID::eType event_id = event.id();
switch (event_id) {
case hmi_apis::FunctionID::UI_ChangeRegistration: {
- LOG4CXX_INFO(logger_, "Received UI_ChangeRegistration event");
+ SDL_LOG_INFO("Received UI_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
pending_requests_.Remove(event_id);
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -260,7 +260,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::VR_ChangeRegistration: {
- LOG4CXX_INFO(logger_, "Received VR_ChangeRegistration event");
+ SDL_LOG_INFO("Received VR_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
pending_requests_.Remove(event_id);
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -269,7 +269,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
break;
}
case hmi_apis::FunctionID::TTS_ChangeRegistration: {
- LOG4CXX_INFO(logger_, "Received TTS_ChangeRegistration event");
+ SDL_LOG_INFO("Received TTS_ChangeRegistration event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
pending_requests_.Remove(event_id);
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
@@ -278,7 +278,7 @@ void ChangeRegistrationRequest::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;
}
}
@@ -288,7 +288,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
application_manager_.application(connection_key());
if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return;
}
@@ -315,9 +315,9 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
response_info.empty() ? NULL : response_info.c_str(),
&(message[strings::msg_params]));
} else {
- LOG4CXX_INFO(logger_,
- "There are some pending responses from HMI."
- "ChangeRegistrationRequest still waiting.");
+ SDL_LOG_INFO(
+ "There are some pending responses from HMI."
+ "ChangeRegistrationRequest still waiting.");
}
}
@@ -331,7 +331,7 @@ void CheckInfo(std::string& str) {
bool ChangeRegistrationRequest::PrepareResponseParameters(
mobile_apis::Result::eType& result_code, std::string& response_info) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
using namespace helpers;
const bool is_tts_succeeded_unsupported =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
@@ -463,7 +463,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
const auto ui_languages = hmi_capabilities.ui_supported_languages();
if (!ui_languages) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return false;
}
@@ -473,7 +473,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
}
}
- LOG4CXX_ERROR(logger_, "Language isn't supported by UI");
+ SDL_LOG_ERROR("Language isn't supported by UI");
return false;
}
@@ -484,7 +484,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
const auto vr_languages = hmi_capabilities.vr_supported_languages();
if (!vr_languages) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return false;
}
@@ -494,7 +494,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR(
}
}
- LOG4CXX_ERROR(logger_, "Language isn't supported by VR");
+ SDL_LOG_ERROR("Language isn't supported by VR");
return false;
}
@@ -505,7 +505,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS(
const auto tts_languages = hmi_capabilities.tts_supported_languages();
if (!tts_languages) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ SDL_LOG_ERROR("NULL pointer");
return false;
}
@@ -516,7 +516,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS(
}
}
- LOG4CXX_ERROR(logger_, "Language isn't supported by TTS");
+ SDL_LOG_ERROR("Language isn't supported by TTS");
return false;
}
@@ -526,7 +526,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::app_name)) {
str = (*message_)[strings::msg_params][strings::app_name].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed");
+ SDL_LOG_ERROR("Invalid app_name syntax check failed");
return true;
}
}
@@ -541,7 +541,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
for (; it_tn != it_tn_end; ++it_tn) {
str = (*it_tn)[strings::text].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed");
+ SDL_LOG_ERROR("Invalid tts_name syntax check failed");
return true;
}
}
@@ -552,8 +552,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name]
.asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid ngn_media_screen_app_name syntax check failed");
+ SDL_LOG_ERROR("Invalid ngn_media_screen_app_name syntax check failed");
return true;
}
}
@@ -568,7 +567,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
for (; it_vs != it_vs_end; ++it_vs) {
str = (*it_vs).asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_, "Invalid vr_synonyms syntax check failed");
+ SDL_LOG_ERROR("Invalid vr_synonyms syntax check failed");
return true;
}
}
@@ -578,7 +577,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
const connection_handler::DeviceHandle& device_id) {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -610,7 +609,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
const auto& cur_name = app->name();
if (msg_params.keyExists(strings::app_name)) {
if (app_name.CompareIgnoreCase(cur_name)) {
- LOG4CXX_ERROR(logger_, "Application name is known already.");
+ SDL_LOG_ERROR("Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
const auto vr = app->vr_synonyms();
@@ -619,7 +618,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
CoincidencePredicateVR v(app_name);
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
- LOG4CXX_ERROR(logger_, "Application name is known already.");
+ SDL_LOG_ERROR("Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
}
@@ -631,7 +630,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
- LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
+ SDL_LOG_ERROR("vr_synonyms duplicated with app_name .");
return mobile_apis::Result::DUPLICATE_NAME;
}
} // End vr check
@@ -646,11 +645,9 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
tts_curr->end(),
compare_tts_name);
if (it_tts != tts_array->end()) {
- LOG4CXX_ERROR(
- logger_,
- "TTS name: "
- << (*it_tts)[strings::text].asCustomString().AsMBString()
- << " is known already");
+ SDL_LOG_ERROR("TTS name: "
+ << (*it_tts)[strings::text].asCustomString().AsMBString()
+ << " is known already");
return mobile_apis::Result::DUPLICATE_NAME;
}
} // End tts check
@@ -661,13 +658,12 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
bool ChangeRegistrationRequest::IsNicknameAllowed(
const custom_str::CustomString& app_name) const {
- LOG4CXX_AUTO_TRACE(logger_);
+ SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(
- logger_,
- "Can't find appication with connection key " << connection_key());
+ SDL_LOG_ERROR("Can't find appication with connection key "
+ << connection_key());
return false;
}
@@ -680,9 +676,8 @@ bool ChangeRegistrationRequest::IsNicknameAllowed(
policy_app_id, &app_nicknames, &app_hmi_types);
if (!init_result) {
- LOG4CXX_ERROR(logger_,
- "Error during getting of nickname list for application "
- << policy_app_id);
+ SDL_LOG_ERROR("Error during getting of nickname list for application "
+ << policy_app_id);
return false;
}
@@ -691,8 +686,7 @@ bool ChangeRegistrationRequest::IsNicknameAllowed(
policy::StringArray::const_iterator it =
std::find_if(app_nicknames.begin(), app_nicknames.end(), compare);
if (app_nicknames.end() == it) {
- LOG4CXX_WARN(logger_,
- "Application name was not found in nicknames list.");
+ SDL_LOG_WARN("Application name was not found in nicknames list.");
usage_statistics::AppCounter count_of_rejections_nickname_mismatch(
policy_handler_.GetStatisticManager(),