summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h2
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h31
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc15
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_request.cc17
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_request.cc17
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc20
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_request.cc57
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc23
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc49
-rw-r--r--src/components/application_manager/src/commands/mobile/speak_request.cc15
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc2
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc39
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_request_test.cc42
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/set_global_properties_test.cc18
-rw-r--r--src/components/application_manager/test/commands/mobile/speak_request_test.cc10
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h4
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc8
-rw-r--r--src/components/interfaces/HMI_API.xml11
-rw-r--r--src/components/interfaces/MOBILE_API.xml7
20 files changed, 380 insertions, 30 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
index 5713e2e814..a88789bc73 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
@@ -210,7 +210,7 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
private:
std::string response_info_;
- mobile_apis::Result::eType result_checking_app_hmi_type_;
+ mobile_apis::Result::eType result_code_;
policy::PolicyHandlerInterface& GetPolicyHandler();
DISALLOW_COPY_AND_ASSIGN(RegisterAppInterfaceRequest);
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index b94609c01b..57a2f847bf 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -549,6 +549,37 @@ class MessageHelper {
int32_t result_code);
/**
+ * @brief Get the full file path of an app file
+ *
+ * @param file_name The relative path of an application file
+ * @param app Current application
+ * @param app_mngr Application manager
+ *
+ * @return The full file path of the application file if valid,
+ * empty string otherwise
+ */
+ static std::string GetAppFilePath(std::string file_name,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief Verify that all ttsChunks with FILE type
+ * in an array include an existing file and set full path
+ *
+ * @param tts_chunks SmartObject with an array of TTSChunks
+ * @param app Current application
+ * @param app_mngr Application manager
+ *
+ * @return FILE_NOT_FOUND if one of the TTSChunks
+ * included a file which wasn't present on disk,
+ * SUCCESS otherwise
+ */
+ static mobile_apis::Result::eType VerifyTtsFiles(
+ smart_objects::SmartObject& tts_chunks,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
+
+ /**
* @brief Verify image and add image file full path
* and add path, although the image doesn't exist
* @param SmartObject with image
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 d5767690d7..dee364cb99 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
@@ -92,6 +92,21 @@ void AlertManeuverRequest::Run() {
// check TTSChunk parameter
if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
+ smart_objects::SmartObject& tts_chunks =
+ (*message_)[strings::msg_params][strings::tts_chunks];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "One or more files needed for tts_chunks are not present");
+ return;
+ }
+
if (0 < (*message_)[strings::msg_params][strings::tts_chunks].length()) {
pending_requests_.Add(hmi_apis::FunctionID::TTS_Speak);
tts_is_ok = true;
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 3c42e43767..e0cbe9e600 100644
--- a/src/components/application_manager/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_request.cc
@@ -281,6 +281,23 @@ bool AlertRequest::Validate(uint32_t app_id) {
return false;
}
+ if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
+ smart_objects::SmartObject& tts_chunks =
+ (*message_)[strings::msg_params][strings::tts_chunks];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "One or more files needed for tts_chunks are not present");
+ return false;
+ }
+ }
+
return true;
}
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 f55767c723..06027a42db 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
@@ -178,6 +178,23 @@ void ChangeRegistrationRequest::Run() {
return;
}
+ if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) {
+ smart_objects::SmartObject& tts_name =
+ (*message_)[strings::msg_params][strings::tts_name];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(tts_name, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "One or more files needed for tts_name are not present");
+ return;
+ }
+ }
+
const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
const HmiInterfaces::InterfaceState vr_state =
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 20076ac50c..a758f04aac 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
@@ -96,8 +96,24 @@ void PerformAudioPassThruRequest::Run() {
// need set flag before sending to hmi
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- if ((*message_)[str::msg_params].keyExists(str::initial_prompt) &&
- (0 < (*message_)[str::msg_params][str::initial_prompt].length())) {
+ if ((*message_)[str::msg_params].keyExists(str::initial_prompt)) {
+ smart_objects::SmartObject& initial_prompt =
+ (*message_)[strings::msg_params][strings::initial_prompt];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(
+ initial_prompt, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ SendResponse(
+ false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "One or more files needed for initial_prompt are not present");
+ return;
+ }
+
// In case TTS Speak, subscribe on notification
SendSpeakRequest();
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 68940158b9..86ab0a97c0 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
@@ -31,6 +31,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <numeric>
#include <string.h>
#include <string>
#include "application_manager/commands/mobile/perform_interaction_request.h"
@@ -536,9 +537,21 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
}
}
+ std::vector<std::string> invalid_params;
if ((*message_)[strings::msg_params].keyExists(strings::help_prompt)) {
- msg_params[strings::help_prompt] =
+ smart_objects::SmartObject& help_prompt =
(*message_)[strings::msg_params][strings::help_prompt];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_WARN(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ invalid_params.push_back("help_prompt");
+ } else {
+ msg_params[strings::help_prompt] = help_prompt;
+ }
} else {
if (choice_list.length() != 0) {
msg_params[strings::help_prompt] =
@@ -573,8 +586,20 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
}
if ((*message_)[strings::msg_params].keyExists(strings::timeout_prompt)) {
- msg_params[strings::timeout_prompt] =
+ smart_objects::SmartObject& timeout_prompt =
(*message_)[strings::msg_params][strings::timeout_prompt];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(
+ timeout_prompt, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_WARN(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ invalid_params.push_back("timeout_prompt");
+ } else {
+ msg_params[strings::timeout_prompt] = timeout_prompt;
+ }
} else {
if (msg_params.keyExists(strings::help_prompt)) {
msg_params[strings::timeout_prompt] = msg_params[strings::help_prompt];
@@ -582,8 +607,34 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
}
if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) {
- msg_params[strings::initial_prompt] =
+ smart_objects::SmartObject& initial_prompt =
(*message_)[strings::msg_params][strings::initial_prompt];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(
+ initial_prompt, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_WARN(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ invalid_params.push_back("initial_prompt");
+ } else {
+ msg_params[strings::initial_prompt] = initial_prompt;
+ }
+ }
+
+ if (!invalid_params.empty()) {
+ const std::string params_list =
+ std::accumulate(std::begin(invalid_params),
+ std::end(invalid_params),
+ std::string(""),
+ [](std::string& first, std::string& second) {
+ return first.empty() ? second : first + ", " + second;
+ });
+ const std::string info =
+ "One or more files needed for " + params_list + " are not present";
+ SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, info.c_str());
+ return;
}
mobile_apis::InteractionMode::eType mode =
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
index 3a8a2de4ab..ff0d0d3622 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
@@ -179,7 +179,7 @@ namespace commands {
RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
const MessageSharedPtr& message, ApplicationManager& application_manager)
: CommandRequestImpl(message, application_manager)
- , result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) {}
+ , result_code_(mobile_apis::Result::INVALID_ENUM) {}
RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {}
@@ -320,7 +320,20 @@ void RegisterAppInterfaceRequest::Run() {
}
if (msg_params.keyExists(strings::tts_name)) {
- application->set_tts_name(msg_params[strings::tts_name]);
+ smart_objects::SmartObject& tts_name =
+ (*message_)[strings::msg_params][strings::tts_name];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(
+ tts_name, application, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_WARN(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ response_info_ = "One or more files needed for tts_name are not present";
+ result_code_ = mobile_apis::Result::WARNINGS;
+ }
+ application->set_tts_name(tts_name);
}
if (msg_params.keyExists(strings::app_hmi_type)) {
@@ -713,9 +726,9 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
}
if ((mobile_apis::Result::SUCCESS == result_code) &&
- (mobile_apis::Result::INVALID_ENUM != result_checking_app_hmi_type_)) {
+ (mobile_apis::Result::INVALID_ENUM != result_code_)) {
add_info += response_info_;
- result_code = result_checking_app_hmi_type_;
+ result_code = result_code_;
}
// in case application exist in resumption we need to send resumeVrgrammars
@@ -1066,7 +1079,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
"Following AppHmiTypes are not present in policy "
"table:" +
log;
- result_checking_app_hmi_type_ = mobile_apis::Result::WARNINGS;
+ result_code_ = mobile_apis::Result::WARNINGS;
}
}
// Replace AppHmiTypes in request with values allowed by policy table
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 e811f5d154..621aa90447 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
@@ -31,6 +31,7 @@
*/
#include <string.h>
+#include <numeric>
#include <algorithm>
#include "application_manager/commands/mobile/set_global_properties_request.h"
@@ -185,14 +186,54 @@ void SetGlobalPropertiesRequest::Run() {
smart_objects::SmartObject params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::vector<std::string> invalid_params;
if (is_help_prompt_present) {
- app->set_help_prompt(msg_params.getElement(strings::help_prompt));
- params[strings::help_prompt] = (*app->help_prompt());
+ smart_objects::SmartObject& help_prompt =
+ (*message_)[strings::msg_params][strings::help_prompt];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ invalid_params.push_back("help_prompt");
+ } else {
+ app->set_help_prompt(help_prompt);
+ params[strings::help_prompt] = (*app->help_prompt());
+ }
}
if (is_timeout_prompt_present) {
- app->set_timeout_prompt(msg_params.getElement(strings::timeout_prompt));
- params[strings::timeout_prompt] = (*app->timeout_prompt());
+ smart_objects::SmartObject& timeout_prompt =
+ (*message_)[strings::msg_params][strings::timeout_prompt];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(
+ timeout_prompt, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ invalid_params.push_back("timeout_prompt");
+ } else {
+ app->set_timeout_prompt(timeout_prompt);
+ params[strings::timeout_prompt] = (*app->timeout_prompt());
+ }
+ }
+
+ if (!invalid_params.empty()) {
+ std::string params_list = std::accumulate(
+ std::begin(invalid_params),
+ std::end(invalid_params),
+ std::string(""),
+ [](std::string& first, std::string& second) {
+ return first.empty() ? second : first + ", " + second;
+ });
+ const std::string info =
+ "One or more files needed for " + params_list + " are not present";
+ SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, info.c_str());
+ return;
}
params[strings::app_id] = app->app_id();
diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc
index 1954cde181..6da6b482b3 100644
--- a/src/components/application_manager/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/src/commands/mobile/speak_request.cc
@@ -69,6 +69,21 @@ void SpeakRequest::Run() {
return;
}
+ smart_objects::SmartObject& tts_chunks =
+ (*message_)[strings::msg_params][strings::tts_chunks];
+ mobile_apis::Result::eType verification_result =
+ MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
+
+ if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyTtsFiles return "
+ << verification_result);
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "One or more files needed for tts_chunks are not present");
+ return;
+ }
+
(*message_)[strings::msg_params][strings::app_id] = app->app_id();
(*message_)[strings::msg_params][hmi_request::speak_type] =
hmi_apis::Common_MethodName::SPEAK;
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index f64b80a088..d00fc2ae19 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -93,6 +93,8 @@ void InitCapabilities() {
hmi_apis::Common_SpeechCapabilities::PRE_RECORDED));
tts_enum_capabilities.insert(std::make_pair(
std::string("SILENCE"), hmi_apis::Common_SpeechCapabilities::SILENCE));
+ tts_enum_capabilities.insert(std::make_pair(
+ std::string("FILE"), hmi_apis::Common_SpeechCapabilities::FILE));
button_enum_name.insert(
std::make_pair(std::string("OK"), hmi_apis::Common_ButtonName::OK));
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index d3af65effa..b674a090c0 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -2756,11 +2756,23 @@ mobile_apis::Result::eType MessageHelper::VerifyImageApplyPath(
}
const std::string& file_name = image[strings::value].asString();
+ const std::string& full_file_path = GetAppFilePath(file_name, app, app_mngr);
+ image[strings::value] = full_file_path;
+ if (file_system::FileExists(full_file_path)) {
+ return mobile_apis::Result::SUCCESS;
+ }
+ return mobile_apis::Result::INVALID_DATA;
+}
+
+std::string MessageHelper::GetAppFilePath(std::string file_name,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
std::string str = file_name;
+ // Verify that file name is not only space characters
str.erase(remove(str.begin(), str.end(), ' '), str.end());
if (0 == str.size()) {
- return mobile_apis::Result::INVALID_DATA;
+ return "";
}
std::string full_file_path;
@@ -2786,12 +2798,25 @@ mobile_apis::Result::eType MessageHelper::VerifyImageApplyPath(
full_file_path += file_name;
}
- image[strings::value] = full_file_path;
- if (!file_system::FileExists(full_file_path)) {
- return mobile_apis::Result::INVALID_DATA;
- }
+ return full_file_path;
+}
- return mobile_apis::Result::SUCCESS;
+mobile_apis::Result::eType MessageHelper::VerifyTtsFiles(
+ smart_objects::SmartObject& tts_chunks,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ mobile_apis::Result::eType result = mobile_apis::Result::SUCCESS;
+ for (auto& tts_chunk : *(tts_chunks.asArray())) {
+ if (tts_chunk[strings::type] == mobile_apis::SpeechCapabilities::FILE) {
+ const std::string full_file_path =
+ GetAppFilePath(tts_chunk[strings::text].asString(), app, app_mngr);
+ tts_chunk[strings::text] = full_file_path;
+ if (!file_system::FileExists(full_file_path)) {
+ result = mobile_apis::Result::FILE_NOT_FOUND;
+ }
+ }
+ }
+ return result;
}
mobile_apis::Result::eType MessageHelper::VerifyImage(
@@ -3035,4 +3060,4 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
return true;
}
-} // namespace application_manager
+} // namespace application_manager \ No newline at end of file
diff --git a/src/components/application_manager/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
index 5d9e507511..f4ad62f29a 100644
--- a/src/components/application_manager/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
@@ -382,6 +382,12 @@ TEST_F(AlertRequestTest, Run_SUCCESS) {
SubscribeApplicationToSoftButton(
(*msg_)[am::strings::msg_params], _, kFunctionId));
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
ExpectManageHmiCommandTTSAndUI();
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -435,6 +441,11 @@ TEST_F(AlertRequestTest, OnEvent_UIAlertHasHmiResponsesToWait_UNSUCCESS) {
EXPECT_CALL(mock_message_helper_,
ProcessSoftButtons((*msg_)[am::strings::msg_params], _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
ExpectManageHmiCommandTTSAndUI();
@@ -465,6 +476,12 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) {
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
.WillOnce(Return(true));
@@ -492,6 +509,11 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSUnsupportedResource_SUCCESS) {
ProcessSoftButtons((*msg_)[am::strings::msg_params], _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
.WillOnce(Return(true));
@@ -524,6 +546,11 @@ TEST_F(AlertRequestTest,
EXPECT_CALL(mock_message_helper_,
ProcessSoftButtons((*msg_)[am::strings::msg_params], _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(mock_message_helper_,
SubscribeApplicationToSoftButton(
(*msg_)[am::strings::msg_params], _, kFunctionId));
@@ -566,6 +593,11 @@ TEST_F(AlertRequestTest, OnEvent_TTSUnsupportedResourceUiAlertSuccess_SUCCESS) {
EXPECT_CALL(mock_message_helper_,
ProcessSoftButtons((*msg_)[am::strings::msg_params], _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(mock_message_helper_,
SubscribeApplicationToSoftButton(
(*msg_)[am::strings::msg_params], _, kFunctionId));
@@ -611,6 +643,11 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) {
ProcessSoftButtons((*msg_)[am::strings::msg_params], _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
.WillOnce(Return(true));
@@ -656,6 +693,11 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
ProcessSoftButtons((*msg_)[am::strings::msg_params], _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
.WillOnce(Return(true));
diff --git a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
index a27bac970c..ad15dca7eb 100644
--- a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -247,6 +247,12 @@ TEST_F(PerformAudioPassThruRequestTest,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
.WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ EXPECT_CALL(mock_message_helper_,
+ VerifyTtsFiles((*mobile_request)[am::strings::msg_params]
+ [am::strings::initial_prompt],
+ _,
+ _)).WillOnce(Return(mobile_apis::Result::SUCCESS));
+
command->Run();
command->on_event(event_tts);
command->on_event(event_ui);
@@ -320,6 +326,10 @@ TEST_F(PerformAudioPassThruRequestTest,
kCorrectPrompt;
msg_params_[am::strings::initial_prompt][0][am::strings::type] = kCorrectType;
+ EXPECT_CALL(mock_message_helper_,
+ VerifyTtsFiles(msg_params_[am::strings::initial_prompt], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
MessageSharedPtr speak_reqeust_result_msg;
MessageSharedPtr perform_result_msg;
{
@@ -405,6 +415,10 @@ TEST_F(PerformAudioPassThruRequestTest,
msg_params_[am::strings::audio_pass_display_text1] = kCorrectDisplayText1;
msg_params_[am::strings::audio_pass_display_text2] = kCorrectDisplayText2;
+ EXPECT_CALL(mock_message_helper_,
+ VerifyTtsFiles(msg_params_[am::strings::initial_prompt], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
MessageSharedPtr speak_reqeust_result_msg;
MessageSharedPtr perform_result_msg;
{
@@ -469,6 +483,10 @@ TEST_F(PerformAudioPassThruRequestTest,
kCorrectPrompt;
msg_params_[am::strings::initial_prompt][0][am::strings::type] = kCorrectType;
+ EXPECT_CALL(mock_message_helper_,
+ VerifyTtsFiles(msg_params_[am::strings::initial_prompt], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
const bool muted = false;
msg_params_[am::strings::mute_audio] = muted;
@@ -743,6 +761,11 @@ TEST_F(PerformAudioPassThruRequestTest,
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
kCorrectPrompt;
msg_params_[am::strings::initial_prompt][0][am::strings::type] = kCorrectType;
+
+ EXPECT_CALL(mock_message_helper_,
+ VerifyTtsFiles(msg_params_[am::strings::initial_prompt], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
MessageSharedPtr speak_reqeust_result_msg;
MessageSharedPtr perform_result_msg;
ON_CALL(app_mngr_, GetNextHMICorrelationID())
diff --git a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
index 641e5636a9..9ed459f799 100644
--- a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
@@ -154,6 +154,10 @@ class SetGlobalPropertiesRequestTest
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(help_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_,
RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
SmartObject vr_help_title("title");
@@ -288,6 +292,12 @@ TEST_F(SetGlobalPropertiesRequestTest,
ON_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillByDefault(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*msg_vr)[am::strings::msg_params][am::strings::help_prompt], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
(*msg_vr)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
Event event_vr(hmi_apis::FunctionID::TTS_SetGlobalProperties);
@@ -763,6 +773,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(help_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
SmartObject vr_help_title("title");
EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
@@ -795,6 +809,8 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(help_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
SmartObject vr_help_title("title");
EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
@@ -825,6 +841,8 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
SmartObject vr_help_title("title");
EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
diff --git a/src/components/application_manager/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
index f07012d315..36a9b85c6a 100644
--- a/src/components/application_manager/test/commands/mobile/speak_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
@@ -286,6 +286,11 @@ TEST_F(SpeakRequestTest, Run_MsgWithEmptyString_Success) {
[am::strings::text] = "";
CommandPtr command(CreateCommand<SpeakRequest>(request_));
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*request_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
ON_CALL(*app_, app_id()).WillByDefault(Return(kAppId));
@@ -301,6 +306,11 @@ TEST_F(SpeakRequestTest, Run_MsgCorrect_Success) {
[am::strings::text] = "asda";
CommandPtr command(CreateCommand<SpeakRequest>(request_));
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyTtsFiles(
+ (*request_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
ON_CALL(*app_, app_id()).WillByDefault(Return(kAppId));
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index 93db0d9795..e8a969718d 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -176,6 +176,10 @@ class MockMessageHelper {
MOCK_METHOD1(SendGlobalPropertiesToHMI, void(ApplicationConstSharedPtr app));
MOCK_METHOD1(GetIVISubscriptionRequests,
smart_objects::SmartObjectList(ApplicationSharedPtr app));
+ MOCK_METHOD3(VerifyTtsFiles,
+ mobile_apis::Result::eType(smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
MOCK_METHOD3(VerifyImageFiles,
mobile_apis::Result::eType(smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 24bba63e71..8b0ec5b854 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -315,6 +315,14 @@ smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
app);
}
+mobile_apis::Result::eType MessageHelper::VerifyTtsFiles(
+ smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->VerifyTtsFiles(
+ message, app, app_mngr);
+}
+
mobile_apis::Result::eType MessageHelper::VerifyImage(
smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index def5d22933..0281b50956 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -371,6 +371,7 @@
<element name="LHPLUS_PHONEMES" />
<element name="PRE_RECORDED" />
<element name="SILENCE" />
+ <element name="FILE" />
</enum>
<enum name="VrCapabilities">
@@ -1927,12 +1928,12 @@
</struct>
<struct name="TTSChunk">
- <description>A TTS chunk, that consists of the text/phonemes to be spoken</description>
+ <description>A TTS chunk, that consists of text/phonemes to speak or the name of a file to play, and a TTS type (like text or SAPI)</description>
<param name="text" type="String" mandatory="true" maxlength="500">
- <description>The text or phonemes to be spoken.</description>
+ <description>The text or phonemes to be spoken, or the name of an audio file to play.</description>
</param>
<param name="type" type="Common.SpeechCapabilities" mandatory="true">
- <description>Describes, whether it is text or a specific phoneme set. See SpeechCapabilities.</description>
+ <description>Describes whether the TTS chunk is plain text, a specific phoneme set, or an audio file. See SpeechCapabilities.</description>
</param>
</struct>
@@ -3348,10 +3349,10 @@
<description>Method is invoked at system start-up. SDL requests the information about all supported hardware and their capabilities</description>
</function>
<function name="GetCapabilities" messagetype="response">
- <param name="speechCapabilities" type="Common.SpeechCapabilities" minsize="1" maxsize="5" array="true" mandatory="true">
+ <param name="speechCapabilities" type="Common.SpeechCapabilities" minsize="1" maxsize="100" array="true" mandatory="true">
<description>See SpeechCapabilities</description>
</param>
- <param name="prerecordedSpeechCapabilities" type="Common.PrerecordedSpeech" minsize="1" maxsize="5" array="true" mandatory="true">
+ <param name="prerecordedSpeechCapabilities" type="Common.PrerecordedSpeech" minsize="1" maxsize="100" array="true" mandatory="true">
<description>See PrerecordedSpeech</description>
</param>
</function>
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index a5504916ba..8b8da6a63a 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -447,6 +447,7 @@
<element name="LHPLUS_PHONEMES" />
<element name="PRE_RECORDED" />
<element name="SILENCE" />
+ <element name="FILE" />
</enum>
<enum name="VrCapabilities">
@@ -2103,15 +2104,15 @@
</param>
</struct>
<struct name="TTSChunk">
- <description>A TTS chunk, that consists of the text/phonemes to speak and the type (like text or SAPI)</description>
+ <description>A TTS chunk, that consists of text/phonemes to speak or the name of a file to play, and a TTS type (like text or SAPI)</description>
<param name="text" minlength="0" maxlength="500" type="String" mandatory="true">
<description>
- The text or phonemes to speak.
+ The text or phonemes to speak, or the name of the audio file to play.
May not be empty.
</description>
</param>
<param name="type" type="SpeechCapabilities" mandatory="true">
- <description>Describes, whether it is text or a specific phoneme set. See SpeechCapabilities</description>
+ <description>Describes whether the TTS chunk is plain text, a specific phoneme set, or an audio file. See SpeechCapabilities</description>
</param>
</struct>
<struct name="Turn">