diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc')
-rw-r--r-- | src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc | 90 |
1 files changed, 42 insertions, 48 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 258aefd63f..6b7e1d917d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -47,6 +47,8 @@ const char* kInvalidImageWarningInfo = "Requested image(s) not found."; namespace sdl_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + using namespace application_manager; CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( @@ -68,16 +70,16 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( , is_timed_out_(false) {} CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void CreateInteractionChoiceSetRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; 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; } @@ -105,7 +107,7 @@ void CreateInteractionChoiceSetRequest::Run() { } if (verification_result_image == Result::INVALID_DATA || verification_result_secondary_image == Result::INVALID_DATA) { - LOG4CXX_ERROR(logger_, "Image verification failed."); + SDL_LOG_ERROR("Image verification failed."); SendResponse(false, Result::INVALID_DATA); return; } else if (verification_result_image == Result::WARNINGS || @@ -120,8 +122,7 @@ void CreateInteractionChoiceSetRequest::Run() { .asInt(); if (app->FindChoiceSet(choice_set_id_)) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id_ << " is not found."); + SDL_LOG_ERROR("Choice set with id " << choice_set_id_ << " is not found."); SendResponse(false, Result::INVALID_ID); return; } @@ -160,7 +161,7 @@ void CreateInteractionChoiceSetRequest::Run() { mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( ApplicationConstSharedPtr app) { using namespace smart_objects; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::set<uint32_t> choice_id_set; @@ -175,15 +176,14 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( choice_id_set.insert( (*current_choice_set_it)[strings::choice_id].asInt()); if (!ins_res.second) { - LOG4CXX_ERROR(logger_, - "Choice with ID " - << (*current_choice_set_it)[strings::choice_id].asInt() - << " already exists"); + SDL_LOG_ERROR("Choice with ID " + << (*current_choice_set_it)[strings::choice_id].asInt() + << " already exists"); return mobile_apis::Result::INVALID_ID; } if (IsWhiteSpaceExist(*current_choice_set_it)) { - LOG4CXX_ERROR(logger_, "Incoming choice set has contains \t\n \\t \\n"); + SDL_LOG_ERROR("Incoming choice set has contains \t\n \\t \\n"); return mobile_apis::Result::INVALID_DATA; } for (next_choice_set_it = current_choice_set_it + 1; @@ -218,9 +218,8 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms( CreateInteractionChoiceSetRequest::compareStr); if (it != vr_cmds_1->end()) { - LOG4CXX_INFO( - logger_, - "Incoming choice set has duplicated VR synonyms " << it->asString()); + SDL_LOG_INFO("Incoming choice set has duplicated VR synonyms " + << it->asString()); return true; } @@ -235,19 +234,19 @@ bool CreateInteractionChoiceSetRequest::compareStr( bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( const smart_objects::SmartObject& choice_set) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; str = choice_set[strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu_name syntax check failed"); + SDL_LOG_ERROR("Invalid menu_name syntax check failed"); return true; } if (choice_set.keyExists(strings::secondary_text)) { str = choice_set[strings::secondary_text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid secondary_text syntax check failed"); + SDL_LOG_ERROR("Invalid secondary_text syntax check failed"); return true; } } @@ -255,7 +254,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::tertiary_text)) { str = choice_set[strings::tertiary_text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tertiary_text syntax check failed"); + SDL_LOG_ERROR("Invalid tertiary_text syntax check failed"); return true; } } @@ -266,7 +265,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( for (size_t i = 0; i < len; ++i) { str = choice_set[strings::vr_commands][i].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); + SDL_LOG_ERROR("Invalid vr_commands syntax check failed"); return true; } } @@ -275,7 +274,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::image)) { str = choice_set[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid image value syntax check failed"); + SDL_LOG_ERROR("Invalid image value syntax check failed"); return true; } } @@ -283,9 +282,9 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::secondary_image)) { str = choice_set[strings::secondary_image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid secondary_image value. " - "Syntax check failed"); + SDL_LOG_ERROR( + "Invalid secondary_image value. " + "Syntax check failed"); return true; } } @@ -294,7 +293,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params]; smart_objects::SmartObject msg_params = @@ -311,8 +310,7 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( { sync_primitives::AutoLock error_lock(error_from_hmi_lock_); if (error_from_hmi_) { - LOG4CXX_WARN(logger_, - "Error from HMI received. Stop sending VRCommands"); + SDL_LOG_WARN("Error from HMI received. Stop sending VRCommands"); break; } } @@ -332,19 +330,17 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( VRCommandInfo vr_command(vr_cmd_id); sent_commands_map_[vr_corr_id] = vr_command; - LOG4CXX_DEBUG( - logger_, - "VR_command sent corr_id " << vr_corr_id << " cmd_id " << vr_corr_id); + SDL_LOG_DEBUG("VR_command sent corr_id " << vr_corr_id << " cmd_id " + << vr_corr_id); } expected_chs_count_ = chs_num; - LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_); + SDL_LOG_DEBUG("expected_chs_count_ = " << expected_chs_count_); } void CreateInteractionChoiceSetRequest::ProcessHmiError( const hmi_apis::Common_Result::eType vr_result) { - LOG4CXX_DEBUG(logger_, - "Hmi response is not Success: " - << vr_result << ". Stop sending VRAddCommand requests"); + SDL_LOG_DEBUG("Hmi response is not Success: " + << vr_result << ". Stop sending VRAddCommand requests"); if (!error_from_hmi_) { error_from_hmi_ = true; std::string info = @@ -359,7 +355,7 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( const uint32_t corr_id) { SentCommandsMap::iterator it = sent_commands_map_.find(corr_id); if (sent_commands_map_.end() == it) { - LOG4CXX_WARN(logger_, "HMI response for unknown VR command received"); + SDL_LOG_WARN("HMI response for unknown VR command received"); return false; } VRCommandInfo& vr_command = it->second; @@ -369,14 +365,13 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { received_chs_count_++; - LOG4CXX_DEBUG(logger_, - "Got VR.AddCommand response, there are " - << expected_chs_count_ - received_chs_count_ - << " more to wait."); + SDL_LOG_DEBUG("Got VR.AddCommand response, there are " + << expected_chs_count_ - received_chs_count_ + << " more to wait."); if (received_chs_count_ < expected_chs_count_) { application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); - LOG4CXX_DEBUG(logger_, "Timeout for request was updated"); + SDL_LOG_DEBUG("Timeout for request was updated"); } else { OnAllHMIResponsesReceived(); } @@ -386,7 +381,7 @@ void CreateInteractionChoiceSetRequest::on_event( const event_engine::Event& event) { using namespace hmi_apis; using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); const Common_Result::eType result = static_cast<Common_Result::eType>( @@ -412,7 +407,7 @@ void CreateInteractionChoiceSetRequest::on_event( } void CreateInteractionChoiceSetRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!error_from_hmi_) { SendResponse(false, mobile_apis::Result::GENERIC_ERROR); @@ -434,12 +429,12 @@ bool CreateInteractionChoiceSetRequest::Init() { } void CreateInteractionChoiceSetRequest::DeleteChoices() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } application->RemoveChoiceSet(choice_set_id_); @@ -455,16 +450,15 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() { msg_param[strings::cmd_id] = vr_command_info.cmd_id_; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param); } else { - LOG4CXX_WARN(logger_, - "succesful response has not been received for cmd_id = " - << vr_command_info.cmd_id_); + SDL_LOG_WARN("succesful response has not been received for cmd_id = " + << vr_command_info.cmd_id_); } } sent_commands_map_.clear(); } void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!error_from_hmi_ && should_send_warnings_) { SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo); |