diff options
author | Anton Hrytsevich (GitHub) <AGritsevich@users.noreply.github.com> | 2016-10-11 15:20:53 +0300 |
---|---|---|
committer | dtrunov <dtrunov@luxoft.com> | 2016-10-11 17:28:34 +0300 |
commit | 10772ba87420736ca6db279d8dcf7d04b591f8bf (patch) | |
tree | cdae5ae516ca6d8bbf74e738df6e23cd4563f1ed /src | |
parent | 2e436abb0c431e1d0d9e8a08fa6ab56ba43adc5e (diff) | |
download | sdl_core-10772ba87420736ca6db279d8dcf7d04b591f8bf.tar.gz |
Fix problems according to test coverage (#1)
* Fix problems according to test coverage
Related-tesk: [APPLINK-25171](https://adc.luxoft.com/jira/browse/APPLINK-25171)
Diffstat (limited to 'src')
3 files changed, 41 insertions, 4 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 d8929c7a2a..47ec32cc74 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 @@ -1,5 +1,5 @@ /* - Copyright (c) 2014, Ford Motor Company + Copyright (c) 2016, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,6 +85,23 @@ namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; std::string MergeInfos(const std::string& first, const std::string& second); /** + * @brief MergeInfos merge 2 infos into one string with info + * @param first_info -contains result_code from HMI response and + * interface that returns response + * @param first_str - info string that should be first in result info + * @param second_info -contains result_code from HMI response and + * interface that returns response + * @param second_str - info string that should be second in result info + * @return if first_info is not available and second_str not empty return second + * if second_info is not available and first_str not empty return first + * other cases return result MergeInfos for 2 params + */ +std::string MergeInfos(const ResponseInfo& first_info, + const std::string& first_str, + const ResponseInfo& second_info, + const std::string& second_str); + +/** * @brief MergeInfos merge 3 infos in one string * @param first - info string that should be first in result info * @param second - info string that should be second in result info 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 f8840057f1..4e10775a4e 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2016, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -41,6 +41,25 @@ namespace application_manager { namespace commands { +std::string MergeInfos(const ResponseInfo& first_info, + const std::string& first_str, + const ResponseInfo& second_info, + const std::string& second_str) { + if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !second_str.empty()) { + return second_str; + } + + if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !first_str.empty()) { + return first_str; + } + + return MergeInfos(first_str, second_str); +} + std::string MergeInfos(const std::string& first, const std::string& second) { return first + ((!first.empty() && !second.empty()) ? ", " : "") + second; } diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc index 6042fb1815..2b55f76115 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc @@ -200,7 +200,7 @@ bool AlertManeuverRequest::PrepareResponseParameters( HmiInterfaces::HMI_INTERFACE_Navigation); application_manager::commands::ResponseInfo tts_alert_info( - tts_speak_result_code_, HmiInterfaces::HMI_INTERFACE_Navigation); + tts_speak_result_code_, HmiInterfaces::HMI_INTERFACE_TTS); const bool result = PrepareResultForMobileResponse(navigation_alert_info, tts_alert_info); @@ -215,7 +215,8 @@ bool AlertManeuverRequest::PrepareResponseParameters( } result_code = PrepareResultCodeForResponse(navigation_alert_info, tts_alert_info); - return_info = MergeInfos(info_navi_, info_tts_); + return_info = + MergeInfos(navigation_alert_info, info_navi_, tts_alert_info, info_tts_); return result; } |