From 04e871e4ed3bd9a5ef9a6812106a6a3484711e43 Mon Sep 17 00:00:00 2001 From: Alexander Kutsan Date: Mon, 7 Apr 2014 11:31:21 +0300 Subject: [PATCH] APPLINK-6502 Changed Resume Controller to work with GrammarId according to new requirments Signed-off-by: Justin Dickow Conflicts: src/components/application_manager/src/resume_ctrl.cpp --- .../application_manager/src/message_helper.cc | 2 + .../application_manager/src/resume_ctrl.cpp | 50 +++++++++++++++++++++- src/components/interfaces/HMI_API.xml | 6 +++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index 197509b..d8b692d 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -1029,6 +1029,8 @@ smart_objects::SmartObject* MessageHelper::CreateAddVRCommandToHMI( if (0 < app_id) { msg_params[strings::app_id] = app_id; } + msg_params[strings::grammar_id] = + ApplicationManagerImpl::instance()->application(app_id)->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; (*vr_command)[strings::msg_params] = msg_params; diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp index 3dd4bbb..4f5c9e8 100644 --- a/src/components/application_manager/src/resume_ctrl.cpp +++ b/src/components/application_manager/src/resume_ctrl.cpp @@ -40,7 +40,6 @@ void ResumeCtrl::SaveAllApplications() { void ResumeCtrl::SaveApplication(ApplicationConstSharedPtr application) { LOG4CXX_INFO(logger_, "ResumeCtrl::SaveApplication"); - DCHECK(application.get()); Json::Value* json_app = NULL; @@ -86,6 +85,7 @@ void ResumeCtrl::SaveApplication(ApplicationConstSharedPtr application) { (*json_app)[strings::application_subscribtions] = GetApplicationSubscriptions(application); (*json_app)[strings::application_files] = GetApplicationFiles(application); + (*json_app)[strings::application_show] = GetApplicationShow(application); (*json_app)[strings::time_stamp] = (uint32_t)time(NULL); (*json_app)[strings::audio_streaming_state] = application->audio_streaming_state(); } @@ -163,10 +163,23 @@ bool ResumeCtrl::RestoreApplicationData(ApplicationSharedPtr application) { Json::Value& app_choise_sets = saved_app[strings::application_choise_sets]; Json::Value& global_properties = saved_app[strings::application_global_properties]; Json::Value& subscribtions = saved_app[strings::application_subscribtions]; - Json::Value& application_files = saved_app[strings::application_files]; + Json::Value& application_files= saved_app[strings::application_files]; + Json::Value& application_show= saved_app[strings::application_show]; uint32_t app_grammar_id = saved_app[strings::grammar_id].asUInt(); application->set_grammar_id(app_grammar_id); + //show + if (!application_show.isNull()) { + smart_objects::SmartObject message; + Formatters::CFormatterJsonBase::jsonValueToObj(application_show, message); + application->set_show_command(message); + + requests = MessageHelper::CreateShowRequestToHMI(application); + for (MessageHelper::SmartObjectList::iterator it = requests.begin(); + it != requests.end(); ++it) { + ProcessHMIRequest(*it, true); + } + } // files for (Json::Value::iterator json_it = application_files.begin(); @@ -481,6 +494,8 @@ bool ResumeCtrl::CheckPersistenceFilesForResumption(ApplicationSharedPtr applica LOG4CXX_INFO(logger_, saved_app.toStyledString()); Json::Value& app_commands = saved_app[strings::application_commands]; Json::Value& app_choise_sets = saved_app[strings::application_choise_sets]; + Json::Value& application_show = saved_app[strings::application_show]; + //add commands for (Json::Value::iterator json_it = app_commands.begin(); @@ -512,6 +527,37 @@ bool ResumeCtrl::CheckPersistenceFilesForResumption(ApplicationSharedPtr applica } } + //show + if (!application_show.isNull()) { + smart_objects::SmartObject message = smart_objects::SmartObject( + smart_objects::SmartType::SmartType_Map); + Formatters::CFormatterJsonBase::jsonValueToObj(application_show, message); + + mobile_apis::Result::eType processing_result = + MessageHelper::ProcessSoftButtons(message, application); + if (mobile_apis::Result::SUCCESS != processing_result) { + if (mobile_apis::Result::INVALID_DATA == processing_result) { + LOG4CXX_ERROR(logger_, "ProcessSoftButtons failed"); + return false ; + } + if (mobile_apis::Result::UNSUPPORTED_RESOURCE == processing_result) { + LOG4CXX_WARN(logger_, "ProcessSoftButtons UNSUPPORTED_RESOURCE!"); + } + } + + mobile_apis::Result::eType verification_result = + MessageHelper::VerifyImageFiles(message, application); + + if (mobile_apis::Result::SUCCESS != verification_result) { + if (mobile_apis::Result::INVALID_DATA == verification_result) { + LOG4CXX_ERROR(logger_, "VerifyImageFiles INVALID_DATA!"); + return false; + } + if (mobile_apis::Result::UNSUPPORTED_RESOURCE == verification_result) { + LOG4CXX_ERROR(logger_, "VerifyImageFiles UNSUPPORTED_RESOURCE!"); + } + } + } return true; } diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index f3c4a98..399b540 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1968,6 +1968,12 @@ Optional length in bytes for resuming partial data chunks + + Full Size of file. sends in first OnPutFile notification if file is splited + into many PutFiles + + + File reference name. -- 2.7.4