diff options
author | Justin Dickow <jjdickow@gmail.com> | 2015-01-24 16:58:15 -0500 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2015-01-24 16:58:15 -0500 |
commit | a24079cb8de5563376dcf782cdb9fe3cae063841 (patch) | |
tree | 1fca30dde1aa30c7ac11fb6b009d2bd6420bd648 /src/components/application_manager/src/commands/mobile/register_app_interface_request.cc | |
parent | f948dd4539eeecb2c32084cc39b68923fc94e3dd (diff) | |
download | sdl_core-a24079cb8de5563376dcf782cdb9fe3cae063841.tar.gz |
HmiStatus modify
HU DCHECK occurs during multisession registration
Remove unused variable
SIGSEGV handler added to flush logger queue
FixIncomplete device list in UpdateDeviceList request
Fix Memory leak on PutFile break
Fix Thread and Timer
Fix OnHmiStatus Notification
Fix Url array sending for endpoints.
Fix HashChange
Fix SDL parse incoming JSON message with both members error and result as success message
Fix Core crashes while connecting mobile app
Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Diffstat (limited to 'src/components/application_manager/src/commands/mobile/register_app_interface_request.cc')
-rw-r--r-- | src/components/application_manager/src/commands/mobile/register_app_interface_request.cc | 108 |
1 files changed, 21 insertions, 87 deletions
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 a035e86f2d..1d81ab6b20 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 @@ -124,14 +124,15 @@ namespace commands { RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( const MessageSharedPtr& message) - : CommandRequestImpl(message) { + : CommandRequestImpl(message), + result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) { } RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() { } bool RegisterAppInterfaceRequest::Init() { - LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::Init"); + LOG4CXX_AUTO_TRACE(logger_); return true; } @@ -139,8 +140,9 @@ void RegisterAppInterfaceRequest::Run() { LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::Run " << connection_key()); // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA. - // Flag conditional compilation "CUSTOMER_PASA" is used in order to exclude hit code + // Flag conditional compilation specific to customer is used in order to exclude hit code // to RTC + // FIXME(EZamakhov): on shutdown - get freez if (true == profile::Profile::instance()->launch_hmi()) { // wait till HMI started while (!ApplicationManagerImpl::instance()->IsHMICooperating()) { @@ -189,13 +191,6 @@ void RegisterAppInterfaceRequest::Run() { return; } - mobile_apis::Result::eType restriction_result = CheckRestrictions(); - if (mobile_apis::Result::SUCCESS != restriction_result) { - LOG4CXX_ERROR_EXT(logger_, "Param names restrictions check failed."); - SendResponse(false, restriction_result); - return; - } - if (IsWhiteSpaceExist()) { LOG4CXX_INFO(logger_, "Incoming register app interface has contains \t\n \\t \\n"); @@ -281,12 +276,11 @@ void RegisterAppInterfaceRequest::Run() { device_info); SendRegisterAppInterfaceResponseToMobile(); - policy::PolicyHandler::instance()->PTExchangeAtRegistration(mobile_app_id); } } void RegisterAppInterfaceRequest::on_event(const event_engine::Event& event) { - LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::on_event"); + LOG4CXX_AUTO_TRACE(logger_); switch (event.id()) { case hmi_apis::FunctionID::TTS_Speak: { const smart_objects::SmartObject& message = event.smart_object(); @@ -465,8 +459,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( ResumeCtrl& resumer = ApplicationManagerImpl::instance()->resume_controller(); uint32_t hash_id = 0; - const char* add_info = ""; - const bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id); + std::string add_info(""); + bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id); bool need_restore_vr = resumption; if (resumption) { hash_id = (*message_)[strings::msg_params][strings::hash_id].asUInt(); @@ -484,8 +478,17 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( add_info = " Resume Succeed"; } } + if ((mobile_apis::Result::SUCCESS == result) && + (mobile_apis::Result::INVALID_ENUM != result_checking_app_hmi_type_)) { + add_info += response_info_; + result = result_checking_app_hmi_type_; + } + SendResponse(true, result, add_info.c_str(), params); - SendResponse(true, result, add_info, params); + // in case application exist in resumption we need to send resumeVrgrammars + if (false == resumption) { + resumption = resumer.IsApplicationSaved(application->mobile_app_id()->asString()); + } MessageHelper::SendOnAppRegisteredNotificationToHMI(*(application.get()), resumption, @@ -502,7 +505,7 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { - LOG4CXX_TRACE_ENTER(logger_); + LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -604,7 +607,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { if (!log.empty()) { response_info_ = "Following AppHMITypes are not present in policy " "table:" + log; - result = mobile_apis::Result::WARNINGS; + result_checking_app_hmi_type_ = mobile_apis::Result::WARNINGS; } } // Replace AppHMITypes in request with values allowed by policy table @@ -657,75 +660,6 @@ void RegisterAppInterfaceRequest::FillDeviceInfo( } } -mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckRestrictions() const { - - LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::CheckRestrictions"); - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - const std::string& app_name = msg_params[strings::app_name].asString(); - - if (ClearParamName(app_name).empty()) { - printf("Application name is empty.\n"); - return mobile_apis::Result::INVALID_DATA; - } - - if ((app_name[0] == '\n') || - ((app_name[0] == '\\') && (app_name[1] == 'n'))) { - - printf("Application name has invalid characters."); - return mobile_apis::Result::INVALID_DATA; - } - - if (msg_params.keyExists(strings::tts_name)) { - - const smart_objects::SmartArray* tts = - msg_params[strings::tts_name].asArray(); - - smart_objects::SmartArray::const_iterator it = tts->begin(); - smart_objects::SmartArray::const_iterator it_end = tts->end(); - - for (; it != it_end; ++it) { - - const std::string& tts_name = (*it)[strings::text].asString(); - - if (ClearParamName(tts_name).empty()) { - printf("TTS value is empty."); - return mobile_apis::Result::INVALID_DATA; - } - - if ((tts_name[0] == '\n') || - ((tts_name[0] == '\\') && (tts_name[1] == 'n'))) { - - printf("TTS value(s) has invalid characters."); - return mobile_apis::Result::INVALID_DATA; - } - } - } - - return mobile_apis::Result::SUCCESS; -} - -std::string -RegisterAppInterfaceRequest::ClearParamName(std::string param_name) const { - - // Expecting for chars different from newlines and spaces in the appName - // - // There is an agreement, that "\n" is not allowed symbols, so we have to - // check for this case also - - std::string newline = "\\n"; - while (std::string::npos != param_name.find(newline)) { - param_name.erase(param_name.find(newline), newline.length()); - } - - std::string::iterator param_name_new_end = - std::remove_if(param_name.begin(), param_name.end(), ::isspace); - - return std::string(param_name.begin(), param_name_new_end); -} - bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::" @@ -750,7 +684,7 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { } bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { - LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::IsWhiteSpaceExist"); + LOG4CXX_AUTO_TRACE(logger_); const char* str = NULL; str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); |