diff options
author | Justin Dickow <jjdickow@gmail.com> | 2015-03-27 11:42:48 -0400 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2015-03-27 11:42:48 -0400 |
commit | a6ad2c9e7fcebdd50b95423520ebe124f4ba01b7 (patch) | |
tree | 8125eb42a0b4ab63369ac8466945ff1f094ff356 | |
parent | e1d6b9b88e412ea240e1cf9b5764bb5f67854bd9 (diff) | |
parent | cc22d1aa76773d12e4d545c5d52cf9488866e0ab (diff) | |
download | sdl_core-a6ad2c9e7fcebdd50b95423520ebe124f4ba01b7.tar.gz |
Merge branch 'github/pr/47' into github/develop
Adds capability to define ttsName and vrSynonyms for app launching
6 files changed, 100 insertions, 5 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 4882c1e068..2d4ff32bdd 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -970,7 +970,19 @@ class ApplicationManagerImpl : public ApplicationManager, */ bool IsAppsQueriedFrom(const connection_handler::DeviceHandle handle) const; -private: + private: + /** + * @brief PullLanguagesInfo allows to pull information about languages. + * + * @param app_data entry to parse + * + * @param ttsName tts name that should be filled. + * @param vrSynonym vr synonymus that should be filled. + */ + void PullLanguagesInfo(const smart_objects::SmartObject& app_data, + smart_objects::SmartObject& ttsName, + smart_objects::SmartObject& vrSynonym); + ApplicationManagerImpl(); /** diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index b7fd52dace..1285300f15 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -287,6 +287,10 @@ const char urlScheme[] = "urlScheme"; const char packageName[] = "packageName"; const char response[] = "response"; const char is_media_application[] = "isMediaApplication"; +const char default_[] = "default"; +const char languages[] = "languages"; +const char ttsName[] = "ttsName"; +const char vrSynonyms[] = "vrSynonyms"; } // namespace json namespace http_request { diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 0d333641f4..7ac10fba9c 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1904,6 +1904,40 @@ HMICapabilities& ApplicationManagerImpl::hmi_capabilities() { return hmi_capabilities_; } +void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data, + SmartObject& ttsName, + SmartObject& vrSynonym) { + LOG4CXX_AUTO_TRACE(logger_); + if (app_data.keyExists(json::languages)) { + + const HMICapabilities& hmi_cap = hmi_capabilities(); + std::string vr(MessageHelper::CommonLanguageToString(hmi_cap.active_vr_language())); + const SmartObject& arr = app_data[json::languages]; + + std::transform(vr.begin(), vr.end(), vr.begin(), ::toupper); + + ssize_t default_idx = -1; + ssize_t specific_idx = -1; + + const size_t size = arr.length(); + for (size_t idx = 0; idx < size; ++idx) { + if (arr[idx].keyExists(vr)) { + specific_idx = idx; break; + } else if (arr[idx].keyExists(json::default_)) { default_idx = idx; } + else { LOG4CXX_DEBUG(logger_, "Unknown key was specified."); } + } + + const ssize_t regular_id = specific_idx != -1 ? specific_idx : default_idx; + + if (regular_id != -1 && + app_data[json::languages][regular_id][vr].keyExists(json::ttsName) && + app_data[json::languages][regular_id][vr].keyExists(json::vrSynonyms)) { + ttsName = app_data[json::languages][regular_id][vr][json::ttsName]; + vrSynonym = app_data[json::languages][regular_id][vr][json::vrSynonyms]; + } + } +} + void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, const uint32_t connection_key) { LOG4CXX_AUTO_TRACE(logger_); @@ -1932,6 +1966,11 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, std::string url_scheme; std::string package_name; std::string os_type; + SmartObject vrSynonym; + SmartObject ttsName; + + const std::string appName(app_data[json::name].asString()); + if (app_data.keyExists(json::ios)) { os_type = json::ios; url_scheme = app_data[os_type][json::urlScheme].asString(); @@ -1941,8 +1980,11 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, app_data[os_type][json::packageName].asString(); } - const std::string appName(app_data[json::name].asString()); + PullLanguagesInfo(app_data[os_type], ttsName, vrSynonym); + if (ttsName.empty() || vrSynonym.empty()) { + ttsName = vrSynonym = appName; + } const uint32_t hmi_app_id = resume_ctrl_.IsApplicationSaved(mobile_app_id)? resume_ctrl_.GetHMIApplicationID(mobile_app_id) : GenerateNewHMIAppID(); @@ -1974,6 +2016,9 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, app->set_hmi_application_id(hmi_app_id); app->set_device(device_id); + app->set_vr_synonyms(vrSynonym); + app->set_tts_name(ttsName); + sync_primitives::AutoLock lock(apps_to_register_list_lock_); LOG4CXX_DEBUG(logger_, "apps_to_register_ size before: " << apps_to_register_.size()); diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index 51f5f39594..829c894b2e 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -1205,14 +1205,18 @@ bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app, if (app->IsRegistered()) { output[strings::hmi_display_language_desired] = app->ui_language(); - } - - if (app->IsRegistered()) { output[strings::is_media_application] = app->is_media_application(); } if (!app->IsRegistered()) { output[strings::greyOut] = app->is_greyed_out(); + if (!app->tts_name()->empty()) { + output[json::ttsName][strings::text] = *(app->tts_name()); + output[json::ttsName][strings::speech_capabilities] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; + } + if (!app->vr_synonyms()->empty()) { + output[json::vrSynonyms] = *(app->vr_synonyms()); + } } if (ngn_media_screen_name) { diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index f6b916788e..bb9d2f4e31 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1314,6 +1314,21 @@ <param name="deviceName" type="String" mandatory="true"> <description>The name of device which the provided application is running on.</description> </param> + <param name="ttsName" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" > + <description> + TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green". + Meant to overcome any failing on speech engine in properly pronouncing / understanding app name. + May not be empty. + May not start with a new line character. + Not unique value + </description> + </param> + <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false"> + <description> + Defines an additional voice recognition command. + Must not interfere with any name of previously registered applications(SDL makes check). + </description> + </param> <param name="appID" type="Integer" mandatory="true"> <description>Unique (during ignition cycle) id of the application. To be used in all RPCs sent by both HU system and SDL</description> </param> diff --git a/src/components/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml index 1960707fb7..24136c05af 100644 --- a/src/components/interfaces/QT_HMI_API.xml +++ b/src/components/interfaces/QT_HMI_API.xml @@ -1238,6 +1238,21 @@ <param name="deviceName" type="String" mandatory="true"> <description>The name of device which the provided application is running on.</description> </param> + <param name="ttsName" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" > + <description> + TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green". + Meant to overcome any failing on speech engine in properly pronouncing / understanding app name. + May not be empty. + May not start with a new line character. + Not unique value + </description> + </param> + <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false"> + <description> + Defines an additional voice recognition command. + Must not interfere with any name of previously registered applications(SDL makes check). + </description> + </param> <param name="appID" type="Integer" mandatory="true"> <description>Unique (during ignition cycle) id of the application. To be used in all RPCs sent by both HU system and SDL</description> </param> |