diff options
author | dtrunov <dtrunov@luxoft.com> | 2016-10-04 10:12:47 +0300 |
---|---|---|
committer | dtrunov <dtrunov@luxoft.com> | 2016-10-04 10:12:47 +0300 |
commit | a2cb12e9de3eb64e590f650d2c45aee82cdfe349 (patch) | |
tree | 5894a1d43bfeb86d4e1b0185adb76ba7676fd67e | |
parent | a100b5efb77e00c7f7153ed8852e09257beb4579 (diff) | |
download | sdl_core-a2cb12e9de3eb64e590f650d2c45aee82cdfe349.tar.gz |
Fix code style
Related issue [APPLINK-25088](https://adc.luxoft.com/jira/browse/APPLINK-25088)
37 files changed, 660 insertions, 598 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index 9d4ea78b42..524b6dbc8c 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -47,7 +47,7 @@ class SmartObject; namespace application_manager { namespace commands { -struct ResponseInfo{ +struct ResponseInfo { hmi_apis::Common_Result::eType result_code; HmiInterfaces::InterfaceID interface; HmiInterfaces::InterfaceState interface_state; @@ -192,8 +192,9 @@ class CommandRequestImpl : public CommandImpl, * @return true if result code complies successful result cods * otherwise returns false. */ - bool PrepareResultForMobileResponse(hmi_apis::Common_Result::eType result_code, - HmiInterfaces::InterfaceID interface) const; + bool PrepareResultForMobileResponse( + hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const; /** * @brief Checks result code from HMI for splitted RPC @@ -217,9 +218,9 @@ class CommandRequestImpl : public CommandImpl, * @param response_from_hmi contains response from HMI */ void GetInfo(HmiInterfaces::InterfaceID interface, - hmi_apis::Common_Result::eType result_code, - std::string& info, - const smart_objects::SmartObject& response_from_hmi); + hmi_apis::Common_Result::eType result_code, + std::string& info, + const smart_objects::SmartObject& response_from_hmi); /** * @brief Prepare result code for sending to mobile application @@ -230,10 +231,9 @@ class CommandRequestImpl : public CommandImpl, * @return resulting code for sending to mobile application. */ mobile_apis::Result::eType PrepareResultCodeForResponse( - const ResponseInfo& first, - const ResponseInfo& second); + const ResponseInfo& first, const ResponseInfo& second); -protected: + protected: /** * @brief Returns policy parameters permissions * @return Parameters permissions struct reference diff --git a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h index 680f1e9d99..9ebb5761c1 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/request_to_hmi.h @@ -60,7 +60,6 @@ bool ChangeInterfaceState(ApplicationManager& application_manager, const smart_objects::SmartObject& response_from_hmi, HmiInterfaces::InterfaceID interface); - class RequestToHMI : public CommandImpl { public: RequestToHMI(const MessageSharedPtr& message, diff --git a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h index d30f900982..df4c772ffa 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/tts_is_ready_request.h @@ -43,7 +43,7 @@ namespace commands { * @brief TTSIsReadyRequest command class **/ class TTSIsReadyRequest : public RequestToHMI, - public event_engine::EventObserver{ + public event_engine::EventObserver { public: /** * @brief TTSIsReadyRequest class constructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h index e8a6bd81b9..7ab9454c7a 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_is_ready_request.h @@ -43,7 +43,7 @@ namespace commands { * @brief UIIsReadyRequest command class **/ class UIIsReadyRequest : public RequestToHMI, - public event_engine::EventObserver{ + public event_engine::EventObserver { public: /** * @brief UIIsReadyRequest class constructor diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h index 93450a0ffc..8c312f70d9 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_is_ready_request.h @@ -43,7 +43,7 @@ namespace commands { * @brief VIIsReadyRequest command class **/ class VIIsReadyRequest : public RequestToHMI, - public event_engine::EventObserver{ + public event_engine::EventObserver { public: /** * @brief VIIsReadyRequest class constructor @@ -78,7 +78,7 @@ class VIIsReadyRequest : public RequestToHMI, */ void SendMessageToHMI(); -private: + private: DISALLOW_COPY_AND_ASSIGN(VIIsReadyRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h index 7b4fb8fe31..aff7430c6a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h @@ -86,7 +86,8 @@ class PerformAudioPassThruRequest : public CommandRequestImpl { private: /** - * @brief Prepare result code, result and info for sending to mobile application + * @brief Prepare result code, result and info for sending to mobile + * application * @param result_code contains result code for sending to mobile application * @return result for sending to mobile application. */ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h index 3102785096..4cf40959b4 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h @@ -104,9 +104,8 @@ class PerformInteractionRequest : public CommandRequestImpl { * @return true if send response to mobile application otherwise * return false. */ - bool ProcessUIResponse( - const smart_objects::SmartObject& message, - smart_objects::SmartObject& msg_params); + bool ProcessUIResponse(const smart_objects::SmartObject& message, + smart_objects::SmartObject& msg_params); /* * @brief Sends UI PerformInteraction request to HMI diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h index 0fad215b74..ec7bbcebbd 100644 --- a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h +++ b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h @@ -427,7 +427,8 @@ class HMICapabilitiesImpl : public HMICapabilities { * @brief Trigger waiting for response * @param request Request object */ - void set_handle_response_for(const smart_objects::SmartObject& request) OVERRIDE; + void set_handle_response_for( + const smart_objects::SmartObject& request) OVERRIDE; protected: /* diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 89b7f4d176..37ddcddc89 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -49,45 +49,48 @@ std::string MergeInfos(const std::string& first, const std::string& second) { std::string MergeInfos(const std::string& first, const std::string& second, const std::string& third) { - std::string result = MergeInfos(first, second); + std::string result = MergeInfos(first, second); return MergeInfos(result, third); } -const std::string CreateInfoForUnsupportedResult(HmiInterfaces::InterfaceID interface) { - switch (interface) { - case(HmiInterfaces::InterfaceID::HMI_INTERFACE_VR):{ - return "VR is not supported by system"; - } case(HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): { - return "TTS is not supported by system"; - } case(HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): { - return "UI is not supported by system"; - } case(HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): { - return "Navi is not supported by system"; +const std::string CreateInfoForUnsupportedResult( + HmiInterfaces::InterfaceID interface) { + switch (interface) { + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): { + return "VR is not supported by system"; } - default: - return ""; + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): { + return "TTS is not supported by system"; } -} - -bool CheckResultCode(const ResponseInfo& first, - const ResponseInfo& second) { - if (first.is_ok && second.is_unsupported_resource) { - return true; + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): { + return "UI is not supported by system"; } - if (first.is_invalid_enum && second.is_unsupported_resource && - HmiInterfaces::STATE_NOT_AVAILABLE != second.interface_state) { - return true; + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): { + return "Navi is not supported by system"; } - return false; + default: + return ""; + } +} + +bool CheckResultCode(const ResponseInfo& first, const ResponseInfo& second) { + if (first.is_ok && second.is_unsupported_resource) { + return true; + } + if (first.is_invalid_enum && second.is_unsupported_resource && + HmiInterfaces::STATE_NOT_AVAILABLE != second.interface_state) { + return true; + } + return false; } bool IsResultCodeUnsupported(const ResponseInfo& first, const ResponseInfo& second) { - return ((first.is_ok || first.is_invalid_enum) && - second.is_unsupported_resource) || - ((second.is_ok || second.is_invalid_enum) && - first.is_unsupported_resource) || - (first.is_unsupported_resource && second.is_unsupported_resource); + return ((first.is_ok || first.is_invalid_enum) && + second.is_unsupported_resource) || + ((second.is_ok || second.is_invalid_enum) && + first.is_unsupported_resource) || + (first.is_unsupported_resource && second.is_unsupported_resource); } struct DisallowedParamsInserter { @@ -115,8 +118,6 @@ struct DisallowedParamsInserter { mobile_apis::VehicleDataResultCode::eType code_; }; - - CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandImpl(message, application_manager) @@ -641,110 +642,109 @@ bool CommandRequestImpl::HasDisallowedParams() const { } bool CommandRequestImpl::PrepareResultForMobileResponse( - hmi_apis::Common_Result::eType result_code, - HmiInterfaces::InterfaceID interface) const { - using namespace helpers; - bool result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - result_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED); - const HmiInterfaces::InterfaceState state = - application_manager_.hmi_interfaces().GetInterfaceState(interface); + hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const { + using namespace helpers; + bool result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + result_code, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::WRONG_LANGUAGE, + hmi_apis::Common_Result::RETRY, + hmi_apis::Common_Result::SAVED); + const HmiInterfaces::InterfaceState state = + application_manager_.hmi_interfaces().GetInterfaceState(interface); - result = result || (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code && - HmiInterfaces::STATE_NOT_AVAILABLE != state); - return result; + result = + result || (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code && + HmiInterfaces::STATE_NOT_AVAILABLE != state); + return result; } bool CommandRequestImpl::PrepareResultForMobileResponse( - ResponseInfo& first, - ResponseInfo& second) const { - using namespace helpers; - - first.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - first.result_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED); - - second.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - second.result_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED); - - first.is_invalid_enum = - hmi_apis::Common_Result::INVALID_ENUM == first.result_code; - - second.is_invalid_enum = - hmi_apis::Common_Result::INVALID_ENUM == second.result_code; - - first.is_unsupported_resource = - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == first.result_code; - - second.is_unsupported_resource = - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == second.result_code; - - first.interface_state = application_manager_.hmi_interfaces().GetInterfaceState( - first.interface); - second.interface_state = application_manager_.hmi_interfaces().GetInterfaceState( - second.interface); - - bool result = (first.is_ok && second.is_ok) || - (second.is_invalid_enum && first.is_ok) || - (first. is_invalid_enum && second.is_ok); - result = result || CheckResultCode(first, second); - result = result || CheckResultCode(second, first); - return result; + ResponseInfo& first, ResponseInfo& second) const { + using namespace helpers; + + first.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + first.result_code, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::WRONG_LANGUAGE, + hmi_apis::Common_Result::RETRY, + hmi_apis::Common_Result::SAVED); + + second.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + second.result_code, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::WRONG_LANGUAGE, + hmi_apis::Common_Result::RETRY, + hmi_apis::Common_Result::SAVED); + + first.is_invalid_enum = + hmi_apis::Common_Result::INVALID_ENUM == first.result_code; + + second.is_invalid_enum = + hmi_apis::Common_Result::INVALID_ENUM == second.result_code; + + first.is_unsupported_resource = + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == first.result_code; + + second.is_unsupported_resource = + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == second.result_code; + + first.interface_state = + application_manager_.hmi_interfaces().GetInterfaceState(first.interface); + second.interface_state = + application_manager_.hmi_interfaces().GetInterfaceState(second.interface); + + bool result = (first.is_ok && second.is_ok) || + (second.is_invalid_enum && first.is_ok) || + (first.is_invalid_enum && second.is_ok); + result = result || CheckResultCode(first, second); + result = result || CheckResultCode(second, first); + return result; } -void CommandRequestImpl::GetInfo(HmiInterfaces::InterfaceID interface, - hmi_apis::Common_Result::eType result_code, - std::string& info, - const smart_objects::SmartObject& response_from_hmi) { - if (response_from_hmi[strings::msg_params].keyExists(strings::info)) { - info = - response_from_hmi[strings::msg_params][strings::info].asString(); - } else { - HmiInterfaces::InterfaceState interface_state = - application_manager_.hmi_interfaces().GetInterfaceState(interface); - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code && - HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == interface_state) { - info = CreateInfoForUnsupportedResult(interface); - } +void CommandRequestImpl::GetInfo( + HmiInterfaces::InterfaceID interface, + hmi_apis::Common_Result::eType result_code, + std::string& info, + const smart_objects::SmartObject& response_from_hmi) { + if (response_from_hmi[strings::msg_params].keyExists(strings::info)) { + info = response_from_hmi[strings::msg_params][strings::info].asString(); + } else { + HmiInterfaces::InterfaceState interface_state = + application_manager_.hmi_interfaces().GetInterfaceState(interface); + if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code && + HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == interface_state) { + info = CreateInfoForUnsupportedResult(interface); } - - } + } +} mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( - const ResponseInfo& first, - const ResponseInfo& second) { - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - if (IsResultCodeUnsupported(first, second)) { - result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; - } else { - //If response contains erroneous result code SDL need return erroneus result code. - hmi_apis::Common_Result::eType first_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType second_result = - hmi_apis::Common_Result::INVALID_ENUM; - if(!first.is_unsupported_resource) { - first_result = first.result_code; - } - if (!second.is_unsupported_resource) { - second_result = second.result_code; - } - result_code = MessageHelper::HMIToMobileResult( - std::max(first_result, second_result)); - } - return result_code; + const ResponseInfo& first, const ResponseInfo& second) { + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; + if (IsResultCodeUnsupported(first, second)) { + result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; + } else { + // If response contains erroneous result code SDL need return erroneus + // result code. + hmi_apis::Common_Result::eType first_result = + hmi_apis::Common_Result::INVALID_ENUM; + hmi_apis::Common_Result::eType second_result = + hmi_apis::Common_Result::INVALID_ENUM; + if (!first.is_unsupported_resource) { + first_result = first.result_code; + } + if (!second.is_unsupported_resource) { + second_result = second.result_code; + } + result_code = + MessageHelper::HMIToMobileResult(std::max(first_result, second_result)); + } + return result_code; } const CommandParametersPermissions& CommandRequestImpl::parameters_permissions() @@ -752,8 +752,6 @@ const CommandParametersPermissions& CommandRequestImpl::parameters_permissions() return parameters_permissions_; } - - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc index 497c21e15c..6364cc2fc8 100644 --- a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc @@ -46,19 +46,19 @@ bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager, bool ChangeInterfaceState(ApplicationManager& application_manager, const smart_objects::SmartObject& response_from_hmi, HmiInterfaces::InterfaceID interface) { - bool is_available = false; - if (response_from_hmi[strings::msg_params].keyExists(strings::available)) { - is_available = response_from_hmi[strings::msg_params][strings::available].asBool(); - const HmiInterfaces::InterfaceState interface_state = - is_available ? HmiInterfaces::STATE_AVAILABLE - : HmiInterfaces::STATE_NOT_AVAILABLE; - application_manager.hmi_interfaces().SetInterfaceState( - interface, interface_state); - } - return is_available; + bool is_available = false; + if (response_from_hmi[strings::msg_params].keyExists(strings::available)) { + is_available = + response_from_hmi[strings::msg_params][strings::available].asBool(); + const HmiInterfaces::InterfaceState interface_state = + is_available ? HmiInterfaces::STATE_AVAILABLE + : HmiInterfaces::STATE_NOT_AVAILABLE; + application_manager.hmi_interfaces().SetInterfaceState(interface, + interface_state); + } + return is_available; } - RequestToHMI::RequestToHMI(const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandImpl(message, application_manager) { @@ -79,10 +79,9 @@ bool RequestToHMI::CleanUp() { void RequestToHMI::Run() {} void RequestToHMI::SendRequest() { - (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; - (*message_)[strings::params][strings::protocol_version] = protocol_version_; - application_manager_.SendMessageToHMI(message_); - + (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; + (*message_)[strings::params][strings::protocol_version] = protocol_version_; + application_manager_.SendMessageToHMI(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc index 6044dd8e94..71e89dd9b9 100644 --- a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc @@ -40,14 +40,13 @@ namespace commands { TTSIsReadyRequest::TTSIsReadyRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()){} + , EventObserver(application_manager.event_dispatcher()) {} TTSIsReadyRequest::~TTSIsReadyRequest() {} void TTSIsReadyRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::TTS_IsReady, - correlation_id()); + subscribe_on_event(hmi_apis::FunctionID::TTS_IsReady, correlation_id()); SendRequest(); } @@ -60,46 +59,47 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received TTS_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::TTS_IsReady); const bool is_available = ChangeInterfaceState( - application_manager_, message, - HmiInterfaces::HMI_INTERFACE_TTS); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + application_manager_, message, HmiInterfaces::HMI_INTERFACE_TTS); + HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); hmi_capabilities.set_is_tts_cooperating(is_available); - if(!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_TTS)) { - LOG4CXX_INFO(logger_, "HmiInterfaces::HMI_INTERFACE_TTS isn't available"); - return; + if (!CheckAvailabilityHMIInterfaces(application_manager_, + HmiInterfaces::HMI_INTERFACE_TTS)) { + LOG4CXX_INFO(logger_, + "HmiInterfaces::HMI_INTERFACE_TTS isn't available"); + return; } SendMessageToHMI(); break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } } } void TTSIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); + // Note(dtrunov): According to new requirment APPLINK-27956 + SendMessageToHMI(); } void TTSIsReadyRequest::SendMessageToHMI() { - - utils::SharedPtr<smart_objects::SmartObject> get_language( - MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage, - application_manager_)); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - hmi_capabilities.set_handle_response_for(*get_language); - application_manager_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::TTS_GetSupportedLanguages, application_manager_)); - application_manager_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::TTS_GetCapabilities, application_manager_)); - application_manager_.ManageHMICommand(get_capabilities); + utils::SharedPtr<smart_objects::SmartObject> get_language( + MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage, + application_manager_)); + HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + hmi_capabilities.set_handle_response_for(*get_language); + application_manager_.ManageHMICommand(get_language); + utils::SharedPtr<smart_objects::SmartObject> get_all_languages( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::TTS_GetSupportedLanguages, + application_manager_)); + application_manager_.ManageHMICommand(get_all_languages); + utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::TTS_GetCapabilities, application_manager_)); + application_manager_.ManageHMICommand(get_capabilities); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc index a36b7104b4..9e27e23d34 100644 --- a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc @@ -40,14 +40,13 @@ namespace commands { UIIsReadyRequest::UIIsReadyRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()){} + , EventObserver(application_manager.event_dispatcher()) {} UIIsReadyRequest::~UIIsReadyRequest() {} void UIIsReadyRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::UI_IsReady, - correlation_id()); + subscribe_on_event(hmi_apis::FunctionID::UI_IsReady, correlation_id()); SendRequest(); } @@ -59,18 +58,19 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received UI_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::UI_IsReady); const bool is_available = ChangeInterfaceState( - application_manager_, message, - HmiInterfaces::HMI_INTERFACE_UI); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + application_manager_, message, HmiInterfaces::HMI_INTERFACE_UI); + HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); hmi_capabilities.set_is_ui_cooperating(is_available); - if(!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_UI)) { - LOG4CXX_INFO(logger_, "HmiInterfaces::HMI_INTERFACE_UI isn't available"); - return; + if (!CheckAvailabilityHMIInterfaces(application_manager_, + HmiInterfaces::HMI_INTERFACE_UI)) { + LOG4CXX_INFO(logger_, + "HmiInterfaces::HMI_INTERFACE_UI isn't available"); + return; } SendMessageToHMI(); break; - } + } default: { LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; @@ -79,26 +79,26 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) { } void UIIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); + // Note(dtrunov): According to new requirment APPLINK-27956 + SendMessageToHMI(); } void UIIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( - MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage, - application_manager_)); - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - hmi_capabilities.set_handle_response_for(*get_language); - application_manager_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::UI_GetSupportedLanguages, application_manager_)); - application_manager_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::UI_GetCapabilities, application_manager_)); - application_manager_.ManageHMICommand(get_capabilities); + utils::SharedPtr<smart_objects::SmartObject> get_language( + MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage, + application_manager_)); + HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + hmi_capabilities.set_handle_response_for(*get_language); + application_manager_.ManageHMICommand(get_language); + utils::SharedPtr<smart_objects::SmartObject> get_all_languages( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::UI_GetSupportedLanguages, + application_manager_)); + application_manager_.ManageHMICommand(get_all_languages); + utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::UI_GetCapabilities, application_manager_)); + application_manager_.ManageHMICommand(get_capabilities); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc index 079c79f65d..ddd08695a0 100644 --- a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc @@ -40,7 +40,7 @@ namespace commands { VIIsReadyRequest::VIIsReadyRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()){} + , EventObserver(application_manager.event_dispatcher()) {} VIIsReadyRequest::~VIIsReadyRequest() {} @@ -58,22 +58,26 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VehicleInfo_IsReady: { LOG4CXX_DEBUG(logger_, "VehicleInfo_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_IsReady); - const bool is_available = ChangeInterfaceState( - application_manager_, message, - HmiInterfaces::HMI_INTERFACE_VehicleInfo); + const bool is_available = + ChangeInterfaceState(application_manager_, + message, + HmiInterfaces::HMI_INTERFACE_VehicleInfo); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); hmi_capabilities.set_is_ivi_cooperating(is_available); application_manager_.GetPolicyHandler().OnVIIsReady(); - if(!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { - LOG4CXX_INFO(logger_, "HmiInterfaces::HMI_INTERFACE_VehicleInfo isn't available"); - return; + if (!CheckAvailabilityHMIInterfaces( + application_manager_, HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { + LOG4CXX_INFO( + logger_, + "HmiInterfaces::HMI_INTERFACE_VehicleInfo isn't available"); + return; } SendMessageToHMI(); break; - } + } default: { LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; @@ -82,15 +86,16 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) { } void VIIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); + // Note(dtrunov): According to new requirment APPLINK-27956 + SendMessageToHMI(); } void VIIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_type( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VehicleInfo_GetVehicleType, application_manager_)); - application_manager_.ManageHMICommand(get_type); + utils::SharedPtr<smart_objects::SmartObject> get_type( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::VehicleInfo_GetVehicleType, + application_manager_)); + application_manager_.ManageHMICommand(get_type); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc index df64e0baa3..086b5d4490 100644 --- a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc +++ b/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc @@ -39,14 +39,13 @@ namespace commands { VRIsReadyRequest::VRIsReadyRequest(const MessageSharedPtr& message, ApplicationManager& application_manager) : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()){} + , EventObserver(application_manager.event_dispatcher()) {} VRIsReadyRequest::~VRIsReadyRequest() {} void VRIsReadyRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::VR_IsReady, - correlation_id()); + subscribe_on_event(hmi_apis::FunctionID::VR_IsReady, correlation_id()); SendRequest(); } @@ -58,19 +57,20 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received VR_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::VR_IsReady); const bool is_available = ChangeInterfaceState( - application_manager_, message, - HmiInterfaces::HMI_INTERFACE_VR); + application_manager_, message, HmiInterfaces::HMI_INTERFACE_VR); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + HMICapabilities& hmi_capabilities = + application_manager_.hmi_capabilities(); hmi_capabilities.set_is_vr_cooperating(is_available); - if(!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_VR)) { - LOG4CXX_INFO(logger_, "HmiInterfaces::HMI_INTERFACE_VR isn't available"); - return; + if (!CheckAvailabilityHMIInterfaces(application_manager_, + HmiInterfaces::HMI_INTERFACE_VR)) { + LOG4CXX_INFO(logger_, + "HmiInterfaces::HMI_INTERFACE_VR isn't available"); + return; } SendMessageToHMI(); break; - } + } default: { LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); return; @@ -79,25 +79,26 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) { } void VRIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); + // Note(dtrunov): According to new requirment APPLINK-27956 + SendMessageToHMI(); } void VRIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( - MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, - application_manager_)); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - hmi_capabilities.set_handle_response_for(*get_language); - application_manager_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VR_GetSupportedLanguages, application_manager_)); - application_manager_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VR_GetCapabilities, application_manager_)); - application_manager_.ManageHMICommand(get_capabilities); + utils::SharedPtr<smart_objects::SmartObject> get_language( + MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, + application_manager_)); + HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); + hmi_capabilities.set_handle_response_for(*get_language); + application_manager_.ManageHMICommand(get_language); + utils::SharedPtr<smart_objects::SmartObject> get_all_languages( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::VR_GetSupportedLanguages, + application_manager_)); + application_manager_.ManageHMICommand(get_all_languages); + utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + MessageHelper::CreateModuleInfoSO( + hmi_apis::FunctionID::VR_GetCapabilities, application_manager_)); + application_manager_.ManageHMICommand(get_capabilities); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc index 43b5daf847..bc211b44a4 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc @@ -315,8 +315,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, ui_result_, - ui_info_, message); + GetInfo(HmiInterfaces::HMI_INTERFACE_UI, ui_result_, ui_info_, message); if (hmi_apis::Common_Result::SUCCESS != ui_result_) { (*message_)[strings::msg_params].erase(strings::menu_params); } @@ -327,8 +326,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_VR, vr_result_, - vr_info_, message); + GetInfo(HmiInterfaces::HMI_INTERFACE_VR, vr_result_, vr_info_, message); if (hmi_apis::Common_Result::SUCCESS != vr_result_) { (*message_)[strings::msg_params].erase(strings::vr_commands); } @@ -362,10 +360,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { ui_result_, hmi_apis::Common_Result::INVALID_ENUM, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - const bool is_vr_unsupported = vr_result_ == - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - const bool is_ui_unsupported = ui_result_ == - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; + const bool is_vr_unsupported = + vr_result_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; + const bool is_ui_unsupported = + ui_result_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; const bool is_no_ui_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( ui_result_, @@ -471,10 +469,11 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { application_manager_.hmi_interfaces().GetInterfaceState( HmiInterfaces::HMI_INTERFACE_VR); - if (!BothSend() && ((is_vr_unsupported && HmiInterfaces::STATE_NOT_AVAILABLE == - vr_interface_state) || - (is_ui_unsupported && HmiInterfaces::STATE_NOT_AVAILABLE == - ui_interface_state))) { + if (!BothSend() && + ((is_vr_unsupported && + HmiInterfaces::STATE_NOT_AVAILABLE == vr_interface_state) || + (is_ui_unsupported && + HmiInterfaces::STATE_NOT_AVAILABLE == ui_interface_state))) { LOG4CXX_DEBUG(logger_, "!BothSend() && is_vr_or_ui_unsupported"); result = false; } diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc index b33d9d3f47..ffa827beaf 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc @@ -104,12 +104,13 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_AddSubMenu: { hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); std::string response_info; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); - const bool result = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); ApplicationSharedPtr application = application_manager_.application(connection_key()); @@ -126,7 +127,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { } SendResponse(result, MessageHelper::HMIToMobileResult(result_code), - response_info.empty()? NULL:response_info.c_str(), + response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); if (result) { application->UpdateHash(); diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc index f144498f47..5fe91b915d 100644 --- a/src/components/application_manager/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_request.cc @@ -165,8 +165,10 @@ void AlertRequest::on_event(const event_engine::Event& event) { // Mobile Alert request is successful when UI_Alert is successful alert_response_params_ = message[strings::msg_params]; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, alert_result_, - ui_response_info_, message); + GetInfo(HmiInterfaces::HMI_INTERFACE_UI, + alert_result_, + ui_response_info_, + message); break; } case hmi_apis::FunctionID::TTS_Speak: { @@ -176,8 +178,10 @@ void AlertRequest::on_event(const event_engine::Event& event) { awaiting_tts_speak_response_ = false; tts_speak_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_TTS, tts_speak_result_, - tts_response_info_, message); + GetInfo(HmiInterfaces::HMI_INTERFACE_TTS, + tts_speak_result_, + tts_response_info_, + message); break; } case hmi_apis::FunctionID::TTS_StopSpeaking: { @@ -205,14 +209,20 @@ void AlertRequest::on_event(const event_engine::Event& event) { &alert_response_params_); } -bool AlertRequest::PrepareResponseParameters(mobile_apis::Result::eType& result_code, - std::string& info) { - ResponseInfo ui_alert_info{alert_result_, HmiInterfaces::HMI_INTERFACE_UI, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - ResponseInfo tts_alert_info{tts_speak_result_, HmiInterfaces::HMI_INTERFACE_TTS, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; +bool AlertRequest::PrepareResponseParameters( + mobile_apis::Result::eType& result_code, std::string& info) { + ResponseInfo ui_alert_info{alert_result_, + HmiInterfaces::HMI_INTERFACE_UI, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + ResponseInfo tts_alert_info{tts_speak_result_, + HmiInterfaces::HMI_INTERFACE_TTS, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info); @@ -222,7 +232,7 @@ bool AlertRequest::PrepareResponseParameters(mobile_apis::Result::eType& result_ */ if (result && ui_alert_info.is_ok && tts_alert_info.is_unsupported_resource && HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) { - result = false; + result = false; } result_code = mobile_apis::Result::WARNINGS; if ((ui_alert_info.is_ok || ui_alert_info.is_invalid_enum) && diff --git a/src/components/application_manager/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/src/commands/mobile/change_registration_request.cc index aaf78a9e3e..6d3c435932 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_request.cc @@ -172,7 +172,9 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { pending_requests_.Remove(event_id); ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, ui_result_, ui_response_info_, + GetInfo(HmiInterfaces::HMI_INTERFACE_UI, + ui_result_, + ui_response_info_, message); break; } @@ -181,7 +183,9 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { pending_requests_.Remove(event_id); vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_VR, vr_result_, vr_response_info_, + GetInfo(HmiInterfaces::HMI_INTERFACE_VR, + vr_result_, + vr_response_info_, message); break; } @@ -190,7 +194,9 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { pending_requests_.Remove(event_id); tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_TTS, tts_result_, tts_response_info_, + GetInfo(HmiInterfaces::HMI_INTERFACE_TTS, + tts_result_, + tts_response_info_, message); break; } @@ -239,8 +245,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { } bool ChangeRegistrationRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, - std::string& response_info) { + mobile_apis::Result::eType& result_code, std::string& response_info) { LOG4CXX_AUTO_TRACE(logger_); using namespace helpers; const bool is_tts_succeeded_unsupported = @@ -261,8 +266,7 @@ bool ChangeRegistrationRequest::PrepareResponseParameters( hmi_apis::Common_Result::WRONG_LANGUAGE, hmi_apis::Common_Result::RETRY, hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE - ); + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); const bool is_vr_succeeded_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( @@ -272,8 +276,7 @@ bool ChangeRegistrationRequest::PrepareResponseParameters( hmi_apis::Common_Result::WRONG_LANGUAGE, hmi_apis::Common_Result::RETRY, hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE - ); + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); const bool is_tts_ui_vr_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ALL>( @@ -295,27 +298,28 @@ bool ChangeRegistrationRequest::PrepareResponseParameters( if ((result && is_tts_or_ui_or_vr_unsupported) || is_tts_ui_vr_unsupported) { result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; } else { - //If response contains erroneous result code SDL need return erroneus result code. - hmi_apis::Common_Result::eType ui_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType vr_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType tts_result = - hmi_apis::Common_Result::INVALID_ENUM; - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != ui_result_) { - ui_result = ui_result_; - } - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != vr_result_) { - vr_result = vr_result_; - } - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != tts_result_) { - tts_result = tts_result_; - } - result_code = MessageHelper::HMIToMobileResult( - std::max(std::max(ui_result, vr_result), tts_result)); + // If response contains erroneous result code SDL need return erroneus + // result code. + hmi_apis::Common_Result::eType ui_result = + hmi_apis::Common_Result::INVALID_ENUM; + hmi_apis::Common_Result::eType vr_result = + hmi_apis::Common_Result::INVALID_ENUM; + hmi_apis::Common_Result::eType tts_result = + hmi_apis::Common_Result::INVALID_ENUM; + if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != ui_result_) { + ui_result = ui_result_; + } + if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != vr_result_) { + vr_result = vr_result_; + } + if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != tts_result_) { + tts_result = tts_result_; + } + result_code = MessageHelper::HMIToMobileResult( + std::max(std::max(ui_result, vr_result), tts_result)); } - response_info = MergeInfos(ui_response_info_, vr_response_info_, - tts_response_info_); + response_info = + MergeInfos(ui_response_info_, vr_response_info_, tts_response_info_); return result; } diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc index ad8e367107..8c67f5f9d1 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc @@ -104,7 +104,7 @@ void DeleteCommandRequest::Run() { is_vr_send_ = true; } if (is_ui_send_) { - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true); + SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true); } if (is_vr_send_) { // VR params @@ -115,35 +115,41 @@ void DeleteCommandRequest::Run() { } bool DeleteCommandRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, - std::string& info) { - using namespace helpers; - ResponseInfo ui_delete_info{ui_result_, HmiInterfaces::HMI_INTERFACE_UI, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - ResponseInfo vr_delete_info{vr_result_, HmiInterfaces::HMI_INTERFACE_VR, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - const bool result = PrepareResultForMobileResponse(ui_delete_info, vr_delete_info); - - const bool is_vr_or_ui_warning = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_); - info = MergeInfos(ui_info_, vr_info_); - if (!result && hmi_apis::Common_Result::REJECTED == ui_result_ - && (!vr_delete_info.is_invalid_enum)) { - result_code = MessageHelper::HMIToMobileResult(vr_result_); - return result; - } - if (is_vr_or_ui_warning && !ui_delete_info.is_unsupported_resource && - !vr_delete_info.is_unsupported_resource) { - LOG4CXX_DEBUG(logger_, "VR or UI result is warning"); - result_code = mobile_apis::Result::WARNINGS; - return result; - } - result_code = PrepareResultCodeForResponse(ui_delete_info, vr_delete_info); - LOG4CXX_DEBUG(logger_, "Result is " << (result ? "true" : "false")); + mobile_apis::Result::eType& result_code, std::string& info) { + using namespace helpers; + ResponseInfo ui_delete_info{ui_result_, + HmiInterfaces::HMI_INTERFACE_UI, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + ResponseInfo vr_delete_info{vr_result_, + HmiInterfaces::HMI_INTERFACE_VR, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + const bool result = + PrepareResultForMobileResponse(ui_delete_info, vr_delete_info); + + const bool is_vr_or_ui_warning = + Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_); + info = MergeInfos(ui_info_, vr_info_); + if (!result && hmi_apis::Common_Result::REJECTED == ui_result_ && + (!vr_delete_info.is_invalid_enum)) { + result_code = MessageHelper::HMIToMobileResult(vr_result_); return result; + } + if (is_vr_or_ui_warning && !ui_delete_info.is_unsupported_resource && + !vr_delete_info.is_unsupported_resource) { + LOG4CXX_DEBUG(logger_, "VR or UI result is warning"); + result_code = mobile_apis::Result::WARNINGS; + return result; + } + result_code = PrepareResultCodeForResponse(ui_delete_info, vr_delete_info); + LOG4CXX_DEBUG(logger_, "Result is " << (result ? "true" : "false")); + return result; } void DeleteCommandRequest::on_event(const event_engine::Event& event) { @@ -154,7 +160,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_DeleteCommand: { is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + message[strings::params][hmi_response::code].asInt()); LOG4CXX_DEBUG(logger_, "Received UI_DeleteCommand event with result " << MessageHelper::HMIResultToString(ui_result_)); @@ -164,7 +170,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VR_DeleteCommand: { is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); + message[strings::params][hmi_response::code].asInt()); LOG4CXX_DEBUG(logger_, "Received VR_DeleteCommand event with result " << MessageHelper::HMIResultToString(vr_result_)); diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc index c3117eaf79..853578d60b 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc @@ -143,13 +143,14 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_DeleteSubMenu: { - hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( + hmi_apis::Common_Result::eType result_code = + static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); std::string response_info; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, - response_info, message); - const bool result = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); ApplicationSharedPtr application = application_manager_.application(connection_key()); @@ -169,7 +170,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { SendResponse(result, MessageHelper::HMIToMobileResult(result_code), - response_info.empty()?NULL:response_info.c_str(), + response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); if (result) { application->UpdateHash(); diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc index dc933ac352..349a542c15 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc @@ -56,12 +56,14 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_EndAudioPassThru: { - hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( + hmi_apis::Common_Result::eType result_code = + static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt()); std::string response_info; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); - const bool result = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); if (result) { bool ended_successfully = application_manager_.EndAudioPassThrough(); if (ended_successfully) { @@ -69,8 +71,9 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { } } - SendResponse(result, MessageHelper::HMIToMobileResult(result_code), - response_info.empty()?NULL:response_info.c_str(), + SendResponse(result, + MessageHelper::HMIToMobileResult(result_code), + response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); break; } diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc index 8f79a00314..52771ea8a0 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -94,8 +94,8 @@ void PerformAudioPassThruRequest::Run() { SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } - //According with new implementation processing of UNSUPPORTE_RESOURCE - //need set flag before sending to hmi + // According with new implementation processing of UNSUPPORTE_RESOURCE + // need set flag before sending to hmi awaiting_ui_response_ = true; if ((*message_)[str::msg_params].keyExists(str::initial_prompt) && @@ -122,13 +122,14 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { awaiting_ui_response_ = false; result_ui_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); + message[strings::params][hmi_response::code].asUInt()); GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_ui_, ui_info_, message); // 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"); - SendResponse(false, MessageHelper::HMIToMobileResult(result_ui_), + SendResponse(false, + MessageHelper::HMIToMobileResult(result_ui_), NULL, &(message[strings::msg_params])); return; @@ -139,8 +140,11 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_Speak: { LOG4CXX_INFO(logger_, "Received TTS_Speak event"); result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_TTS, result_tts_speak_, tts_info_, message); + message[strings::params][hmi_response::code].asUInt()); + GetInfo(HmiInterfaces::HMI_INTERFACE_TTS, + result_tts_speak_, + tts_info_, + message); awaiting_tts_speak_response_ = false; const bool is_tts_speak_success_unsuported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( @@ -175,36 +179,40 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { } } if (IsWaitingHMIResponse()) { - return; + return; } - std::string return_info; - mobile_apis::Result::eType result_code = - mobile_apis::Result::INVALID_ENUM; - const bool result = PrepareResponseParameters(result_code, return_info); + std::string return_info; + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; + const bool result = PrepareResponseParameters(result_code, return_info); - SendResponse(result, - result_code, - return_info.empty() ? NULL : return_info.c_str(), - &(message[strings::msg_params])); + SendResponse(result, + result_code, + return_info.empty() ? NULL : return_info.c_str(), + &(message[strings::msg_params])); } bool PerformAudioPassThruRequest::PrepareResponseParameters( mobile_apis::Result::eType& result_code, std::string& info) { LOG4CXX_AUTO_TRACE(logger_); - ResponseInfo ui_perform_info{result_ui_, HmiInterfaces::HMI_INTERFACE_UI, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - ResponseInfo tts_perform_info{result_tts_speak_, HmiInterfaces::HMI_INTERFACE_TTS, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - - bool result = PrepareResultForMobileResponse(ui_perform_info, tts_perform_info); - - - if (ui_perform_info.is_ok && - tts_perform_info.is_unsupported_resource && + ResponseInfo ui_perform_info{result_ui_, + HmiInterfaces::HMI_INTERFACE_UI, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + ResponseInfo tts_perform_info{result_tts_speak_, + HmiInterfaces::HMI_INTERFACE_TTS, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + + bool result = + PrepareResultForMobileResponse(ui_perform_info, tts_perform_info); + + if (ui_perform_info.is_ok && tts_perform_info.is_unsupported_resource && HmiInterfaces::STATE_AVAILABLE == tts_perform_info.interface_state) { result_code = mobile_apis::Result::WARNINGS; tts_info_ = "Unsupported phoneme type sent in a prompt"; @@ -224,18 +232,18 @@ void PerformAudioPassThruRequest::SendSpeakRequest() { SmartObject msg_params = smart_objects::SmartObject(SmartType_Map); for (uint32_t i = 0; - i < (*message_)[str::msg_params][str::initial_prompt].length(); - ++i) { - msg_params[hmi_request::tts_chunks][i][str::text] = - (*message_)[str::msg_params][str::initial_prompt][i][str::text]; - msg_params[hmi_request::tts_chunks][i][str::type] = - (*message_)[str::msg_params][str::initial_prompt][i][str::type]; - } - // app_id - msg_params[strings::app_id] = connection_key(); - msg_params[hmi_request::speak_type] = Common_MethodName::AUDIO_PASS_THRU; - awaiting_tts_speak_response_ = true; - SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true); + i < (*message_)[str::msg_params][str::initial_prompt].length(); + ++i) { + msg_params[hmi_request::tts_chunks][i][str::text] = + (*message_)[str::msg_params][str::initial_prompt][i][str::text]; + msg_params[hmi_request::tts_chunks][i][str::type] = + (*message_)[str::msg_params][str::initial_prompt][i][str::type]; + } + // app_id + msg_params[strings::app_id] = connection_key(); + msg_params[hmi_request::speak_type] = Common_MethodName::AUDIO_PASS_THRU; + awaiting_tts_speak_response_ = true; + SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true); } void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc index a3335b75e4..38faf84b62 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc @@ -229,9 +229,9 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { ui_response_recived_ = true; unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, ui_result_code_, - ui_info_, message); + message[strings::params][hmi_response::code].asUInt()); + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, ui_result_code_, ui_info_, message); if (ProcessUIResponse(event.smart_object(), msg_param)) { return; } @@ -241,12 +241,12 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction"); vr_response_recived_ = true; unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction); - vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_VR, vr_result_code_, - vr_info_, message); + vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asUInt()); + GetInfo( + HmiInterfaces::HMI_INTERFACE_VR, vr_result_code_, vr_info_, message); if (ProcessVRResponse(event.smart_object(), msg_param)) { - return; + return; } break; } @@ -314,18 +314,15 @@ bool PerformInteractionRequest::ProcessVRResponse( msg_params[strings::trigger_source] = static_cast<int32_t>(TriggerSource::TS_VR); - const bool is_vr_aborted_timeout = - Compare<Common_Result::eType, EQ, ONE>(vr_result_code_, - Common_Result::ABORTED, - Common_Result::TIMED_OUT); + const bool is_vr_aborted_timeout = Compare<Common_Result::eType, EQ, ONE>( + vr_result_code_, Common_Result::ABORTED, Common_Result::TIMED_OUT); if (is_vr_aborted_timeout) { LOG4CXX_DEBUG(logger_, "VR response aborted"); if (InteractionMode::VR_ONLY == interaction_mode_) { LOG4CXX_DEBUG(logger_, "Aborted or Timeout Send Close Popup"); TerminatePerformInteraction(); - SendResponse(false, - MessageHelper::HMIToMobileResult(vr_result_code_)); + SendResponse(false, MessageHelper::HMIToMobileResult(vr_result_code_)); return true; } LOG4CXX_DEBUG(logger_, "Update timeout for UI"); @@ -372,23 +369,24 @@ bool PerformInteractionRequest::ProcessUIResponse( } HmiInterfaces::InterfaceState ui_interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_UI); - bool result = false; + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::HMI_INTERFACE_UI); + bool result = false; result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( ui_result_code_, hmi_apis::Common_Result::SUCCESS, hmi_apis::Common_Result::WARNINGS); result = result || - (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_code_ && - HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state); + (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_code_ && + HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state); const bool is_pi_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( ui_result_code_, hmi_apis::Common_Result::WARNINGS); - const bool is_pi_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); + const bool is_pi_unsupported = + Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); if (result) { if (is_pi_warning) { @@ -425,11 +423,11 @@ bool PerformInteractionRequest::ProcessUIResponse( const SmartObject* response_params = msg_params.empty() ? NULL : &msg_params; if (mobile_apis::InteractionMode::BOTH != interaction_mode_ && - HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state) { + HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state) { DisablePerformInteraction(); SendResponse(result, MessageHelper::HMIToMobileResult(ui_result_code_), - ui_info_.empty()?NULL:ui_info_.c_str(), + ui_info_.empty() ? NULL : ui_info_.c_str(), response_params); return true; } @@ -938,24 +936,31 @@ void PerformInteractionRequest::SendBothModeResponse( const smart_objects::SmartObject& msg_param) { LOG4CXX_AUTO_TRACE(logger_); mobile_apis::Result::eType perform_interaction_result_code = - mobile_apis::Result::INVALID_ENUM; - ResponseInfo ui_perform_info{ui_result_code_, HmiInterfaces::HMI_INTERFACE_UI, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - ResponseInfo vr_perform_info{vr_result_code_, HmiInterfaces::HMI_INTERFACE_VR, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - - const bool result = PrepareResultForMobileResponse(ui_perform_info, vr_perform_info); + mobile_apis::Result::INVALID_ENUM; + ResponseInfo ui_perform_info{ui_result_code_, + HmiInterfaces::HMI_INTERFACE_UI, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + ResponseInfo vr_perform_info{vr_result_code_, + HmiInterfaces::HMI_INTERFACE_VR, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + + const bool result = + PrepareResultForMobileResponse(ui_perform_info, vr_perform_info); perform_interaction_result_code = - PrepareResultCodeForResponse(ui_perform_info, vr_perform_info); + PrepareResultCodeForResponse(ui_perform_info, vr_perform_info); const smart_objects::SmartObject* response_params = msg_param.empty() ? NULL : &msg_param; - std::string info = MergeInfos(ui_info_, vr_info_); + std::string info = MergeInfos(ui_info_, vr_info_); DisablePerformInteraction(); SendResponse(result, perform_interaction_result_code, - info.empty()?NULL:info.c_str(), + info.empty() ? NULL : info.c_str(), response_params); } diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc index c34c814198..f0cc3aa3dd 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc @@ -128,18 +128,18 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event"); hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( + static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); std::string response_info; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, - message); + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); - const bool result = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); SendResponse(result, MessageHelper::HMIToMobileResult(result_code), - response_info.empty()?NULL:response_info.c_str(), + response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); break; } diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc index 67aadfa7f1..e2dc10be26 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc @@ -235,13 +235,13 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetAppIcon: { hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asInt()); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); std::string response_info; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, - message); + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); if (result) { ApplicationSharedPtr app = application_manager_.application(connection_key()); @@ -262,7 +262,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { SendResponse(result, MessageHelper::HMIToMobileResult(result_code), - response_info.empty()?NULL:response_info.c_str(), + response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); break; } diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc index a9188e59f0..8036692eea 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc @@ -71,10 +71,10 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_SetDisplayLayout: { LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event"); hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( + static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool response_success = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + const bool response_success = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); std::string info; GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, info, message); smart_objects::SmartObject msg_params = message[strings::msg_params]; @@ -96,7 +96,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { } SendResponse(response_success, MessageHelper::HMIToMobileResult(result_code), - info.empty()?NULL:info.c_str(), + info.empty() ? NULL : info.c_str(), &msg_params); break; } diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc index 322641dea3..dc9de7e69d 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc @@ -232,7 +232,8 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, ui_result_, + GetInfo(HmiInterfaces::HMI_INTERFACE_UI, + ui_result_, ui_response_info_, message); break; @@ -243,7 +244,9 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(HmiInterfaces::HMI_INTERFACE_TTS, - tts_result_, tts_response_info_, message); + tts_result_, + tts_response_info_, + message); break; } default: { @@ -284,22 +287,31 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( LOG4CXX_AUTO_TRACE(logger_); using namespace helpers; - ResponseInfo ui_properties_info{ui_result_, HmiInterfaces::HMI_INTERFACE_UI, - HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - ResponseInfo tts_properties_info{tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, + ResponseInfo ui_properties_info{ui_result_, + HmiInterfaces::HMI_INTERFACE_UI, HmiInterfaces::STATE_NOT_RESPONSE, - false, false, false}; - - bool result = PrepareResultForMobileResponse(ui_properties_info, tts_properties_info); - if (result && (HmiInterfaces::STATE_AVAILABLE == tts_properties_info.interface_state) && + false, + false, + false}; + ResponseInfo tts_properties_info{tts_result_, + HmiInterfaces::HMI_INTERFACE_TTS, + HmiInterfaces::STATE_NOT_RESPONSE, + false, + false, + false}; + + bool result = + PrepareResultForMobileResponse(ui_properties_info, tts_properties_info); + if (result && + (HmiInterfaces::STATE_AVAILABLE == tts_properties_info.interface_state) && (tts_properties_info.is_unsupported_resource)) { result_code = mobile_apis::Result::WARNINGS; tts_response_info_ = "Unsupported phoneme type sent in a prompt"; info = MergeInfos(tts_response_info_, ui_response_info_); return result; } - result_code = PrepareResultCodeForResponse(ui_properties_info, tts_properties_info); + result_code = + PrepareResultCodeForResponse(ui_properties_info, tts_properties_info); info = MergeInfos(tts_response_info_, ui_response_info_); return result; } diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc index 014918a4aa..085e55c3af 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc @@ -85,15 +85,18 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetMediaClockTimer: { - hmi_apis::Common_Result::eType result_code =static_cast<hmi_apis::Common_Result::eType>( + hmi_apis::Common_Result::eType result_code = + static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); std::string response_info; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, result_code, response_info, message); - SendResponse(result, MessageHelper::HMIToMobileResult(result_code), - response_info.empty()?NULL:response_info.c_str(), + SendResponse(result, + MessageHelper::HMIToMobileResult(result_code), + response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); break; } diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc index 13fa4a2c42..efb3d1fb67 100644 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_request.cc @@ -229,13 +229,13 @@ void ShowRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received UI_Show event."); std::string response_info; hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( + static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse(result_code, - HmiInterfaces::HMI_INTERFACE_UI); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); GetInfo(HmiInterfaces::InterfaceID::HMI_INTERFACE_UI, - result_code, - response_info, + result_code, + response_info, message); if (hmi_apis::Common_Result::WARNINGS == result_code && message[strings::params].keyExists(hmi_response::message)) { diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc index 5c07056afb..892f6c3f5d 100644 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/src/commands/mobile/slider_request.cc @@ -133,8 +133,7 @@ void SliderRequest::on_event(const event_engine::Event& event) { LOG4CXX_DEBUG(logger_, "Received UI_Slider event"); - const Common_Result::eType response_code = - static_cast<Common_Result::eType>( + const Common_Result::eType response_code = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); SmartObject response_msg_params = message[strings::msg_params]; @@ -156,14 +155,14 @@ void SliderRequest::on_event(const event_engine::Event& event) { } } std::string response_info; - GetInfo(HmiInterfaces::HMI_INTERFACE_UI, response_code, response_info, message); - const bool is_response_success = - PrepareResultForMobileResponse(response_code, HmiInterfaces::HMI_INTERFACE_UI); - + GetInfo( + HmiInterfaces::HMI_INTERFACE_UI, response_code, response_info, message); + const bool is_response_success = PrepareResultForMobileResponse( + response_code, HmiInterfaces::HMI_INTERFACE_UI); SendResponse(is_response_success, MessageHelper::HMIToMobileResult(response_code), - response_info.empty()?NULL:response_info.c_str(), + response_info.empty() ? NULL : response_info.c_str(), &response_msg_params); } diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc index 7735dbc0b9..c6fa321401 100644 --- a/src/components/application_manager/src/hmi_capabilities_impl.cc +++ b/src/components/application_manager/src/hmi_capabilities_impl.cc @@ -1074,8 +1074,8 @@ HMILanguageHandler& HMICapabilitiesImpl::get_hmi_language_handler() { } void HMICapabilitiesImpl::set_handle_response_for( - const smart_objects::SmartObject& request) { - hmi_language_handler_.set_handle_response_for(request); + const smart_objects::SmartObject& request) { + hmi_language_handler_.set_handle_response_for(request); } } // namespace application_manager diff --git a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc index 1d76cf7cf1..aa4b450a98 100644 --- a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc @@ -61,10 +61,10 @@ using am::event_engine::Event; typedef SharedPtr<VIIsReadyRequest> VIIsReadyRequestPtr; -class VIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { - public: - VIIsReadyRequestTest() - :command_(CreateCommand<VIIsReadyRequest>()) {} +class VIIsReadyRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + VIIsReadyRequestTest() : command_(CreateCommand<VIIsReadyRequest>()) {} void SetUpExpectations(bool is_vi_cooperating_available, bool is_send_message_to_hmi, @@ -77,13 +77,13 @@ class VIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNic if (is_message_contain_param) { EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(mock_hmi_interfaces_)); + .WillRepeatedly(ReturnRef(mock_hmi_interfaces_)); EXPECT_CALL(mock_hmi_interfaces_, - SetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VehicleInfo, - state)); + SetInterfaceState( + am::HmiInterfaces::HMI_INTERFACE_VehicleInfo, state)); } else { EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillOnce(ReturnRef(mock_hmi_interfaces_)); + .WillOnce(ReturnRef(mock_hmi_interfaces_)); EXPECT_CALL(mock_hmi_interfaces_, SetInterfaceState(_, _)).Times(0); } EXPECT_CALL(app_mngr_, GetPolicyHandler()) @@ -91,8 +91,8 @@ class VIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNic EXPECT_CALL(mock_policy_handler_interface_, OnVIIsReady()); EXPECT_CALL(mock_hmi_interfaces_, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VehicleInfo)) - .WillOnce(Return(state)); + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VehicleInfo)) + .WillOnce(Return(state)); if (is_send_message_to_hmi) { ExpectSendMessagesToHMI(); @@ -102,17 +102,17 @@ class VIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNic void ExpectSendMessagesToHMI() { smart_objects::SmartObjectSPtr ivi_type; EXPECT_CALL( - *(MockMessageHelper::message_helper_mock()), - CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _)) - .WillOnce(Return(ivi_type)); + *(MockMessageHelper::message_helper_mock()), + CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _)) + .WillOnce(Return(ivi_type)); EXPECT_CALL(app_mngr_, ManageHMICommand(ivi_type)); } void PrepareEvent(bool is_message_contain_param, - Event& event, - bool is_vi_cooperating_available = false) { + Event& event, + bool is_vi_cooperating_available = false) { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); - if(is_message_contain_param) { + if (is_message_contain_param) { (*msg)[am::strings::msg_params][am::strings::available] = is_vi_cooperating_available; } @@ -125,8 +125,7 @@ class VIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNic policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_; }; -TEST_F(VIIsReadyRequestTest, - Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) { +TEST_F(VIIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) { const bool is_vi_cooperating_available = false; const bool is_send_message_to_hmi = true; const bool is_message_contain_param = false; diff --git a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc index 6f563901e6..e5989d0b64 100644 --- a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc @@ -59,10 +59,10 @@ using am::event_engine::Event; typedef SharedPtr<VRIsReadyRequest> VRIsReadyRequestPtr; -class VRIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { +class VRIsReadyRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - VRIsReadyRequestTest() - : command_(CreateCommand<VRIsReadyRequest>()) {} + VRIsReadyRequestTest() : command_(CreateCommand<VRIsReadyRequest>()) {} void SetUpExpectations(bool is_vr_cooperating_available, bool is_send_message_to_hmi, @@ -82,18 +82,18 @@ class VRIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNic if (is_message_contain_param) { EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(mock_hmi_interfaces_)); - EXPECT_CALL(mock_hmi_interfaces_, - SetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR, - state)); + .WillRepeatedly(ReturnRef(mock_hmi_interfaces_)); + EXPECT_CALL( + mock_hmi_interfaces_, + SetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR, state)); } else { EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillOnce(ReturnRef(mock_hmi_interfaces_)); + .WillOnce(ReturnRef(mock_hmi_interfaces_)); EXPECT_CALL(mock_hmi_interfaces_, SetInterfaceState(_, _)).Times(0); } EXPECT_CALL(mock_hmi_interfaces_, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) - .WillOnce(Return(state)); + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) + .WillOnce(Return(state)); } void ExpectSendMessagesToHMI(bool is_send_message_by_timeout) { @@ -103,33 +103,34 @@ class VRIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNic } smart_objects::SmartObjectSPtr language( - new smart_objects::SmartObject(smart_objects::SmartType_Map)); - EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), - CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _)) - .WillOnce(Return(language)); - EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language)); - EXPECT_CALL(app_mngr_, ManageHMICommand(language)); - - smart_objects::SmartObjectSPtr support_language( - new smart_objects::SmartObject(smart_objects::SmartType_Map)); - EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), - CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, - _)).WillOnce(Return(support_language)); - EXPECT_CALL(app_mngr_, ManageHMICommand(support_language)); - - smart_objects::SmartObjectSPtr capabilities( - new smart_objects::SmartObject(smart_objects::SmartType_Map)); - EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), - CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _)) - .WillOnce(Return(capabilities)); - EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities)); + new smart_objects::SmartObject(smart_objects::SmartType_Map)); + EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), + CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _)) + .WillOnce(Return(language)); + EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language)); + EXPECT_CALL(app_mngr_, ManageHMICommand(language)); + + smart_objects::SmartObjectSPtr support_language( + new smart_objects::SmartObject(smart_objects::SmartType_Map)); + EXPECT_CALL( + *(MockMessageHelper::message_helper_mock()), + CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _)) + .WillOnce(Return(support_language)); + EXPECT_CALL(app_mngr_, ManageHMICommand(support_language)); + + smart_objects::SmartObjectSPtr capabilities( + new smart_objects::SmartObject(smart_objects::SmartType_Map)); + EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), + CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _)) + .WillOnce(Return(capabilities)); + EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities)); } void PrepareEvent(bool is_message_contain_param, - Event& event, - bool is_vr_cooperating_available = false) { + Event& event, + bool is_vr_cooperating_available = false) { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); - if(is_message_contain_param) { + if (is_message_contain_param) { (*msg)[am::strings::msg_params][am::strings::available] = is_vr_cooperating_available; } @@ -141,8 +142,7 @@ class VRIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNic application_manager_test::MockHMICapabilities mock_hmi_capabilities_; }; -TEST_F(VRIsReadyRequestTest, - Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) { +TEST_F(VRIsReadyRequestTest, Run_NoKeyAvailableInMessage_HmiInterfacesIgnored) { const bool is_vr_cooperating_available = false; const bool is_send_message_to_hmi = true; const bool is_message_contain_param = false; @@ -156,16 +156,16 @@ TEST_F(VRIsReadyRequestTest, } TEST_F(VRIsReadyRequestTest, Run_KeyAvailableEqualToFalse_StateNotAvailable) { -const bool is_vr_cooperating_available = false; -const bool is_send_message_to_hmi = false; -const bool is_message_contain_param = true; -Event event(hmi_apis::FunctionID::VR_IsReady); -PrepareEvent(is_message_contain_param, event); -SetUpExpectations(is_vr_cooperating_available, - is_send_message_to_hmi, - is_message_contain_param, - am::HmiInterfaces::STATE_NOT_AVAILABLE); -command_->on_event(event); + const bool is_vr_cooperating_available = false; + const bool is_send_message_to_hmi = false; + const bool is_message_contain_param = true; + Event event(hmi_apis::FunctionID::VR_IsReady); + PrepareEvent(is_message_contain_param, event); + SetUpExpectations(is_vr_cooperating_available, + is_send_message_to_hmi, + is_message_contain_param, + am::HmiInterfaces::STATE_NOT_AVAILABLE); + command_->on_event(event); } TEST_F(VRIsReadyRequestTest, Run_KeyAvailableEqualToTrue_StateAvailable) { diff --git a/src/components/application_manager/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/test/commands/mobile/change_registration_test.cc index e8aee29055..e5cdaa0f1c 100644 --- a/src/components/application_manager/test/commands/mobile/change_registration_test.cc +++ b/src/components/application_manager/test/commands/mobile/change_registration_test.cc @@ -92,17 +92,16 @@ class ChangeRegistrationRequestTest (*msg)[strings::params][strings::connection_key] = kConnectionKey; smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::hmi_display_language] = - mobile_apis::Language::EN_US; - msg_params[strings::language] = - mobile_apis::Language::EN_US; + msg_params[strings::hmi_display_language] = mobile_apis::Language::EN_US; + msg_params[strings::language] = mobile_apis::Language::EN_US; (*msg)[strings::msg_params] = msg_params; return msg; } void PrepareExpectationBeforeRun() { ON_CALL(app_mngr_, hmi_capabilities()) .WillByDefault(ReturnRef(hmi_capabilities_)); - smart_objects::SmartObject supported_languages(smart_objects::SmartType_Array); + smart_objects::SmartObject supported_languages( + smart_objects::SmartType_Array); supported_languages[0] = static_cast<int32_t>(mobile_apis::Language::EN_US); EXPECT_CALL(hmi_capabilities_, ui_supported_languages()) .WillOnce(Return(&supported_languages)); @@ -112,34 +111,36 @@ class ChangeRegistrationRequestTest .WillOnce(Return(&supported_languages)); EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces_)); - EXPECT_CALL(hmi_interfaces_, GetInterfaceFromFunction( - hmi_apis::FunctionID::UI_ChangeRegistration)) + .WillRepeatedly(ReturnRef(hmi_interfaces_)); + EXPECT_CALL( + hmi_interfaces_, + GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState( - am::HmiInterfaces::HMI_INTERFACE_UI)) + EXPECT_CALL(hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(hmi_interfaces_, GetInterfaceFromFunction( - hmi_apis::FunctionID::VR_ChangeRegistration)) + EXPECT_CALL( + hmi_interfaces_, + GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState( - am::HmiInterfaces::HMI_INTERFACE_VR)) + EXPECT_CALL(hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(hmi_interfaces_, GetInterfaceFromFunction( - hmi_apis::FunctionID::TTS_ChangeRegistration)) + EXPECT_CALL( + hmi_interfaces_, + GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration)) .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); - EXPECT_CALL(hmi_interfaces_, GetInterfaceState( - am::HmiInterfaces::HMI_INTERFACE_TTS)) + EXPECT_CALL(hmi_interfaces_, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); } void CreateResponseFromHMI(MessageSharedPtr msg, hmi_apis::Common_Result::eType result, const std::string& info) { - (*msg)[strings::params][hmi_response::code] = - static_cast<int32_t>(result); + (*msg)[strings::params][hmi_response::code] = static_cast<int32_t>(result); (*msg)[strings::msg_params][strings::info] = info; } @@ -149,7 +150,6 @@ class ChangeRegistrationRequestTest MockHMICapabilities; MockHMICapabilities hmi_capabilities_; MockHmiInterfaces hmi_interfaces_; - }; typedef ChangeRegistrationRequestTest::MockHMICapabilities MockHMICapabilities; @@ -180,25 +180,27 @@ TEST_F(ChangeRegistrationRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { MessageSharedPtr vr_response = CreateMessage(smart_objects::SmartType_Map); MessageSharedPtr tts_response = CreateMessage(smart_objects::SmartType_Map); CreateResponseFromHMI( - ui_response, hmi_apis::Common_Result::WARNINGS,"ui_info"); - CreateResponseFromHMI( - vr_response, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "unsupported_resource"); + ui_response, hmi_apis::Common_Result::WARNINGS, "ui_info"); + CreateResponseFromHMI(vr_response, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, + "unsupported_resource"); CreateResponseFromHMI( - tts_response, hmi_apis::Common_Result::SUCCESS, "tts_info"); + tts_response, hmi_apis::Common_Result::SUCCESS, "tts_info"); am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_ChangeRegistration); event_ui.set_smart_object(*ui_response); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_ChangeRegistration); event_vr.set_smart_object(*vr_response); - am::event_engine::Event event_tts(hmi_apis::FunctionID::TTS_ChangeRegistration); + am::event_engine::Event event_tts( + hmi_apis::FunctionID::TTS_ChangeRegistration); event_tts.set_smart_object(*tts_response); MessageSharedPtr response_to_mobile; EXPECT_CALL( - app_mngr_, - ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) - .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); + app_mngr_, + ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) + .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); command->on_event(event_ui); command->on_event(event_vr); diff --git a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc index a5f0e837fa..3b6a66f112 100644 --- a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc +++ b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc @@ -68,7 +68,6 @@ using ::testing::ReturnRef; using am::commands::PerformInteractionRequest; using ::test::components::application_manager_test::MockApplication; - namespace strings = ::application_manager::strings; namespace hmi_response = ::application_manager::hmi_response; @@ -85,7 +84,8 @@ class PerformInteractionRequestTest }; TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { - MessageSharedPtr response_msg_vr = CreateMessage(smart_objects::SmartType_Map); + MessageSharedPtr response_msg_vr = + CreateMessage(smart_objects::SmartType_Map); (*response_msg_vr)[strings::params][hmi_response::code] = static_cast<uint64_t>(hmi_apis::Common_Result::SUCCESS); (*response_msg_vr)[strings::msg_params][strings::info] = "info"; @@ -103,9 +103,10 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { command->Init(); command->on_event(event); - MessageSharedPtr response_to_mobile = CreateMessage(smart_objects::SmartType_Map); + MessageSharedPtr response_to_mobile = + CreateMessage(smart_objects::SmartType_Map); (*response_to_mobile)[strings::msg_params][strings::result_code] = - static_cast<uint64_t>(am::mobile_api::Result::GENERIC_ERROR); + static_cast<uint64_t>(am::mobile_api::Result::GENERIC_ERROR); MockMessageHelper* mock_message_helper = MockMessageHelper::message_helper_mock(); EXPECT_CALL( @@ -129,7 +130,8 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { } TEST_F(PerformInteractionRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { - MessageSharedPtr msg_from_mobile = CreateMessage(smart_objects::SmartType_Map); + MessageSharedPtr msg_from_mobile = + CreateMessage(smart_objects::SmartType_Map); (*msg_from_mobile)[strings::params][strings::connection_key] = kConnectionKey; (*msg_from_mobile)[strings::msg_params][strings::interaction_mode] = mobile_apis::InteractionMode::VR_ONLY; @@ -142,27 +144,32 @@ TEST_F(PerformInteractionRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { MockHmiInterfaces hmi_interfaces; EXPECT_CALL(app_mngr_, hmi_interfaces()) - .WillRepeatedly(ReturnRef(hmi_interfaces)); + .WillRepeatedly(ReturnRef(hmi_interfaces)); - MessageSharedPtr response_msg_vr = CreateMessage(smart_objects::SmartType_Map); + MessageSharedPtr response_msg_vr = + CreateMessage(smart_objects::SmartType_Map); (*response_msg_vr)[strings::params][hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - (*response_msg_vr)[strings::params][strings::info] = "VR is not supported by system"; + (*response_msg_vr)[strings::params][strings::info] = + "VR is not supported by system"; (*response_msg_vr)[strings::msg_params][strings::cmd_id] = kCommandId; am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); event_vr.set_smart_object(*response_msg_vr); - MessageSharedPtr response_msg_ui = CreateMessage(smart_objects::SmartType_Map); + MessageSharedPtr response_msg_ui = + CreateMessage(smart_objects::SmartType_Map); (*response_msg_ui)[strings::params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS; am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction); event_ui.set_smart_object(*response_msg_ui); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(hmi_interfaces, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) + EXPECT_CALL(hmi_interfaces, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); + EXPECT_CALL(hmi_interfaces, + GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); MessageSharedPtr response_to_mobile; diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc index 4d4cae30af..738797b122 100644 --- a/src/components/application_manager/test/hmi_capabilities_test.cc +++ b/src/components/application_manager/test/hmi_capabilities_test.cc @@ -388,8 +388,8 @@ TEST_F(HMICapabilitiesTest, SetUICooperating) { } TEST_F(HMICapabilitiesTest, SetIviCooperating) { - hmi_capabilities_test->set_is_ivi_cooperating(true); - EXPECT_EQ(true, hmi_capabilities_test->is_ivi_cooperating()); + hmi_capabilities_test->set_is_ivi_cooperating(true); + EXPECT_EQ(true, hmi_capabilities_test->is_ivi_cooperating()); } } // namespace application_manager_test diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h index 8875a6f4c5..a8664f5e2c 100644 --- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h +++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h @@ -43,7 +43,7 @@ namespace components { namespace application_manager_test { class MockHMICapabilities : public ::application_manager::HMICapabilities { - public: + public: MOCK_CONST_METHOD1(VerifyImageType, bool(const int32_t image_type)); MOCK_CONST_METHOD0(is_vr_cooperating, bool()); @@ -160,8 +160,8 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities { MOCK_METHOD1(set_ccpu_version, void(const std::string& ccpu_version)); MOCK_METHOD0(get_hmi_language_handler, application_manager::HMILanguageHandler&()); - MOCK_METHOD1(set_handle_response_for, void ( - const smart_objects::SmartObject& request)); + MOCK_METHOD1(set_handle_response_for, + void(const smart_objects::SmartObject& request)); protected: MOCK_CONST_METHOD2(check_existing_json_member, |