diff options
author | JackLivio <jack@livio.io> | 2018-09-04 11:27:42 -0400 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2018-09-04 11:27:42 -0400 |
commit | 548867072facaeb1d696b4534c8e64f9f9ea13d5 (patch) | |
tree | c275015ac588514a5140145bad24d1688d6c6af7 /src/components/application_manager/src | |
parent | 6bb3a0e5d9938ddfbf36994fe9937d6fafb047b7 (diff) | |
parent | ddc79ce414adcd966bdab61b814ce8a422e780f8 (diff) | |
download | sdl_core-548867072facaeb1d696b4534c8e64f9f9ea13d5.tar.gz |
Merge remote-tracking branch 'origin/develop' into fix/Wrong_connection_closure
# Conflicts:
# src/components/connection_handler/test/heart_beat_monitor_test.cc
Diffstat (limited to 'src/components/application_manager/src')
394 files changed, 4239 insertions, 37691 deletions
diff --git a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc index 481635d8e6..8df3d436bd 100644 --- a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc +++ b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc @@ -38,7 +38,6 @@ #include "connection_handler/connection_handler.h" #include "application_manager/application.h" #include "utils/timer_task_impl.h" -#include "utils/make_shared.h" namespace app_launch { CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") @@ -60,7 +59,7 @@ void AppLaunchCtrlImpl::OnAppRegistered( const application_manager::Application& app) { LOG4CXX_AUTO_TRACE(logger_); // TODO (AKutsan) : get device mac - ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>( + ApplicationDataPtr app_data = std::make_shared<ApplicationData>( app.policy_app_id(), app.bundle_id(), app.mac_address()); apps_launcher_.OnLaunched(app_data); app_launch_data_.AddApplicationData(*app_data); diff --git a/src/components/application_manager/src/app_launch/app_launch_data_db.cc b/src/components/application_manager/src/app_launch/app_launch_data_db.cc index f3adfc749b..393b01c952 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_db.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_db.cc @@ -37,7 +37,6 @@ #include "application_manager/app_launch/app_launch_sql_queries.h" #include "application_manager/smart_object_keys.h" #include "application_manager/message_helper.h" -#include "utils/make_shared.h" namespace app_launch { CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") @@ -276,7 +275,7 @@ std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac( const std::string device_mac = query.GetString(device_mac_index); const std::string mobile_app_id = query.GetString(application_id_index); const std::string bundle_id = query.GetString(bundle_id_index); - dev_apps.push_back(utils::MakeShared<ApplicationData>( + dev_apps.push_back(std::make_shared<ApplicationData>( mobile_app_id, bundle_id, device_mac)); } while (query.Next()); LOG4CXX_DEBUG(logger_, "All application data has been successfully loaded"); @@ -384,7 +383,7 @@ bool AppLaunchDataDB::WriteDb() { utils::dbms::SQLDatabase* AppLaunchDataDB::db() const { #ifdef __QNX__ - std::auto_ptr<utils::dbms::SQLDatabase> db_qnx( + std::unique_ptr<utils::dbms::SQLDatabase> db_qnx( new utils::dbms::SQLDatabase(kDatabaseName)); db_qnx.get()->Open(); return db_qnx.get(); diff --git a/src/components/application_manager/src/app_launch/app_launch_data_json.cc b/src/components/application_manager/src/app_launch/app_launch_data_json.cc index 7599dcccb3..d3e3b7d445 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_json.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_json.cc @@ -33,7 +33,7 @@ #include "application_manager/app_launch/app_launch_data_json.h" #include "application_manager/smart_object_keys.h" #include "smart_objects/smart_object.h" -#include "utils/make_shared.h" + #include "utils/date_time.h" #include "json/json.h" @@ -43,9 +43,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") AppLaunchDataJson::AppLaunchDataJson(const AppLaunchSettings& settings, resumption::LastState& last_state) - : AppLaunchDataImpl(settings) - , app_launch_json_lock_(true) - , last_state_(last_state) {} + : AppLaunchDataImpl(settings), last_state_(last_state) {} AppLaunchDataJson::~AppLaunchDataJson() {} @@ -133,7 +131,7 @@ bool AppLaunchDataJson::RefreshAppSessionTime(const ApplicationData& app_data) { if (index != NotFound) { if (json_data_list.empty() == false) { json_data_list[index][strings::app_launch_last_session] = - static_cast<Json::Value::UInt64>(DateTime::getCurrentTime().tv_sec); + static_cast<Json::Value::UInt64>(getSecs(getCurrentTime())); retVal = true; } } @@ -152,7 +150,7 @@ bool AppLaunchDataJson::AddNewAppData(const ApplicationData& app_data) { json_app_data[strings::app_id] = app_data.mobile_app_id_; json_app_data[strings::bundle_id] = app_data.bundle_id_; json_app_data[strings::app_launch_last_session] = - static_cast<Json::Value::UInt64>(DateTime::getCurrentTime().tv_sec); + static_cast<Json::Value::UInt64>(getSecs(getCurrentTime())); LOG4CXX_DEBUG(logger_, "New application data saved. Detatils device_id: " @@ -185,7 +183,7 @@ std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac( if (deviceMac == dev_mac) { dev_apps.push_back( - utils::MakeShared<ApplicationData>(appID, bundleID, deviceMac)); + std::make_shared<ApplicationData>(appID, bundleID, deviceMac)); } } } diff --git a/src/components/application_manager/src/app_launch/apps_launcher.cc b/src/components/application_manager/src/app_launch/apps_launcher.cc index bf3ce1e0a9..f3851482c1 100644 --- a/src/components/application_manager/src/app_launch/apps_launcher.cc +++ b/src/components/application_manager/src/app_launch/apps_launcher.cc @@ -1,6 +1,6 @@ #include <algorithm> #include "application_manager/app_launch/apps_launcher.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" #include <iostream> @@ -15,7 +15,7 @@ struct LauncherGenerator { , app_launch_max_retry_attempt_(app_launch_max_retry_attempt) , app_launch_retry_wait_time_(app_launch_retry_wait_time) {} AppsLauncher::LauncherPtr operator()() { - return utils::MakeShared<AppsLauncher::Launcher>( + return std::make_shared<AppsLauncher::Launcher>( apps_laucnher_, connection_handler_, app_launch_max_retry_attempt_, diff --git a/src/components/application_manager/src/app_launch/device_apps_launcher.cc b/src/components/application_manager/src/app_launch/device_apps_launcher.cc index 0eb9245cf8..a4468d87bc 100644 --- a/src/components/application_manager/src/app_launch/device_apps_launcher.cc +++ b/src/components/application_manager/src/app_launch/device_apps_launcher.cc @@ -6,8 +6,7 @@ #include "application_manager/app_launch/app_launch_data.h" #include "application_manager/app_launch/apps_launcher.h" #include "application_manager/resumption/resume_ctrl.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + #include "utils/timer.h" #include "utils/timer_task_impl.h" #include <iostream> @@ -16,7 +15,7 @@ namespace app_launch { CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") typedef std::pair<std::string, std::vector<ApplicationDataPtr> > AppsOnDevice; -typedef utils::SharedPtr<AppsOnDevice> AppsOnDevicePtr; +typedef std::shared_ptr<AppsOnDevice> AppsOnDevicePtr; class Launcher { public: @@ -61,7 +60,7 @@ class Launcher { } else { LOG4CXX_DEBUG(logger_, "All Apps on " << apps_on_device_->first - << " posponed launched"); + << " postponed launched"); device_launcher_.StopLaunchingAppsOnDevice(apps_on_device_->first); } } @@ -95,7 +94,7 @@ class Launcher { AppsOnDevicePtr apps_on_device_; }; -typedef utils::SharedPtr<Launcher> LauncherPtr; +typedef std::shared_ptr<Launcher> LauncherPtr; typedef std::vector<LauncherPtr> Launchers; struct LauncherGenerator { @@ -107,8 +106,7 @@ struct LauncherGenerator { , apps_launcher_(apps_launcher) {} LauncherPtr operator()() const { - return utils::MakeShared<Launcher>( - resume_ctrl_, interface_, apps_launcher_); + return std::make_shared<Launcher>(resume_ctrl_, interface_, apps_launcher_); } resumption::ResumeCtrl& resume_ctrl_; @@ -116,71 +114,59 @@ struct LauncherGenerator { AppsLauncher& apps_launcher_; }; -class DeviceAppsLauncherImpl { - public: - DeviceAppsLauncherImpl(DeviceAppsLauncher& interface, - AppsLauncher& apps_launcher) - : interface_(interface) { - sync_primitives::AutoLock lock(launchers_lock_); - LauncherGenerator generate( - interface.app_mngr_.resume_controller(), interface, apps_launcher); - free_launchers_.reserve(interface.settings_.max_number_of_ios_device()); - std::generate_n(std::back_inserter(free_launchers_), - interface.settings_.max_number_of_ios_device(), - generate); - } - - bool LaunchAppsOnDevice( - const std::string& device_mac, - const std::vector<ApplicationDataPtr>& applications_to_launch) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "On Device " << device_mac << " will be launched " - << applications_to_launch.size() << " apps"); - AppsOnDevicePtr apps_on_device = - utils::MakeShared<AppsOnDevice>(device_mac, applications_to_launch); - sync_primitives::AutoLock lock(launchers_lock_); - DCHECK_OR_RETURN(!free_launchers_.empty(), false) - const Launchers::iterator it = free_launchers_.begin(); - LauncherPtr launcher = *it; - works_launchers_.push_back(launcher); - free_launchers_.erase(it); - launcher->Start(apps_on_device); - return true; - } +// DeviceAppsLauncherImpl member function definitions +DeviceAppsLauncherImpl::DeviceAppsLauncherImpl(DeviceAppsLauncher& interface, + AppsLauncher& apps_launcher) + : interface_(interface) { + sync_primitives::AutoLock lock(launchers_lock_); + LauncherGenerator generate( + interface.app_mngr_.resume_controller(), interface, apps_launcher); + free_launchers_.reserve(interface.settings_.max_number_of_ios_device()); + std::generate_n(std::back_inserter(free_launchers_), + interface.settings_.max_number_of_ios_device(), + generate); +} - struct LauncherFinder { - LauncherFinder(const std::string& device_mac) : device_mac_(device_mac) {} +bool DeviceAppsLauncherImpl::LauncherFinder::operator()( + const std::shared_ptr<Launcher>& launcher) const { + return device_mac_ == launcher->apps_on_device_->first; +} - bool operator()(const LauncherPtr& launcher) const { - return device_mac_ == launcher->apps_on_device_->first; - } +bool DeviceAppsLauncherImpl::LaunchAppsOnDevice( + const std::string& device_mac, + const std::vector<ApplicationDataPtr>& applications_to_launch) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "On Device " << device_mac << " will be launched " + << applications_to_launch.size() << " apps"); + AppsOnDevicePtr apps_on_device = + std::make_shared<AppsOnDevice>(device_mac, applications_to_launch); + sync_primitives::AutoLock lock(launchers_lock_); + DCHECK_OR_RETURN(!free_launchers_.empty(), false) + const Launchers::iterator it = free_launchers_.begin(); + LauncherPtr launcher = *it; + works_launchers_.push_back(launcher); + free_launchers_.erase(it); + launcher->Start(apps_on_device); + return true; +} - std::string device_mac_; - }; - - bool StopLaunchingAppsOnDevice(const std::string& device_mac) { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(launchers_lock_); - const Launchers::iterator it = std::find_if(works_launchers_.begin(), - works_launchers_.end(), - LauncherFinder(device_mac)); - if (it == works_launchers_.end()) { - return false; - } - LauncherPtr launcher = *it; - launcher->Clear(); - free_launchers_.push_back(launcher); - works_launchers_.erase(it); - return true; +bool DeviceAppsLauncherImpl::StopLaunchingAppsOnDevice( + const std::string& device_mac) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(launchers_lock_); + const Launchers::iterator it = std::find_if(works_launchers_.begin(), + works_launchers_.end(), + LauncherFinder(device_mac)); + if (it == works_launchers_.end()) { + return false; } - - private: - sync_primitives::Lock launchers_lock_; - Launchers free_launchers_; - Launchers works_launchers_; - DeviceAppsLauncher& interface_; -}; + LauncherPtr launcher = *it; + launcher->Clear(); + free_launchers_.push_back(launcher); + works_launchers_.erase(it); + return true; +} bool DeviceAppsLauncher::LaunchAppsOnDevice( const std::string& device_mac, diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc index a81540708c..0636748977 100644 --- a/src/components/application_manager/src/application_data_impl.cc +++ b/src/components/application_manager/src/application_data_impl.cc @@ -44,6 +44,7 @@ InitialApplicationDataImpl::InitialApplicationDataImpl() , vr_synonyms_(NULL) , tts_name_(NULL) , ngn_media_screen_name_(NULL) + , language_(mobile_api::Language::INVALID_ENUM) , ui_language_(mobile_api::Language::INVALID_ENUM) {} @@ -102,6 +103,10 @@ const mobile_api::Language::eType& InitialApplicationDataImpl::ui_language() return ui_language_; } +const utils::SemanticVersion& InitialApplicationDataImpl::msg_version() const { + return msg_version_; +} + void InitialApplicationDataImpl::set_app_types( const smart_objects::SmartObject& app_types) { if (app_types_) { @@ -152,6 +157,11 @@ void InitialApplicationDataImpl::set_ui_language( ui_language_ = ui_language; } +void InitialApplicationDataImpl::set_msg_version( + const utils::SemanticVersion& version) { + msg_version_ = version; +} + void InitialApplicationDataImpl::set_perform_interaction_layout( mobile_apis::LayoutMode::eType layout) { perform_interaction_layout_ = layout; @@ -173,12 +183,18 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl() , menu_title_(NULL) , menu_icon_(NULL) , tbt_show_command_(NULL) + , day_color_scheme_(NULL) + , night_color_scheme_(NULL) + , display_layout_("") , commands_() - , commands_lock_(true) + , commands_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>()) , sub_menu_() + , sub_menu_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , choice_set_map_() + , choice_set_map_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , performinteraction_choice_set_map_() - , performinteraction_choice_set_lock_(true) + , performinteraction_choice_set_lock_ptr_( + std::make_shared<sync_primitives::RecursiveLock>()) , is_perform_interaction_active_(false) , is_reset_global_properties_active_(false) , perform_interaction_mode_(-1) {} @@ -214,6 +230,16 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() { tbt_show_command_ = NULL; } + if (day_color_scheme_) { + delete day_color_scheme_; + day_color_scheme_ = NULL; + } + + if (night_color_scheme_) { + delete night_color_scheme_; + night_color_scheme_ = NULL; + } + for (CommandsMap::iterator command_it = commands_.begin(); commands_.end() != command_it; ++command_it) { @@ -290,6 +316,20 @@ const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon() return menu_icon_; } +const smart_objects::SmartObject* DynamicApplicationDataImpl::day_color_scheme() + const { + return day_color_scheme_; +} + +const smart_objects::SmartObject* +DynamicApplicationDataImpl::night_color_scheme() const { + return night_color_scheme_; +} + +const std::string& DynamicApplicationDataImpl::display_layout() const { + return display_layout_; +} + void DynamicApplicationDataImpl::load_global_properties( const smart_objects::SmartObject& properties_so) { SetGlobalProperties(properties_so.getElement(strings::vr_help_title), @@ -405,10 +445,32 @@ void DynamicApplicationDataImpl::set_menu_icon( menu_icon_ = new smart_objects::SmartObject(menu_icon); } +void DynamicApplicationDataImpl::set_day_color_scheme( + const smart_objects::SmartObject& color_scheme) { + if (day_color_scheme_) { + delete day_color_scheme_; + } + + day_color_scheme_ = new smart_objects::SmartObject(color_scheme); +} + +void DynamicApplicationDataImpl::set_night_color_scheme( + const smart_objects::SmartObject& color_scheme) { + if (night_color_scheme_) { + delete night_color_scheme_; + } + + night_color_scheme_ = new smart_objects::SmartObject(color_scheme); +} + +void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) { + display_layout_ = layout; +} + void DynamicApplicationDataImpl::SetGlobalProperties( const smart_objects::SmartObject& param, void (DynamicApplicationData::*callback)( - const NsSmartDeviceLink::NsSmartObjects::SmartObject&)) { + const ns_smart_device_link::ns_smart_objects::SmartObject&)) { smart_objects::SmartType so_type = param.getType(); if (so_type != smart_objects::SmartType::SmartType_Invalid && so_type != smart_objects::SmartType::SmartType_Null) { @@ -422,7 +484,7 @@ void DynamicApplicationDataImpl::SetGlobalProperties( void DynamicApplicationDataImpl::AddCommand( uint32_t cmd_id, const smart_objects::SmartObject& command) { - sync_primitives::AutoLock lock(commands_lock_); + sync_primitives::AutoLock lock(commands_lock_ptr_); CommandsMap::const_iterator it = commands_.find(cmd_id); if (commands_.end() == it) { commands_[cmd_id] = new smart_objects::SmartObject(command); @@ -430,7 +492,7 @@ void DynamicApplicationDataImpl::AddCommand( } void DynamicApplicationDataImpl::RemoveCommand(uint32_t cmd_id) { - sync_primitives::AutoLock lock(commands_lock_); + sync_primitives::AutoLock lock(commands_lock_ptr_); CommandsMap::iterator it = commands_.find(cmd_id); if (commands_.end() != it) { delete it->second; @@ -440,7 +502,7 @@ void DynamicApplicationDataImpl::RemoveCommand(uint32_t cmd_id) { smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand( uint32_t cmd_id) { - sync_primitives::AutoLock lock(commands_lock_); + sync_primitives::AutoLock lock(commands_lock_ptr_); CommandsMap::const_iterator it = commands_.find(cmd_id); if (it != commands_.end()) { return it->second; @@ -452,7 +514,7 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand( // TODO(VS): Create common functions for processing collections void DynamicApplicationDataImpl::AddSubMenu( uint32_t menu_id, const smart_objects::SmartObject& menu) { - sync_primitives::AutoLock lock(sub_menu_lock_); + sync_primitives::AutoLock lock(sub_menu_lock_ptr_); SubMenuMap::const_iterator it = sub_menu_.find(menu_id); if (sub_menu_.end() == it) { sub_menu_[menu_id] = new smart_objects::SmartObject(menu); @@ -460,7 +522,7 @@ void DynamicApplicationDataImpl::AddSubMenu( } void DynamicApplicationDataImpl::RemoveSubMenu(uint32_t menu_id) { - sync_primitives::AutoLock lock(sub_menu_lock_); + sync_primitives::AutoLock lock(sub_menu_lock_ptr_); SubMenuMap::iterator it = sub_menu_.find(menu_id); if (sub_menu_.end() != it) { @@ -471,7 +533,7 @@ void DynamicApplicationDataImpl::RemoveSubMenu(uint32_t menu_id) { smart_objects::SmartObject* DynamicApplicationDataImpl::FindSubMenu( uint32_t menu_id) const { - sync_primitives::AutoLock lock(sub_menu_lock_); + sync_primitives::AutoLock lock(sub_menu_lock_ptr_); SubMenuMap::const_iterator it = sub_menu_.find(menu_id); if (it != sub_menu_.end()) { return it->second; @@ -482,7 +544,7 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindSubMenu( bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist( const std::string& name) { - sync_primitives::AutoLock lock(sub_menu_lock_); + sync_primitives::AutoLock lock(sub_menu_lock_ptr_); for (SubMenuMap::iterator it = sub_menu_.begin(); sub_menu_.end() != it; ++it) { smart_objects::SmartObject* menu = it->second; @@ -495,7 +557,7 @@ bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist( void DynamicApplicationDataImpl::AddChoiceSet( uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) { - sync_primitives::AutoLock lock(choice_set_map_lock_); + sync_primitives::AutoLock lock(choice_set_map_lock_ptr_); ChoiceSetMap::const_iterator it = choice_set_map_.find(choice_set_id); if (choice_set_map_.end() == it) { choice_set_map_[choice_set_id] = new smart_objects::SmartObject(choice_set); @@ -503,7 +565,7 @@ void DynamicApplicationDataImpl::AddChoiceSet( } void DynamicApplicationDataImpl::RemoveChoiceSet(uint32_t choice_set_id) { - sync_primitives::AutoLock lock(choice_set_map_lock_); + sync_primitives::AutoLock lock(choice_set_map_lock_ptr_); ChoiceSetMap::iterator it = choice_set_map_.find(choice_set_id); if (choice_set_map_.end() != it) { @@ -514,7 +576,7 @@ void DynamicApplicationDataImpl::RemoveChoiceSet(uint32_t choice_set_id) { smart_objects::SmartObject* DynamicApplicationDataImpl::FindChoiceSet( uint32_t choice_set_id) { - sync_primitives::AutoLock lock(choice_set_map_lock_); + sync_primitives::AutoLock lock(choice_set_map_lock_ptr_); ChoiceSetMap::const_iterator it = choice_set_map_.find(choice_set_id); if (it != choice_set_map_.end()) { return it->second; @@ -527,14 +589,14 @@ void DynamicApplicationDataImpl::AddPerformInteractionChoiceSet( uint32_t correlation_id, uint32_t choice_set_id, const smart_objects::SmartObject& vr_commands) { - sync_primitives::AutoLock lock(performinteraction_choice_set_lock_); + sync_primitives::AutoLock lock(performinteraction_choice_set_lock_ptr_); performinteraction_choice_set_map_[correlation_id].insert(std::make_pair( choice_set_id, new smart_objects::SmartObject(vr_commands))); } void DynamicApplicationDataImpl::DeletePerformInteractionChoiceSet( uint32_t correlation_id) { - sync_primitives::AutoLock lock(performinteraction_choice_set_lock_); + sync_primitives::AutoLock lock(performinteraction_choice_set_lock_ptr_); PerformChoice::iterator it = performinteraction_choice_set_map_[correlation_id].begin(); for (; performinteraction_choice_set_map_[correlation_id].end() != it; ++it) { diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index ac21219d7d..1168d94245 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Ford Motor Company + * Copyright (c) 2018, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,7 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/gen_hash.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/resumption/resume_ctrl.h" @@ -72,7 +71,7 @@ mobile_apis::FileType::eType StringToFileType(const char* str) { return mobile_apis::FileType::BINARY; } } -} +} // namespace CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") @@ -83,8 +82,8 @@ void SwitchApplicationParameters(ApplicationSharedPtr app, const size_t device_id, const std::string& mac_address) { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<ApplicationImpl> application = - ApplicationSharedPtr::dynamic_pointer_cast<ApplicationImpl>(app); + std::shared_ptr<ApplicationImpl> application = + std::dynamic_pointer_cast<ApplicationImpl>(app); DCHECK_OR_RETURN_VOID(application); application->app_id_ = app_id; application->device_id_ = device_id; @@ -97,7 +96,7 @@ ApplicationImpl::ApplicationImpl( const std::string& mac_address, const connection_handler::DeviceHandle device_id, const custom_str::CustomString& app_name, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, ApplicationManager& application_manager) : grammar_id_(0) , hmi_app_id_(0) @@ -105,6 +104,7 @@ ApplicationImpl::ApplicationImpl( , active_message_(NULL) , is_media_(false) , is_navi_(false) + , is_remote_control_supported_(false) , mobile_projection_enabled_(false) , video_streaming_approved_(false) , audio_streaming_approved_(false) @@ -123,11 +123,14 @@ ApplicationImpl::ApplicationImpl( , list_files_in_none_count_(0) , mac_address_(mac_address) , device_id_(device_id) + , secondary_device_id_(0) , usage_report_(mobile_app_id, statistics_manager) + , help_prompt_manager_impl_(*this, application_manager) , protocol_version_( protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3) , is_voice_communication_application_(false) , is_resuming_(false) + , deferred_resumption_hmi_level_(mobile_api::HMILevel::eType::INVALID_ENUM) , is_hash_changed_during_suspend_(false) , video_stream_retry_number_(0) , audio_stream_retry_number_(0) @@ -139,11 +142,13 @@ ApplicationImpl::ApplicationImpl( "AudioStreamSuspend", new ::timer::TimerTaskImpl<ApplicationImpl>( this, &ApplicationImpl::OnAudioStreamSuspend)) + , vi_lock_ptr_(std::make_shared<sync_primitives::Lock>()) + , button_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , application_manager_(application_manager) { cmd_number_to_time_limits_[mobile_apis::FunctionID::ReadDIDID] = { - date_time::DateTime::getCurrentTime(), 0}; + date_time::getCurrentTime(), 0}; cmd_number_to_time_limits_[mobile_apis::FunctionID::GetVehicleDataID] = { - date_time::DateTime::getCurrentTime(), 0}; + date_time::getCurrentTime(), 0}; set_mobile_app_id(mobile_app_id); set_name(app_name); @@ -168,7 +173,6 @@ ApplicationImpl::~ApplicationImpl() { } subscribed_buttons_.clear(); - subscribed_vehicle_info_.clear(); if (is_perform_interaction_active()) { set_perform_interaction_active(0); set_perform_interaction_mode(-1); @@ -220,6 +224,14 @@ void ApplicationImpl::set_is_navi(bool allow) { is_navi_ = allow; } +bool ApplicationImpl::is_remote_control_supported() const { + return is_remote_control_supported_; +} + +void ApplicationImpl::set_remote_control_supported(const bool allow) { + is_remote_control_supported_ = allow; +} + bool ApplicationImpl::is_voice_communication_supported() const { return is_voice_communication_application_; } @@ -230,7 +242,26 @@ void ApplicationImpl::set_voice_communication_supported( } bool ApplicationImpl::IsAudioApplication() const { - return is_media_ || is_voice_communication_application_ || is_navi_; + const bool is_audio_app = + is_media_application() || is_voice_communication_supported() || is_navi(); + LOG4CXX_DEBUG(logger_, + std::boolalpha << "is audio app --> ((is_media_app: " + << is_media_application() << ")" + << " || (is_voice_communication_app: " + << is_voice_communication_supported() << ")" + << " || (is_navi: " << is_navi() << ")) --> " + << is_audio_app); + return is_audio_app; +} + +bool ApplicationImpl::IsVideoApplication() const { + const bool is_video_app = is_navi() || mobile_projection_enabled(); + LOG4CXX_DEBUG(logger_, + std::boolalpha + << "is video app --> ((is_navi: " << is_navi() << ")" + << " || (mobile_projection: " << mobile_projection_enabled() + << ")) --> " << is_video_app); + return is_video_app; } void ApplicationImpl::SetRegularState(HmiStatePtr state) { @@ -283,6 +314,13 @@ const HmiStatePtr ApplicationImpl::RegularHmiState() const { return state_.GetState(HmiState::STATE_ID_REGULAR); } +bool ApplicationImpl::IsAllowedToChangeAudioSource() const { + if (is_remote_control_supported() && is_media_application()) { + return true; + } + return false; +} + const HmiStatePtr ApplicationImpl::PostponedHmiState() const { return state_.GetState(HmiState::STATE_ID_POSTPONED); } @@ -360,6 +398,10 @@ connection_handler::DeviceHandle ApplicationImpl::device() const { return device_id_; } +connection_handler::DeviceHandle ApplicationImpl::secondary_device() const { + return secondary_device_id_; +} + const std::string& ApplicationImpl::mac_address() const { return mac_address_; } @@ -473,6 +515,9 @@ void ApplicationImpl::StopStreamingForce( using namespace protocol_handler; LOG4CXX_AUTO_TRACE(logger_); + // see the comment in StopStreaming() + sync_primitives::AutoLock lock(streaming_stop_lock_); + SuspendStreaming(service_type); if (service_type == ServiceType::kMobileNav) { @@ -487,6 +532,12 @@ void ApplicationImpl::StopStreaming( using namespace protocol_handler; LOG4CXX_AUTO_TRACE(logger_); + // since WakeUpStreaming() is called from another thread, it is possible that + // the stream will be restarted after we call SuspendStreaming() and before + // we call StopXxxStreaming(). To avoid such timing issue, make sure that + // we run SuspendStreaming() and StopXxxStreaming() atomically. + sync_primitives::AutoLock lock(streaming_stop_lock_); + SuspendStreaming(service_type); if (service_type == ServiceType::kMobileNav && video_streaming_approved()) { @@ -537,6 +588,10 @@ void ApplicationImpl::WakeUpStreaming( using namespace protocol_handler; LOG4CXX_AUTO_TRACE(logger_); + // See the comment in StopStreaming(). Also, please make sure that we acquire + // streaming_stop_lock_ then xxx_streaming_suspended_lock_ in this order! + sync_primitives::AutoLock lock(streaming_stop_lock_); + if (ServiceType::kMobileNav == service_type) { sync_primitives::AutoLock lock(video_streaming_suspended_lock_); if (video_streaming_suspended_) { @@ -616,8 +671,9 @@ void ApplicationImpl::set_app_allowed(const bool allowed) { is_app_allowed_ = allowed; } -void ApplicationImpl::set_device(connection_handler::DeviceHandle device) { - device_id_ = device; +void ApplicationImpl::set_secondary_device( + connection_handler::DeviceHandle secondary_device) { + secondary_device_id_ = secondary_device; } uint32_t ApplicationImpl::get_grammar_id() const { @@ -665,6 +721,16 @@ bool ApplicationImpl::is_resuming() const { return is_resuming_; } +void ApplicationImpl::set_deferred_resumption_hmi_level( + mobile_api::HMILevel::eType level) { + deferred_resumption_hmi_level_ = level; +} + +mobile_api::HMILevel::eType ApplicationImpl::deferred_resumption_hmi_level() + const { + return deferred_resumption_hmi_level_; +} + bool ApplicationImpl::AddFile(const AppFile& file) { if (app_files_.count(file.file_name) == 0) { LOG4CXX_INFO(logger_, @@ -712,13 +778,13 @@ const AppFile* ApplicationImpl::GetFile(const std::string& file_name) { bool ApplicationImpl::SubscribeToButton( mobile_apis::ButtonName::eType btn_name) { - sync_primitives::AutoLock lock(button_lock_); + sync_primitives::AutoLock lock(button_lock_ptr_); return subscribed_buttons_.insert(btn_name).second; } bool ApplicationImpl::IsSubscribedToButton( mobile_apis::ButtonName::eType btn_name) { - sync_primitives::AutoLock lock(button_lock_); + sync_primitives::AutoLock lock(button_lock_ptr_); std::set<mobile_apis::ButtonName::eType>::iterator it = subscribed_buttons_.find(btn_name); return (subscribed_buttons_.end() != it); @@ -726,38 +792,21 @@ bool ApplicationImpl::IsSubscribedToButton( bool ApplicationImpl::UnsubscribeFromButton( mobile_apis::ButtonName::eType btn_name) { - sync_primitives::AutoLock lock(button_lock_); + sync_primitives::AutoLock lock(button_lock_ptr_); return subscribed_buttons_.erase(btn_name); } -bool ApplicationImpl::SubscribeToIVI(uint32_t vehicle_info_type) { - sync_primitives::AutoLock lock(vi_lock_); - return subscribed_vehicle_info_ - .insert( - static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type)) - .second; -} - -bool ApplicationImpl::IsSubscribedToIVI(uint32_t vehicle_info_type) const { - sync_primitives::AutoLock lock(vi_lock_); - VehicleInfoSubscriptions::const_iterator it = subscribed_vehicle_info_.find( - static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type)); - return (subscribed_vehicle_info_.end() != it); -} - -bool ApplicationImpl::UnsubscribeFromIVI(uint32_t vehicle_info_type) { - sync_primitives::AutoLock lock(vi_lock_); - return subscribed_vehicle_info_.erase( - static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type)); -} - UsageStatistics& ApplicationImpl::usage_report() { return usage_report_; } +HelpPromptManager& ApplicationImpl::help_prompt_manager() { + return help_prompt_manager_impl_; +} + bool ApplicationImpl::AreCommandLimitsExceeded( mobile_apis::FunctionID::eType cmd_id, TLimitSource source) { - TimevalStruct current = date_time::DateTime::getCurrentTime(); + date_time::TimeDuration current = date_time::getCurrentTime(); switch (source) { // In case of config file values there is COMMON limitations for number of // commands per certain time in seconds, i.e. 5 requests per 10 seconds with @@ -789,13 +838,14 @@ bool ApplicationImpl::AreCommandLimitsExceeded( LOG4CXX_INFO(logger_, "Time Info: " - << "\n Current: " << current.tv_sec << "\n Limit: (" - << limit.first.tv_sec << "," << limit.second - << ")" - "\n frequency_restrictions: (" + << "\n Current: " << date_time::getSecs(current) + << "\n Limit: (" << date_time::getSecs(limit.first) + << "," << limit.second << ")" + "\n frequency_restrictions: (" << frequency_restrictions.first << "," << frequency_restrictions.second << ")"); - if (current.tv_sec < limit.first.tv_sec + frequency_restrictions.second) { + if (date_time::getSecs(current) < + date_time::getSecs(limit.first) + frequency_restrictions.second) { if (limit.second < frequency_restrictions.first) { ++limit.second; return false; @@ -837,7 +887,8 @@ bool ApplicationImpl::AreCommandLimitsExceeded( TimeToNumberLimit& limit = it->second; // Checking even limitation for command - if (static_cast<uint32_t>(current.tv_sec - limit.first.tv_sec) < + if (static_cast<uint32_t>(date_time::getSecs(current) - + date_time::getSecs(limit.first)) < minute / cmd_limit) { return true; } @@ -857,12 +908,8 @@ bool ApplicationImpl::AreCommandLimitsExceeded( } DataAccessor<ButtonSubscriptions> ApplicationImpl::SubscribedButtons() const { - return DataAccessor<ButtonSubscriptions>(subscribed_buttons_, button_lock_); -} - -DataAccessor<VehicleInfoSubscriptions> ApplicationImpl::SubscribedIVI() const { - return DataAccessor<VehicleInfoSubscriptions>(subscribed_vehicle_info_, - vi_lock_); + return DataAccessor<ButtonSubscriptions>(subscribed_buttons_, + button_lock_ptr_); } const std::string& ApplicationImpl::curHash() const { @@ -1040,8 +1087,6 @@ void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) { } } -#ifdef SDL_REMOTE_CONTROL - void ApplicationImpl::set_system_context( const mobile_api::SystemContext::eType& system_context) { const HmiStatePtr hmi_state = CurrentHmiState(); @@ -1077,10 +1122,6 @@ void ApplicationImpl::set_hmi_level( usage_report_.RecordHmiStateChanged(new_hmi_level); } -const VehicleInfoSubscriptions& ApplicationImpl::SubscribesIVI() const { - return subscribed_vehicle_info_; -} - AppExtensionPtr ApplicationImpl::QueryInterface(AppExtensionUID uid) { std::list<AppExtensionPtr>::const_iterator it = extensions_.begin(); for (; it != extensions_.end(); ++it) { @@ -1101,21 +1142,17 @@ bool ApplicationImpl::AddExtension(AppExtensionPtr extension) { } bool ApplicationImpl::RemoveExtension(AppExtensionUID uid) { - for (std::list<AppExtensionPtr>::iterator it = extensions_.begin(); - extensions_.end() != it; - ++it) { - if ((*it)->uid() == uid) { - extensions_.erase(it); - return true; - } - } - return false; + auto it = std::find_if( + extensions_.begin(), + extensions_.end(), + [uid](AppExtensionPtr extension) { return extension->uid() == uid; }); + + return it != extensions_.end(); } -void ApplicationImpl::RemoveExtensions() { - application_manager_.GetPluginManager().RemoveAppExtension(app_id_); +const std::list<AppExtensionPtr>& ApplicationImpl::Extensions() const { + return extensions_; } -#endif // SDL_REMOTE_CONTROL void ApplicationImpl::PushMobileMessage( smart_objects::SmartObjectSPtr mobile_message) { diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 248b54fee5..3f877895ef 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -39,10 +39,11 @@ #include <bson_object.h> #include "application_manager/application_manager_impl.h" -#include "application_manager/mobile_command_factory.h" #include "application_manager/commands/command_impl.h" #include "application_manager/commands/command_notification_impl.h" #include "application_manager/message_helper.h" +#include "application_manager/rpc_service_impl.h" +#include "application_manager/rpc_handler_impl.h" #include "application_manager/mobile_message_handler.h" #include "application_manager/policies/policy_handler.h" #include "application_manager/hmi_capabilities_impl.h" @@ -51,6 +52,7 @@ #include "application_manager/app_launch/app_launch_data_db.h" #include "application_manager/app_launch/app_launch_data_json.h" #include "application_manager/helpers/application_helper.h" +#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h" #include "protocol_handler/protocol_handler.h" #include "hmi_message_handler/hmi_message_handler.h" #include "application_manager/command_holder_impl.h" @@ -63,7 +65,6 @@ #include "utils/threads/thread.h" #include "utils/file_system.h" #include "utils/helpers.h" -#include "utils/make_shared.h" #include "utils/timer_task_impl.h" #include "smart_objects/enum_schema_item.h" #include "interfaces/HMI_API_schema.h" @@ -73,17 +74,11 @@ #include "utils/custom_string.h" #include <time.h> -#ifdef SDL_REMOTE_CONTROL -#include "policy/usage_statistics/counter.h" -#include "functional_module/plugin_manager.h" -#include "application_manager/core_service.h" -#endif // SDL_REMOTE_CONTROL - namespace { int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) { return std::rand() % to + from; } -} +} // namespace namespace application_manager { @@ -97,7 +92,13 @@ DeviceTypes devicesType = { hmi_apis::Common_TransportType::BLUETOOTH), std::make_pair(std::string("BLUETOOTH_IOS"), hmi_apis::Common_TransportType::BLUETOOTH), - std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI)}; + std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI), + std::make_pair(std::string("USB_IOS_HOST_MODE"), + hmi_apis::Common_TransportType::USB_IOS), + std::make_pair(std::string("USB_IOS_DEVICE_MODE"), + hmi_apis::Common_TransportType::USB_IOS), + std::make_pair(std::string("CARPLAY_WIRELESS_IOS"), + hmi_apis::Common_TransportType::WIFI)}; } /** @@ -132,20 +133,21 @@ bool policy_app_id_comparator(const std::string& policy_app_id, uint32_t ApplicationManagerImpl::corelation_id_ = 0; const uint32_t ApplicationManagerImpl::max_corelation_id_ = UINT_MAX; -namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; -namespace jhs = NsSmartDeviceLink::NsJSONHandler::strings; +namespace formatters = ns_smart_device_link::ns_json_handler::formatters; +namespace jhs = ns_smart_device_link::ns_json_handler::strings; -using namespace NsSmartDeviceLink::NsSmartObjects; +using namespace ns_smart_device_link::ns_smart_objects; ApplicationManagerImpl::ApplicationManagerImpl( const ApplicationManagerSettings& am_settings, const policy::PolicySettings& policy_settings) : settings_(am_settings) - , applications_list_lock_(true) + , applications_list_lock_ptr_( + std::make_shared<sync_primitives::RecursiveLock>()) + , apps_to_register_list_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , audio_pass_thru_active_(false) , audio_pass_thru_app_id_(0) - , driver_distraction_state_( - hmi_apis::Common_DriverDistractionState::INVALID_ENUM) + , driver_distraction_state_(hmi_apis::Common_DriverDistractionState::DD_OFF) , is_vr_session_strated_(false) , hmi_cooperating_(false) , is_all_apps_allowed_(true) @@ -157,22 +159,13 @@ ApplicationManagerImpl::ApplicationManagerImpl( , request_ctrl_(am_settings) , hmi_so_factory_(NULL) , mobile_so_factory_(NULL) - , messages_from_mobile_("AM FromMobile", this) - , messages_to_mobile_("AM ToMobile", this) - , messages_from_hmi_("AM FromHMI", this) - , messages_to_hmi_("AM ToHMI", this) - , audio_pass_thru_messages_("AudioPassThru", this) , hmi_capabilities_(new HMICapabilitiesImpl(*this)) , unregister_reason_( mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM) , resume_ctrl_(new resumption::ResumeCtrlImpl(*this)) , navi_close_app_timeout_(am_settings.stop_streaming_timeout()) , navi_end_stream_timeout_(am_settings.stop_streaming_timeout()) - , stopping_application_mng_lock_(true) , state_ctrl_(*this) -#ifdef TELEMETRY_MONITOR - , metric_observer_(NULL) -#endif // TELEMETRY_MONITOR , application_list_update_timer_( "AM ListUpdater", new TimerTaskImpl<ApplicationManagerImpl>( @@ -184,7 +177,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( , is_low_voltage_(false) , apps_size_(0) , is_stopping_(false) { - std::srand(std::time(0)); + std::srand(std::time(nullptr)); AddPolicyObserver(this); dir_type_to_string_map_ = {{TYPE_STORAGE, "Storage"}, @@ -192,14 +185,20 @@ ApplicationManagerImpl::ApplicationManagerImpl( {TYPE_ICONS, "Icons"}}; sync_primitives::AutoLock lock(timer_pool_lock_); - TimerSPtr clearing_timer(utils::MakeShared<timer::Timer>( + TimerSPtr clearing_timer(std::make_shared<timer::Timer>( "ClearTimerPoolTimer", new TimerTaskImpl<ApplicationManagerImpl>( this, &ApplicationManagerImpl::ClearTimerPool))); const uint32_t timeout_ms = 10000u; clearing_timer->Start(timeout_ms, timer::kSingleShot); timer_pool_.push_back(clearing_timer); + rpc_handler_.reset(new rpc_handler::RPCHandlerImpl(*this)); commands_holder_.reset(new CommandHolderImpl(*this)); + rpc_service_.reset(new rpc_service::RPCServiceImpl(*this, + request_ctrl_, + protocol_handler_, + hmi_handler_, + *commands_holder_)); } ApplicationManagerImpl::~ApplicationManagerImpl() { @@ -227,10 +226,13 @@ ApplicationManagerImpl::~ApplicationManagerImpl() { navi_app_to_stop_.clear(); navi_app_to_end_stream_.clear(); + + secondary_transport_devices_cache_.clear(); } DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const { - DataAccessor<ApplicationSet> accessor(applications_, applications_list_lock_); + DataAccessor<ApplicationSet> accessor(applications_, + applications_list_lock_ptr_); return accessor; } @@ -352,8 +354,7 @@ struct IsApplication { connection_handler::DeviceHandle device_handle_; const std::string& policy_app_id_; }; - -std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated( +void ApplicationManagerImpl::IviInfoUpdated( mobile_apis::VehicleDataType::eType vehicle_info, int value) { // Notify Policy Manager if available about info it's interested in, // i.e. odometer etc @@ -364,19 +365,21 @@ std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated( default: break; } - - SubscribedToIVIPredicate finder(vehicle_info); - DataAccessor<ApplicationSet> accessor = applications(); - return FindAllApps(accessor, finder); } void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); - sync_primitives::AutoLock lock(applications_list_lock_); + sync_primitives::AutoLock lock(applications_list_lock_ptr_); const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app); state_ctrl_.OnApplicationRegistered(app, default_level); + std::function<void(plugin_manager::RPCPlugin&)> on_app_registered = + [app](plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent(plugin_manager::kApplicationRegistered, app); + }; + plugin_manager_->ForEachPlugin(on_app_registered); + // TODO(AOleynik): Is neccessary to be able to know that registration process // has been completed and default HMI level is set, otherwise policy will // block all the requests/notifications to mobile @@ -401,13 +404,14 @@ void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) { bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( ApplicationConstSharedPtr app) const { + LOG4CXX_AUTO_TRACE(logger_); bool voice_state = app->is_voice_communication_supported(); bool media_state = app->is_media_application(); bool navi_state = app->is_navi(); bool mobile_projection_state = app->mobile_projection_enabled(); ApplicationSharedPtr active_app = active_application(); // Check app in FULL level - if (active_app.valid()) { + if (active_app.use_count() != 0) { // If checking app hmi level FULL, we return false // because we couldn't have two applications with same HMIType in FULL and // LIMITED HMI level @@ -434,28 +438,28 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( // Check LIMITED apps if (voice_state) { - if (get_limited_voice_application().valid() && + if ((get_limited_voice_application().use_count() != 0) && (get_limited_voice_application()->app_id() != app->app_id())) { return true; } } if (media_state) { - if (get_limited_media_application().valid() && + if ((get_limited_media_application().use_count() != 0) && (get_limited_media_application()->app_id() != app->app_id())) { return true; } } if (navi_state) { - if (get_limited_navi_application().valid() && + if ((get_limited_navi_application().use_count() != 0) && (get_limited_navi_application()->app_id() != app->app_id())) { return true; } } if (mobile_projection_state) { - if (get_limited_mobile_projection_application().valid() && + if ((get_limited_mobile_projection_application().use_count() != 0) && (get_limited_mobile_projection_application()->app_id() != app->app_id())) { return true; @@ -466,7 +470,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( } ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( - const utils::SharedPtr<smart_objects::SmartObject>& + const std::shared_ptr<smart_objects::SmartObject>& request_for_registration) { LOG4CXX_AUTO_TRACE(logger_); @@ -484,18 +488,19 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( if (connection_handler().get_session_observer().GetDataOnSessionKey( connection_key, &app_id, &sessions_list, &device_id) == -1) { LOG4CXX_ERROR(logger_, "Failed to create application: no connection info."); - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID, message[strings::params][strings::correlation_id].asUInt(), mobile_apis::Result::GENERIC_ERROR)); - ManageMobileCommand(response, commands::Command::ORIGIN_SDL); + rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL); return ApplicationSharedPtr(); } smart_objects::SmartObject& params = message[strings::msg_params]; - const std::string& policy_app_id = params[strings::app_id].asString(); + const std::string& policy_app_id = + GetCorrectMobileIDFromMessage(request_for_registration); const custom_str::CustomString& app_name = message[strings::msg_params][strings::app_name].asCustomString(); std::string device_mac; @@ -516,13 +521,13 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( if (!is_all_apps_allowed_) { LOG4CXX_WARN(logger_, "RegisterApplication: access to app's disabled by user"); - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID, message[strings::params][strings::correlation_id].asUInt(), mobile_apis::Result::DISALLOWED)); - ManageMobileCommand(response, commands::Command::ORIGIN_SDL); + rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL); return ApplicationSharedPtr(); } @@ -535,20 +540,21 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( GetPolicyHandler().GetStatisticManager(), *this)); if (!application) { - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID, message[strings::params][strings::correlation_id].asUInt(), mobile_apis::Result::OUT_OF_MEMORY)); - ManageMobileCommand(response, commands::Command::ORIGIN_SDL); + rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL); return ApplicationSharedPtr(); } HmiStatePtr initial_state = - CreateRegularState(utils::SharedPtr<Application>(application), + CreateRegularState(std::shared_ptr<Application>(application), mobile_apis::HMILevel::INVALID_ENUM, mobile_apis::AudioStreamingState::INVALID_ENUM, + mobile_apis::VideoStreamingState::INVALID_ENUM, mobile_api::SystemContext::SYSCTXT_MAIN); application->SetInitialState(initial_state); @@ -601,13 +607,13 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( } // Keep HMI add id in case app is present in "waiting for registration" list - apps_to_register_list_lock_.Acquire(); + apps_to_register_list_lock_ptr_->Acquire(); AppsWaitRegistrationSet::iterator it = apps_to_register_.find(application); if (apps_to_register_.end() != it) { application->set_hmi_application_id((*it)->hmi_app_id()); apps_to_register_.erase(application); } - apps_to_register_list_lock_.Release(); + apps_to_register_list_lock_ptr_->Release(); if (!application->hmi_app_id()) { const bool is_saved = @@ -623,7 +629,12 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( const std::string& bundle_id = app_info[strings::bundle_id].asString(); application->set_bundle_id(bundle_id); } - PutDriverDistractionMessageToPostponed(application); + + const std::string app_icon_dir(settings_.app_icons_folder()); + const std::string full_icon_path(app_icon_dir + "/" + policy_app_id); + if (file_system::FileExists(full_icon_path)) { + application->set_app_icon_path(full_icon_path); + } // Stops timer of saving data to resumption in order to // doesn't erase data from resumption storage. @@ -633,23 +644,25 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( // Add application to registered app list and set appropriate mark. // Lock has to be released before adding app to policy DB to avoid possible // deadlock with simultaneous PTU processing - applications_list_lock_.Acquire(); + applications_list_lock_ptr_->Acquire(); application->MarkRegistered(); applications_.insert(application); apps_size_ = applications_.size(); - applications_list_lock_.Release(); + applications_list_lock_ptr_->Release(); - return application; -} - -DEPRECATED bool ApplicationManagerImpl::RemoveAppDataFromHMI( - ApplicationSharedPtr app) { - return true; -} + // It is possible that secondary transport of this app has been already + // established. Make sure that the information is reflected to application + // instance. + // Also, make sure that this is done *after* we updated applications_ list to + // avoid timing issues. + DeviceMap::iterator itr = + secondary_transport_devices_cache_.find(connection_key); + if (secondary_transport_devices_cache_.end() != itr) { + connection_handler::DeviceHandle secondary_device_handle = itr->second; + application->set_secondary_device(secondary_device_handle); + } -DEPRECATED bool ApplicationManagerImpl::LoadAppDataToHMI( - ApplicationSharedPtr app) { - return true; + return application; } bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { @@ -657,13 +670,18 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(app, false); + LOG4CXX_DEBUG(logger_, "Activating application with id:" << app->app_id()); + // remove from resumption if app was activated by user resume_controller().OnAppActivated(app); - HMILevel::eType hmi_level = HMILevel::HMI_FULL; - AudioStreamingState::eType audio_state; - app->IsAudioApplication() ? audio_state = AudioStreamingState::AUDIBLE - : audio_state = AudioStreamingState::NOT_AUDIBLE; - state_ctrl_.SetRegularState(app, hmi_level, audio_state, false); + const HMILevel::eType hmi_level = HMILevel::HMI_FULL; + const AudioStreamingState::eType audio_state = + app->IsAudioApplication() ? AudioStreamingState::AUDIBLE + : AudioStreamingState::NOT_AUDIBLE; + const VideoStreamingState::eType video_state = + app->IsVideoApplication() ? VideoStreamingState::STREAMABLE + : VideoStreamingState::NOT_STREAMABLE; + state_ctrl_.SetRegularState(app, hmi_level, audio_state, video_state, false); return true; } @@ -675,10 +693,10 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed( NOTREACHED(); return mobile_api::HMILevel::INVALID_ENUM; } - bool is_audio_app = app->IsAudioApplication(); - bool does_audio_app_with_same_type_exist = + const bool is_audio_app = app->IsAudioApplication(); + const bool does_audio_app_with_same_type_exist = IsAppTypeExistsInFullOrLimited(app); - bool is_active_app_exist = active_application().valid(); + const bool is_active_app_exist = (active_application().use_count() != 0); mobile_api::HMILevel::eType result = mobile_api::HMILevel::HMI_FULL; if (is_audio_app && does_audio_app_with_same_type_exist) { @@ -720,48 +738,46 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() { hmi_cooperating_ = true; MessageHelper::SendGetSystemInfoRequest(*this); - utils::SharedPtr<smart_objects::SmartObject> is_vr_ready( + std::shared_ptr<smart_objects::SmartObject> is_vr_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_IsReady, *this)); - ManageHMICommand(is_vr_ready); + rpc_service_->ManageHMICommand(is_vr_ready); - utils::SharedPtr<smart_objects::SmartObject> is_tts_ready( + std::shared_ptr<smart_objects::SmartObject> is_tts_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_IsReady, *this)); - ManageHMICommand(is_tts_ready); + rpc_service_->ManageHMICommand(is_tts_ready); - utils::SharedPtr<smart_objects::SmartObject> is_ui_ready( + std::shared_ptr<smart_objects::SmartObject> is_ui_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_IsReady, *this)); - ManageHMICommand(is_ui_ready); + rpc_service_->ManageHMICommand(is_ui_ready); - utils::SharedPtr<smart_objects::SmartObject> is_navi_ready( + std::shared_ptr<smart_objects::SmartObject> is_navi_ready( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::Navigation_IsReady, *this)); - ManageHMICommand(is_navi_ready); + rpc_service_->ManageHMICommand(is_navi_ready); - utils::SharedPtr<smart_objects::SmartObject> is_ivi_ready( + std::shared_ptr<smart_objects::SmartObject> is_ivi_ready( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::VehicleInfo_IsReady, *this)); - ManageHMICommand(is_ivi_ready); + rpc_service_->ManageHMICommand(is_ivi_ready); -#ifdef SDL_REMOTE_CONTROL - utils::SharedPtr<smart_objects::SmartObject> is_rc_ready( + std::shared_ptr<smart_objects::SmartObject> is_rc_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::RC_IsReady, *this)); - ManageHMICommand(is_rc_ready); -#endif + rpc_service_->ManageHMICommand(is_rc_ready); - utils::SharedPtr<smart_objects::SmartObject> button_capabilities( + std::shared_ptr<smart_objects::SmartObject> button_capabilities( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::Buttons_GetCapabilities, *this)); - ManageHMICommand(button_capabilities); + rpc_service_->ManageHMICommand(button_capabilities); - utils::SharedPtr<smart_objects::SmartObject> mixing_audio_supported_request( + std::shared_ptr<smart_objects::SmartObject> mixing_audio_supported_request( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported, *this)); - ManageHMICommand(mixing_audio_supported_request); + rpc_service_->ManageHMICommand(mixing_audio_supported_request); resume_controller().ResetLaunchTime(); } @@ -775,16 +791,6 @@ uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() { return corelation_id_; } -bool ApplicationManagerImpl::BeginAudioPassThrough() { - sync_primitives::AutoLock lock(audio_pass_thru_lock_); - if (audio_pass_thru_active_) { - return false; - } else { - audio_pass_thru_active_ = true; - return true; - } -} - bool ApplicationManagerImpl::BeginAudioPassThru(uint32_t app_id) { sync_primitives::AutoLock lock(audio_pass_thru_lock_); if (audio_pass_thru_active_) { @@ -796,16 +802,6 @@ bool ApplicationManagerImpl::BeginAudioPassThru(uint32_t app_id) { } } -bool ApplicationManagerImpl::EndAudioPassThrough() { - sync_primitives::AutoLock lock(audio_pass_thru_lock_); - if (audio_pass_thru_active_) { - audio_pass_thru_active_ = false; - return true; - } else { - return false; - } -} - bool ApplicationManagerImpl::EndAudioPassThru(uint32_t app_id) { sync_primitives::AutoLock lock(audio_pass_thru_lock_); if (audio_pass_thru_active_ && audio_pass_thru_app_id_ == app_id) { @@ -827,45 +823,24 @@ void ApplicationManagerImpl::set_driver_distraction_state( driver_distraction_state_ = state; } -DEPRECATED void ApplicationManagerImpl::set_vr_session_started( - const bool state) { - is_vr_session_strated_ = state; -} - void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) { is_all_apps_allowed_ = allowed; } HmiStatePtr ApplicationManagerImpl::CreateRegularState( - utils::SharedPtr<Application> app, + std::shared_ptr<Application> app, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::VideoStreamingState::eType video_state, mobile_apis::SystemContext::eType system_context) const { HmiStatePtr state(new HmiState(app, *this)); state->set_hmi_level(hmi_level); state->set_audio_streaming_state(audio_state); + state->set_video_streaming_state(video_state); state->set_system_context(system_context); return state; } -HmiStatePtr ApplicationManagerImpl::CreateRegularState( - uint32_t app_id, - mobile_apis::HMILevel::eType hmi_level, - mobile_apis::AudioStreamingState::eType audio_state, - mobile_apis::SystemContext::eType system_context) const { - HmiStatePtr state(new HmiState(app_id, *this)); - state->set_hmi_level(hmi_level); - state->set_audio_streaming_state(audio_state); - state->set_system_context(system_context); - return state; -} - -bool ApplicationManagerImpl::IsStateActive(HmiState::StateID state_id) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Checking for active state id " << state_id); - return state_ctrl_.IsStateActive(state_id); -} - void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key, int32_t correlation_id, int32_t max_duration, @@ -879,23 +854,6 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key, session_key, get_settings().recording_file_name(), max_duration); } -void ApplicationManagerImpl::SendAudioPassThroughNotification( - uint32_t session_key, std::vector<uint8_t>& binary_data) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!audio_pass_thru_active_) { - LOG4CXX_ERROR(logger_, - "Trying to send PassThroughNotification" - " when PassThrough is not active"); - return; - } - - impl::AudioData data; - data.session_key = session_key; - data.binary_data = binary_data; - audio_pass_thru_messages_.PostMessage(data); -} - void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(audio_pass_thru_lock_); @@ -933,43 +891,6 @@ ApplicationManagerImpl::GetDeviceTransportType( return result; } -void ApplicationManagerImpl::OnMessageReceived( - const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); - NOTREACHED(); - return; - } - - utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message); - - if (outgoing_message) { - LOG4CXX_DEBUG(logger_, "Posting new Message"); - messages_from_mobile_.PostMessage( - impl::MessageFromMobile(outgoing_message)); - } -} - -void ApplicationManagerImpl::OnMobileMessageSent( - const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); -} - -void ApplicationManagerImpl::OnMessageReceived( - hmi_message_handler::MessageSharedPointer message) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); - NOTREACHED(); - return; - } - - messages_from_hmi_.PostMessage(impl::MessageFromHmi(message)); -} - ApplicationConstSharedPtr ApplicationManagerImpl::WaitingApplicationByID( const uint32_t hmi_id) const { AppsWaitRegistrationSet app_list = AppsWaitingForRegistration().GetData(); @@ -988,12 +909,12 @@ ApplicationConstSharedPtr ApplicationManagerImpl::WaitingApplicationByID( DataAccessor<AppsWaitRegistrationSet> ApplicationManagerImpl::AppsWaitingForRegistration() const { return DataAccessor<AppsWaitRegistrationSet>(apps_to_register_, - apps_to_register_list_lock_); + apps_to_register_list_lock_ptr_); } bool ApplicationManagerImpl::IsAppsQueriedFrom( const connection_handler::DeviceHandle handle) const { - sync_primitives::AutoLock lock(apps_to_register_list_lock_); + sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); AppsWaitRegistrationSet::iterator it = apps_to_register_.begin(); AppsWaitRegistrationSet::const_iterator it_end = apps_to_register_.end(); for (; it != it_end; ++it) { @@ -1012,9 +933,25 @@ const ApplicationManagerSettings& ApplicationManagerImpl::get_settings() const { return settings_; } +// Extract the app ID to use for policy based on the UseFullAppID .ini setting +std::string ApplicationManagerImpl::GetCorrectMobileIDFromMessage( + const commands::MessageSharedPtr& message) const { + // If core is expecting a fullAppID + if (get_settings().use_full_app_id()) { + // fullAppID is present and core is configured to use it + if ((*message)[strings::msg_params].keyExists(strings::full_app_id)) { + return (*message)[strings::msg_params][strings::full_app_id].asString(); + } else { + LOG4CXX_DEBUG(logger_, "UseFullAppID is on but only short ID given!"); + } + } + // If core isn't using full or no full given, use regular appID + return (*message)[strings::msg_params][strings::app_id].asString(); +} + void application_manager::ApplicationManagerImpl::MarkAppsGreyOut( const connection_handler::DeviceHandle handle, bool is_greyed_out) { - sync_primitives::AutoLock lock(apps_to_register_list_lock_); + sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); AppsWaitRegistrationSet::iterator it = apps_to_register_.begin(); AppsWaitRegistrationSet::const_iterator it_end = apps_to_register_.end(); for (; it != it_end; ++it) { @@ -1023,10 +960,6 @@ void application_manager::ApplicationManagerImpl::MarkAppsGreyOut( } } } -void ApplicationManagerImpl::OnErrorSending( - hmi_message_handler::MessageSharedPointer message) { - return; -} void ApplicationManagerImpl::OnDeviceListUpdated( const connection_handler::DeviceMap& device_list) { @@ -1058,7 +991,8 @@ void ApplicationManagerImpl::OnDeviceListUpdated( return; } - smart_objects::SmartObjectSPtr update_list = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr update_list = + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& so_to_send = *update_list; so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList; @@ -1068,7 +1002,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated( so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = 1; so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID(); so_to_send[jhs::S_MSG_PARAMS] = *msg_params; - ManageHMICommand(update_list); + rpc_service_->ManageHMICommand(update_list); } void ApplicationManagerImpl::OnFindNewApplicationsRequest() { @@ -1097,7 +1031,7 @@ void ApplicationManagerImpl::SendUpdateAppList() { PrepareApplicationListSO(applications_, applications, *this); PrepareApplicationListSO(apps_to_register_, applications, *this); - ManageHMICommand(request); + rpc_service_->ManageHMICommand(request); } void ApplicationManagerImpl::RemoveDevice( @@ -1145,7 +1079,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart( return; } - auto update_list = utils::MakeShared<smart_objects::SmartObject>(); + auto update_list = std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& so_to_send = *update_list; so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList; @@ -1155,7 +1089,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart( so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = 1; so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID(); so_to_send[jhs::S_MSG_PARAMS] = *msg_params; - ManageHMICommand(update_list); + rpc_service_->ManageHMICommand(update_list); } void ApplicationManagerImpl::OnDeviceSwitchingFinish( @@ -1184,7 +1118,7 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app, const std::string& mac_address) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); - sync_primitives::AutoLock lock(applications_list_lock_); + sync_primitives::AutoLock lock(applications_list_lock_ptr_); DCHECK_OR_RETURN_VOID(1 == applications_.erase(app)); LOG4CXX_DEBUG(logger_, @@ -1235,127 +1169,95 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel( return default_hmi; } -uint32_t ApplicationManagerImpl::GenerateGrammarID() { - return rand(); -} - -uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() { +bool ApplicationManagerImpl::CheckResumptionRequiredTransportAvailable( + ApplicationConstSharedPtr application) const { + using namespace mobile_apis; LOG4CXX_AUTO_TRACE(logger_); - uint32_t hmi_app_id = get_rand_from_range(1); - LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id); - while (resume_controller().IsHMIApplicationIdExist(hmi_app_id)) { - LOG4CXX_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists."); - hmi_app_id = get_rand_from_range(1); - LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id); - } + const std::map<std::string, std::vector<std::string> >& transport_map = + get_settings().transport_required_for_resumption_map(); - return hmi_app_id; -} + // retrieve transport type string used in .ini file + const std::string transport_type = + GetTransportTypeProfileString(application->device()); + const std::string secondary_transport_type = + GetTransportTypeProfileString(application->secondary_device()); -void ApplicationManagerImpl::ReplaceMobileByHMIAppId( - smart_objects::SmartObject& message) { - MessageHelper::PrintSmartObject(message); - if (message.keyExists(strings::app_id)) { - ApplicationSharedPtr application_ptr = - application(message[strings::app_id].asUInt()); - if (application_ptr.valid()) { - LOG4CXX_DEBUG(logger_, - "ReplaceMobileByHMIAppId from " - << message[strings::app_id].asInt() << " to " - << application_ptr->hmi_app_id()); - message[strings::app_id] = application_ptr->hmi_app_id(); - } - } else { - switch (message.getType()) { - case smart_objects::SmartType::SmartType_Array: { - smart_objects::SmartArray* message_array = message.asArray(); - smart_objects::SmartArray::iterator it = message_array->begin(); - for (; it != message_array->end(); ++it) { - ReplaceMobileByHMIAppId(*it); - } - break; - } - case smart_objects::SmartType::SmartType_Map: { - std::set<std::string> keys = message.enumerate(); - std::set<std::string>::const_iterator key = keys.begin(); - for (; key != keys.end(); ++key) { - std::string k = *key; - ReplaceMobileByHMIAppId(message[*key]); - } - break; - } - default: { break; } + const smart_objects::SmartObject* app_types_array = application->app_types(); + if (app_types_array == NULL || app_types_array->length() == 0) { + // This app does not have any AppHMIType. In this case, check "EMPTY_APP" + // entry + std::map<std::string, std::vector<std::string> >::const_iterator it = + transport_map.find(std::string("EMPTY_APP")); + if (it == transport_map.end()) { + // if "EMPTY_APP" is not specified, resumption is always enabled + return true; } - } -} - -void ApplicationManagerImpl::ReplaceHMIByMobileAppId( - smart_objects::SmartObject& message) { - if (message.keyExists(strings::app_id)) { - ApplicationSharedPtr application = - application_by_hmi_app(message[strings::app_id].asUInt()); + const std::vector<std::string>& required_transport_list = it->second; - if (application.valid()) { - LOG4CXX_DEBUG(logger_, - "ReplaceHMIByMobileAppId from " - << message[strings::app_id].asInt() << " to " - << application->app_id()); - message[strings::app_id] = application->app_id(); + for (std::vector<std::string>::const_iterator itr = + required_transport_list.begin(); + itr != required_transport_list.end(); + ++itr) { + if (transport_type == *itr || secondary_transport_type == *itr) { + return true; + } } + return false; } else { - switch (message.getType()) { - case smart_objects::SmartType::SmartType_Array: { - smart_objects::SmartArray* message_array = message.asArray(); - smart_objects::SmartArray::iterator it = message_array->begin(); - for (; it != message_array->end(); ++it) { - ReplaceHMIByMobileAppId(*it); - } - break; + // check all AppHMITypes that the app has + for (size_t i = 0; i < app_types_array->length(); i++) { + const std::string app_type_string = + AppHMITypeToString(static_cast<mobile_apis::AppHMIType::eType>( + app_types_array->getElement(i).asUInt())); + bool transport_is_found = false; + + std::map<std::string, std::vector<std::string> >::const_iterator it = + transport_map.find(app_type_string); + if (it == transport_map.end()) { + // this AppHMIType is not listed in .ini file, so resumption is always + // enabled + continue; } - case smart_objects::SmartType::SmartType_Map: { - std::set<std::string> keys = message.enumerate(); - std::set<std::string>::const_iterator key = keys.begin(); - for (; key != keys.end(); ++key) { - ReplaceHMIByMobileAppId(message[*key]); + + const std::vector<std::string>& required_transport_list = it->second; + for (std::vector<std::string>::const_iterator itr = + required_transport_list.begin(); + itr != required_transport_list.end(); + ++itr) { + if (transport_type == *itr || secondary_transport_type == *itr) { + transport_is_found = true; + break; } - break; } - default: { break; } - } - } -} - -bool ApplicationManagerImpl::StartNaviService( - uint32_t app_id, protocol_handler::ServiceType service_type) { - using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - if (HMILevelAllowsStreaming(app_id, service_type)) { - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() == it) { - std::pair<NaviServiceStatusMap::iterator, bool> res = - navi_service_status_.insert( - std::pair<uint32_t, std::pair<bool, bool> >( - app_id, std::make_pair(false, false))); - if (!res.second) { - LOG4CXX_WARN(logger_, "Navi service refused"); + // if neither primary or secondary transport type is included in the list, + // then resumption will be disabled + if (!transport_is_found) { return false; } - it = res.first; } - // Fill NaviServices map. Set true to first value of pair if - // we've started video service or to second value if we've - // started audio service - service_type == ServiceType::kMobileNav ? it->second.first = true - : it->second.second = true; - application(app_id)->StartStreaming(service_type); return true; - } else { - LOG4CXX_WARN(logger_, "Refused navi service by HMI level"); } - return false; +} + +uint32_t ApplicationManagerImpl::GenerateGrammarID() { + return rand(); +} + +uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() { + LOG4CXX_AUTO_TRACE(logger_); + uint32_t hmi_app_id = get_rand_from_range(1); + LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id); + + while (resume_controller().IsHMIApplicationIdExist(hmi_app_id)) { + LOG4CXX_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists."); + hmi_app_id = get_rand_from_range(1); + LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id); + } + + return hmi_app_id; } bool ApplicationManagerImpl::StartNaviService( @@ -1497,46 +1399,6 @@ void ApplicationManagerImpl::StopNaviService( app->StopStreaming(service_type); } -// Suppress warning for deprecated method used within another deprecated method -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -bool ApplicationManagerImpl::OnServiceStartedCallback( - const connection_handler::DeviceHandle& device_handle, - const int32_t& session_key, - const protocol_handler::ServiceType& type) { - using namespace helpers; - using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "ServiceType = " << type << ". Session = " << std::hex - << session_key); - - if (type == kRpc) { - LOG4CXX_DEBUG(logger_, "RPC service is about to be started."); - return true; - } - ApplicationSharedPtr app = application(session_key); - if (!app) { - LOG4CXX_WARN(logger_, - "The application with id:" << session_key - << " doesn't exists."); - return false; - } - - if (Compare<ServiceType, EQ, ONE>( - type, ServiceType::kMobileNav, ServiceType::kAudio)) { - if (app->is_navi()) { - return StartNaviService(session_key, type); - } else { - LOG4CXX_WARN(logger_, "Refuse not navi application"); - } - } else { - LOG4CXX_WARN(logger_, "Refuse unknown service"); - } - return false; -} -#pragma GCC diagnostic pop - void ApplicationManagerImpl::OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, @@ -1623,10 +1485,10 @@ void ApplicationManagerImpl::OnServiceEndedCallback( is_resuming = true; is_unexpected_disconnect = false; - ManageMobileCommand( + rpc_service_->ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( session_key, AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS), - commands::Command::ORIGIN_SDL); + commands::Command::SOURCE_SDL); break; } case CloseSessionReason::kMalformed: { @@ -1659,6 +1521,79 @@ void ApplicationManagerImpl::OnServiceEndedCallback( } } +void ApplicationManagerImpl::OnSecondaryTransportStartedCallback( + const connection_handler::DeviceHandle device_handle, + const int32_t session_key) { + LOG4CXX_AUTO_TRACE(logger_); + + if (device_handle == 0) { + LOG4CXX_WARN(logger_, + "Invalid device handle passed for secondary transport of app " + << session_key); + return; + } + + secondary_transport_devices_cache_[session_key] = device_handle; + + { + sync_primitives::AutoLock auto_lock(applications_list_lock_ptr_); + ApplicationSharedPtr app = application(session_key); + if (!app) { + // It is possible that secondary transport is established prior to + // RegisterAppInterface request being processed. In this case, we will + // update the app's information during RegisterApplication(). + LOG4CXX_DEBUG(logger_, + "Application with id: " << session_key << " is not found"); + return; + } + app->set_secondary_device(device_handle); + } + + // notify the event to HMI through BC.UpdateAppList request + SendUpdateAppList(); + + // if resumption has not been enabled, run it now + resume_controller().RetryResumption(session_key); +} + +void ApplicationManagerImpl::OnSecondaryTransportEndedCallback( + const int32_t session_key) { + LOG4CXX_AUTO_TRACE(logger_); + + DeviceMap::iterator it = secondary_transport_devices_cache_.find(session_key); + if (it == secondary_transport_devices_cache_.end()) { + LOG4CXX_WARN( + logger_, + "Unknown session_key specified while removing secondary transport: " + << session_key); + } else { + secondary_transport_devices_cache_.erase(it); + } + + { + sync_primitives::AutoLock auto_lock(applications_list_lock_ptr_); + ApplicationSharedPtr app = application(session_key); + if (!app) { + LOG4CXX_DEBUG(logger_, + "Application with id: " << session_key << " is not found"); + return; + } + + connection_handler::DeviceHandle device_handle = app->secondary_device(); + if (device_handle == 0) { + LOG4CXX_WARN(logger_, + "Secondary transport of app " << session_key + << " is not found"); + return; + } + + app->set_secondary_device(0); + } + + // notify the event to HMI through BC.UpdateAppList request + SendUpdateAppList(); +} + bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); @@ -1691,6 +1626,11 @@ bool ApplicationManagerImpl::OnHandshakeDone( return false; } +bool ApplicationManagerImpl::OnHandshakeFailed() { + LOG4CXX_AUTO_TRACE(logger_); + return false; +} + void ApplicationManagerImpl::OnCertificateUpdateRequired() { LOG4CXX_AUTO_TRACE(logger_); GetPolicyHandler().OnPTExchangeNeeded(); @@ -1718,6 +1658,7 @@ ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const { void ApplicationManagerImpl::set_hmi_message_handler( hmi_message_handler::HMIMessageHandler* handler) { hmi_handler_ = handler; + rpc_service_->set_hmi_message_handler(handler); } void ApplicationManagerImpl::set_connection_handler( @@ -1738,447 +1679,35 @@ protocol_handler::ProtocolHandler& ApplicationManagerImpl::protocol_handler() void ApplicationManagerImpl::set_protocol_handler( protocol_handler::ProtocolHandler* handler) { protocol_handler_ = handler; + rpc_service_->set_protocol_handler(handler); } void ApplicationManagerImpl::StartDevicesDiscovery() { connection_handler().get_device_discovery_starter().StartDevicesDiscovery(); } -void ApplicationManagerImpl::SendMessageToMobile( - const commands::MessageSharedPtr message, bool final_message) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); - NOTREACHED(); - return; - } - - if (!protocol_handler_) { - LOG4CXX_WARN(logger_, "No Protocol Handler set"); - return; - } - - ApplicationSharedPtr app = application( - (*message)[strings::params][strings::connection_key].asUInt()); - - const bool is_result_code_exists = - (*message)[strings::msg_params].keyExists(strings::result_code); - - if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with connection key"); - if (is_result_code_exists && - ((*message)[strings::msg_params][strings::result_code] == - NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION)) { - (*message)[strings::params][strings::protocol_version] = - protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1; - } else { - (*message)[strings::params][strings::protocol_version] = - SupportedSDLVersion(); - } - } else { - (*message)[strings::params][strings::protocol_version] = - app->protocol_version(); - } - - if (app && is_result_code_exists && - (*message)[strings::msg_params][strings::result_code] == - mobile_apis::Result::OUT_OF_MEMORY) { - app->usage_report().RecordRejectionsSyncOutOfMemory(); - } - - mobile_so_factory().attachSchema(*message, false); - LOG4CXX_DEBUG( - logger_, - "Attached schema to message, result if valid: " << message->isValid()); - - // Messages to mobile are not yet prioritized so use default priority value - utils::SharedPtr<Message> message_to_send( - new Message(protocol_handler::MessagePriority::kDefault)); - if (!ConvertSOtoMessage((*message), (*message_to_send))) { - LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string"); - return; - } - - smart_objects::SmartObject& msg_to_mobile = *message; - // If correlation_id is not present, it is from-HMI message which should be - // checked against policy permissions - if (msg_to_mobile[strings::params].keyExists(strings::correlation_id)) { - request_ctrl_.OnMobileResponse( - msg_to_mobile[strings::params][strings::correlation_id].asUInt(), - msg_to_mobile[strings::params][strings::connection_key].asUInt(), - msg_to_mobile[strings::params][strings::function_id].asInt()); -#ifdef SDL_REMOTE_CONTROL - const mobile_apis::FunctionID::eType function_id = - static_cast<mobile_apis::FunctionID::eType>( - (*message)[strings::params][strings::function_id].asUInt()); - if (function_id == mobile_apis::FunctionID::RegisterAppInterfaceID && - (*message)[strings::msg_params][strings::success].asBool()) { - LOG4CXX_INFO(logger_, - "Registered app " - << app->app_id() << " is " - << (plugin_manager_.IsAppForPlugins(app) ? "" : "not ") - << "for plugins."); - } -#endif // SDL_REMOTE_CONTROL - } else if (app) { - mobile_apis::FunctionID::eType function_id = - static_cast<mobile_apis::FunctionID::eType>( - (*message)[strings::params][strings::function_id].asUInt()); - RPCParams params; - - const smart_objects::SmartObject& s_map = (*message)[strings::msg_params]; - if (smart_objects::SmartType_Map == s_map.getType()) { - smart_objects::SmartMap::iterator iter = s_map.map_begin(); - smart_objects::SmartMap::iterator iter_end = s_map.map_end(); - - for (; iter != iter_end; ++iter) { - if (true == iter->second.asBool()) { - LOG4CXX_INFO(logger_, "Request's param: " << iter->first); - params.insert(iter->first); - } - } - } - const std::string string_functionID = - MessageHelper::StringifiedFunctionID(function_id); - const mobile_apis::Result::eType check_result = - CheckPolicyPermissions(app, string_functionID, params); - if (mobile_apis::Result::SUCCESS != check_result) { - LOG4CXX_WARN(logger_, - "Function \"" << string_functionID << "\" (#" << function_id - << ") not allowed by policy"); - return; - } - -#ifdef EXTERNAL_PROPRIETARY_MODE - if (function_id == mobile_apis::FunctionID::OnSystemRequestID) { - mobile_apis::RequestType::eType request_type = - static_cast<mobile_apis::RequestType::eType>( - (*message)[strings::msg_params][strings::request_type].asUInt()); - if (mobile_apis::RequestType::PROPRIETARY == request_type || - mobile_apis::RequestType::HTTP == request_type) { - GetPolicyHandler().OnUpdateRequestSentToMobile(); - } - } -#endif // EXTERNAL_PROPRIETARY_MODE - } - - if (message_to_send->binary_data()) { - LOG4CXX_DEBUG( - logger_, - "Binary data size: " << message_to_send->binary_data()->size()); - } - messages_to_mobile_.PostMessage( - impl::MessageToMobile(message_to_send, final_message)); -} - void ApplicationManagerImpl::TerminateRequest(const uint32_t connection_key, const uint32_t corr_id, const int32_t function_id) { request_ctrl_.TerminateRequest(corr_id, connection_key, function_id, true); } -bool ApplicationManagerImpl::ManageMobileCommand( - const commands::MessageSharedPtr message, - commands::Command::CommandOrigin origin) { - LOG4CXX_AUTO_TRACE(logger_); - if (!message) { - LOG4CXX_WARN(logger_, "Null-pointer message received."); - return false; - } - - if (IsLowVoltage()) { - LOG4CXX_WARN(logger_, "Low Voltage is active"); - return false; - } -#ifdef DEBUG - MessageHelper::PrintSmartObject(*message); -#endif - - LOG4CXX_DEBUG(logger_, "Trying to create message in mobile factory."); - utils::SharedPtr<commands::Command> command( - MobileCommandFactory::CreateCommand(message, origin, *this)); - - if (!command) { - LOG4CXX_WARN(logger_, - "RET Failed to create mobile command from smart object"); - return false; - } - - const uint32_t connection_key = static_cast<uint32_t>( - (*message)[strings::params][strings::connection_key].asUInt()); - - auto app_ptr = application(connection_key); - if (app_ptr && IsAppInReconnectMode(app_ptr->policy_app_id())) { - commands_holder_->Suspend( - app_ptr, CommandHolder::CommandType::kMobileCommand, message); - return true; - } - - mobile_apis::FunctionID::eType function_id = - static_cast<mobile_apis::FunctionID::eType>( - (*message)[strings::params][strings::function_id].asInt()); - - // Notifications from HMI have no such parameter - uint32_t correlation_id = - (*message)[strings::params].keyExists(strings::correlation_id) - ? (*message)[strings::params][strings::correlation_id].asUInt() - : 0; - - int32_t protocol_type = - (*message)[strings::params][strings::protocol_type].asUInt(); - - ApplicationSharedPtr app; - int32_t message_type = - (*message)[strings::params][strings::message_type].asInt(); - - if (((mobile_apis::FunctionID::RegisterAppInterfaceID != function_id) && - (protocol_type == commands::CommandImpl::mobile_protocol_type_)) && - (mobile_apis::FunctionID::UnregisterAppInterfaceID != function_id)) { - app = application(connection_key); - if (!app) { - LOG4CXX_ERROR(logger_, "RET APPLICATION_NOT_REGISTERED"); - smart_objects::SmartObjectSPtr response = - MessageHelper::CreateNegativeResponse( - connection_key, - static_cast<int32_t>(function_id), - correlation_id, - static_cast<int32_t>( - mobile_apis::Result::APPLICATION_NOT_REGISTERED)); - - SendMessageToMobile(response); - return false; - } - - // Message for "CheckPermission" must be with attached schema - mobile_so_factory().attachSchema(*message, false); - } - - if (message_type == mobile_apis::messageType::response) { - if (command->Init()) { - command->Run(); - command->CleanUp(); - } - return true; - } - if (message_type == mobile_apis::messageType::notification) { - request_ctrl_.addNotification(command); - if (command->Init()) { - command->Run(); - if (command->CleanUp()) { - request_ctrl_.removeNotification(command.get()); - } - // If CleanUp returned false notification should remove it self. - } - return true; - } - - if (message_type == mobile_apis::messageType::request) { - // commands will be launched from requesr_ctrl - mobile_apis::HMILevel::eType app_hmi_level = - mobile_apis::HMILevel::INVALID_ENUM; - if (app) { - app_hmi_level = app->hmi_level(); - } - - // commands will be launched from request_ctrl - - const request_controller::RequestController::TResult result = - request_ctrl_.addMobileRequest(command, app_hmi_level); - - if (result == request_controller::RequestController::SUCCESS) { - LOG4CXX_DEBUG(logger_, "Perform request"); - } else if (result == request_controller::RequestController:: - TOO_MANY_PENDING_REQUESTS) { - LOG4CXX_ERROR(logger_, - "RET Unable top perform request: " - << "TOO_MANY_PENDING_REQUESTS"); - - smart_objects::SmartObjectSPtr response = - MessageHelper::CreateNegativeResponse( - connection_key, - static_cast<int32_t>(function_id), - correlation_id, - static_cast<int32_t>( - mobile_apis::Result::TOO_MANY_PENDING_REQUESTS)); - ApplicationSharedPtr app_ptr = application(connection_key); - if (app_ptr) { - app_ptr->usage_report().RecordRemovalsForBadBehavior(); - } - - SendMessageToMobile(response); - return false; - } else if (result == - request_controller::RequestController::TOO_MANY_REQUESTS) { - LOG4CXX_ERROR(logger_, - "RET Unable to perform request: " - << "TOO_MANY_REQUESTS"); - - ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - connection_key, - mobile_api::AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS), - commands::Command::ORIGIN_SDL); - - UnregisterApplication(connection_key, - mobile_apis::Result::TOO_MANY_PENDING_REQUESTS, - false); - ApplicationSharedPtr app_ptr = application(connection_key); - if (app_ptr) { - app_ptr->usage_report().RecordRemovalsForBadBehavior(); - } - return false; - } else if (result == request_controller::RequestController:: - NONE_HMI_LEVEL_MANY_REQUESTS) { - LOG4CXX_ERROR(logger_, - "RET Unable to perform request: " - << "REQUEST_WHILE_IN_NONE_HMI_LEVEL"); - - ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - connection_key, - mobile_api::AppInterfaceUnregisteredReason:: - REQUEST_WHILE_IN_NONE_HMI_LEVEL), - commands::Command::ORIGIN_SDL); - - ApplicationSharedPtr app_ptr = application(connection_key); - if (app_ptr) { - app_ptr->usage_report().RecordRemovalsForBadBehavior(); - } - UnregisterApplication( - connection_key, mobile_apis::Result::INVALID_ENUM, false); - return false; - } else { - LOG4CXX_ERROR(logger_, "RET Unable to perform request: Unknown case"); - return false; - } - return true; - } - - LOG4CXX_ERROR(logger_, "RET UNKNOWN MESSAGE TYPE " << message_type); - return false; -} - void ApplicationManagerImpl::RemoveHMIFakeParameters( - application_manager::MessagePtr& message) { + application_manager::commands::MessageSharedPtr& message) { LOG4CXX_AUTO_TRACE(logger_); - using namespace NsSmartDeviceLink::NsSmartObjects; - using namespace NsSmartDeviceLink::NsJSONHandler; - SmartObject so; - - Formatters::FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType, - hmi_apis::messageType::eType>( - message->json_message(), so); - - std::string formatted_message; - namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; hmi_apis::HMI_API factory; - factory.attachSchema(so, true); - Formatters::FormatterJsonRpc::ToString(so, formatted_message); - message->set_json_message(formatted_message); -} - -void ApplicationManagerImpl::SendMessageToHMI( - const commands::MessageSharedPtr message) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!message) { - LOG4CXX_WARN(logger_, "Null-pointer message received."); - NOTREACHED(); - return; - } - - if (!hmi_handler_) { - LOG4CXX_WARN(logger_, "No HMI Handler set"); - return; - } - - // SmartObject |message| has no way to declare priority for now - utils::SharedPtr<Message> message_to_send( - new Message(protocol_handler::MessagePriority::kDefault)); - if (!message_to_send) { - LOG4CXX_ERROR(logger_, "Null pointer"); - return; - } - - hmi_so_factory().attachSchema(*message, false); - LOG4CXX_INFO( - logger_, - "Attached schema to message, result if valid: " << message->isValid()); - -#ifdef HMI_DBUS_API - message_to_send->set_smart_object(*message); -#else - if (!ConvertSOtoMessage(*message, *message_to_send)) { - LOG4CXX_WARN(logger_, - "Cannot send message to HMI: failed to create string"); - return; - } -#endif // HMI_DBUS_API - - messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send)); -} - -bool ApplicationManagerImpl::ManageHMICommand( - const commands::MessageSharedPtr message) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!message) { - LOG4CXX_WARN(logger_, "Null-pointer message received."); - return false; - } - - if (IsLowVoltage()) { - LOG4CXX_WARN(logger_, "Low Voltage is active"); - return false; - } - - MessageHelper::PrintSmartObject(*message); - - CommandSharedPtr command = HMICommandFactory::CreateCommand(message, *this); - if (!command) { - LOG4CXX_WARN(logger_, "Failed to create command from smart object"); - return false; - } - - if ((*message).keyExists(strings::msg_params) && - (*message)[strings::msg_params].keyExists(strings::app_id)) { - const auto connection_key = - (*message)[strings::msg_params][strings::app_id].asUInt(); - - auto app = application(static_cast<uint32_t>(connection_key)); - if (app && IsAppInReconnectMode(app->policy_app_id())) { - commands_holder_->Suspend( - app, CommandHolder::CommandType::kHmiCommand, message); - return true; - } - } - - int32_t message_type = - (*message)[strings::params][strings::message_type].asInt(); - - if (kRequest == message_type) { - LOG4CXX_DEBUG(logger_, "ManageHMICommand"); - request_ctrl_.addHMIRequest(command); - } - - if (command->Init()) { - command->Run(); - if (kResponse == message_type) { - const uint32_t correlation_id = - (*message)[strings::params][strings::correlation_id].asUInt(); - const int32_t function_id = - (*message)[strings::params][strings::function_id].asInt(); - request_ctrl_.OnHMIResponse(correlation_id, function_id); - } - return true; - } - return false; + factory.attachSchema(*message, true); } bool ApplicationManagerImpl::Init(resumption::LastState& last_state, media_manager::MediaManager* media_manager) { LOG4CXX_TRACE(logger_, "Init application manager"); + plugin_manager_.reset(new plugin_manager::RPCPluginManagerImpl( + *this, *rpc_service_, *hmi_capabilities_, *policy_handler_)); + if (!plugin_manager_->LoadPlugins(get_settings().plugins_folder())) { + LOG4CXX_ERROR(logger_, "Plugins are not loaded"); + return false; + } const std::string app_storage_folder = get_settings().app_storage_folder(); if (!InitDirectory(app_storage_folder, TYPE_STORAGE) || !IsReadWriteAllowed(app_storage_folder, TYPE_STORAGE)) { @@ -2234,18 +1763,6 @@ bool ApplicationManagerImpl::Init(resumption::LastState& last_state, } app_launch_ctrl_.reset(new app_launch::AppLaunchCtrlImpl( *app_launch_dto_.get(), *this, settings_)); - -#ifdef SDL_REMOTE_CONTROL - if (!hmi_handler_) { - LOG4CXX_ERROR(logger_, "HMI message handler was not initialized"); - return false; - } - plugin_manager_.SetServiceHandler(utils::MakeShared<CoreService>(*this)); - plugin_manager_.LoadPlugins(settings_.plugins_folder()); - plugin_manager_.OnServiceStateChanged( - functional_modules::ServiceState::HMI_ADAPTER_INITIALIZED); -#endif // SDL_REMOTE_CONTROL - return true; } @@ -2256,6 +1773,8 @@ bool ApplicationManagerImpl::Stop() { stopping_application_mng_lock_.Release(); application_list_update_timer_.Stop(); try { + SetUnregisterAllApplicationsReason( + mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF); UnregisterAllApplications(); } catch (...) { LOG4CXX_ERROR(logger_, @@ -2270,155 +1789,6 @@ bool ApplicationManagerImpl::Stop() { return true; } -bool ApplicationManagerImpl::ConvertMessageToSO( - const Message& message, smart_objects::SmartObject& output) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "\t\t\tMessage to convert: protocol " - << message.protocol_version() << "; json " - << message.json_message()); - - switch (message.protocol_version()) { - case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5: - case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4: - case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3: - case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2: { - const bool conversion_result = - formatters::CFormatterJsonSDLRPCv2::fromString( - message.json_message(), - output, - message.function_id(), - message.type(), - message.correlation_id()); - - rpc::ValidationReport report("RPC"); - - if (!conversion_result || - !mobile_so_factory().attachSchema(output, true) || - ((output.validate(&report) != smart_objects::Errors::OK))) { - LOG4CXX_WARN(logger_, - "Failed to parse string to smart object :" - << message.json_message()); - utils::SharedPtr<smart_objects::SmartObject> response( - MessageHelper::CreateNegativeResponse( - message.connection_key(), - message.function_id(), - message.correlation_id(), - mobile_apis::Result::INVALID_DATA)); - - (*response)[strings::msg_params][strings::info] = - rpc::PrettyFormat(report); - ManageMobileCommand(response, commands::Command::ORIGIN_SDL); - return false; - } - LOG4CXX_DEBUG(logger_, - "Convertion result for sdl object is true function_id " - << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); - - output[strings::params][strings::connection_key] = - message.connection_key(); - output[strings::params][strings::protocol_version] = - message.protocol_version(); - if (message.binary_data()) { - if (message.payload_size() < message.data_size()) { - LOG4CXX_ERROR(logger_, - "Incomplete binary" - << " binary size should be " << message.data_size() - << " payload data size is " - << message.payload_size()); - utils::SharedPtr<smart_objects::SmartObject> response( - MessageHelper::CreateNegativeResponse( - message.connection_key(), - message.function_id(), - message.correlation_id(), - mobile_apis::Result::INVALID_DATA)); - ManageMobileCommand(response, commands::Command::ORIGIN_SDL); - return false; - } - output[strings::params][strings::binary_data] = - *(message.binary_data()); - } - break; - } - case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI: { -#ifdef ENABLE_LOG - int32_t result = -#endif - formatters::FormatterJsonRpc::FromString< - hmi_apis::FunctionID::eType, - hmi_apis::messageType::eType>(message.json_message(), output); - LOG4CXX_DEBUG(logger_, - "Convertion result: " - << result << " function id " - << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); - if (!hmi_so_factory().attachSchema(output, false)) { - LOG4CXX_WARN(logger_, "Failed to attach schema to object."); - return false; - } - - rpc::ValidationReport report("RPC"); - - if (output.validate(&report) != smart_objects::Errors::OK) { - LOG4CXX_ERROR(logger_, - "Incorrect parameter from HMI" - << rpc::PrettyFormat(report)); - - output.erase(strings::msg_params); - output[strings::params][hmi_response::code] = - hmi_apis::Common_Result::INVALID_DATA; - output[strings::msg_params][strings::info] = rpc::PrettyFormat(report); - return false; - } - break; - } - case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: { - static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema; - - if (message.function_id() == 0 || message.type() == kUnknownType) { - LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION"); - - int32_t conversation_result = - formatters::CFormatterJsonSDLRPCv1::fromString< - NsSmartDeviceLinkRPC::V1::FunctionID::eType, - NsSmartDeviceLinkRPC::V1::messageType::eType>( - message.json_message(), output); - - if (formatters::CFormatterJsonSDLRPCv1::kSuccess == - conversation_result) { - smart_objects::SmartObject params = smart_objects::SmartObject( - smart_objects::SmartType::SmartType_Map); - - output[strings::params][strings::message_type] = - NsSmartDeviceLinkRPC::V1::messageType::response; - output[strings::params][strings::connection_key] = - message.connection_key(); - - output[strings::msg_params] = smart_objects::SmartObject( - smart_objects::SmartType::SmartType_Map); - output[strings::msg_params][strings::success] = false; - output[strings::msg_params][strings::result_code] = - NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION; - - smart_objects::SmartObjectSPtr msg_to_send = - new smart_objects::SmartObject(output); - v1_shema.attachSchema(*msg_to_send, false); - SendMessageToMobile(msg_to_send); - return false; - } - } - break; - } - default: - LOG4CXX_WARN(logger_, - "Application used unsupported protocol :" - << message.protocol_version() << "."); - return false; - } - - LOG4CXX_DEBUG(logger_, "Successfully parsed message into smart object"); - return true; -} - bool ApplicationManagerImpl::ConvertSOtoMessage( const smart_objects::SmartObject& message, Message& output) { LOG4CXX_AUTO_TRACE(logger_); @@ -2518,162 +1888,6 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( return true; } -MessageValidationResult ApplicationManagerImpl::ValidateMessageBySchema( - const Message& message) { - LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject so; - using namespace protocol_handler; - switch (message.protocol_version()) { - case MajorProtocolVersion::PROTOCOL_VERSION_5: - case MajorProtocolVersion::PROTOCOL_VERSION_4: - case MajorProtocolVersion::PROTOCOL_VERSION_3: - case MajorProtocolVersion::PROTOCOL_VERSION_2: { - const bool conversion_result = - formatters::CFormatterJsonSDLRPCv2::fromString( - message.json_message(), - so, - message.function_id(), - message.type(), - message.correlation_id()); - if (!conversion_result) { - return INVALID_JSON; - } - - if (!mobile_so_factory().attachSchema(so, true)) { - return INVALID_METADATA; - } - rpc::ValidationReport report("RPC"); - if (so.validate(&report) != smart_objects::Errors::OK) { - LOG4CXX_WARN(logger_, - "validate() failed for Mobile message - " - << rpc::PrettyFormat(report)); - return SCHEMA_MISMATCH; - } - break; - } - case MajorProtocolVersion::PROTOCOL_VERSION_HMI: { - const int32_t conversion_result = formatters::FormatterJsonRpc:: - FromString<hmi_apis::FunctionID::eType, hmi_apis::messageType::eType>( - message.json_message(), so); - if (0 != conversion_result) { - LOG4CXX_WARN(logger_, - "Failed to parse json from HMI: " << conversion_result); - return INVALID_JSON; - } - - if (!hmi_so_factory().attachSchema(so, true)) { - return INVALID_METADATA; - } - - rpc::ValidationReport report("RPC"); - if (so.validate(&report) != smart_objects::Errors::OK) { - LOG4CXX_WARN(logger_, - "validate() failed for HMI message - " - << rpc::PrettyFormat(report)); - return SCHEMA_MISMATCH; - } - break; - } - default: { return UNSUPPORTED_PROTOCOL; } - } - return SUCCESS; -} - -utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage( - const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); - DCHECK(message); - utils::SharedPtr<Message> outgoing_message; - - LOG4CXX_DEBUG(logger_, "Service type." << message->service_type()); - if (message->service_type() != protocol_handler::kRpc && - message->service_type() != protocol_handler::kBulk) { - // skip this message, not under handling of ApplicationManager - LOG4CXX_TRACE(logger_, "Skipping message; not the under AM handling."); - return outgoing_message; - } - - Message* convertion_result = - MobileMessageHandler::HandleIncomingMessageProtocol(message); - - if (convertion_result) { - outgoing_message = convertion_result; - } else { - LOG4CXX_ERROR(logger_, "Received invalid message"); - } - return outgoing_message; -} - -void ApplicationManagerImpl::ProcessMessageFromMobile( - const utils::SharedPtr<Message> message) { - LOG4CXX_AUTO_TRACE(logger_); -#ifdef TELEMETRY_MONITOR - AMTelemetryObserver::MessageMetricSharedPtr metric( - new AMTelemetryObserver::MessageMetric()); - metric->begin = date_time::DateTime::getCurrentTime(); -#endif // TELEMETRY_MONITOR - smart_objects::SmartObjectSPtr so_from_mobile = - utils::MakeShared<smart_objects::SmartObject>(); - - DCHECK_OR_RETURN_VOID(so_from_mobile); - if (!so_from_mobile) { - LOG4CXX_ERROR(logger_, "Null pointer"); - return; - } - - if (!ConvertMessageToSO(*message, *so_from_mobile)) { - LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); - return; - } -#ifdef TELEMETRY_MONITOR - metric->message = so_from_mobile; -#endif // TELEMETRY_MONITOR - - if (!ManageMobileCommand(so_from_mobile, commands::Command::ORIGIN_MOBILE)) { - LOG4CXX_ERROR(logger_, "Received command didn't run successfully"); - } -#ifdef TELEMETRY_MONITOR - metric->end = date_time::DateTime::getCurrentTime(); - if (metric_observer_) { - metric_observer_->OnMessage(metric); - } -#endif // TELEMETRY_MONITOR -} - -void ApplicationManagerImpl::ProcessMessageFromHMI( - const utils::SharedPtr<Message> message) { - LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr smart_object(new smart_objects::SmartObject); - - if (!smart_object) { - LOG4CXX_ERROR(logger_, "Null pointer"); - return; - } - -#ifdef HMI_DBUS_API - *smart_object = message->smart_object(); -#else - if (!ConvertMessageToSO(*message, *smart_object)) { - if (application_manager::MessageType::kResponse == - (*smart_object)[strings::params][strings::message_type].asInt()) { - (*smart_object).erase(strings::msg_params); - (*smart_object)[strings::params][hmi_response::code] = - hmi_apis::Common_Result::INVALID_DATA; - (*smart_object)[strings::msg_params][strings::info] = - std::string("Received invalid data on HMI response"); - } else { - LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); - return; - } - } -#endif // HMI_DBUS_API - - LOG4CXX_DEBUG(logger_, "Converted message, trying to create hmi command"); - if (!ManageHMICommand(smart_object)) { - LOG4CXX_ERROR(logger_, "Received command didn't run successfully"); - } -} - hmi_apis::HMI_API& ApplicationManagerImpl::hmi_so_factory() { if (!hmi_so_factory_) { hmi_so_factory_ = new hmi_apis::HMI_API; @@ -2855,7 +2069,7 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, app->set_vr_synonyms(vrSynonym); app->set_tts_name(ttsName); - sync_primitives::AutoLock lock(apps_to_register_list_lock_); + sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); LOG4CXX_DEBUG( logger_, "apps_to_register_ size before: " << apps_to_register_.size()); apps_to_register_.insert(app); @@ -2899,7 +2113,7 @@ bool ApplicationManagerImpl::is_attenuated_supported() const { #ifdef TELEMETRY_MONITOR void ApplicationManagerImpl::SetTelemetryObserver( AMTelemetryObserver* observer) { - metric_observer_ = observer; + rpc_handler_->SetTelemetryObserver(observer); } #endif // TELEMETRY_MONITOR @@ -2940,6 +2154,14 @@ void ApplicationManagerImpl::set_application_id(const int32_t correlation_id, std::pair<const int32_t, const uint32_t>(correlation_id, app_id)); } +uint32_t ApplicationManagerImpl::get_current_audio_source() const { + return current_audio_source_; +} + +void ApplicationManagerImpl::set_current_audio_source(const uint32_t source) { + current_audio_source_ = source; +} + void ApplicationManagerImpl::AddPolicyObserver( policy::PolicyHandlerObserver* listener) { GetPolicyHandler().add_listener(listener); @@ -3032,10 +2254,14 @@ void ApplicationManagerImpl::ClearAppsPersistentData() { void ApplicationManagerImpl::SendOnSDLClose() { LOG4CXX_AUTO_TRACE(logger_); - + if (IsLowVoltage()) { + LOG4CXX_TRACE(logger_, "SDL is in Low Voltage State"); + return; + } // must be sent to PASA HMI on shutdown synchronously smart_objects::SmartObjectSPtr msg = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); (*msg)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_OnSDLClose; @@ -3052,7 +2278,7 @@ void ApplicationManagerImpl::SendOnSDLClose() { } // SmartObject |message| has no way to declare priority for now - utils::SharedPtr<Message> message_to_send( + std::shared_ptr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); hmi_so_factory().attachSchema(*msg, false); @@ -3060,15 +2286,11 @@ void ApplicationManagerImpl::SendOnSDLClose() { logger_, "Attached schema to message, result if valid: " << msg->isValid()); -#ifdef HMI_DBUS_API - message_to_send->set_smart_object(*msg); -#else if (!ConvertSOtoMessage(*msg, *message_to_send)) { LOG4CXX_WARN(logger_, "Cannot send message to HMI: failed to create string"); return; } -#endif // HMI_DBUS_API if (!hmi_handler_) { LOG4CXX_WARN(logger_, "No HMI Handler set"); @@ -3099,10 +2321,10 @@ void ApplicationManagerImpl::UnregisterAllApplications() { ApplicationSetConstIt it = accessor.GetData().begin(); while (it != accessor.GetData().end()) { ApplicationSharedPtr app_to_remove = *it; - ManageMobileCommand( + rpc_service_->ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app_to_remove->app_id(), unregister_reason_), - commands::Command::ORIGIN_SDL); + commands::Command::SOURCE_SDL); UnregisterApplication(app_to_remove->app_id(), mobile_apis::Result::INVALID_ENUM, is_ignition_off, @@ -3121,7 +2343,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() { void ApplicationManagerImpl::RemoveAppsWaitingForRegistration( const connection_handler::DeviceHandle handle) { DevicePredicate device_finder(handle); - apps_to_register_list_lock_.Acquire(); + apps_to_register_list_lock_ptr_->Acquire(); AppsWaitRegistrationSet::iterator it_app = std::find_if( apps_to_register_.begin(), apps_to_register_.end(), device_finder); @@ -3134,7 +2356,7 @@ void ApplicationManagerImpl::RemoveAppsWaitingForRegistration( apps_to_register_.begin(), apps_to_register_.end(), device_finder); } - apps_to_register_list_lock_.Release(); + apps_to_register_list_lock_ptr_->Release(); } void ApplicationManagerImpl::UnregisterApplication( @@ -3205,7 +2427,7 @@ void ApplicationManagerImpl::UnregisterApplication( ApplicationSharedPtr app_to_remove; connection_handler::DeviceHandle handle = 0; { - sync_primitives::AutoLock lock(applications_list_lock_); + sync_primitives::AutoLock lock(applications_list_lock_ptr_); auto it_app = applications_.begin(); while (applications_.end() != it_app) { if (app_id == (*it_app)->app_id()) { @@ -3225,11 +2447,13 @@ void ApplicationManagerImpl::UnregisterApplication( return; } + if (is_resuming) { resume_controller().SaveApplication(app_to_remove); } else { resume_controller().RemoveApplicationFromSaved(app_to_remove); } + (hmi_capabilities_->get_hmi_language_handler()) .OnUnregisterApplication(app_id); AppV4DevicePredicate finder(handle); @@ -3250,12 +2474,12 @@ void ApplicationManagerImpl::UnregisterApplication( StopAudioPassThru(app_id); MessageHelper::SendStopAudioPathThru(*this); } - -#ifdef SDL_REMOTE_CONTROL - plugin_manager_.OnApplicationEvent( - functional_modules::ApplicationEvent::kApplicationUnregistered, - app_to_remove); -#endif + auto on_app_unregistered = + [app_to_remove](plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent(plugin_manager::kApplicationUnregistered, + app_to_remove); + }; + plugin_manager_->ForEachPlugin(on_app_unregistered); MessageHelper::SendOnAppUnregNotificationToHMI( app_to_remove, is_unexpected_disconnect, *this); @@ -3268,144 +2492,12 @@ void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) { connection_handler::kUnauthorizedApp); } -void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); - return; - } - sync_primitives::AutoLock lock(stopping_application_mng_lock_); - if (is_stopping_) { - LOG4CXX_INFO(logger_, "Application manager is stopping"); - return; - } -#ifdef SDL_REMOTE_CONTROL - if (plugin_manager_.IsMessageForPlugin(message)) { - if (functional_modules::ProcessResult::PROCESSED == - plugin_manager_.ProcessMessage(message)) { - LOG4CXX_INFO(logger_, "Message is processed by plugin."); - return; - } - } -#endif - ProcessMessageFromMobile(message); -} - -void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) { - if (!protocol_handler_) { - LOG4CXX_WARN(logger_, - "Protocol Handler is not set; cannot send message to mobile."); - return; - } - - utils::SharedPtr<protocol_handler::RawMessage> rawMessage = - MobileMessageHandler::HandleOutgoingMessageProtocol(message); - - if (!rawMessage) { - LOG4CXX_ERROR(logger_, "Failed to create raw message."); - return; - } - - bool is_final = message.is_final; - bool close_session = false; - if (is_final) { - if (1 < connection_handler().GetConnectionSessionsCount( - message->connection_key())) { - is_final = false; - close_session = true; - } - } - - protocol_handler_->SendMessageToMobileApp(rawMessage, is_final); - LOG4CXX_INFO(logger_, "Message for mobile given away"); - - if (close_session) { - connection_handler().CloseSession(message->connection_key(), - connection_handler::kCommon); - } -} - -void ApplicationManagerImpl::Handle(const impl::MessageFromHmi message) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); - return; - } - -#ifdef SDL_REMOTE_CONTROL - if (plugin_manager_.IsHMIMessageForPlugin(message)) { - functional_modules::ProcessResult result = - plugin_manager_.ProcessHMIMessage(message); - if (functional_modules::ProcessResult::PROCESSED == result || - functional_modules::ProcessResult::FAILED == result) { - LOG4CXX_INFO(logger_, "Message is processed by plugin."); - return; - } - } -#endif - - ProcessMessageFromHMI(message); -} - -void ApplicationManagerImpl::Handle(const impl::MessageToHmi message) { - LOG4CXX_AUTO_TRACE(logger_); - if (!hmi_handler_) { - LOG4CXX_ERROR(logger_, "Observer is not set for HMIMessageHandler"); - return; - } - - hmi_handler_->SendMessageToHMI(message); - LOG4CXX_INFO(logger_, "Message for HMI given away"); -} - -void ApplicationManagerImpl::Handle(const impl::AudioData message) { - LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr on_audio_pass = - new smart_objects::SmartObject(); - - if (!on_audio_pass) { - LOG4CXX_ERROR(logger_, "OnAudioPassThru NULL pointer"); - return; - } - - LOG4CXX_DEBUG(logger_, "Fill smart object"); - - (*on_audio_pass)[strings::params][strings::message_type] = - application_manager::MessageType::kNotification; - - (*on_audio_pass)[strings::params][strings::connection_key] = - static_cast<int32_t>(message.session_key); - (*on_audio_pass)[strings::params][strings::function_id] = - mobile_apis::FunctionID::OnAudioPassThruID; - - LOG4CXX_DEBUG(logger_, "Fill binary data"); - // binary data - (*on_audio_pass)[strings::params][strings::binary_data] = - smart_objects::SmartObject(message.binary_data); - - LOG4CXX_DEBUG(logger_, "After fill binary data"); - LOG4CXX_DEBUG(logger_, "Send data"); - CommandSharedPtr command(MobileCommandFactory::CreateCommand( - on_audio_pass, commands::Command::ORIGIN_SDL, *this)); - if (!command) { - LOG4CXX_WARN(logger_, "Failed to create mobile command from smart object"); - return; - } - - if (command->Init()) { - command->Run(); - command->CleanUp(); - } -} - mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( const ApplicationSharedPtr app, const std::string& function_id, const RPCParams& rpc_params, CommandParametersPermissions* params_permissions) { - LOG4CXX_INFO(logger_, "CheckPolicyPermissions"); + LOG4CXX_AUTO_TRACE(logger_); // TODO(AOleynik): Remove check of policy_enable, when this flag will be // unused in config file if (!GetPolicyHandler().PolicyEnabled()) { @@ -3453,17 +2545,36 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( return mobile_api::Result::SUCCESS; } +bool ApplicationManagerImpl::is_stopping() const { + sync_primitives::AutoLock lock(stopping_application_mng_lock_); + return is_stopping_; +} + +bool ApplicationManagerImpl::is_audio_pass_thru_active() const { + return audio_pass_thru_active_; +} + void ApplicationManagerImpl::OnLowVoltage() { LOG4CXX_AUTO_TRACE(logger_); is_low_voltage_ = true; + resume_ctrl_->SaveLowVoltageTime(); + resume_ctrl_->StopSavePersistentDataTimer(); request_ctrl_.OnLowVoltage(); } -bool ApplicationManagerImpl::IsLowVoltage() { - LOG4CXX_TRACE(logger_, "result: " << is_low_voltage_); +bool ApplicationManagerImpl::IsLowVoltage() const { + LOG4CXX_TRACE(logger_, "Result: " << is_low_voltage_); return is_low_voltage_; } +void ApplicationManagerImpl::OnWakeUp() { + LOG4CXX_AUTO_TRACE(logger_); + is_low_voltage_ = false; + resume_ctrl_->SaveWakeUpTime(); + resume_ctrl_->StartSavePersistentDataTimer(); + request_ctrl_.OnWakeUp(); +} + std::string ApplicationManagerImpl::GetHashedAppID( uint32_t connection_key, const std::string& mobile_app_id) const { connection_handler::DeviceHandle device_id = 0; @@ -3548,10 +2659,10 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { } } if (unregister) { - ManageMobileCommand( + rpc_service_->ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app_id, PROTOCOL_VIOLATION), - commands::Command::ORIGIN_SDL); + commands::Command::SOURCE_SDL); UnregisterApplication(app_id, ABORTED); return; } @@ -3560,7 +2671,6 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { void ApplicationManagerImpl::OnAppStreaming( uint32_t app_id, protocol_handler::ServiceType service_type, bool state) { - using namespace protocol_handler; LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); @@ -3573,11 +2683,11 @@ void ApplicationManagerImpl::OnAppStreaming( DCHECK_OR_RETURN_VOID(media_manager_); if (state) { - state_ctrl_.OnNaviStreamingStarted(); + state_ctrl_.OnVideoStreamingStarted(app); media_manager_->StartStreaming(app_id, service_type); } else { media_manager_->StopStreaming(app_id, service_type); - state_ctrl_.OnNaviStreamingStopped(); + state_ctrl_.OnVideoStreamingStarted(app); } } @@ -3622,7 +2732,7 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { navi_app_to_stop_.push_back(app_id); - TimerSPtr close_timer(utils::MakeShared<timer::Timer>( + TimerSPtr close_timer(std::make_shared<timer::Timer>( "CloseNaviAppTimer", new TimerTaskImpl<ApplicationManagerImpl>( this, &ApplicationManagerImpl::CloseNaviApp))); @@ -3652,21 +2762,20 @@ void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) { } MobileMessageQueue messages; app->SwapMobileMessageQueue(messages); - auto push_allowed_messages = - [this, &app](smart_objects::SmartObjectSPtr message) { - const std::string function_id = MessageHelper::StringifiedFunctionID( - static_cast<mobile_apis::FunctionID::eType>( - (*message)[strings::params][strings::function_id].asUInt())); - const RPCParams params; - const mobile_apis::Result::eType check_result = - CheckPolicyPermissions(app, function_id, params); - if (mobile_api::Result::SUCCESS == check_result) { - ManageMobileCommand(message, - commands::Command::CommandOrigin::ORIGIN_SDL); - } else { - app->PushMobileMessage(message); - } - }; + auto push_allowed_messages = [this, &app]( + smart_objects::SmartObjectSPtr message) { + const std::string function_id = MessageHelper::StringifiedFunctionID( + static_cast<mobile_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asUInt())); + const RPCParams params; + const mobile_apis::Result::eType check_result = + CheckPolicyPermissions(app, function_id, params); + if (mobile_api::Result::SUCCESS == check_result) { + rpc_service_->ManageMobileCommand(message, commands::Command::SOURCE_SDL); + } else { + app->PushMobileMessage(message); + } + }; std::for_each(messages.begin(), messages.end(), push_allowed_messages); } @@ -3698,7 +2807,7 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, if (from == HMI_FULL || from == HMI_LIMITED) { LOG4CXX_TRACE(logger_, "HMILevel from FULL or LIMITED"); navi_app_to_end_stream_.push_back(app_id); - TimerSPtr end_stream_timer(utils::MakeShared<timer::Timer>( + TimerSPtr end_stream_timer(std::make_shared<timer::Timer>( "AppShouldFinishStreaming", new TimerTaskImpl<ApplicationManagerImpl>( this, &ApplicationManagerImpl::EndNaviStreaming))); @@ -3716,11 +2825,11 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, } void ApplicationManagerImpl::SendHMIStatusNotification( - const utils::SharedPtr<Application> app) { + const std::shared_ptr<Application> app) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = @@ -3738,10 +2847,14 @@ void ApplicationManagerImpl::SendHMIStatusNotification( message[strings::msg_params][strings::audio_streaming_state] = static_cast<int32_t>(app->audio_streaming_state()); + message[strings::msg_params][strings::video_streaming_state] = + static_cast<int32_t>(app->video_streaming_state()); + message[strings::msg_params][strings::system_context] = static_cast<int32_t>(app->system_context()); - ManageMobileCommand(notification, commands::Command::ORIGIN_SDL); + rpc_service_->ManageMobileCommand(notification, + commands::Command::SOURCE_SDL); } void ApplicationManagerImpl::ClearTimerPool() { @@ -3784,10 +2897,10 @@ void ApplicationManagerImpl::CloseNaviApp() { if (unregister) { LOG4CXX_INFO(logger_, "App haven't answered for EndService. Unregister it."); - ManageMobileCommand( + rpc_service_->ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app_id, PROTOCOL_VIOLATION), - commands::Command::ORIGIN_SDL); + commands::Command::SOURCE_SDL); UnregisterApplication(app_id, ABORTED); } } @@ -3880,12 +2993,6 @@ policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice( return GetPolicyHandler().GetUserConsentForDevice(device_id); } -void ApplicationManagerImpl::OnWakeUp() { - LOG4CXX_AUTO_TRACE(logger_); - is_low_voltage_ = false; - request_ctrl_.OnWakeUp(); -} - mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( const std::vector<uint8_t>& binary_data, const std::string& file_path, @@ -3969,9 +3076,9 @@ bool ApplicationManagerImpl::IsHMICooperating() const { void ApplicationManagerImpl::OnApplicationListUpdateTimer() { LOG4CXX_DEBUG(logger_, "Application list update timer finished"); - apps_to_register_list_lock_.Acquire(); + apps_to_register_list_lock_ptr_->Acquire(); const bool trigger_ptu = apps_size_ != applications_.size(); - apps_to_register_list_lock_.Release(); + apps_to_register_list_lock_ptr_->Release(); SendUpdateAppList(); GetPolicyHandler().OnAppsSearchCompleted(trigger_ptu); } @@ -3980,14 +3087,14 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() { std::vector<uint32_t> app_list; { sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_); - std::map<uint32_t, TimevalStruct>::iterator it = + std::map<uint32_t, date_time::TimeDuration>::iterator it = tts_global_properties_app_list_.begin(); - std::map<uint32_t, TimevalStruct>::iterator it_end = + std::map<uint32_t, date_time::TimeDuration>::iterator it_end = tts_global_properties_app_list_.end(); date_time::TimeCompare time_comp; for (; it != it_end; ++it) { - time_comp = date_time::DateTime::compareTime( - date_time::DateTime::getCurrentTime(), it->second); + time_comp = + date_time::compareTime(date_time::getCurrentTime(), it->second); if (date_time::GREATER == time_comp || date_time::EQUAL == time_comp) { app_list.push_back(it->first); } @@ -4008,8 +3115,8 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList( const uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); uint16_t timeout = get_settings().tts_global_properties_timeout(); - TimevalStruct current_time = date_time::DateTime::getCurrentTime(); - current_time.tv_sec += timeout; + date_time::TimeDuration current_time = date_time::getCurrentTime(); + current_time += date_time::seconds(timeout); // please avoid AutoLock usage to avoid deadlock tts_global_properties_app_list_lock_.Acquire(); if (tts_global_properties_app_list_.end() == @@ -4032,7 +3139,7 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( LOG4CXX_AUTO_TRACE(logger_); // please avoid AutoLock usage to avoid deadlock tts_global_properties_app_list_lock_.Acquire(); - std::map<uint32_t, TimevalStruct>::iterator it = + std::map<uint32_t, date_time::TimeDuration>::iterator it = tts_global_properties_app_list_.find(app_id); if (tts_global_properties_app_list_.end() != it) { tts_global_properties_app_list_.erase(it); @@ -4060,6 +3167,8 @@ mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType( return mobile_apis::AppHMIType::MESSAGING; } else if ("NAVIGATION" == str) { return mobile_apis::AppHMIType::NAVIGATION; + } else if ("PROJECTION" == str) { + return mobile_apis::AppHMIType::PROJECTION; } else if ("INFORMATION" == str) { return mobile_apis::AppHMIType::INFORMATION; } else if ("SOCIAL" == str) { @@ -4075,6 +3184,39 @@ mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType( } } +const std::string ApplicationManagerImpl::AppHMITypeToString( + mobile_apis::AppHMIType::eType type) const { + LOG4CXX_AUTO_TRACE(logger_); + switch (type) { + case mobile_apis::AppHMIType::DEFAULT: + return "DEFAULT"; + case mobile_apis::AppHMIType::COMMUNICATION: + return "COMMUNICATION"; + case mobile_apis::AppHMIType::MEDIA: + return "MEDIA"; + case mobile_apis::AppHMIType::MESSAGING: + return "MESSAGING"; + case mobile_apis::AppHMIType::NAVIGATION: + return "NAVIGATION"; + case mobile_apis::AppHMIType::INFORMATION: + return "INFORMATION"; + case mobile_apis::AppHMIType::SOCIAL: + return "SOCIAL"; + case mobile_apis::AppHMIType::BACKGROUND_PROCESS: + return "BACKGROUND_PROCESS"; + case mobile_apis::AppHMIType::TESTING: + return "TESTING"; + case mobile_apis::AppHMIType::SYSTEM: + return "SYSTEM"; + case mobile_apis::AppHMIType::PROJECTION: + return "PROJECTION"; + case mobile_apis::AppHMIType::REMOTE_CONTROL: + return "REMOTE_CONTROL"; + default: + return "INVALID_ENUM"; + } +} + bool ApplicationManagerImpl::CompareAppHMIType( const smart_objects::SmartObject& from_policy, const smart_objects::SmartObject& from_application) { @@ -4201,17 +3343,19 @@ void ApplicationManagerImpl::ProcessReconnection( } void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) { -#ifdef SDL_REMOTE_CONTROL + LOG4CXX_AUTO_TRACE(logger_); if (!ptu_result) { return; } - plugin_manager_.OnPolicyEvent( - functional_modules::PolicyEvent::kApplicationPolicyUpdated); -#endif // SDL_REMOTE_CONTROL + auto on_app_policy_updated = [](plugin_manager::RPCPlugin& plugin) { + plugin.OnPolicyEvent(plugin_manager::kApplicationPolicyUpdated); + }; + + plugin_manager_->ForEachPlugin(on_app_policy_updated); } -void ApplicationManagerImpl::PutDriverDistractionMessageToPostponed( - ApplicationSharedPtr application) const { +void ApplicationManagerImpl::SendDriverDistractionState( + ApplicationSharedPtr application) { LOG4CXX_AUTO_TRACE(logger_); if (hmi_apis::Common_DriverDistractionState::INVALID_ENUM == driver_distraction_state()) { @@ -4219,7 +3363,7 @@ void ApplicationManagerImpl::PutDriverDistractionMessageToPostponed( return; } smart_objects::SmartObjectSPtr on_driver_distraction = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*on_driver_distraction)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); @@ -4229,7 +3373,20 @@ void ApplicationManagerImpl::PutDriverDistractionMessageToPostponed( driver_distraction_state(); (*on_driver_distraction)[strings::params][strings::connection_key] = application->app_id(); - application->PushMobileMessage(on_driver_distraction); + + const std::string function_id = MessageHelper::StringifiedFunctionID( + static_cast<mobile_apis::FunctionID::eType>( + (*on_driver_distraction)[strings::params][strings::function_id] + .asUInt())); + const RPCParams params; + const mobile_apis::Result::eType check_result = + CheckPolicyPermissions(application, function_id, params); + if (mobile_api::Result::SUCCESS == check_result) { + rpc_service_->ManageMobileCommand(on_driver_distraction, + commands::Command::SOURCE_SDL); + } else { + application->PushMobileMessage(on_driver_distraction); + } } protocol_handler::MajorProtocolVersion @@ -4299,37 +3456,13 @@ void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() { } bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( - const uint32_t app_id) const { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - if (subscribed_way_points_apps_list_.find(app_id) == - subscribed_way_points_apps_list_.end()) { - return false; - } - return true; -} - -void ApplicationManagerImpl::SubscribeAppForWayPoints(const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.insert(app_id); -} - -void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( - const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.erase(app_id); -} - -bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( ApplicationSharedPtr app) const { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); LOG4CXX_DEBUG(logger_, "There are applications subscribed: " << subscribed_way_points_apps_list_.size()); - if (subscribed_way_points_apps_list_.find(app) == + if (subscribed_way_points_apps_list_.find(app->app_id()) == subscribed_way_points_apps_list_.end()) { return false; } @@ -4340,7 +3473,7 @@ void ApplicationManagerImpl::SubscribeAppForWayPoints( ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.insert(app); + subscribed_way_points_apps_list_.insert(app->app_id()); LOG4CXX_DEBUG(logger_, "There are applications subscribed: " << subscribed_way_points_apps_list_.size()); @@ -4350,7 +3483,7 @@ void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.erase(app); + subscribed_way_points_apps_list_.erase(app->app_id()); LOG4CXX_DEBUG(logger_, "There are applications subscribed: " << subscribed_way_points_apps_list_.size()); @@ -4372,6 +3505,16 @@ const std::set<int32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints() return subscribed_way_points_apps_list_; } +// retrieve transport type string used in .ini file, e.g. "TCP_WIFI" +const std::string ApplicationManagerImpl::GetTransportTypeProfileString( + connection_handler::DeviceHandle device_handle) const { + LOG4CXX_AUTO_TRACE(logger_); + + return connection_handler() + .get_session_observer() + .TransportTypeProfileStringFromDeviceHandle(device_handle); +} + static hmi_apis::Common_VideoStreamingProtocol::eType ConvertVideoProtocol( const char* str) { if (strcmp(str, "RAW") == 0) { @@ -4456,12 +3599,29 @@ std::vector<std::string> ApplicationManagerImpl::ConvertRejectedParamList( return output; } +bool ApplicationManagerImpl::IsSOStructValid( + const hmi_apis::StructIdentifiers::eType struct_id, + const smart_objects::SmartObject& display_capabilities) { + smart_objects::SmartObject display_capabilities_so = display_capabilities; + if (hmi_so_factory().AttachSchema(struct_id, display_capabilities_so)) { + if (display_capabilities_so.isValid()) { + return true; + } else { + return false; + } + } else { + LOG4CXX_ERROR(logger_, "Could not find struct id: " << struct_id); + return false; + } + return true; +} + #ifdef BUILD_TESTS void ApplicationManagerImpl::AddMockApplication(ApplicationSharedPtr mock_app) { - applications_list_lock_.Acquire(); + applications_list_lock_ptr_->Acquire(); applications_.insert(mock_app); apps_size_ = applications_.size(); - applications_list_lock_.Release(); + applications_list_lock_ptr_->Release(); } void ApplicationManagerImpl::SetMockMediaManager( @@ -4469,7 +3629,6 @@ void ApplicationManagerImpl::SetMockMediaManager( media_manager_ = mock_media_manager; } #endif // BUILD_TESTS -#ifdef SDL_REMOTE_CONTROL struct MobileAppIdPredicate { std::string policy_app_id_; MobileAppIdPredicate(const std::string& policy_app_id) @@ -4523,7 +3682,6 @@ std::vector<std::string> ApplicationManagerImpl::devices( void ApplicationManagerImpl::ChangeAppsHMILevel( uint32_t app_id, mobile_apis::HMILevel::eType level) { - using namespace mobile_apis::HMILevel; LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "AppID to change: " << app_id << " -> " << level); ApplicationSharedPtr app = application(app_id); @@ -4531,26 +3689,13 @@ void ApplicationManagerImpl::ChangeAppsHMILevel( LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id); return; } - eType old_level = app->hmi_level(); + const mobile_apis::HMILevel::eType old_level = app->hmi_level(); if (old_level != level) { app->set_hmi_level(level); OnHMILevelChanged(app_id, old_level, level); - - plugin_manager_.OnAppHMILevelChanged(app, old_level); } else { - LOG4CXX_WARN(logger_, "Redudant changing HMI level : " << level); + LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level); } } -void ApplicationManagerImpl::SendPostMessageToMobile( - const MessagePtr& message) { - messages_to_mobile_.PostMessage(impl::MessageToMobile(message, false)); -} - -void ApplicationManagerImpl::SendPostMessageToHMI(const MessagePtr& message) { - messages_to_hmi_.PostMessage(impl::MessageToHmi(message)); -} - -#endif // SDL_REMOTE_CONTROL - } // namespace application_manager diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc index 101a565a8e..3f775ee4e2 100644 --- a/src/components/application_manager/src/application_state.cc +++ b/src/components/application_manager/src/application_state.cc @@ -101,7 +101,6 @@ void ApplicationState::RemoveState(HmiState::StateID state) { } HmiStatePtr ApplicationState::GetState(HmiState::StateID state_id) const { - LOG4CXX_AUTO_TRACE(logger_); switch (state_id) { case HmiState::StateID::STATE_ID_REGULAR: LOG4CXX_DEBUG(logger_, "Getting regular state."); diff --git a/src/components/application_manager/src/command_holder_impl.cc b/src/components/application_manager/src/command_holder_impl.cc index afdaa2f1f4..ea74e78f4e 100644 --- a/src/components/application_manager/src/command_holder_impl.cc +++ b/src/components/application_manager/src/command_holder_impl.cc @@ -43,7 +43,7 @@ CommandHolderImpl::CommandHolderImpl(ApplicationManager& app_manager) void CommandHolderImpl::Suspend( ApplicationSharedPtr application, CommandType type, - utils::SharedPtr<smart_objects::SmartObject> command) { + std::shared_ptr<smart_objects::SmartObject> command) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(application); LOG4CXX_DEBUG(logger_, @@ -114,7 +114,7 @@ void CommandHolderImpl::ResumeHmiCommand(ApplicationSharedPtr application) { for (auto cmd : app_commands->second) { (*cmd)[strings::msg_params][strings::app_id] = application->hmi_app_id(); - app_manager_.ManageHMICommand(cmd); + app_manager_.GetRPCService().ManageHMICommand(cmd); } app_hmi_commands_.erase(app_commands); @@ -133,8 +133,8 @@ void CommandHolderImpl::ResumeMobileCommand(ApplicationSharedPtr application) { for (auto cmd : app_commands->second) { (*cmd)[strings::params][strings::connection_key] = application->app_id(); - app_manager_.ManageMobileCommand( - cmd, commands::Command::CommandOrigin::ORIGIN_MOBILE); + app_manager_.GetRPCService().ManageMobileCommand( + cmd, commands::Command::CommandSource::SOURCE_MOBILE); } app_mobile_commands_.erase(app_commands); diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index b928184148..04fabfb2ec 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -35,6 +35,16 @@ #include "application_manager/application_manager.h" namespace application_manager { + +namespace { +struct AppExtensionPredicate { + AppExtensionUID uid; + bool operator()(const ApplicationSharedPtr app) { + return app ? (app->QueryInterface(uid).use_count() != 0) : false; + } +}; +} + namespace commands { CREATE_LOGGERPTR_LOCAL(CommandImpl::logger_, "Commands") @@ -44,11 +54,17 @@ const int32_t CommandImpl::mobile_protocol_type_ = 0; const int32_t CommandImpl::protocol_version_ = 3; CommandImpl::CommandImpl(const MessageSharedPtr& message, - ApplicationManager& application_manager) + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) : message_(message) , default_timeout_(application_manager.get_settings().default_timeout()) , allowed_to_terminate_(true) - , application_manager_(application_manager) {} + , application_manager_(application_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) {} CommandImpl::~CommandImpl() { CleanUp(); @@ -95,7 +111,7 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) { } bool CommandImpl::ReplaceMobileWithHMIAppId( - NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { + ns_smart_device_link::ns_smart_objects::SmartObject& message) { LOG4CXX_AUTO_TRACE(logger_); if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application = @@ -139,15 +155,8 @@ bool CommandImpl::ReplaceMobileWithHMIAppId( return true; } -DEPRECATED void CommandImpl::ReplaceMobileByHMIAppId( - NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { - if (!ReplaceMobileWithHMIAppId(message)) { - LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed."); - } -} - bool CommandImpl::ReplaceHMIWithMobileAppId( - NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { + ns_smart_device_link::ns_smart_objects::SmartObject& message) { if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application = application_manager_.application_by_hmi_app( @@ -191,12 +200,5 @@ bool CommandImpl::ReplaceHMIWithMobileAppId( return true; } -DEPRECATED void CommandImpl::ReplaceHMIByMobileAppId( - NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { - if (!ReplaceHMIWithMobileAppId(message)) { - LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed."); - } -} - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc index 5b44abeec9..4e9a2556de 100644 --- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc @@ -32,6 +32,7 @@ #include "application_manager/commands/command_notification_from_mobile_impl.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" #include "application_manager/message_helper.h" namespace application_manager { @@ -39,8 +40,16 @@ namespace application_manager { namespace commands { CommandNotificationFromMobileImpl::CommandNotificationFromMobileImpl( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandImpl(message, application_manager) {} + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CommandNotificationFromMobileImpl::~CommandNotificationFromMobileImpl() {} @@ -63,7 +72,7 @@ void CommandNotificationFromMobileImpl::SendNotification() { LOG4CXX_INFO(logger_, "SendNotification"); MessageHelper::PrintSmartObject(*message_); - application_manager_.SendMessageToMobile(message_); + rpc_service_.SendMessageToMobile(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/command_notification_impl.cc b/src/components/application_manager/src/commands/command_notification_impl.cc index b6b0e7d500..70df95986b 100644 --- a/src/components/application_manager/src/commands/command_notification_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_impl.cc @@ -32,6 +32,7 @@ #include "application_manager/commands/command_notification_impl.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" #include "application_manager/message_helper.h" namespace application_manager { @@ -39,8 +40,16 @@ namespace application_manager { namespace commands { CommandNotificationImpl::CommandNotificationImpl( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandImpl(message, application_manager) {} + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CommandNotificationImpl::~CommandNotificationImpl() {} @@ -63,7 +72,7 @@ void CommandNotificationImpl::SendNotification() { LOG4CXX_INFO(logger_, "SendNotification"); MessageHelper::PrintSmartObject(*message_); - application_manager_.SendMessageToMobile(message_); + rpc_service_.SendMessageToMobile(message_); } } // namespace commands 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 515d8a998c..68e8cfe6b4 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -34,11 +34,13 @@ #include <numeric> #include <string> #include "utils/macro.h" -#include "utils/make_shared.h" + #include "application_manager/commands/command_request_impl.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" #include "application_manager/message_helper.h" #include "smart_objects/smart_object.h" + namespace application_manager { namespace commands { @@ -143,7 +145,8 @@ struct DisallowedParamsInserter { VehicleData::const_iterator it = vehicle_data.find(param); if (vehicle_data.end() != it) { smart_objects::SmartObjectSPtr disallowed_param = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); (*disallowed_param)[strings::data_type] = (*it).second; (*disallowed_param)[strings::result_code] = code_; response_[strings::msg_params][param.c_str()] = *disallowed_param; @@ -193,9 +196,17 @@ ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; } -CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandImpl(message, application_manager) +CommandRequestImpl::CommandRequestImpl( + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , EventObserver(application_manager.event_dispatcher()) , current_state_(kAwaitingHMIResponse) , hash_update_mode_(kSkipHashUpdate) @@ -241,7 +252,7 @@ void CommandRequestImpl::onTimeOut() { correlation_id(), mobile_api::Result::GENERIC_ERROR); AddTimeOutComponentInfoToMessage(*response); - application_manager_.ManageMobileCommand(response, ORIGIN_SDL); + rpc_service_.ManageMobileCommand(response, SOURCE_SDL); } void CommandRequestImpl::on_event(const event_engine::Event& event) {} @@ -263,7 +274,7 @@ void CommandRequestImpl::SendResponse( } smart_objects::SmartObjectSPtr result = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& response = *result; @@ -304,7 +315,7 @@ void CommandRequestImpl::SendResponse( is_success_result_ = success; - application_manager_.ManageMobileCommand(result, ORIGIN_SDL); + rpc_service_.ManageMobileCommand(result, SOURCE_SDL); } bool CommandRequestImpl::CheckSyntax(const std::string& str, @@ -407,7 +418,8 @@ uint32_t CommandRequestImpl::SendHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject* msg_params, bool use_events) { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr result = + std::make_shared<smart_objects::SmartObject>(); const uint32_t hmi_correlation_id = application_manager_.GetNextHMICorrelationID(); @@ -432,7 +444,7 @@ uint32_t CommandRequestImpl::SendHMIRequest( subscribe_on_event(function_id, hmi_correlation_id); } if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { - if (!application_manager_.ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send request"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); } @@ -444,8 +456,9 @@ uint32_t CommandRequestImpl::SendHMIRequest( void CommandRequestImpl::CreateHMINotification( const hmi_apis::FunctionID::eType& function_id, - const NsSmart::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + const ns_smart::SmartObject& msg_params) const { + smart_objects::SmartObjectSPtr result = + std::make_shared<smart_objects::SmartObject>(); if (!result) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); return; @@ -461,7 +474,7 @@ void CommandRequestImpl::CreateHMINotification( notify[strings::params][strings::function_id] = function_id; notify[strings::msg_params] = msg_params; - if (!application_manager_.ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send HMI notification"); } } @@ -570,6 +583,10 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( mobile_result = mobile_apis::Result::SAVED; break; } + case hmi_apis::Common_Result::READ_ONLY: { + mobile_result = mobile_apis::Result::READ_ONLY; + break; + } default: { LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code); break; @@ -605,10 +622,8 @@ bool CommandRequestImpl::CheckAllowedParameters() { smart_objects::SmartMap::const_iterator iter_end = s_map.map_end(); for (; iter != iter_end; ++iter) { - if (iter->second.asBool()) { - LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first); - params.insert(iter->first); - } + LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first); + params.insert(iter->first); } mobile_apis::Result::eType check_result = @@ -628,7 +643,7 @@ bool CommandRequestImpl::CheckAllowedParameters() { correlation_id(), app->app_id()); - application_manager_.SendMessageToMobile(response); + rpc_service_.SendMessageToMobile(response); return false; } @@ -652,15 +667,13 @@ bool CommandRequestImpl::CheckHMICapabilities( using namespace smart_objects; using namespace mobile_apis; - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - if (!hmi_capabilities.is_ui_cooperating()) { + if (!hmi_capabilities_.is_ui_cooperating()) { LOG4CXX_ERROR(logger_, "UI is not supported by HMI"); return false; } const SmartObject* button_capabilities_so = - hmi_capabilities.button_capabilities(); + hmi_capabilities_.button_capabilities(); if (!button_capabilities_so) { LOG4CXX_ERROR(logger_, "Invalid button capabilities object"); return false; @@ -946,7 +959,7 @@ const std::string InfoInterfaceSeparator( void CommandRequestImpl::AddTimeOutComponentInfoToMessage( smart_objects::SmartObject& response) const { - using NsSmartDeviceLink::NsSmartObjects::SmartObject; + using ns_smart_device_link::ns_smart_objects::SmartObject; LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); if (awaiting_response_interfaces_.empty()) { diff --git a/src/components/application_manager/src/commands/command_response_impl.cc b/src/components/application_manager/src/commands/command_response_impl.cc index c3265230a8..b956a4c7a5 100644 --- a/src/components/application_manager/src/commands/command_response_impl.cc +++ b/src/components/application_manager/src/commands/command_response_impl.cc @@ -32,14 +32,23 @@ #include "application_manager/commands/command_response_impl.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" namespace application_manager { namespace commands { CommandResponseImpl::CommandResponseImpl( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandImpl(message, application_manager) {} + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CommandResponseImpl::~CommandResponseImpl() {} @@ -80,7 +89,7 @@ void CommandResponseImpl::SendResponse( } } - application_manager_.SendMessageToMobile(message_, final_message); + rpc_service_.SendMessageToMobile(message_, final_message); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/src/commands/hmi/activate_app_request.cc deleted file mode 100644 index ea36cd2b0a..0000000000 --- a/src/components/application_manager/src/commands/hmi/activate_app_request.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/activate_app_request.h" - -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -ActivateAppRequest::ActivateAppRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -ActivateAppRequest::~ActivateAppRequest() { - LOG4CXX_TRACE(logger_, "~ActivateAppRequest"); -} - -void ActivateAppRequest::Run() { - LOG4CXX_TRACE(logger_, "enter " << correlation_id()); - uint32_t app_id = RequestToHMI::application_id(); - application_manager_.set_application_id(correlation_id(), app_id); -#ifdef ENABLE_LOG - if ((*message_)[strings::msg_params].keyExists( - strings::activate_app_hmi_level)) { - mobile_apis::HMILevel::eType requested_hmi_level = - static_cast<mobile_apis::HMILevel::eType>( - (*message_)[strings::msg_params][strings::activate_app_hmi_level] - .asInt()); - LOG4CXX_TRACE(logger_, "requested_hmi_level = " << requested_hmi_level); - } -#endif - SendRequest(); - LOG4CXX_TRACE(logger_, "exit"); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/activate_app_response.cc b/src/components/application_manager/src/commands/hmi/activate_app_response.cc deleted file mode 100644 index 55e704b6c4..0000000000 --- a/src/components/application_manager/src/commands/hmi/activate_app_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/activate_app_response.h" - -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -ActivateAppResponse::ActivateAppResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -ActivateAppResponse::~ActivateAppResponse() {} - -void ActivateAppResponse::Run() { - LOG4CXX_TRACE(logger_, "enter"); - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_ActivateApp); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); - LOG4CXX_TRACE(logger_, "exit"); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc b/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc deleted file mode 100644 index ef75eba1e2..0000000000 --- a/src/components/application_manager/src/commands/hmi/add_statistics_info_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/add_statistics_info_notification.h" -#include "application_manager/policies/policy_handler.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -AddStatisticsInfoNotification::AddStatisticsInfoNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -AddStatisticsInfoNotification::~AddStatisticsInfoNotification() {} - -void AddStatisticsInfoNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - int type = (*message_)[strings::msg_params][hmi_notification::statistic_type] - .asInt(); - - application_manager_.GetPolicyHandler().AddStatisticsInfo(type); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc b/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc deleted file mode 100644 index 4e096a2cda..0000000000 --- a/src/components/application_manager/src/commands/hmi/allow_all_apps_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/allow_all_apps_request.h" - -namespace application_manager { - -namespace commands { - -AllowAllAppsRequest::AllowAllAppsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -AllowAllAppsRequest::~AllowAllAppsRequest() {} - -void AllowAllAppsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc b/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc deleted file mode 100644 index ed05c3ba83..0000000000 --- a/src/components/application_manager/src/commands/hmi/allow_all_apps_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/allow_all_apps_response.h" - -namespace application_manager { - -namespace commands { - -AllowAllAppsResponse::AllowAllAppsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -AllowAllAppsResponse::~AllowAllAppsResponse() {} - -void AllowAllAppsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SetAllAppsAllowed( - (*message_)[strings::msg_params][hmi_response::allowed].asBool()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/allow_app_request.cc b/src/components/application_manager/src/commands/hmi/allow_app_request.cc deleted file mode 100644 index 5176b3b4fe..0000000000 --- a/src/components/application_manager/src/commands/hmi/allow_app_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/allow_app_request.h" - -namespace application_manager { - -namespace commands { - -AllowAppRequest::AllowAppRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -AllowAppRequest::~AllowAppRequest() {} - -void AllowAppRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/allow_app_response.cc b/src/components/application_manager/src/commands/hmi/allow_app_response.cc deleted file mode 100644 index 5fd9c702b4..0000000000 --- a/src/components/application_manager/src/commands/hmi/allow_app_response.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/allow_app_response.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -AllowAppResponse::AllowAppResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -AllowAppResponse::~AllowAppResponse() {} - -void AllowAppResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - uint32_t connection_key = - (*message_)[strings::params][strings::connection_key].asInt(); - - ApplicationSharedPtr app = application_manager_.application(connection_key); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - app->set_app_allowed( - (*message_)[strings::msg_params][hmi_response::allowed].asBool()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc deleted file mode 100644 index c6c550a474..0000000000 --- a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2017, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h" -#include "application_manager/message_helper.h" -#include "application_manager/resumption/resume_ctrl.h" - -namespace application_manager { - -namespace commands { - -OnAwakeSDLNotification::OnAwakeSDLNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnAwakeSDLNotification::~OnAwakeSDLNotification() {} - -void OnAwakeSDLNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - if (!application_manager_.resume_controller().is_suspended()) { - return; - } - - { - DataAccessor<ApplicationSet> accessor = application_manager_.applications(); - ApplicationSetIt itBegin = accessor.GetData().begin(); - ApplicationSetIt itEnd = accessor.GetData().end(); - for (; itBegin != itEnd; ++itBegin) { - const ApplicationSharedPtr app = *itBegin; - if (app && app->IsHashChangedDuringSuspend()) { - MessageHelper::SendHashUpdateNotification(app->app_id(), - application_manager_); - app->SetHashChangedDuringSuspend(false); - } - } - } - - application_manager_.resume_controller().OnAwake(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc b/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc deleted file mode 100644 index 2499c21680..0000000000 --- a/src/components/application_manager/src/commands/hmi/basic_communication_system_request.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/basic_communication_system_request.h" - -namespace application_manager { - -namespace commands { - -BasicCommunicationSystemRequest::BasicCommunicationSystemRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -BasicCommunicationSystemRequest::~BasicCommunicationSystemRequest() {} - -void BasicCommunicationSystemRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc b/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc deleted file mode 100644 index 16afce92e0..0000000000 --- a/src/components/application_manager/src/commands/hmi/basic_communication_system_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/basic_communication_system_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -BasicCommunicationSystemResponse::BasicCommunicationSystemResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -BasicCommunicationSystemResponse::~BasicCommunicationSystemResponse() {} - -void BasicCommunicationSystemResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_SystemRequest); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc deleted file mode 100644 index e6b73879e5..0000000000 --- a/src/components/application_manager/src/commands/hmi/button_get_capabilities_request.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/button_get_capabilities_request.h" -#include "utils/logger.h" - -namespace application_manager { - -namespace commands { - -ButtonGetCapabilitiesRequest::ButtonGetCapabilitiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -ButtonGetCapabilitiesRequest::~ButtonGetCapabilitiesRequest() {} - -void ButtonGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc deleted file mode 100644 index a947fb7ba9..0000000000 --- a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/button_get_capabilities_response.h" - -#include "utils/logger.h" - -namespace application_manager { - -namespace commands { - -ButtonGetCapabilitiesResponse::ButtonGetCapabilitiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() {} - -void ButtonGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - (*message_)[strings::params][hmi_response::code].asInt()); - - if (hmi_apis::Common_Result::SUCCESS != code) { - LOG4CXX_ERROR(logger_, "Error is returned. Capabilities won't be updated."); - return; - } - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_button_capabilities( - (*message_)[strings::msg_params][hmi_response::capabilities]); - - hmi_capabilities.set_preset_bank_capabilities( - (*message_)[strings::msg_params][hmi_response::preset_bank_capabilities]); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/close_popup_request.cc b/src/components/application_manager/src/commands/hmi/close_popup_request.cc deleted file mode 100644 index d628475438..0000000000 --- a/src/components/application_manager/src/commands/hmi/close_popup_request.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/close_popup_request.h" - -namespace application_manager { - -namespace commands { - -ClosePopupRequest::ClosePopupRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -ClosePopupRequest::~ClosePopupRequest() {} - -void ClosePopupRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/close_popup_response.cc b/src/components/application_manager/src/commands/hmi/close_popup_response.cc deleted file mode 100644 index 15adb2ee32..0000000000 --- a/src/components/application_manager/src/commands/hmi/close_popup_response.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/close_popup_response.h" - -namespace application_manager { - -namespace commands { - -ClosePopupResponse::ClosePopupResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -ClosePopupResponse::~ClosePopupResponse() {} - -void ClosePopupResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // TODO(VS): Process response from HMI -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/decrypt_certificate_request.cc b/src/components/application_manager/src/commands/hmi/decrypt_certificate_request.cc deleted file mode 100644 index a09fe71bf2..0000000000 --- a/src/components/application_manager/src/commands/hmi/decrypt_certificate_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/decrypt_certificate_request.h" - -namespace application_manager { - -namespace commands { - -DecryptCertificateRequest::DecryptCertificateRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -void DecryptCertificateRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - const uint32_t correlation_id = RequestToHMI::correlation_id(); - const uint32_t app_id = RequestToHMI::application_id(); - application_manager_.set_application_id(correlation_id, app_id); - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/decrypt_certificate_response.cc b/src/components/application_manager/src/commands/hmi/decrypt_certificate_response.cc deleted file mode 100644 index cea9290f7d..0000000000 --- a/src/components/application_manager/src/commands/hmi/decrypt_certificate_response.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/decrypt_certificate_response.h" - -#include "application_manager/policies/policy_handler.h" -#ifdef EXTERNAL_PROPRIETARY_MODE -namespace application_manager { - -namespace commands { - -DecryptCertificateResponse::DecryptCertificateResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -DecryptCertificateResponse::~DecryptCertificateResponse() {} - -void DecryptCertificateResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - (*message_)[strings::params][hmi_response::code].asInt()); - - const bool is_succeeded = hmi_apis::Common_Result::SUCCESS == code; - - application_manager_.GetPolicyHandler().OnCertificateDecrypted(is_succeeded); -} - -} // namespace commands -} // namespace application_manager -#endif // EXTERNAL_PROPRIETARY_MODE diff --git a/src/components/application_manager/src/commands/hmi/dial_number_request.cc b/src/components/application_manager/src/commands/hmi/dial_number_request.cc deleted file mode 100644 index b26541cb01..0000000000 --- a/src/components/application_manager/src/commands/hmi/dial_number_request.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/dial_number_request.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -DialNumberRequest::~DialNumberRequest() {} - -void DialNumberRequest::Run() { - SendRequest(); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/dial_number_response.cc b/src/components/application_manager/src/commands/hmi/dial_number_response.cc deleted file mode 100644 index 5511fa98f8..0000000000 --- a/src/components/application_manager/src/commands/hmi/dial_number_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/dial_number_response.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -DialNumberResponse::~DialNumberResponse() {} - -void DialNumberResponse::Run() { - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_DialNumber); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/src/commands/hmi/get_system_info_request.cc deleted file mode 100644 index 379027c43a..0000000000 --- a/src/components/application_manager/src/commands/hmi/get_system_info_request.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/get_system_info_request.h" - -namespace application_manager { - -namespace commands { - -GetSystemInfoRequest::GetSystemInfoRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -GetSystemInfoRequest::~GetSystemInfoRequest() {} - -void GetSystemInfoRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - uint32_t correlation_id = RequestToHMI::correlation_id(); - uint32_t app_id = RequestToHMI::application_id(); - application_manager_.set_application_id(correlation_id, app_id); - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc deleted file mode 100644 index be6dabb292..0000000000 --- a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/get_system_info_response.h" -#include "application_manager/message_helper.h" - -namespace application_manager { -namespace commands { - -GetSystemInfoResponse::GetSystemInfoResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -GetSystemInfoResponse::~GetSystemInfoResponse() {} - -void GetSystemInfoResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - (*message_)[strings::params][hmi_response::code].asInt()); - - const SystemInfo& info = GetSystemInfo(code); - - // We have to set preloaded flag as false in policy table on any response - // of GetSystemInfo (SDLAQ-CRS-2365) - application_manager_.GetPolicyHandler().OnGetSystemInfo( - info.ccpu_version, info.wers_country_code, info.language); -} - -const SystemInfo GetSystemInfoResponse::GetSystemInfo( - const hmi_apis::Common_Result::eType code) const { - SystemInfo info; - - if (hmi_apis::Common_Result::SUCCESS != code) { - LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code); - return info; - } - info.ccpu_version = - (*message_)[strings::msg_params]["ccpu_version"].asString(); - - info.wers_country_code = - (*message_)[strings::msg_params]["wersCountryCode"].asString(); - - const uint32_t lang_code = - (*message_)[strings::msg_params]["language"].asUInt(); - info.language = application_manager::MessageHelper::CommonLanguageToString( - static_cast<hmi_apis::Common_Language::eType>(lang_code)); - - application_manager_.hmi_capabilities().set_ccpu_version(info.ccpu_version); - - return info; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/get_urls.cc b/src/components/application_manager/src/commands/hmi/get_urls.cc deleted file mode 100644 index bfcdf4985e..0000000000 --- a/src/components/application_manager/src/commands/hmi/get_urls.cc +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/get_urls.h" -#include "application_manager/message.h" -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler.h" -#include "utils/helpers.h" - -namespace application_manager { -namespace commands { - -GetUrls::GetUrls(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestFromHMI(message, application_manager) {} - -GetUrls::~GetUrls() {} - -void GetUrls::Run() { - LOG4CXX_AUTO_TRACE(logger_); - namespace Common_Result = hmi_apis::Common_Result; - using policy::EndpointUrls; - - if (!application_manager_.GetPolicyHandler().PolicyEnabled()) { - SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); - return; - } - - const uint32_t service_to_check = - (*message_)[strings::msg_params][hmi_request::service].asUInt(); - - EndpointUrls endpoints; - application_manager_.GetPolicyHandler().GetUpdateUrls(service_to_check, - endpoints); - - if (endpoints.empty()) { - LOG4CXX_ERROR(logger_, "No URLs for service " << service_to_check); - SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); - return; - } - -#ifdef PROPRIETARY_MODE - const uint32_t policy_service = 7u; - - if (policy_service == service_to_check) { - ProcessPolicyServiceURLs(endpoints); - return; - } -#endif // PROPRIETARY_MODE - - ProcessServiceURLs(endpoints); -} - -void GetUrls::ProcessServiceURLs(const policy::EndpointUrls& endpoints) { - namespace Common_Result = hmi_apis::Common_Result; - using smart_objects::SmartObject; - - (*message_)[strings::msg_params].erase(hmi_request::service); - SmartObject& urls = (*message_)[strings::msg_params][hmi_response::urls]; - - size_t index = 0; - for (size_t e = 0; e < endpoints.size(); ++e) { - ApplicationSharedPtr app = - application_manager_.application_by_policy_id(endpoints[e].app_id); - -#ifndef PROPRIETARY_MODE - bool registered_not_default = false; - if (policy::kDefaultId != endpoints[e].app_id) { - if (!app) { - LOG4CXX_ERROR(logger_, - "Can't find application with policy id " - << endpoints[e].app_id - << " URLs adding for this application is skipped."); - continue; - } - registered_not_default = true; - } -#endif // EXTERNAL_PROPRIETARY_MODE || HTTP - for (size_t u = 0; u < endpoints[e].url.size(); ++u, ++index) { - const std::string& app_url = endpoints[e].url[u]; - SmartObject& service_info = urls[index]; - - service_info[strings::url] = app_url; -#ifndef PROPRIETARY_MODE - if (registered_not_default) { - service_info[strings::app_id] = app->hmi_app_id(); - } -#else // EXTERNAL_PROPRIETARY_MODE || HTTP - service_info[hmi_response::policy_app_id] = endpoints[e].app_id; -#endif - } - } - SendResponseToHMI(Common_Result::SUCCESS); -} - -void GetUrls::SendResponseToHMI(hmi_apis::Common_Result::eType result) { - (*message_)[strings::params][strings::message_type] = MessageType::kResponse; - (*message_)[strings::params][hmi_response::code] = result; - application_manager_.ManageHMICommand(message_); -} - -#ifdef PROPRIETARY_MODE -struct PolicyAppIdComparator { - PolicyAppIdComparator(const std::string& policy_app_id) - : policy_app_id_(policy_app_id) {} - - bool operator()(const policy::EndpointData& data) { - return data.app_id == policy_app_id_; - } - std::string policy_app_id_; -}; - -void FillSODefaultUrls(smart_objects::SmartObject& urls, - const policy::EndpointUrls& endpoints) { - using smart_objects::SmartObject; - PolicyAppIdComparator comparator(policy::kDefaultId); - policy::EndpointUrls::const_iterator it = - std::find_if(endpoints.begin(), endpoints.end(), comparator); - if (it == endpoints.end()) { - return; - } - SmartObject service_info = SmartObject(smart_objects::SmartType_Map); - for (size_t i = 0; i < (*it).url.size(); ++i) { - service_info[strings::url] = (*it).url[i]; - urls[i] = service_info; - } -} - -void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace smart_objects; - using namespace application_manager; - using namespace strings; - using namespace hmi_apis; - - const uint32_t app_id_to_send_to = - application_manager_.GetPolicyHandler().GetAppIdForSending(); - - if (!app_id_to_send_to) { - LOG4CXX_ERROR(logger_, - "There are no available applications for processing."); - SmartObject urls(SmartType_Array); - FillSODefaultUrls(urls, endpoints); - if (!urls.empty()) { - (*message_)[msg_params][hmi_response::urls] = urls; - } - (*message_).erase(hmi_request::service); - SendResponseToHMI(Common_Result::SUCCESS); - return; - } - - ApplicationSharedPtr app = - application_manager_.application(app_id_to_send_to); - - if (!app.valid()) { - LOG4CXX_WARN(logger_, - "There is no registered application with " - "connection key '" - << app_id_to_send_to << "'"); - SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE); - return; - } - - SmartObject& object = *message_; - object[msg_params].erase(hmi_request::service); - object[msg_params][hmi_response::urls] = SmartObject(SmartType_Array); - SmartObject& urls = object[msg_params][hmi_response::urls]; - const std::string mobile_app_id = app->policy_app_id(); - - size_t index = 0; - for (size_t i = 0; i < endpoints.size(); ++i) { - using namespace helpers; - - const bool to_add = Compare<std::string, EQ, ONE>( - endpoints[i].app_id, mobile_app_id, policy::kDefaultId); - const bool is_default = policy::kDefaultId == endpoints[i].app_id; - - if (to_add) { - for (size_t k = 0; k < endpoints[i].url.size(); ++k) { - if (!is_default) { - urls[index][strings::app_id] = app_id_to_send_to; - } - urls[index][strings::url] = endpoints[i].url[k]; - ++index; - } - } - } - SendResponseToHMI(Common_Result::SUCCESS); - return; -} -#endif // PROPRIETARY_MODE - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/get_urls_response.cc b/src/components/application_manager/src/commands/hmi/get_urls_response.cc deleted file mode 100644 index dd9686fbce..0000000000 --- a/src/components/application_manager/src/commands/hmi/get_urls_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/get_urls_response.h" - -namespace application_manager { -namespace commands { - -GetUrlsResponse::GetUrlsResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseToHMI(message, application_manager) {} - -GetUrlsResponse::~GetUrlsResponse() {} - -void GetUrlsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; - (*message_)[strings::params][strings::protocol_version] = protocol_version_; - - application_manager_.SendMessageToHMI(message_); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc deleted file mode 100644 index e38d1fc088..0000000000 --- a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/mixing_audio_supported_request.h" - -namespace application_manager { - -namespace commands { - -MixingAudioSupportedRequest::MixingAudioSupportedRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -MixingAudioSupportedRequest::~MixingAudioSupportedRequest() {} - -void MixingAudioSupportedRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc b/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc deleted file mode 100644 index f8b58e6f35..0000000000 --- a/src/components/application_manager/src/commands/hmi/mixing_audio_supported_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/mixing_audio_supported_response.h" - -namespace application_manager { - -namespace commands { - -MixingAudioSupportedResponse::MixingAudioSupportedResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -MixingAudioSupportedResponse::~MixingAudioSupportedResponse() {} - -void MixingAudioSupportedResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - hmi_capabilities.set_attenuated_supported( - (*message_)[strings::msg_params][hmi_response::attenuated_supported] - .asBool()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc deleted file mode 100644 index 582caaa8f3..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_alert_maneuver_request.h" - -namespace application_manager { - -namespace commands { - -NaviAlertManeuverRequest::NaviAlertManeuverRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviAlertManeuverRequest::~NaviAlertManeuverRequest() {} - -void NaviAlertManeuverRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc b/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc deleted file mode 100644 index 5f0422bf6a..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_alert_maneuver_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_alert_maneuver_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -NaviAlertManeuverResponse::NaviAlertManeuverResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviAlertManeuverResponse::~NaviAlertManeuverResponse() {} - -void NaviAlertManeuverResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_AlertManeuver); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc deleted file mode 100644 index 42b8c64fc0..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_audio_start_stream_request.h" - -#include "application_manager/message_helper.h" -#include "protocol_handler/protocol_handler.h" - -namespace application_manager { - -namespace commands { - -AudioStartStreamRequest::AudioStartStreamRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) - , retry_number_(0) { - LOG4CXX_AUTO_TRACE(logger_); - std::pair<uint32_t, int32_t> stream_retry = - application_manager_.get_settings().start_stream_retry_amount(); - default_timeout_ = stream_retry.second; - retry_number_ = stream_retry.first; - LOG4CXX_DEBUG(logger_, - "default_timeout_ = " << default_timeout_ - << "; retry_number_ = " << retry_number_); -} - -AudioStartStreamRequest::~AudioStartStreamRequest() {} - -void AudioStartStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - if (!CheckAvailabilityHMIInterfaces( - application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); - return; - } - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "Applcation with hmi_app_id " << application_id() - << " does not exist"); - return; - } - SetAllowedToTerminate(false); - subscribe_on_event(hmi_apis::FunctionID::Navigation_StartAudioStream, - correlation_id()); - app->set_audio_streaming_allowed(true); - SendRequest(); -} - -void AudioStartStreamRequest::on_event(const event_engine::Event& event) { - using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "StartAudioStreamRequest aborted. Application not found"); - return; - } - - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_StartAudioStream: { - LOG4CXX_DEBUG(logger_, "Received StartStream event"); - - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - - if (hmi_apis::Common_Result::SUCCESS == code) { - LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS"); - if (application_manager_.HMILevelAllowsStreaming(app->app_id(), - ServiceType::kAudio)) { - app->set_audio_streaming_approved(true); - } else { - LOG4CXX_WARN( - logger_, - "StartAudioStreamRequest aborted. Application can not stream"); - } - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); - break; - } - if (hmi_apis::Common_Result::REJECTED == code) { - LOG4CXX_INFO(logger_, "StartAudioStream response REJECTED"); - RetryStartSession(); - break; - } - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -void AudioStartStreamRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); - RetryStartSession(); -} - -void AudioStartStreamRequest::RetryStartSession() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "StartAudioStreamRequest aborted. Application not found"); - return; - } - - if (!app->audio_streaming_allowed()) { - LOG4CXX_WARN(logger_, "Audio streaming not allowed"); - return; - } - - if (app->audio_streaming_approved()) { - LOG4CXX_INFO(logger_, - "AudioStartStream retry sequence stopped. " - << "SUCCESS received"); - app->set_audio_stream_retry_number(0); - return; - } - - uint32_t curr_retry_number = app->audio_stream_retry_number(); - LOG4CXX_DEBUG( - logger_, "Retry number " << curr_retry_number << " of " << retry_number_); - - if (curr_retry_number < retry_number_) { - LOG4CXX_DEBUG(logger_, "Send AudioStartStream retry"); - MessageHelper::SendAudioStartStream(app->app_id(), application_manager_); - app->set_audio_stream_retry_number(++curr_retry_number); - } else { - LOG4CXX_DEBUG(logger_, - "Audio start stream retry sequence stopped. " - << "Attempts expired."); - - application_manager_.EndNaviServices(app->app_id()); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc deleted file mode 100644 index c7fc7365e7..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_audio_start_stream_response.h" - -namespace application_manager { - -namespace commands { - -AudioStartStreamResponse::AudioStartStreamResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -AudioStartStreamResponse::~AudioStartStreamResponse() {} - -void AudioStartStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_StartAudioStream); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc deleted file mode 100644 index f86ee8302a..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_request.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_audio_stop_stream_request.h" - -namespace application_manager { - -namespace commands { - -AudioStopStreamRequest::AudioStopStreamRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -AudioStopStreamRequest::~AudioStopStreamRequest() {} - -void AudioStopStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - if (!CheckAvailabilityHMIInterfaces( - application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); - return; - } - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc deleted file mode 100644 index c669d399f9..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_audio_stop_stream_response.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_audio_stop_stream_response.h" - -namespace application_manager { - -namespace commands { - -AudioStopStreamResponse::AudioStopStreamResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -AudioStopStreamResponse::~AudioStopStreamResponse() {} - -void AudioStopStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc deleted file mode 100644 index 51f862c957..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_get_way_points_request.h" - -namespace application_manager { - -namespace commands { - -NaviGetWayPointsRequest::NaviGetWayPointsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviGetWayPointsRequest::~NaviGetWayPointsRequest() {} - -void NaviGetWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc deleted file mode 100644 index f295845b24..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_get_way_points_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -NaviGetWayPointsResponse::NaviGetWayPointsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviGetWayPointsResponse::~NaviGetWayPointsResponse() {} - -void NaviGetWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_GetWayPoints); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc deleted file mode 100644 index 4392258a31..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_is_ready_request.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_is_ready_request.h" - -namespace application_manager { - -namespace commands { - -NaviIsReadyRequest::NaviIsReadyRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) {} - -NaviIsReadyRequest::~NaviIsReadyRequest() {} - -void NaviIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::Navigation_IsReady, - correlation_id()); - SendRequest(); -} - -void NaviIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_IsReady: { - LOG4CXX_DEBUG(logger_, "Received Navigation_IsReady event"); - unsubscribe_from_event(hmi_apis::FunctionID::Navigation_IsReady); - const bool is_available = - ChangeInterfaceState(application_manager_, - message, - HmiInterfaces::HMI_INTERFACE_Navigation); - - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - hmi_capabilities.set_is_navi_cooperating(is_available); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc deleted file mode 100644 index 7daba4258b..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_is_ready_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_is_ready_response.h" - -namespace application_manager { - -namespace commands { - -NaviIsReadyResponse::NaviIsReadyResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviIsReadyResponse::~NaviIsReadyResponse() {} - -void NaviIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::Navigation_IsReady); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc b/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc deleted file mode 100644 index ad878033ca..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_send_location_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_send_location_request.h" - -namespace application_manager { - -namespace commands { - -NaviSendLocationRequest::NaviSendLocationRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviSendLocationRequest::~NaviSendLocationRequest() {} - -void NaviSendLocationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc b/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc deleted file mode 100644 index a3d9f4c9e5..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_send_location_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_send_location_response.h" -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -NaviSendLocationResponse::NaviSendLocationResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviSendLocationResponse::~NaviSendLocationResponse() {} - -void NaviSendLocationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_SendLocation); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/src/commands/hmi/navi_set_video_config_request.cc deleted file mode 100644 index d19db515ab..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_set_video_config_request.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2017 Xevo Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of the copyright holders nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_set_video_config_request.h" -#include <string> -#include <vector> - -namespace application_manager { - -namespace commands { - -NaviSetVideoConfigRequest::NaviSetVideoConfigRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) {} - -NaviSetVideoConfigRequest::~NaviSetVideoConfigRequest() {} - -void NaviSetVideoConfigRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - if (!CheckAvailabilityHMIInterfaces( - application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_WARN(logger_, "HMI interface Navigation is not supported"); - return; - } - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "Application with hmi_app_id " << application_id() - << "does not exist"); - return; - } - - subscribe_on_event(hmi_apis::FunctionID::Navigation_SetVideoConfig, - correlation_id()); - SendRequest(); -} - -void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "Application is not found, abort NaviSetVideoConfigRequest"); - return; - } - - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_SetVideoConfig: { - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - bool result = false; - std::vector<std::string> rejected_params; - - if (code == hmi_apis::Common_Result::SUCCESS) { - LOG4CXX_DEBUG(logger_, "Received SetVideoConfig success response"); - result = true; - } else { - LOG4CXX_DEBUG(logger_, - "Received SetVideoConfig failure response (" << event.id() - << ")"); - result = false; - if (message[strings::msg_params].keyExists(strings::rejected_params)) { - const smart_objects::SmartArray* list = - message[strings::msg_params][strings::rejected_params].asArray(); - if (list != NULL) { - for (unsigned int i = 0; i < list->size(); i++) { - const std::string& param = (*list)[i].asString(); - // Make sure that we actually sent the parameter in the request - if ((*message_)[strings::msg_params].keyExists(strings::config) && - (*message_)[strings::msg_params][strings::config].keyExists( - param)) { - rejected_params.push_back(param); - } - } - } - } - } - application_manager_.OnStreamingConfigured( - app->app_id(), - protocol_handler::ServiceType::kMobileNav, - result, - rejected_params); - break; - } - default: - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } -} - -void NaviSetVideoConfigRequest::onTimeOut() { - LOG4CXX_WARN(logger_, "Timed out while waiting for SetVideoConfig response"); - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not found"); - return; - } - - std::vector<std::string> empty; - application_manager_.OnStreamingConfigured( - app->app_id(), protocol_handler::ServiceType::kMobileNav, false, empty); - - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_set_video_config_response.cc b/src/components/application_manager/src/commands/hmi/navi_set_video_config_response.cc deleted file mode 100644 index 03679eb3b1..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_set_video_config_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017 Xevo Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the names of the copyright holders nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_set_video_config_response.h" -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -NaviSetVideoConfigResponse::NaviSetVideoConfigResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviSetVideoConfigResponse::~NaviSetVideoConfigResponse() {} - -void NaviSetVideoConfigResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_SetVideoConfig); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc deleted file mode 100644 index a92ef07d12..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_show_constant_tbt_request.h" - -namespace application_manager { - -namespace commands { - -NaviShowConstantTBTRequest::NaviShowConstantTBTRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviShowConstantTBTRequest::~NaviShowConstantTBTRequest() {} - -void NaviShowConstantTBTRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc b/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc deleted file mode 100644 index ede3272e8e..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_show_constant_tbt_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_show_constant_tbt_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -NaviShowConstantTBTResponse::NaviShowConstantTBTResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviShowConstantTBTResponse::~NaviShowConstantTBTResponse() {} - -void NaviShowConstantTBTResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_ShowConstantTBT); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc deleted file mode 100644 index ffc325b5e4..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_start_stream_request.h" - -#include "application_manager/message_helper.h" -#include "protocol_handler/protocol_handler.h" - -namespace application_manager { - -namespace commands { - -NaviStartStreamRequest::NaviStartStreamRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) - , retry_number_(0) { - LOG4CXX_AUTO_TRACE(logger_); - std::pair<uint32_t, int32_t> stream_retry = - application_manager_.get_settings().start_stream_retry_amount(); - default_timeout_ = stream_retry.second; - retry_number_ = stream_retry.first; - LOG4CXX_DEBUG(logger_, - "default_timeout_ = " << default_timeout_ - << "; retry_number_ = " << retry_number_); -} - -NaviStartStreamRequest::~NaviStartStreamRequest() {} - -void NaviStartStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - if (!CheckAvailabilityHMIInterfaces( - application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); - return; - } - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "Applcation with hmi_app_id " << application_id() - << "does not exist"); - return; - } - SetAllowedToTerminate(false); - subscribe_on_event(hmi_apis::FunctionID::Navigation_StartStream, - correlation_id()); - app->set_video_streaming_allowed(true); - SendRequest(); -} - -void NaviStartStreamRequest::on_event(const event_engine::Event& event) { - using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "NaviStartStreamRequest aborted. Application not found"); - return; - } - - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_StartStream: { - LOG4CXX_DEBUG(logger_, "Received StartStream event"); - - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - - if (hmi_apis::Common_Result::SUCCESS == code) { - LOG4CXX_INFO(logger_, "NaviStartStreamResponse SUCCESS"); - if (application_manager_.HMILevelAllowsStreaming( - app->app_id(), ServiceType::kMobileNav)) { - app->set_video_streaming_approved(true); - } else { - LOG4CXX_DEBUG( - logger_, - "NaviStartStreamRequest aborted. Application can not stream"); - } - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); - break; - } - if (hmi_apis::Common_Result::REJECTED == code) { - LOG4CXX_INFO(logger_, "StartStream response REJECTED "); - RetryStartSession(); - break; - } - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -void NaviStartStreamRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); - RetryStartSession(); -} - -void NaviStartStreamRequest::RetryStartSession() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(application_id()); - if (!app) { - LOG4CXX_ERROR(logger_, - "NaviStartStreamRequest aborted. Application not found"); - return; - } - - if (!app->video_streaming_allowed()) { - LOG4CXX_WARN(logger_, "Video streaming not allowed"); - return; - } - - if (app->video_streaming_approved()) { - LOG4CXX_INFO(logger_, - "NaviStartStream retry sequence stopped. " - << "SUCCESS received"); - app->set_video_stream_retry_number(0); - return; - } - - uint32_t curr_retry_number = app->video_stream_retry_number(); - LOG4CXX_DEBUG( - logger_, "Retry number " << curr_retry_number << " of " << retry_number_); - - if (curr_retry_number < retry_number_) { - LOG4CXX_DEBUG(logger_, "Send NaviStartStream retry"); - MessageHelper::SendNaviStartStream(app->app_id(), application_manager_); - app->set_video_stream_retry_number(++curr_retry_number); - } else { - LOG4CXX_DEBUG(logger_, - "NaviStartStream retry sequence stopped. " - << "Attempts expired"); - - application_manager_.EndNaviServices(app->app_id()); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc deleted file mode 100644 index b0b9e672c3..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_start_stream_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_start_stream_response.h" - -namespace application_manager { - -namespace commands { - -NaviStartStreamResponse::NaviStartStreamResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviStartStreamResponse::~NaviStartStreamResponse() {} - -void NaviStartStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_StartStream); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc deleted file mode 100644 index a40ee13b68..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_stop_stream_request.cc +++ /dev/null @@ -1,25 +0,0 @@ -#include "application_manager/commands/hmi/navi_stop_stream_request.h" - -namespace application_manager { - -namespace commands { - -NaviStopStreamRequest::NaviStopStreamRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviStopStreamRequest::~NaviStopStreamRequest() {} - -void NaviStopStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - if (!CheckAvailabilityHMIInterfaces( - application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); - return; - } - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc b/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc deleted file mode 100644 index 3a7fc75260..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_stop_stream_response.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_stop_stream_response.h" - -namespace application_manager { - -namespace commands { - -NaviStopStreamResponse::NaviStopStreamResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviStopStreamResponse::~NaviStopStreamResponse() {} - -void NaviStopStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc deleted file mode 100644 index f2106c8724..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_subscribe_way_points_request.h" - -namespace application_manager { - -namespace commands { - -NaviSubscribeWayPointsRequest::NaviSubscribeWayPointsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviSubscribeWayPointsRequest::~NaviSubscribeWayPointsRequest() {} - -void NaviSubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc deleted file mode 100644 index f641051560..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_subscribe_way_points_response.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_subscribe_way_points_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -NaviSubscribeWayPointsResponse::NaviSubscribeWayPointsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviSubscribeWayPointsResponse::~NaviSubscribeWayPointsResponse() {} - -void NaviSubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event( - hmi_apis::FunctionID::Navigation_SubscribeWayPoints); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc deleted file mode 100644 index e66069feef..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_unsubscribe_way_points_request.h" - -namespace application_manager { - -namespace commands { - -NaviUnSubscribeWayPointsRequest::NaviUnSubscribeWayPointsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviUnSubscribeWayPointsRequest::~NaviUnSubscribeWayPointsRequest() {} - -void NaviUnSubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc deleted file mode 100644 index 61216321e8..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_unsubscribe_way_points_response.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_unsubscribe_way_points_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -NaviUnsubscribeWayPointsResponse::NaviUnsubscribeWayPointsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviUnsubscribeWayPointsResponse::~NaviUnsubscribeWayPointsResponse() {} - -void NaviUnsubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event( - hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc deleted file mode 100644 index c37c3d12f9..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/navi_update_turn_list_request.h" - -namespace application_manager { - -namespace commands { - -NaviUpdateTurnListRequest::NaviUpdateTurnListRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -NaviUpdateTurnListRequest::~NaviUpdateTurnListRequest() {} - -void NaviUpdateTurnListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc b/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc deleted file mode 100644 index faf5719d05..0000000000 --- a/src/components/application_manager/src/commands/hmi/navi_update_turn_list_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/navi_update_turn_list_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -NaviUpdateTurnListResponse::NaviUpdateTurnListResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -NaviUpdateTurnListResponse::~NaviUpdateTurnListResponse() {} - -void NaviUpdateTurnListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc b/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc deleted file mode 100644 index 70e5e7cefd..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_allow_sdl_functionality_notification.h" -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler.h" - -namespace application_manager { - -namespace commands { - -OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnAllowSDLFunctionalityNotification::~OnAllowSDLFunctionalityNotification() {} - -void OnAllowSDLFunctionalityNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - std::string device_id; - if ((*message_)[strings::msg_params].keyExists("device")) { - device_id = (*message_)[strings::msg_params]["device"]["id"].asString(); - } - application_manager_.GetPolicyHandler().OnAllowSDLFunctionalityNotification( - (*message_)[strings::msg_params][hmi_response::allowed].asBool(), - device_id); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc deleted file mode 100644 index 76252a50fd..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_app_activated_notification.h" - -#include "application_manager/message_helper.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -OnAppActivatedNotification::OnAppActivatedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnAppActivatedNotification::~OnAppActivatedNotification() {} - -void OnAppActivatedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_OnAppActivated); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc deleted file mode 100644 index 86ce6a830c..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_app_deactivated_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" - -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -OnAppDeactivatedNotification::OnAppDeactivatedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnAppDeactivatedNotification::~OnAppDeactivatedNotification() {} - -void OnAppDeactivatedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc deleted file mode 100644 index fa7293513a..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_app_permission_changed_notification.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_app_permission_changed_notification.h" - -namespace application_manager { - -namespace commands { - -OnAppPermissionChangedNotification::OnAppPermissionChangedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnAppPermissionChangedNotification::~OnAppPermissionChangedNotification() {} - -void OnAppPermissionChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc deleted file mode 100644 index 19577f0127..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc +++ /dev/null @@ -1,175 +0,0 @@ - -/** - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_app_permission_consent_notification.h" -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler.h" -#include "application_manager/message_helper.h" -#include <algorithm> -#include <functional> -#include <string> -#include "policy/policy_types.h" -#include "smart_objects/smart_object.h" -#include "utils/make_shared.h" - -namespace { - -/** - * @brief Converts SmartObject data to group permission status and appends to - * collection - */ -struct PermissionsAppender - : public std::unary_function<void, - const smart_objects::SmartArray::value_type&> { - PermissionsAppender(policy::PermissionConsent& consents) - : allowed_key_(application_manager::hmi_response::allowed) - , consents_(consents) {} - void operator()(const smart_objects::SmartArray::value_type& item) const { - using namespace policy; - using namespace application_manager; - - FunctionalGroupPermission permissions; - - permissions.group_id = static_cast<int32_t>(item[strings::id].asInt()); - permissions.group_alias = item[strings::name].asString(); - - if (item.keyExists(allowed_key_)) { - permissions.state = - item[allowed_key_].asBool() ? kGroupAllowed : kGroupDisallowed; - } - - consents_.group_permissions.push_back(permissions); - } - - private: - const std::string allowed_key_; - policy::PermissionConsent& consents_; -}; - -#ifdef EXTERNAL_PROPRIETARY_MODE -/** - * @brief Converts SmartObject data to customer connectivity status item and - * appends to collection - */ -struct ExternalConsentStatusAppender - : std::unary_function<void, const smart_objects::SmartArray::value_type&> { - ExternalConsentStatusAppender( - policy::ExternalConsentStatus& external_consent_status) - : external_consent_status_(external_consent_status) {} - void operator()(const smart_objects::SmartArray::value_type& item) const { - using namespace policy; - using namespace hmi_apis; - using namespace application_manager; - - ExternalConsentStatusItem status_item( - static_cast<uint32_t>(item[strings::entity_type].asUInt()), - static_cast<uint32_t>(item[strings::entity_id].asUInt()), - static_cast<Common_EntityStatus::eType>( - item[strings::status].asUInt()) == Common_EntityStatus::ON - ? policy::kStatusOn - : policy::kStatusOff); - - external_consent_status_.insert(status_item); - } - - private: - policy::ExternalConsentStatus& external_consent_status_; -}; -#endif -} // namespace - -namespace application_manager { - -namespace commands { - -OnAppPermissionConsentNotification::OnAppPermissionConsentNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnAppPermissionConsentNotification::~OnAppPermissionConsentNotification() {} - -void OnAppPermissionConsentNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - - uint32_t connection_key = 0; - - policy::PermissionConsent permission_consent; - - // If user defined group permissions for specific app - if (msg_params.keyExists(strings::app_id)) { - connection_key = msg_params[strings::app_id].asUInt(); - } - - if (msg_params.keyExists(strings::consented_functions)) { - const smart_objects::SmartArray* user_consent = - msg_params[strings::consented_functions].asArray(); - - smart_objects::SmartArray::const_iterator it = user_consent->begin(); - smart_objects::SmartArray::const_iterator it_end = user_consent->end(); - for (; it != it_end; ++it) { - policy::FunctionalGroupPermission permissions; - permissions.group_id = (*it)["id"].asInt(); - permissions.group_alias = (*it)["name"].asString(); - if ((*it).keyExists("allowed")) { - permissions.state = (*it)["allowed"].asBool() - ? policy::kGroupAllowed - : policy::kGroupDisallowed; - } else { - permissions.state = policy::kGroupUndefined; - } - - permission_consent.group_permissions.push_back(permissions); - } - - permission_consent.consent_source = msg_params[strings::source].asString(); - } -#ifdef EXTERNAL_PROPRIETARY_MODE - policy::ExternalConsentStatus external_consent_status; - if (msg_params.keyExists(strings::external_consent_status)) { - const smart_objects::SmartArray* system_external_consent_status = - msg_params[strings::external_consent_status].asArray(); - ExternalConsentStatusAppender status_appender(external_consent_status); - std::for_each(system_external_consent_status->begin(), - system_external_consent_status->end(), - status_appender); - } - application_manager_.GetPolicyHandler().OnAppPermissionConsent( - connection_key, permission_consent, external_consent_status); -#else - application_manager_.GetPolicyHandler().OnAppPermissionConsent( - connection_key, permission_consent); -#endif -} -} // commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc deleted file mode 100644 index a97e19b556..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_app_registered_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_app_registered_notification.h" - -namespace application_manager { - -namespace commands { - -OnAppRegisteredNotification::OnAppRegisteredNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnAppRegisteredNotification::~OnAppRegisteredNotification() {} - -void OnAppRegisteredNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - // SDL must notify system about app registration before any dependent actions - // will be started - SendNotification(); - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc deleted file mode 100644 index f64e3e111b..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_app_unregistered_notification.h" - -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -OnAppUnregisteredNotification::OnAppUnregisteredNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {} - -bool OnAppUnregisteredNotification::Init() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Replacement of hmi id is skipped."); - return true; -} - -void OnAppUnregisteredNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // sending event for delete VRCommand on PerformInteraction - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); - - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc b/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc deleted file mode 100644 index c3e81bdc30..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_audio_data_streaming_notification.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_audio_data_streaming_notification.h" - -namespace application_manager { - -namespace commands { - -OnAudioDataStreamingNotification::OnAudioDataStreamingNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnAudioDataStreamingNotification::~OnAudioDataStreamingNotification() {} - -void OnAudioDataStreamingNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc deleted file mode 100644 index fc8d5989a1..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_button_event_notification.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_button_event_notification.h" - -#include "application_manager/application_impl.h" -#include "utils/logger.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -OnButtonEventNotification::OnButtonEventNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -void OnButtonEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::OnButtonEventID); - - SendNotificationToMobile(message_); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc deleted file mode 100644 index abff87c962..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_button_press_notification.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_button_press_notification.h" - -#include "application_manager/application_impl.h" -#include "utils/logger.h" -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -OnButtonPressNotification::OnButtonPressNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -void OnButtonPressNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::Buttons_OnButtonPress); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); - (*message_)[strings::params][strings::function_id] = - static_cast<int>(mobile_apis::FunctionID::eType::OnButtonPressID); - SendNotificationToMobile(message_); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc deleted file mode 100644 index aae994ea34..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_button_subscription_notification.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_button_subscription_notification.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -OnButtonSubscriptionNotification::OnButtonSubscriptionNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {} - -void OnButtonSubscriptionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc deleted file mode 100644 index 83ec785a9d..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_device_chosen_notification.h" - -namespace application_manager { - -namespace commands { - -OnDeviceChosenNotification::OnDeviceChosenNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnDeviceChosenNotification::~OnDeviceChosenNotification() {} - -void OnDeviceChosenNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - if ((*message_)[strings::msg_params].keyExists(strings::device_info)) { - application_manager_.ConnectToDevice( - (*message_)[strings::msg_params][strings::device_info][strings::id] - .asString()); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc deleted file mode 100644 index 346c05032b..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <algorithm> -#include "application_manager/commands/hmi/on_device_state_changed_notification.h" -#include "application_manager/application_manager.h" -#include "application_manager/message_helper.h" -#include "interfaces/HMI_API.h" -#include "encryption/hashing.h" - -namespace { -// TODO(AOleynik) : replace this !!! -void check_zero(const char& a, const char& b, std::string& bt_mac) { - if ('0' != a && '0' == b) { - bt_mac.push_back(a); - bt_mac.push_back(b); - } else if ('0' == a) { - bt_mac.push_back(b); - } else { - bt_mac.push_back(a); - bt_mac.push_back(b); - } -} - -std::string convert_to_bt_mac(std::string& deviceInternalId) { - std::transform(deviceInternalId.begin(), - deviceInternalId.end(), - deviceInternalId.begin(), - ::tolower); - - std::string bt_mac; - check_zero(deviceInternalId[10], deviceInternalId[11], bt_mac); - bt_mac.push_back(':'); - check_zero(deviceInternalId[8], deviceInternalId[9], bt_mac); - bt_mac.push_back(':'); - check_zero(deviceInternalId[6], deviceInternalId[7], bt_mac); - bt_mac.push_back(':'); - check_zero(deviceInternalId[4], deviceInternalId[5], bt_mac); - bt_mac.push_back(':'); - check_zero(deviceInternalId[2], deviceInternalId[3], bt_mac); - bt_mac.push_back(':'); - check_zero(deviceInternalId[0], deviceInternalId[1], bt_mac); - - return bt_mac; -} -} - -namespace application_manager { - -namespace commands { - -OnDeviceStateChangedNotification::OnDeviceStateChangedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnDeviceStateChangedNotification::~OnDeviceStateChangedNotification() {} - -void OnDeviceStateChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - if ((*message_)[strings::msg_params]["deviceState"] == - hmi_apis::Common_DeviceState::UNPAIRED) { - // It is expected, that "deviceInternalId" is the device MAC address in - // form XXXXXXXXXX - std::string device_id = - (*message_)[strings::msg_params]["deviceInternalId"].asString(); - if (device_id.empty()) { - if ((*message_)[strings::msg_params].keyExists("deviceId")) { - device_id = - (*message_)[strings::msg_params]["deviceId"]["id"].asString(); - } - } else { - // Policy uses hashed MAC address as device_id - LOG4CXX_DEBUG(logger_, "Device_id from HMI: " << device_id); - std::string bt_mac = convert_to_bt_mac(device_id); - LOG4CXX_DEBUG(logger_, "Device_id as BT MAC: " << bt_mac); - device_id = encryption::MakeHash(bt_mac); - LOG4CXX_DEBUG(logger_, "Device_id hashed as BT MAC : " << device_id); - } - application_manager_.GetPolicyHandler().RemoveDevice(device_id); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc deleted file mode 100644 index a895d353ce..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <set> -#include "application_manager/commands/hmi/on_driver_distraction_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/make_shared.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -namespace { -struct OnDriverDistractionProcessor { - OnDriverDistractionProcessor( - OnDriverDistractionNotification& command, - smart_objects::SmartObjectSPtr on_driver_distraction_so, - ApplicationManager& application_manager) - : command_(command) - , on_driver_distraction_so_(on_driver_distraction_so) - , application_manager_(application_manager) - , stringified_function_id_(MessageHelper::StringifiedFunctionID( - mobile_api::FunctionID::OnDriverDistractionID)) {} - - void operator()(ApplicationSharedPtr application) { - if (application) { - (*on_driver_distraction_so_)[strings::params][strings::connection_key] = - application->app_id(); - const RPCParams params; - policy::CheckPermissionResult result; - application_manager_.GetPolicyHandler().CheckPermissions( - application, stringified_function_id_, params, result); - if (result.hmi_level_permitted != policy::kRpcAllowed) { - MobileMessageQueue messages; - application->SwapMobileMessageQueue(messages); - messages.erase( - std::remove_if( - messages.begin(), - messages.end(), - [this](smart_objects::SmartObjectSPtr message) { - return (*message)[strings::params][strings::function_id] - .asString() == stringified_function_id_; - }), - messages.end()); - application->PushMobileMessage(on_driver_distraction_so_); - return; - } - command_.SendNotificationToMobile(on_driver_distraction_so_); - } - } - - private: - OnDriverDistractionNotification& command_; - smart_objects::SmartObjectSPtr on_driver_distraction_so_; - ApplicationManager& application_manager_; - std::string stringified_function_id_; -}; -} - -OnDriverDistractionNotification::OnDriverDistractionNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnDriverDistractionNotification::~OnDriverDistractionNotification() {} - -void OnDriverDistractionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - const hmi_apis::Common_DriverDistractionState::eType state = - static_cast<hmi_apis::Common_DriverDistractionState::eType>( - (*message_)[strings::msg_params][hmi_notification::state].asInt()); - application_manager_.set_driver_distraction_state(state); - - smart_objects::SmartObjectSPtr on_driver_distraction = - utils::MakeShared<smart_objects::SmartObject>(); - - if (!on_driver_distraction) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - (*on_driver_distraction)[strings::params][strings::function_id] = - mobile_api::FunctionID::OnDriverDistractionID; - (*on_driver_distraction)[strings::params][strings::message_type] = - static_cast<int32_t>(application_manager::MessageType::kNotification); - (*on_driver_distraction)[strings::msg_params][mobile_notification::state] = - state; - - const ApplicationSet applications = - application_manager_.applications().GetData(); - - OnDriverDistractionProcessor processor( - *this, on_driver_distraction, application_manager_); - std::for_each(applications.begin(), applications.end(), processor); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc deleted file mode 100644 index c211ffde50..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_event_changed_notification.h" - -namespace application_manager { - -namespace commands { - -OnEventChangedNotification::OnEventChangedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnEventChangedNotification::~OnEventChangedNotification() {} - -void OnEventChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event( - hmi_apis::FunctionID::BasicCommunication_OnEventChanged); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc deleted file mode 100644 index cb68b21263..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_exit_all_applications_notification.h" - -#include <sys/types.h> -#include <unistd.h> -#include <signal.h> - -#include "application_manager/application_manager.h" -#include "application_manager/resumption/resume_ctrl.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -OnExitAllApplicationsNotification::OnExitAllApplicationsNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnExitAllApplicationsNotification::~OnExitAllApplicationsNotification() {} - -void OnExitAllApplicationsNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const hmi_apis::Common_ApplicationsCloseReason::eType reason = - static_cast<hmi_apis::Common_ApplicationsCloseReason::eType>( - (*message_)[strings::msg_params][hmi_request::reason].asInt()); - LOG4CXX_DEBUG(logger_, "Reason " << reason); - - mobile_api::AppInterfaceUnregisteredReason::eType mob_reason = - mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM; - - switch (reason) { - case hmi_apis::Common_ApplicationsCloseReason::IGNITION_OFF: { - mob_reason = mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF; - break; - } - case hmi_apis::Common_ApplicationsCloseReason::MASTER_RESET: { - mob_reason = mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET; - break; - } - case hmi_apis::Common_ApplicationsCloseReason::FACTORY_DEFAULTS: { - mob_reason = mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS; - break; - } - case hmi_apis::Common_ApplicationsCloseReason::SUSPEND: { - application_manager_.resume_controller().OnSuspend(); - SendOnSDLPersistenceComplete(); - return; - } - default: { - LOG4CXX_ERROR(logger_, "Unknown Application close reason" << reason); - return; - } - } - - application_manager_.SetUnregisterAllApplicationsReason(mob_reason); - - if (mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET == mob_reason || - mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS == - mob_reason) { - application_manager_.HeadUnitReset(mob_reason); - } - kill(getpid(), SIGINT); -} - -void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObjectSPtr message = - new smart_objects::SmartObject(smart_objects::SmartType_Map); - (*message)[strings::params][strings::function_id] = - hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete; - (*message)[strings::params][strings::message_type] = - MessageType::kNotification; - (*message)[strings::params][strings::correlation_id] = - application_manager_.GetNextHMICorrelationID(); - - application_manager_.ManageHMICommand(message); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc deleted file mode 100644 index efdfaf8f3e..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2017, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_exit_application_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/state_controller.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#ifdef SDL_REMOTE_CONTROL -#include "functional_module/plugin_manager.h" -#endif // SDL_REMOTE_CONTROL - -namespace application_manager { - -namespace commands { - -OnExitApplicationNotification::OnExitApplicationNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnExitApplicationNotification::~OnExitApplicationNotification() {} - -void OnExitApplicationNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - using namespace mobile_apis; - using namespace hmi_apis; - - uint32_t app_id = (*message_)[strings::msg_params][strings::app_id].asUInt(); - ApplicationSharedPtr app_impl = application_manager_.application(app_id); - - if (!(app_impl.valid())) { - LOG4CXX_ERROR(logger_, "Application does not exist"); - return; - } - -#ifdef SDL_REMOTE_CONTROL - application_manager_.GetPluginManager().OnApplicationEvent( - functional_modules::ApplicationEvent::kApplicationExit, app_impl); -#endif // SDL_REMOTE_CONTROL - - Common_ApplicationExitReason::eType reason; - reason = static_cast<Common_ApplicationExitReason::eType>( - (*message_)[strings::msg_params][strings::reason].asInt()); - - switch (reason) { - case Common_ApplicationExitReason::DRIVER_DISTRACTION_VIOLATION: { - break; - } - case Common_ApplicationExitReason::USER_EXIT: { - break; - } - case Common_ApplicationExitReason::UNAUTHORIZED_TRANSPORT_REGISTRATION: { - application_manager_.ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app_id, AppInterfaceUnregisteredReason::APP_UNAUTHORIZED), - commands::Command::ORIGIN_SDL); - // HMI rejects registration for navi application - application_manager_.UnregisterApplication(app_id, Result::SUCCESS); - return; - } - case Common_ApplicationExitReason::UNSUPPORTED_HMI_RESOURCE: { - application_manager_.ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app_id, AppInterfaceUnregisteredReason::UNSUPPORTED_HMI_RESOURCE), - commands::Command::ORIGIN_SDL); - application_manager_.UnregisterApplication(app_id, Result::SUCCESS); - return; - } - default: { - LOG4CXX_WARN(logger_, "Unhandled reason"); - return; - } - } - - application_manager_.state_controller().SetRegularState( - app_impl, HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE, false); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc b/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc deleted file mode 100644 index e69d111d2c..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_file_removed_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_file_removed_notification.h" - -namespace application_manager { - -namespace commands { - -OnFileRemovedNotification::OnFileRemovedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnFileRemovedNotification::~OnFileRemovedNotification() {} - -void OnFileRemovedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_find_applications.cc b/src/components/application_manager/src/commands/hmi/on_find_applications.cc deleted file mode 100644 index 9d3633ba6d..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_find_applications.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_find_applications.h" - -namespace application_manager { - -namespace commands { - -OnFindApplications::OnFindApplications(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnFindApplications::~OnFindApplications() {} - -void OnFindApplications::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // TODO(PV): add UpdateAppsOnDevice to ApplicationManager -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc b/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc deleted file mode 100644 index 8c772d6dcd..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_ignition_cycle_over_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_ignition_cycle_over_notification.h" -#include "application_manager/application_manager.h" - -namespace application_manager { - -namespace commands { - -OnIgnitionCycleOverNotification::OnIgnitionCycleOverNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnIgnitionCycleOverNotification::~OnIgnitionCycleOverNotification() {} - -void OnIgnitionCycleOverNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - application_manager_.GetPolicyHandler().OnIgnitionCycleOver(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc deleted file mode 100644 index e25de1f3a9..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_navi_tbt_client_state_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_navi_tbt_client_state_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnNaviTBTClientStateNotification::OnNaviTBTClientStateNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnNaviTBTClientStateNotification::~OnNaviTBTClientStateNotification() {} - -void OnNaviTBTClientStateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::OnTBTClientStateID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc deleted file mode 100644 index 17d1b420be..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_navi_way_point_change_notification.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_navi_way_point_change_notification.h" - -namespace application_manager { - -namespace commands { - -OnNaviWayPointChangeNotification::OnNaviWayPointChangeNotification( - const MessageSharedPtr& message, ApplicationManager& app_man) - : NotificationFromHMI(message, app_man) {} - -OnNaviWayPointChangeNotification::~OnNaviWayPointChangeNotification() {} - -void OnNaviWayPointChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::OnWayPointChangeID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_policy_update.cc b/src/components/application_manager/src/commands/hmi/on_policy_update.cc deleted file mode 100644 index 39b179f967..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_policy_update.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_policy_update.h" -#include "application_manager/application_manager.h" - -namespace application_manager { -namespace commands { - -OnPolicyUpdate::OnPolicyUpdate(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnPolicyUpdate::~OnPolicyUpdate() {} - -void OnPolicyUpdate::Run() { - LOG4CXX_AUTO_TRACE(logger_); - application_manager_.GetPolicyHandler().OnPTExchangeNeeded(); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc b/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc deleted file mode 100644 index 596b7d4549..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_put_file_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_put_file_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnPutFileNotification::OnPutFileNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnPutFileNotification::~OnPutFileNotification() {} - -void OnPutFileNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/src/commands/hmi/on_ready_notification.cc deleted file mode 100644 index 3a45e0f934..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_ready_notification.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_ready_notification.h" - -namespace application_manager { - -namespace commands { - -OnReadyNotification::OnReadyNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnReadyNotification::~OnReadyNotification() {} - -void OnReadyNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.OnHMIStartedCooperation(); - event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnReady); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc deleted file mode 100644 index 8724a072ed..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string> -#include "application_manager/commands/hmi/on_received_policy_update.h" -#include "application_manager/application_manager.h" -#include "utils/file_system.h" - -namespace application_manager { - -namespace commands { - -OnReceivedPolicyUpdate::OnReceivedPolicyUpdate( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {} - -void OnReceivedPolicyUpdate::Run() { - LOG4CXX_AUTO_TRACE(logger_); -#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE) - const std::string& file_path = - (*message_)[strings::msg_params][hmi_notification::policyfile].asString(); - policy::BinaryMessage file_content; - if (!file_system::ReadBinaryFile(file_path, file_content)) { - LOG4CXX_ERROR(logger_, "Failed to read Update file."); - return; - } - application_manager_.GetPolicyHandler().ReceiveMessageFromSDK(file_path, - file_content); -#else - LOG4CXX_WARN(logger_, - "This RPC is part of extended policy flow." - "Please re-build with extended policy mode enabled."); -#endif -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc b/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc deleted file mode 100644 index 4d126ac67d..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_record_start_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_record_start_notification.h" - -namespace application_manager { - -namespace commands { - -OnRecordStartdNotification::OnRecordStartdNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnRecordStartdNotification::~OnRecordStartdNotification() {} - -void OnRecordStartdNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc b/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc deleted file mode 100644 index ce3c371cf8..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_resume_audio_source_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_resume_audio_source_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnResumeAudioSourceNotification::OnResumeAudioSourceNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnResumeAudioSourceNotification::~OnResumeAudioSourceNotification() {} - -void OnResumeAudioSourceNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc deleted file mode 100644 index 0517ea8d24..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_sdl_close_notification.h" - -namespace application_manager { - -namespace commands { - -OnSDLCloseNotification::OnSDLCloseNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnSDLCloseNotification::~OnSDLCloseNotification() {} - -void OnSDLCloseNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc deleted file mode 100644 index a9c36813f6..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_sdl_consent_needed_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ - -/** - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_sdl_consent_needed_notification.h" - -namespace application_manager { - -namespace commands { - -OnSDLConsentNeededNotification::OnSDLConsentNeededNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnSDLConsentNeededNotification::~OnSDLConsentNeededNotification() {} - -void OnSDLConsentNeededNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc deleted file mode 100644 index e30a0fb902..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_sdl_persistence_complete_notification.h" - -namespace application_manager { - -namespace commands { - -OnSDLPersistenceCompleteNotification::OnSDLPersistenceCompleteNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnSDLPersistenceCompleteNotification::~OnSDLPersistenceCompleteNotification() {} - -void OnSDLPersistenceCompleteNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc b/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc deleted file mode 100644 index 8e94b2b004..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_start_device_discovery.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_start_device_discovery.h" - -namespace application_manager { - -namespace commands { - -OnStartDeviceDiscovery::OnStartDeviceDiscovery( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnStartDeviceDiscovery::~OnStartDeviceDiscovery() {} - -void OnStartDeviceDiscovery::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.StartDevicesDiscovery(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc b/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc deleted file mode 100644 index 78a6b68324..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_status_update_notification.h" - -namespace application_manager { - -namespace commands { - -OnStatusUpdateNotification::OnStatusUpdateNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnStatusUpdateNotification::~OnStatusUpdateNotification() {} - -void OnStatusUpdateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc deleted file mode 100644 index 887aacf5b9..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_system_context_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/state_controller.h" -#include "application_manager/message_helper.h" - -namespace application_manager { -namespace commands { - -OnSystemContextNotification::OnSystemContextNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnSystemContextNotification::~OnSystemContextNotification() {} - -void OnSystemContextNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - mobile_api::SystemContext::eType system_context = - static_cast<mobile_api::SystemContext::eType>( - (*message_)[strings::msg_params][hmi_notification::system_context] - .asInt()); - - ApplicationSharedPtr app; - if ((mobile_api::SystemContext::SYSCTXT_VRSESSION == system_context) || - (mobile_api::SystemContext::SYSCTXT_MENU == system_context) || - (mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED == system_context)) { - app = application_manager_.active_application(); - } else if ((mobile_api::SystemContext::SYSCTXT_ALERT == system_context) || - (mobile_api::SystemContext::SYSCTXT_MAIN == system_context)) { - if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { - app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asUInt()); - } - } - - if (app && mobile_api::SystemContext::INVALID_ENUM != system_context) { - application_manager_.state_controller().SetRegularState(app, - system_context); - } else { - LOG4CXX_ERROR(logger_, "Application does not exist"); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc deleted file mode 100644 index 4885420f1c..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_system_error_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_system_error_notification.h" -#include "application_manager/application_manager.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -OnSystemErrorNotification::OnSystemErrorNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnSystemErrorNotification::~OnSystemErrorNotification() {} - -void OnSystemErrorNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const int code = - (*message_)[strings::msg_params][hmi_notification::error].asInt(); - - application_manager_.GetPolicyHandler().OnSystemError(code); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc deleted file mode 100644 index 00b3649284..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_system_info_changed_notification.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_system_info_changed_notification.h" -#include "application_manager/application_manager.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -OnSystemInfoChangedNotification::OnSystemInfoChangedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnSystemInfoChangedNotification::~OnSystemInfoChangedNotification() {} - -void OnSystemInfoChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - uint32_t lang_code = - (*message_)[strings::msg_params][strings::language].asUInt(); - const std::string language = - application_manager::MessageHelper::CommonLanguageToString( - static_cast<hmi_apis::Common_Language::eType>(lang_code)); - - application_manager_.GetPolicyHandler().OnSystemInfoChanged(language); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc deleted file mode 100644 index ea91dca5f1..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/application_impl.h" - -#include "application_manager/commands/hmi/on_system_request_notification.h" -#include "application_manager/policies/policy_handler_interface.h" -#include "interfaces/MOBILE_API.h" -#include "utils/macro.h" - -using policy::PolicyHandlerInterface; - -namespace application_manager { - -namespace commands { - -OnSystemRequestNotification::OnSystemRequestNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnSystemRequestNotification::~OnSystemRequestNotification() {} - -void OnSystemRequestNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject& params = (*message_)[strings::params]; - smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - - params[strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID); - - // According to HMI API, this should be HMI unique id, but during processing - // messages from HMI this param is replaced by connection key, so below it - // will be treated as connection key - ApplicationSharedPtr app; - if (msg_params.keyExists(strings::app_id)) { - const uint32_t app_id = msg_params[strings::app_id].asUInt(); - LOG4CXX_DEBUG(logger_, "Received OnSystemRequest for appID " << app_id); - LOG4CXX_DEBUG(logger_, "Searching app to send OnSystemRequest by appID."); - app = application_manager_.application(app_id); - } else { - LOG4CXX_DEBUG(logger_, - "Received OnSystemRequest without appID." - " One of registered apps will be used."); - LOG4CXX_DEBUG(logger_, "Searching registered app to send OnSystemRequest."); - const PolicyHandlerInterface& policy_handler = - application_manager_.GetPolicyHandler(); - const uint32_t selected_app_id = policy_handler.GetAppIdForSending(); - if (0 == selected_app_id) { - LOG4CXX_WARN(logger_, - "Can't select application to forward OnSystemRequest."); - return; - } - app = application_manager_.application(selected_app_id); - } - - if (!app.valid()) { - LOG4CXX_WARN(logger_, - "No valid application found to forward OnSystemRequest."); - return; - } - - std::string device_mac; - application_manager_.connection_handler() - .get_session_observer() - .GetDataOnDeviceID(app->device(), NULL, NULL, &device_mac, NULL); - - if (policy::kDeviceAllowed != - application_manager_.GetPolicyHandler().GetUserConsentForDevice( - device_mac)) { - LOG4CXX_WARN(logger_, - "Application " - << app->policy_app_id() - << " is registered from non-consented device." - "Can't forward notification to application."); - return; - } - - LOG4CXX_DEBUG(logger_, - "Sending request with application id " << app->policy_app_id()); - - params[strings::connection_key] = app->app_id(); - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc deleted file mode 100644 index bd152c2af0..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_tts_language_change_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {} - -void OnTTSLanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_active_tts_language( - static_cast<hmi_apis::Common_Language::eType>( - (*message_)[strings::msg_params][strings::language].asInt())); - - /* need to clarify, because unchanged VR - cause WRONG_LANGUAGE on Register */ - hmi_capabilities.set_active_vr_language( - static_cast<hmi_apis::Common_Language::eType>( - (*message_)[strings::msg_params][strings::language].asInt())); - - (*message_)[strings::msg_params][strings::hmi_display_language] = - hmi_capabilities.active_ui_language(); - - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID); - - const ApplicationSet& accessor = - application_manager_.applications().GetData(); - ApplicationSetIt it = accessor.begin(); - for (; accessor.end() != it;) { - ApplicationSharedPtr app = *it++; - (*message_)[strings::params][strings::connection_key] = app->app_id(); - SendNotificationToMobile(message_); - - if (static_cast<int>(app->language()) != - (*message_)[strings::msg_params][strings::language].asInt()) { - application_manager_.ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app->app_id(), - mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE), - commands::Command::ORIGIN_SDL); - application_manager_.UnregisterApplication( - app->app_id(), mobile_apis::Result::SUCCESS, false); - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc deleted file mode 100644 index 283e2056ba..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_tts_reset_timeout_notification.cc +++ /dev/null @@ -1,29 +0,0 @@ -#include "application_manager/commands/hmi/on_tts_reset_timeout_notification.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {} - -void OnTTSResetTimeoutNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc deleted file mode 100644 index 317465f354..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_tts_started_notification.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_tts_started_notification.h" - -namespace application_manager { - -namespace commands { - -OnTTSStartedNotification::OnTTSStartedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnTTSStartedNotification::~OnTTSStartedNotification() {} - -void OnTTSStartedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::TTS_Started); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc deleted file mode 100644 index 7f763d8598..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_tts_stopped_notification.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_tts_stopped_notification.h" - -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -OnTTSStoppedNotification::OnTTSStoppedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnTTSStoppedNotification::~OnTTSStoppedNotification() {} - -void OnTTSStoppedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::TTS_Stopped); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc deleted file mode 100644 index 9f91d99a85..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_ui_command_notification.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_ui_command_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnUICommandNotification::OnUICommandNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnUICommandNotification::~OnUICommandNotification() {} - -void OnUICommandNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID); - - (*message_)[strings::msg_params][strings::trigger_source] = - static_cast<int32_t>(mobile_apis::TriggerSource::TS_MENU); - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc deleted file mode 100644 index 117fec5741..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_ui_keyboard_input_notification.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_ui_keyboard_input_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -OnUIKeyBoardInputNotification::OnUIKeyBoardInputNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnUIKeyBoardInputNotification::~OnUIKeyBoardInputNotification() {} - -void OnUIKeyBoardInputNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::OnKeyboardInputID; - SendNotificationToMobile(message_); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc deleted file mode 100644 index 6e8e38f757..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_ui_language_change_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnUILanguageChangeNotification::OnUILanguageChangeNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {} - -void OnUILanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_active_ui_language( - static_cast<hmi_apis::Common_Language::eType>( - (*message_)[strings::msg_params][strings::language].asInt())); - - (*message_)[strings::msg_params][strings::hmi_display_language] = - (*message_)[strings::msg_params][strings::language]; - - (*message_)[strings::msg_params][strings::language] = - hmi_capabilities.active_vr_language(); - - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID); - - const ApplicationSet& accessor = - application_manager_.applications().GetData(); - - ApplicationSetConstIt it = accessor.begin(); - for (; accessor.end() != it;) { - ApplicationSharedPtr app = *it++; - (*message_)[strings::params][strings::connection_key] = app->app_id(); - SendNotificationToMobile(message_); - - if (app->ui_language() != - (*message_)[strings::msg_params][strings::hmi_display_language] - .asInt()) { - application_manager_.ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app->app_id(), - mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE), - commands::Command::ORIGIN_SDL); - application_manager_.UnregisterApplication( - app->app_id(), mobile_apis::Result::SUCCESS, false); - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc deleted file mode 100644 index a5fea7bf8d..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_ui_reset_timeout_notification.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_ui_reset_timeout_notification.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -OnUIResetTimeoutNotification::OnUIResetTimeoutNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {} - -void OnUIResetTimeoutNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc deleted file mode 100644 index 7709af8720..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_ui_touch_event_notification.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_ui_touch_event_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -namespace hmi { - -OnUITouchEventNotification::OnUITouchEventNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnUITouchEventNotification::~OnUITouchEventNotification() {} - -void OnUITouchEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::OnTouchEventID; - SendNotificationToMobile(message_); -} - -} // namespace hmi - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_update_device_list.cc b/src/components/application_manager/src/commands/hmi/on_update_device_list.cc deleted file mode 100644 index b245ea21aa..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_update_device_list.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/on_update_device_list.h" - -namespace application_manager { - -namespace commands { - -OnUpdateDeviceList::OnUpdateDeviceList(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnUpdateDeviceList::~OnUpdateDeviceList() {} - -void OnUpdateDeviceList::Run() { - LOG4CXX_AUTO_TRACE(logger_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc deleted file mode 100644 index 9b10055e2c..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_acc_pedal_position_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {} - -void OnVIAccPedalPositionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc deleted file mode 100644 index 58f9add514..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_belt_status_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_belt_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIBeltStatusNotification::OnVIBeltStatusNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {} - -void OnVIBeltStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc deleted file mode 100644 index 33f2944c38..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_body_information_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_body_information_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIBodyInformationNotification::OnVIBodyInformationNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {} - -void OnVIBodyInformationNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc deleted file mode 100644 index 9cbf612be1..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_device_status_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_device_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIDeviceStatusNotification::OnVIDeviceStatusNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {} - -void OnVIDeviceStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc deleted file mode 100644 index e521ac3a37..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_driver_braking_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_driver_braking_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIDriverBrakingNotification::OnVIDriverBrakingNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {} - -void OnVIDriverBrakingNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc deleted file mode 100644 index ebed955270..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_engine_torque_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_engine_torque_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIEngineTorqueNotification::OnVIEngineTorqueNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {} - -void OnVIEngineTorqueNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc deleted file mode 100644 index 9f0696fdc6..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_external_temperature_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_external_temperature_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {} - -void OnVIExternalTemperatureNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc deleted file mode 100644 index ef650a9f99..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_fuel_level_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIFuelLevelNotification::OnVIFuelLevelNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {} - -void OnVIFuelLevelNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc deleted file mode 100644 index a5267d8dac..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_fuel_level_state_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_fuel_level_state_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {} - -void OnVIFuelLevelStateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc deleted file mode 100644 index 63b95bf6dc..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_gps_data_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_gps_data_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIGpsDataNotification::OnVIGpsDataNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIGpsDataNotification::~OnVIGpsDataNotification() {} - -void OnVIGpsDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc deleted file mode 100644 index 7d494f02d3..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_head_lamp_status_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_head_lamp_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {} - -void OnVIHeadLampStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc deleted file mode 100644 index a62f4cacea..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIInstantFuelConsumptionNotification::OnVIInstantFuelConsumptionNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIInstantFuelConsumptionNotification:: - ~OnVIInstantFuelConsumptionNotification() {} - -void OnVIInstantFuelConsumptionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc deleted file mode 100644 index 229d50667b..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_my_key_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_my_key_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIMyKeyNotification::OnVIMyKeyNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIMyKeyNotification::~OnVIMyKeyNotification() {} - -void OnVIMyKeyNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc deleted file mode 100644 index 10f236539c..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_odometer_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_odometer_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIOdometerNotification::OnVIOdometerNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIOdometerNotification::~OnVIOdometerNotification() {} - -void OnVIOdometerNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc deleted file mode 100644 index 81585eabca..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_prndl_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_prndl_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIPrndlNotification::OnVIPrndlNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIPrndlNotification::~OnVIPrndlNotification() {} - -void OnVIPrndlNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc deleted file mode 100644 index b5c0703917..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_rpm_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_rpm_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIRpmNotification::OnVIRpmNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIRpmNotification::~OnVIRpmNotification() {} - -void OnVIRpmNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc deleted file mode 100644 index aacafb71c9..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_speed_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_speed_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVISpeedNotification::OnVISpeedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVISpeedNotification::~OnVISpeedNotification() {} - -void OnVISpeedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc deleted file mode 100644 index af102ea926..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {} - -void OnVISteeringWheelAngleNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc deleted file mode 100644 index 99506e6171..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_tire_pressure_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_tire_pressure_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVITirePressureNotification::OnVITirePressureNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVITirePressureNotification::~OnVITirePressureNotification() {} - -void OnVITirePressureNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc deleted file mode 100644 index bba7e2f3ff..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_vehicle_data_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIVehicleDataNotification::OnVIVehicleDataNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {} - -void OnVIVehicleDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - if (msg_params.keyExists(strings::odometer)) { - application_manager_.IviInfoUpdated( - mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER, - msg_params[strings::odometer].asInt()); - } - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc deleted file mode 100644 index c360e41dff..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_vin_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_vin_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIVinNotification::OnVIVinNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIVinNotification::~OnVIVinNotification() {} - -void OnVIVinNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc deleted file mode 100644 index 08fb3f31d4..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vi_wiper_status_notification.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vi_wiper_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVIWiperStatusNotification::OnVIWiperStatusNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {} - -void OnVIWiperStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc b/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc deleted file mode 100644 index ee0a91f5ef..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_video_data_streaming_notification.cc +++ /dev/null @@ -1,53 +0,0 @@ - -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_video_data_streaming_notification.h" - -namespace application_manager { - -namespace commands { - -OnVideoDataStreamingNotification::OnVideoDataStreamingNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationToHMI(message, application_manager) {} - -OnVideoDataStreamingNotification::~OnVideoDataStreamingNotification() {} - -void OnVideoDataStreamingNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc deleted file mode 100644 index c609e2dc0a..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vr_command_notification.h" - -#include "application_manager/policies/policy_handler.h" -#include "application_manager/message_helper.h" -#include "application_manager/state_controller.h" - -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -OnVRCommandNotification::OnVRCommandNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVRCommandNotification::~OnVRCommandNotification() {} - -void OnVRCommandNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - const uint32_t cmd_id = - (*message_)[strings::msg_params][strings::cmd_id].asUInt(); - uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id(); - - // Check if this is one of standart VR commands (i.e. "Help") - if (cmd_id > max_cmd_id + 1) { - LOG4CXX_INFO(logger_, "Switched App"); - const uint32_t app_id = cmd_id - max_cmd_id; - ApplicationSharedPtr app = application_manager_.application(app_id); - if (app) { - application_manager_.state_controller().SetRegularState( - app, mobile_apis::HMILevel::HMI_FULL, true); - } else { - LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id); - } - return; - } - - // Check if this is "Help" - if (cmd_id == max_cmd_id + 1) { - return; - } - const uint32_t app_id = - (*message_)[strings::msg_params][strings::app_id].asUInt(); - ApplicationSharedPtr app = application_manager_.application(app_id); - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - /* check if perform interaction is active - * if it is active we should sent to HMI DeleteCommand request - * and PerformInterActionResponse to mobile - */ - if (0 != app->is_perform_interaction_active()) { - event_engine::Event event(hmi_apis::FunctionID::VR_OnCommand); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); - } else { - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID); - - (*message_)[strings::msg_params][strings::trigger_source] = - static_cast<int32_t>(mobile_apis::TriggerSource::TS_VR); - SendNotificationToMobile(message_); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc deleted file mode 100644 index bbdb55cde6..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vr_language_change_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/state_controller.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVRLanguageChangeNotification::OnVRLanguageChangeNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {} - -void OnVRLanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_active_vr_language( - static_cast<hmi_apis::Common_Language::eType>( - (*message_)[strings::msg_params][strings::language].asInt())); - - (*message_)[strings::msg_params][strings::hmi_display_language] = - hmi_capabilities.active_ui_language(); - - (*message_)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID); - - const ApplicationSet& accessor = - application_manager_.applications().GetData(); - - ApplicationSetConstIt it = accessor.begin(); - for (; accessor.end() != it;) { - ApplicationSharedPtr app = *it++; - (*message_)[strings::params][strings::connection_key] = app->app_id(); - SendNotificationToMobile(message_); - if (static_cast<int32_t>(app->language()) != - (*message_)[strings::msg_params][strings::language].asInt()) { - application_manager_.state_controller().SetRegularState( - app, mobile_api::HMILevel::HMI_NONE, false); - - application_manager_.ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app->app_id(), - mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE), - commands::Command::ORIGIN_SDL); - application_manager_.UnregisterApplication( - app->app_id(), mobile_apis::Result::SUCCESS, false); - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc deleted file mode 100644 index 68942fcf01..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vr_started_notification.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vr_started_notification.h" - -namespace application_manager { - -namespace commands { - -OnVRStartedNotification::OnVRStartedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVRStartedNotification::~OnVRStartedNotification() {} - -void OnVRStartedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VR_Started); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc deleted file mode 100644 index e8f9fab847..0000000000 --- a/src/components/application_manager/src/commands/hmi/on_vr_stopped_notification.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/on_vr_stopped_notification.h" - -namespace application_manager { - -namespace commands { - -OnVRStoppedNotification::OnVRStoppedNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : NotificationFromHMI(message, application_manager) {} - -OnVRStoppedNotification::~OnVRStoppedNotification() {} - -void OnVRStoppedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VR_Stopped); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_request.cc deleted file mode 100644 index 32b296a3b9..0000000000 --- a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/rc_get_capabilities_request.h" - -namespace application_manager { - -namespace commands { - -RCGetCapabilitiesRequest::RCGetCapabilitiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -RCGetCapabilitiesRequest::~RCGetCapabilitiesRequest() {} - -void RCGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc deleted file mode 100644 index 82cbd7f128..0000000000 --- a/src/components/application_manager/src/commands/hmi/rc_get_capabilities_response.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/rc_get_capabilities_response.h" - -namespace application_manager { - -namespace commands { - -RCGetCapabilitiesResponse::RCGetCapabilitiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -RCGetCapabilitiesResponse::~RCGetCapabilitiesResponse() {} - -void RCGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - bool capability_exists = - (*message_)[strings::msg_params].keyExists(strings::rc_capability); - - if (capability_exists) { - hmi_capabilities.set_rc_capability( - (*message_)[strings::msg_params][strings::rc_capability]); - } - hmi_capabilities.set_rc_supported(capability_exists); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc deleted file mode 100644 index a976ce1044..0000000000 --- a/src/components/application_manager/src/commands/hmi/rc_is_ready_request.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/rc_is_ready_request.h" - -namespace application_manager { - -namespace commands { - -RCIsReadyRequest::RCIsReadyRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) {} - -RCIsReadyRequest::~RCIsReadyRequest() {} - -void RCIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::RC_IsReady, correlation_id()); - SendRequest(); -} - -void RCIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::RC_IsReady: { - LOG4CXX_DEBUG(logger_, "Received RC_IsReady event"); - unsubscribe_from_event(hmi_apis::FunctionID::RC_IsReady); - const bool is_available = ChangeInterfaceState( - application_manager_, message, HmiInterfaces::HMI_INTERFACE_RC); - - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - hmi_capabilities.set_is_rc_cooperating(is_available); - if (!is_available) { - hmi_capabilities.set_rc_supported(false); - } - - if (!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_RC)) { - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_RC isn't available"); - return; - } - SendMessageToHMI(); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -void RCIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); -} - -void RCIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::RC_GetCapabilities, application_manager_)); - application_manager_.ManageHMICommand(get_capabilities); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/rc_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/rc_is_ready_response.cc deleted file mode 100644 index 6756b294f3..0000000000 --- a/src/components/application_manager/src/commands/hmi/rc_is_ready_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/rc_is_ready_response.h" - -namespace application_manager { - -namespace commands { - -RCIsReadyResponse::RCIsReadyResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -RCIsReadyResponse::~RCIsReadyResponse() {} - -void RCIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::RC_IsReady); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc deleted file mode 100644 index 6961c15f76..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_activate_app_request.h" -#include "application_manager/state_controller.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -namespace { -struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> { - connection_handler::DeviceHandle handle_; - ProtoV4AppsOnDevice(const connection_handler::DeviceHandle handle) - : handle_(handle) {} - bool operator()(const ApplicationSharedPtr app) const { - return app - ? handle_ == app->device() && - Message::is_sufficient_version( - protocol_handler::MajorProtocolVersion:: - PROTOCOL_VERSION_4, - app->protocol_version()) - : false; - } -}; - -struct ForegroundApp - : std::unary_function<SDLActivateAppRequest::V4ProtoApps::value_type, - bool> { - bool operator()( - const SDLActivateAppRequest::V4ProtoApps::value_type ptr) const { - return ptr ? ptr->is_foreground() : false; - } -}; - -struct SendLaunchApp - : std::unary_function<SDLActivateAppRequest::V4ProtoApps::value_type, - void> { - ApplicationConstSharedPtr app_to_launch_; - ApplicationManager& application_manager_; - SendLaunchApp(ApplicationConstSharedPtr app_to_launch, ApplicationManager& am) - : app_to_launch_(app_to_launch), application_manager_(am) {} - void operator()( - const SDLActivateAppRequest::V4ProtoApps::value_type ptr) const { - MessageHelper::SendLaunchApp((*ptr).app_id(), - app_to_launch_->SchemaUrl(), - app_to_launch_->PackageName(), - application_manager_); - return; - } -}; -} - -SDLActivateAppRequest::SDLActivateAppRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestFromHMI(message, application_manager) {} - -SDLActivateAppRequest::~SDLActivateAppRequest() {} - -uint32_t SDLActivateAppRequest::app_id() const { - using namespace strings; - if (!(*message_).keyExists(msg_params)) { - LOG4CXX_DEBUG(logger_, msg_params << " section is absent in the message."); - return 0; - } - if (!(*message_)[msg_params].keyExists(strings::app_id)) { - LOG4CXX_DEBUG(logger_, - strings::app_id << " section is absent in the message."); - return 0; - } - return (*message_)[msg_params][strings::app_id].asUInt(); -} - -#ifdef EXTERNAL_PROPRIETARY_MODE -void SDLActivateAppRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis::FunctionID; - - if (application_manager_.state_controller().IsStateActive( - HmiState::STATE_ID_DEACTIVATE_HMI)) { - LOG4CXX_DEBUG(logger_, - "DeactivateHmi state is active. " - "Sends response with result code REJECTED"); - SendErrorResponse(correlation_id(), - static_cast<eType>(function_id()), - hmi_apis::Common_Result::REJECTED, - "HMIDeactivate is active"); - } else { - const uint32_t application_id = app_id(); - application_manager_.GetPolicyHandler().OnActivateApp(application_id, - correlation_id()); - } -} - -#else // EXTERNAL_PROPRIETARY_MODE -void SDLActivateAppRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis::FunctionID; - using namespace hmi_apis::Common_Result; - - const uint32_t application_id = app_id(); - - ApplicationConstSharedPtr app_to_activate = - application_manager_.application(application_id); - - if (!app_to_activate) { - LOG4CXX_WARN( - logger_, - "Can't find application within regular apps: " << application_id); - - // Here is the hack - in fact SDL gets hmi_app_id in appID field and - // replaces it with connection_key only for normally registered apps, but - // for apps_to_be_registered (waiting) it keeps original value (hmi_app_id) - // so method does lookup for hmi_app_id - app_to_activate = - application_manager_.WaitingApplicationByID(application_id); - - if (!app_to_activate) { - LOG4CXX_WARN( - logger_, - "Can't find application within waiting apps: " << application_id); - return; - } - } - - LOG4CXX_DEBUG(logger_, - "Found application to activate. Application id is " - << app_to_activate->app_id()); - - if (application_manager_.state_controller().IsStateActive( - HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) { - LOG4CXX_WARN(logger_, - "DeactivateHmi state is active. " - "Sends response with result code REJECTED"); - SendErrorResponse(correlation_id(), - static_cast<hmi_apis::FunctionID::eType>(function_id()), - hmi_apis::Common_Result::REJECTED, - "HMIDeactivate is active"); - return; - } - - if (app_to_activate->IsRegistered()) { - LOG4CXX_DEBUG(logger_, "Application is registered. Activating."); - application_manager_.GetPolicyHandler().OnActivateApp(application_id, - correlation_id()); - return; - } - - connection_handler::DeviceHandle device_handle = app_to_activate->device(); - ApplicationSharedPtr foreground_v4_app = get_foreground_app(device_handle); - V4ProtoApps v4_proto_apps = get_v4_proto_apps(device_handle); - - if (!foreground_v4_app && v4_proto_apps.empty()) { - LOG4CXX_ERROR(logger_, - "Can't find regular foreground app with the same " - "connection id:" - << device_handle); - SendErrorResponse( - correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED, ""); - return; - } - - LOG4CXX_DEBUG(logger_, - "Application is not registered yet. " - "Sending launch request."); - - if (foreground_v4_app) { - LOG4CXX_DEBUG(logger_, "Sending request to foreground application."); - MessageHelper::SendLaunchApp(foreground_v4_app->app_id(), - app_to_activate->SchemaUrl(), - app_to_activate->PackageName(), - application_manager_); - } else { - LOG4CXX_DEBUG(logger_, - "No preffered (foreground) application is found. " - "Sending request to all v4 applications."); - std::for_each(v4_proto_apps.begin(), - v4_proto_apps.end(), - SendLaunchApp(app_to_activate, application_manager_)); - } - - subscribe_on_event(BasicCommunication_OnAppRegistered); -} - -#endif // EXTERNAL_PROPRIETARY_MODE -void SDLActivateAppRequest::onTimeOut() { - using namespace hmi_apis::FunctionID; - using namespace hmi_apis::Common_Result; - using namespace application_manager; - unsubscribe_from_event(BasicCommunication_OnAppRegistered); - SendErrorResponse( - correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED, ""); -} - -void SDLActivateAppRequest::on_event(const event_engine::Event& event) { - using namespace hmi_apis::FunctionID; - if (event.id() != BasicCommunication_OnAppRegistered) { - return; - } - unsubscribe_from_event(BasicCommunication_OnAppRegistered); - - // Have to use HMI app id from event, since HMI app id from original request - // message will be changed after app, initially requested for launch via - // SDL.ActivateApp, will be registered - const uint32_t hmi_application_id = hmi_app_id(event.smart_object()); - - ApplicationSharedPtr app = - application_manager_.application_by_hmi_app(hmi_application_id); - if (!app) { - LOG4CXX_ERROR( - logger_, "Application not found by HMI app id: " << hmi_application_id); - return; - } - application_manager_.GetPolicyHandler().OnActivateApp(app->app_id(), - correlation_id()); -} - -uint32_t SDLActivateAppRequest::hmi_app_id( - const smart_objects::SmartObject& so) const { - using namespace strings; - if (!so.keyExists(params)) { - LOG4CXX_DEBUG(logger_, params << " section is absent in the message."); - return 0; - } - if (!so[msg_params].keyExists(application)) { - LOG4CXX_DEBUG(logger_, application << " section is absent in the message."); - return 0; - } - if (so[msg_params][application].keyExists(strings::app_id)) { - LOG4CXX_DEBUG(logger_, - strings::app_id << " section is absent in the message."); - return 0; - } - return so[msg_params][application][strings::app_id].asUInt(); -} - -SDLActivateAppRequest::V4ProtoApps SDLActivateAppRequest::get_v4_proto_apps( - const connection_handler::DeviceHandle handle) const { - const ApplicationSet app_list = application_manager_.applications().GetData(); - V4ProtoApps v4_proto_apps; - std::copy_if(app_list.begin(), - app_list.end(), - std::back_inserter(v4_proto_apps), - ProtoV4AppsOnDevice(handle)); - return v4_proto_apps; -} - -ApplicationSharedPtr SDLActivateAppRequest::get_foreground_app( - const connection_handler::DeviceHandle handle) const { - V4ProtoApps v4_proto_apps = get_v4_proto_apps(handle); - V4ProtoApps::iterator foreground_app = - std::find_if(v4_proto_apps.begin(), v4_proto_apps.end(), ForegroundApp()); - return foreground_app != v4_proto_apps.end() ? *foreground_app - : ApplicationSharedPtr(); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc deleted file mode 100644 index 75a8c0b241..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_activate_app_response.h" - -namespace application_manager { - -namespace commands { - -SDLActivateAppResponse::SDLActivateAppResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseToHMI(message, application_manager) {} - -SDLActivateAppResponse::~SDLActivateAppResponse() {} - -void SDLActivateAppResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; - (*message_)[strings::params][strings::protocol_version] = protocol_version_; - - application_manager_.SendMessageToHMI(message_); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc deleted file mode 100644 index 4b150cda60..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_request.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_get_list_of_permissions_request.h" -#include "application_manager/application_manager.h" - -namespace application_manager { - -namespace commands { - -SDLGetListOfPermissionsRequest::SDLGetListOfPermissionsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestFromHMI(message, application_manager) {} - -SDLGetListOfPermissionsRequest::~SDLGetListOfPermissionsRequest() {} - -void SDLGetListOfPermissionsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - uint32_t connection_key = 0; - if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { - connection_key = (*message_)[strings::msg_params][strings::app_id].asUInt(); - } - application_manager_.GetPolicyHandler().OnGetListOfPermissions( - connection_key, - (*message_)[strings::params][strings::correlation_id].asUInt()); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc deleted file mode 100644 index 521b59a0ec..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_get_list_of_permissions_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_get_list_of_permissions_response.h" - -namespace application_manager { - -namespace commands { - -SDLGetListOfPermissionsResponse::SDLGetListOfPermissionsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseToHMI(message, application_manager) {} - -SDLGetListOfPermissionsResponse::~SDLGetListOfPermissionsResponse() {} - -void SDLGetListOfPermissionsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; - (*message_)[strings::params][strings::protocol_version] = protocol_version_; - - application_manager_.SendMessageToHMI(message_); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc deleted file mode 100644 index afa7569746..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_get_status_update_request.h" -#include "application_manager/application_manager.h" - -namespace application_manager { - -namespace commands { - -SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestFromHMI(message, application_manager) {} - -SDLGetStatusUpdateRequest::~SDLGetStatusUpdateRequest() {} - -void SDLGetStatusUpdateRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - application_manager_.GetPolicyHandler().OnGetStatusUpdate( - (*message_)[strings::params][strings::correlation_id].asUInt()); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc deleted file mode 100644 index 0af7e0217a..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_get_status_update_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_get_status_update_response.h" - -namespace application_manager { - -namespace commands { - -SDLGetStatusUpdateResponse::SDLGetStatusUpdateResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseToHMI(message, application_manager) {} - -SDLGetStatusUpdateResponse::~SDLGetStatusUpdateResponse() {} - -void SDLGetStatusUpdateResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; - (*message_)[strings::params][strings::protocol_version] = protocol_version_; - - application_manager_.SendMessageToHMI(message_); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc deleted file mode 100644 index ea959389ef..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_request.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_get_user_friendly_message_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -SDLGetUserFriendlyMessageRequest::SDLGetUserFriendlyMessageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestFromHMI(message, application_manager) {} - -SDLGetUserFriendlyMessageRequest::~SDLGetUserFriendlyMessageRequest() {} - -void SDLGetUserFriendlyMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - const std::string messageCodes = "messageCodes"; - if (!(*message_)[strings::msg_params].keyExists(messageCodes)) { - LOG4CXX_WARN(logger_, - "Mandatory parameter '" + messageCodes + "'' is missing"); - return; - } - smart_objects::SmartArray* msg = - (*message_)[strings::msg_params][messageCodes].asArray(); - - std::vector<std::string> msg_codes; - - smart_objects::SmartArray::const_iterator it = msg->begin(); - smart_objects::SmartArray::const_iterator it_end = msg->end(); - for (; it != it_end; ++it) { - msg_codes.push_back((*it).asString()); - } - - std::string required_language; - if ((*message_)[strings::msg_params].keyExists(strings::language)) { - uint32_t lang_code = - (*message_)[strings::msg_params][strings::language].asUInt(); - required_language = - application_manager::MessageHelper::CommonLanguageToString( - static_cast<hmi_apis::Common_Language::eType>(lang_code)); - } else { - hmi_apis::Common_Language::eType ui_language = - application_manager_.hmi_capabilities().active_ui_language(); - - required_language = - application_manager::MessageHelper::CommonLanguageToString(ui_language); - } - - application_manager_.GetPolicyHandler().OnGetUserFriendlyMessage( - msg_codes, - required_language, - (*message_)[strings::params][strings::correlation_id].asInt()); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc b/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc deleted file mode 100644 index c693625dbb..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_get_user_friendly_message_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_get_user_friendly_message_response.h" - -namespace application_manager { - -namespace commands { - -SDLGetUserFriendlyMessageResponse::SDLGetUserFriendlyMessageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseToHMI(message, application_manager) {} - -SDLGetUserFriendlyMessageResponse::~SDLGetUserFriendlyMessageResponse() {} - -void SDLGetUserFriendlyMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; - (*message_)[strings::params][strings::protocol_version] = protocol_version_; - - application_manager_.SendMessageToHMI(message_); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc deleted file mode 100644 index f1fb9ccead..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_policy_update.h" - -namespace application_manager { - -namespace commands { - -SDLPolicyUpdate::SDLPolicyUpdate(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -SDLPolicyUpdate::~SDLPolicyUpdate() {} - -void SDLPolicyUpdate::Run() { - LOG4CXX_AUTO_TRACE(logger_); -#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE) - SendRequest(); -#else - LOG4CXX_WARN(logger_, - "This RPC is part of extended policy flow." - "Please re-build with extended policy mode enabled."); -#endif -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc deleted file mode 100644 index 38b57a5b9f..0000000000 --- a/src/components/application_manager/src/commands/hmi/sdl_policy_update_response.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/sdl_policy_update_response.h" - -namespace application_manager { - -namespace commands { -SDLPolicyUpdateResponse::SDLPolicyUpdateResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {} - -void SDLPolicyUpdateResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - // TODO(PV): add some logic here -} -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc deleted file mode 100644 index bb1f29d889..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_change_registration_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_change_registration_request.h" - -namespace application_manager { - -namespace commands { - -TTSChangeRegistrationRequest::TTSChangeRegistrationRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -TTSChangeRegistrationRequest::~TTSChangeRegistrationRequest() {} - -void TTSChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc deleted file mode 100644 index e63ee5f74d..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_change_registration_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_change_registration_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -TTSChangeRegistratioResponse::TTSChangeRegistratioResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSChangeRegistratioResponse::~TTSChangeRegistratioResponse() {} - -void TTSChangeRegistratioResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::TTS_ChangeRegistration); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc deleted file mode 100644 index 4dbf5e8ee7..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_get_capabilities_request.h" - -namespace application_manager { - -namespace commands { - -TTSGetCapabilitiesRequest::TTSGetCapabilitiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -TTSGetCapabilitiesRequest::~TTSGetCapabilitiesRequest() {} - -void TTSGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc deleted file mode 100644 index ce629b36d7..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_get_capabilities_response.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_get_capabilities_response.h" - -namespace application_manager { - -namespace commands { - -TTSGetCapabilitiesResponse::TTSGetCapabilitiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {} - -void TTSGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - if ((*message_)[strings::msg_params].keyExists( - hmi_response::speech_capabilities)) { - hmi_capabilities.set_speech_capabilities( - (*message_)[strings::msg_params][hmi_response::speech_capabilities]); - } - if ((*message_)[strings::msg_params].keyExists( - hmi_response::prerecorded_speech_capabilities)) { - hmi_capabilities.set_prerecorded_speech( - (*message_)[strings::msg_params] - [hmi_response::prerecorded_speech_capabilities]); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc deleted file mode 100644 index c44667a223..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_get_language_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_get_language_request.h" - -namespace application_manager { - -namespace commands { - -TTSGetLanguageRequest::TTSGetLanguageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -TTSGetLanguageRequest::~TTSGetLanguageRequest() {} - -void TTSGetLanguageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc deleted file mode 100644 index 37aed2c6cb..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_get_language_response.h" - -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -TTSGetLanguageResponse::TTSGetLanguageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSGetLanguageResponse::~TTSGetLanguageResponse() {} - -void TTSGetLanguageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis; - - Common_Language::eType language = Common_Language::INVALID_ENUM; - - if ((*message_).keyExists(strings::msg_params) && - (*message_)[strings::msg_params].keyExists(hmi_response::language)) { - language = static_cast<Common_Language::eType>( - (*message_)[strings::msg_params][hmi_response::language].asInt()); - } - - application_manager_.hmi_capabilities().set_active_tts_language(language); - - LOG4CXX_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); - event_engine::Event event(FunctionID::TTS_GetLanguage); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc deleted file mode 100644 index 941adca01d..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_get_supported_languages_request.h" - -namespace application_manager { - -namespace commands { - -TTSGetSupportedLanguagesRequest::TTSGetSupportedLanguagesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -TTSGetSupportedLanguagesRequest::~TTSGetSupportedLanguagesRequest() {} - -void TTSGetSupportedLanguagesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc deleted file mode 100644 index 79af1d3cc2..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_get_supported_languages_response.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_get_supported_languages_response.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -TTSGetSupportedLanguagesResponse::TTSGetSupportedLanguagesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSGetSupportedLanguagesResponse::~TTSGetSupportedLanguagesResponse() {} - -void TTSGetSupportedLanguagesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - (*message_)[strings::params][hmi_response::code].asInt()); - - if (hmi_apis::Common_Result::SUCCESS == code) { - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_tts_supported_languages( - (*message_)[strings::msg_params][hmi_response::languages]); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc deleted file mode 100644 index 71e89dd9b9..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_is_ready_request.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_is_ready_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -TTSIsReadyRequest::TTSIsReadyRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) {} - -TTSIsReadyRequest::~TTSIsReadyRequest() {} - -void TTSIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::TTS_IsReady, correlation_id()); - SendRequest(); -} - -void TTSIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::TTS_IsReady: { - LOG4CXX_DEBUG(logger_, "Received TTS_IsReady event"); - unsubscribe_from_event(hmi_apis::FunctionID::TTS_IsReady); - const bool is_available = ChangeInterfaceState( - application_manager_, message, HmiInterfaces::HMI_INTERFACE_TTS); - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - hmi_capabilities.set_is_tts_cooperating(is_available); - if (!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_TTS)) { - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_TTS isn't available"); - return; - } - SendMessageToHMI(); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -void TTSIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); -} - -void TTSIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( - MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage, - application_manager_)); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - hmi_capabilities.set_handle_response_for(*get_language); - application_manager_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::TTS_GetSupportedLanguages, - application_manager_)); - application_manager_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::TTS_GetCapabilities, application_manager_)); - application_manager_.ManageHMICommand(get_capabilities); -} -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc deleted file mode 100644 index 30e2f4816b..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_is_ready_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_is_ready_response.h" - -namespace application_manager { - -namespace commands { - -TTSIsReadyResponse::TTSIsReadyResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSIsReadyResponse::~TTSIsReadyResponse() {} - -void TTSIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::TTS_IsReady); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc deleted file mode 100644 index bf035ffe23..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_set_global_properties_request.h" - -namespace application_manager { - -namespace commands { - -TTSSetGlobalPropertiesRequest::TTSSetGlobalPropertiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -TTSSetGlobalPropertiesRequest::~TTSSetGlobalPropertiesRequest() {} - -void TTSSetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc b/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc deleted file mode 100644 index f494fb1a8e..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_set_global_properties_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_set_global_properties_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -TTSSetGlobalPropertiesResponse::TTSSetGlobalPropertiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSSetGlobalPropertiesResponse::~TTSSetGlobalPropertiesResponse() {} - -void TTSSetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_speak_request.cc b/src/components/application_manager/src/commands/hmi/tts_speak_request.cc deleted file mode 100644 index 2e386449d0..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_speak_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_speak_request.h" - -namespace application_manager { - -namespace commands { - -TTSSpeakRequest::TTSSpeakRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -TTSSpeakRequest::~TTSSpeakRequest() {} - -void TTSSpeakRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_speak_response.cc b/src/components/application_manager/src/commands/hmi/tts_speak_response.cc deleted file mode 100644 index 5cffdccf34..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_speak_response.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_speak_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -TTSSpeakResponse::TTSSpeakResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSSpeakResponse::~TTSSpeakResponse() {} - -void TTSSpeakResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::TTS_Speak); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc deleted file mode 100644 index c2275dda72..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/tts_stop_speaking_request.h" - -namespace application_manager { - -namespace commands { - -TTSStopSpeakingRequest::TTSStopSpeakingRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -TTSStopSpeakingRequest::~TTSStopSpeakingRequest() {} - -void TTSStopSpeakingRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc b/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc deleted file mode 100644 index 67d747f464..0000000000 --- a/src/components/application_manager/src/commands/hmi/tts_stop_speaking_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/tts_stop_speaking_response.h" - -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -TTSStopSpeakingResponse::TTSStopSpeakingResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -TTSStopSpeakingResponse::~TTSStopSpeakingResponse() {} - -void TTSStopSpeakingResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::TTS_StopSpeaking); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc deleted file mode 100644 index c0edad3f80..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_add_command_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_add_command_request.h" - -namespace application_manager { - -namespace commands { - -UIAddCommandRequest::UIAddCommandRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIAddCommandRequest::~UIAddCommandRequest() {} - -void UIAddCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc b/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc deleted file mode 100644 index a7eaabc91e..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_add_command_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_add_command_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIAddCommandResponse::UIAddCommandResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIAddCommandResponse::~UIAddCommandResponse() {} - -void UIAddCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_AddCommand); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc deleted file mode 100644 index f0a233853c..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_add_submenu_request.h" - -namespace application_manager { - -namespace commands { - -UIAddSubmenuRequest::UIAddSubmenuRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIAddSubmenuRequest::~UIAddSubmenuRequest() {} - -void UIAddSubmenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc b/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc deleted file mode 100644 index 6c6c18cbad..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_add_submenu_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_add_submenu_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIAddSubmenuResponse::UIAddSubmenuResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIAddSubmenuResponse::~UIAddSubmenuResponse() {} - -void UIAddSubmenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_AddSubMenu); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/src/commands/hmi/ui_alert_request.cc deleted file mode 100644 index 44673d4981..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_alert_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_alert_request.h" - -namespace application_manager { - -namespace commands { - -UIAlertRequest::UIAlertRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIAlertRequest::~UIAlertRequest() {} - -void UIAlertRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_alert_response.cc b/src/components/application_manager/src/commands/hmi/ui_alert_response.cc deleted file mode 100644 index 6d552a1eb7..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_alert_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_alert_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIAlertResponse::UIAlertResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIAlertResponse::~UIAlertResponse() {} - -void UIAlertResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_Alert); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc deleted file mode 100644 index dcc88125fc..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_change_registration_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_change_registration_request.h" - -namespace application_manager { - -namespace commands { - -UIChangeRegistrationRequest::UIChangeRegistrationRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIChangeRegistrationRequest::~UIChangeRegistrationRequest() {} - -void UIChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc deleted file mode 100644 index 52805a93c8..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_change_registration_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_change_registration_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIChangeRegistratioResponse::UIChangeRegistratioResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIChangeRegistratioResponse::~UIChangeRegistratioResponse() {} - -void UIChangeRegistratioResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_ChangeRegistration); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc b/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc deleted file mode 100644 index 7bd529e8dc..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_delete_command_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_delete_command_request.h" - -namespace application_manager { - -namespace commands { - -UIDeleteCommandRequest::UIDeleteCommandRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIDeleteCommandRequest::~UIDeleteCommandRequest() {} - -void UIDeleteCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc b/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc deleted file mode 100644 index 74a1bd64c2..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_delete_command_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_delete_command_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIDeleteCommandResponse::UIDeleteCommandResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIDeleteCommandResponse::~UIDeleteCommandResponse() {} - -void UIDeleteCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_DeleteCommand); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc deleted file mode 100644 index 335d97eee4..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_delete_submenu_request.h" - -namespace application_manager { - -namespace commands { - -UIDeleteSubmenuRequest::UIDeleteSubmenuRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIDeleteSubmenuRequest::~UIDeleteSubmenuRequest() {} - -void UIDeleteSubmenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc b/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc deleted file mode 100644 index 302343da5e..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_delete_submenu_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_delete_submenu_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIDeleteSubmenuResponse::UIDeleteSubmenuResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIDeleteSubmenuResponse::~UIDeleteSubmenuResponse() {} - -void UIDeleteSubmenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc deleted file mode 100644 index e1cd11f922..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_end_audio_pass_thru_request.h" - -namespace application_manager { - -namespace commands { - -UIEndAudioPassThruRequest::UIEndAudioPassThruRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIEndAudioPassThruRequest::~UIEndAudioPassThruRequest() {} - -void UIEndAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc deleted file mode 100644 index e9eb596b85..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_end_audio_pass_thru_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_end_audio_pass_thru_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIEndAudioPassThruResponse::UIEndAudioPassThruResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIEndAudioPassThruResponse::~UIEndAudioPassThruResponse() {} - -void UIEndAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_EndAudioPassThru); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc deleted file mode 100644 index 0ae4258d6b..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_get_capabilities_request.h" - -namespace application_manager { - -namespace commands { - -UIGetCapabilitiesRequest::UIGetCapabilitiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIGetCapabilitiesRequest::~UIGetCapabilitiesRequest() {} - -void UIGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc deleted file mode 100644 index 3b5aeac639..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_get_capabilities_response.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_get_capabilities_response.h" - -namespace application_manager { - -namespace commands { - -UIGetCapabilitiesResponse::UIGetCapabilitiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {} - -void UIGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - if (msg_params.keyExists(hmi_response::display_capabilities)) { - hmi_capabilities.set_display_capabilities( - msg_params[hmi_response::display_capabilities]); - } - - if (msg_params.keyExists(hmi_response::hmi_zone_capabilities)) { - hmi_capabilities.set_hmi_zone_capabilities( - msg_params[hmi_response::hmi_zone_capabilities]); - } - - if (msg_params.keyExists(hmi_response::soft_button_capabilities)) { - hmi_capabilities.set_soft_button_capabilities( - msg_params[hmi_response::soft_button_capabilities]); - } - - if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) { - hmi_capabilities.set_audio_pass_thru_capabilities( - msg_params[strings::audio_pass_thru_capabilities]); - } - - if (msg_params.keyExists(strings::hmi_capabilities)) { - if (msg_params[strings::hmi_capabilities].keyExists(strings::navigation)) { - hmi_capabilities.set_navigation_supported( - msg_params[strings::hmi_capabilities][strings::navigation].asBool()); - } - if (msg_params[strings::hmi_capabilities].keyExists(strings::phone_call)) { - hmi_capabilities.set_phone_call_supported( - msg_params[strings::hmi_capabilities][strings::phone_call].asBool()); - } - if (msg_params[strings::hmi_capabilities].keyExists( - strings::video_streaming)) { - hmi_capabilities.set_video_streaming_supported( - msg_params[strings::hmi_capabilities][strings::video_streaming] - .asBool()); - } - } - - if (msg_params.keyExists(strings::system_capabilities)) { - if (msg_params[strings::system_capabilities].keyExists( - strings::navigation_capability)) { - hmi_capabilities.set_navigation_capability( - msg_params[strings::system_capabilities] - [strings::navigation_capability]); - } - if (msg_params[strings::system_capabilities].keyExists( - strings::phone_capability)) { - hmi_capabilities.set_phone_capability( - msg_params[strings::system_capabilities][strings::phone_capability]); - } - if (msg_params[strings::system_capabilities].keyExists( - strings::video_streaming_capability)) { - hmi_capabilities.set_video_streaming_capability( - msg_params[strings::system_capabilities] - [strings::video_streaming_capability]); - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc deleted file mode 100644 index 59d9eef6e3..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_get_language_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_get_language_request.h" - -namespace application_manager { - -namespace commands { - -UIGetLanguageRequest::UIGetLanguageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIGetLanguageRequest::~UIGetLanguageRequest() {} - -void UIGetLanguageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc deleted file mode 100644 index dfbdb89804..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_get_language_response.h" - -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIGetLanguageResponse::UIGetLanguageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIGetLanguageResponse::~UIGetLanguageResponse() {} - -void UIGetLanguageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis; - - Common_Language::eType language = Common_Language::INVALID_ENUM; - - if ((*message_).keyExists(strings::msg_params) && - (*message_)[strings::msg_params].keyExists(hmi_response::language)) { - language = static_cast<Common_Language::eType>( - (*message_)[strings::msg_params][hmi_response::language].asInt()); - } - - application_manager_.hmi_capabilities().set_active_ui_language(language); - - LOG4CXX_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); - event_engine::Event event(FunctionID::UI_GetLanguage); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc deleted file mode 100644 index 598ff39f79..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_get_supported_languages_request.h" - -namespace application_manager { - -namespace commands { - -UIGetSupportedLanguagesRequest::UIGetSupportedLanguagesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIGetSupportedLanguagesRequest::~UIGetSupportedLanguagesRequest() {} - -void UIGetSupportedLanguagesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc deleted file mode 100644 index e5849f5f63..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_get_supported_languages_response.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_get_supported_languages_response.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIGetSupportedLanguagesResponse::UIGetSupportedLanguagesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIGetSupportedLanguagesResponse::~UIGetSupportedLanguagesResponse() {} - -void UIGetSupportedLanguagesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - (*message_)[strings::params][hmi_response::code].asInt()); - - if (hmi_apis::Common_Result::SUCCESS == code) { - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_ui_supported_languages( - (*message_)[strings::msg_params][hmi_response::languages]); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc deleted file mode 100644 index 9e27e23d34..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_is_ready_request.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_is_ready_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -UIIsReadyRequest::UIIsReadyRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) {} - -UIIsReadyRequest::~UIIsReadyRequest() {} - -void UIIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::UI_IsReady, correlation_id()); - SendRequest(); -} - -void UIIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::UI_IsReady: { - LOG4CXX_DEBUG(logger_, "Received UI_IsReady event"); - unsubscribe_from_event(hmi_apis::FunctionID::UI_IsReady); - const bool is_available = ChangeInterfaceState( - application_manager_, message, HmiInterfaces::HMI_INTERFACE_UI); - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - hmi_capabilities.set_is_ui_cooperating(is_available); - if (!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_UI)) { - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_UI isn't available"); - return; - } - SendMessageToHMI(); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -void UIIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); -} - -void UIIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( - MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage, - application_manager_)); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - hmi_capabilities.set_handle_response_for(*get_language); - application_manager_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::UI_GetSupportedLanguages, - application_manager_)); - application_manager_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::UI_GetCapabilities, application_manager_)); - application_manager_.ManageHMICommand(get_capabilities); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc deleted file mode 100644 index 088baeb8b2..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_is_ready_response.h" - -namespace application_manager { - -namespace commands { - -UIIsReadyResponse::UIIsReadyResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIIsReadyResponse::~UIIsReadyResponse() {} - -void UIIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_IsReady); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc deleted file mode 100644 index a88719d303..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h" - -namespace application_manager { - -namespace commands { - -UIPerformAudioPassThruRequest::UIPerformAudioPassThruRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIPerformAudioPassThruRequest::~UIPerformAudioPassThruRequest() {} - -void UIPerformAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc deleted file mode 100644 index 0736cca526..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_perform_audio_pass_thru_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -UIPerformAudioPassThruResponse::UIPerformAudioPassThruResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIPerformAudioPassThruResponse::~UIPerformAudioPassThruResponse() {} - -void UIPerformAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc deleted file mode 100644 index 82a900f1ae..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_perform_interaction_request.h" - -namespace application_manager { - -namespace commands { - -UIPerformInteractionRequest::UIPerformInteractionRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIPerformInteractionRequest::~UIPerformInteractionRequest() {} - -void UIPerformInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc b/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc deleted file mode 100644 index ea78c0cd66..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_perform_interaction_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_perform_interaction_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIPerformInteractionResponse::UIPerformInteractionResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIPerformInteractionResponse::~UIPerformInteractionResponse() {} - -void UIPerformInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::UI_PerformInteraction); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc deleted file mode 100644 index 006944d404..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_scrollable_message_request.h" - -namespace application_manager { - -namespace commands { - -UIScrollableMessageRequest::UIScrollableMessageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIScrollableMessageRequest::~UIScrollableMessageRequest() {} - -void UIScrollableMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc b/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc deleted file mode 100644 index c39a99fc61..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_scrollable_message_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_scrollable_message_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UIScrollableMessageResponse::UIScrollableMessageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIScrollableMessageResponse::~UIScrollableMessageResponse() {} - -void UIScrollableMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_ScrollableMessage); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc deleted file mode 100644 index 9484906a17..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2017 Xevo Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Xevo Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" - -namespace application_manager { - -namespace commands { - -UISendHapticDataRequest::UISendHapticDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UISendHapticDataRequest::~UISendHapticDataRequest() {} - -void UISendHapticDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc deleted file mode 100644 index a8239a40e8..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017 Xevo Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Xevo Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_send_haptic_data_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UISendHapticDataResponse::UISendHapticDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UISendHapticDataResponse::~UISendHapticDataResponse() {} - -void UISendHapticDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::UI_SendHapticData); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc deleted file mode 100644 index 2666eedfc8..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_set_app_icon_request.h" - -namespace application_manager { - -namespace commands { - -UISetAppIconRequest::UISetAppIconRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UISetAppIconRequest::~UISetAppIconRequest() {} - -void UISetAppIconRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc deleted file mode 100644 index 18fc5a5761..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_app_icon_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_set_app_icon_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UISetAppIconResponse::UISetAppIconResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UISetAppIconResponse::~UISetAppIconResponse() {} - -void UISetAppIconResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_SetAppIcon); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc deleted file mode 100644 index cd69c9c8e6..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_request.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_set_display_layout_request.h" - -namespace application_manager { - -namespace commands { - -UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {} - -void UiSetDisplayLayoutRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc deleted file mode 100644 index c5a439636f..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_display_layout_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_set_display_layout_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {} - -void UiSetDisplayLayoutResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc deleted file mode 100644 index 8658a043b0..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_set_global_properties_request.h" - -namespace application_manager { - -namespace commands { - -UISetGlobalPropertiesRequest::UISetGlobalPropertiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UISetGlobalPropertiesRequest::~UISetGlobalPropertiesRequest() {} - -void UISetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc deleted file mode 100644 index d10c206a7c..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_global_properties_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_set_global_properties_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UISetGlobalPropertiesResponse::UISetGlobalPropertiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UISetGlobalPropertiesResponse::~UISetGlobalPropertiesResponse() {} - -void UISetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc deleted file mode 100644 index 1653ec0744..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_set_icon_request.h" - -namespace application_manager { - -namespace commands { - -UISetIconRequest::UISetIconRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UISetIconRequest::~UISetIconRequest() {} - -void UISetIconRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc deleted file mode 100644 index 955cb1d57b..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_set_media_clock_timer_request.h" - -namespace application_manager { - -namespace commands { - -UISetMediaClockTimerRequest::UISetMediaClockTimerRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UISetMediaClockTimerRequest::~UISetMediaClockTimerRequest() {} - -void UISetMediaClockTimerRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc deleted file mode 100644 index 32acef4994..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_set_media_clock_timer_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_set_media_clock_timer_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UISetMediaClockTimerResponse::UISetMediaClockTimerResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UISetMediaClockTimerResponse::~UISetMediaClockTimerResponse() {} - -void UISetMediaClockTimerResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_show_request.cc b/src/components/application_manager/src/commands/hmi/ui_show_request.cc deleted file mode 100644 index 9c0e90feff..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_show_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_show_request.h" - -namespace application_manager { - -namespace commands { - -UIShowRequest::UIShowRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UIShowRequest::~UIShowRequest() {} - -void UIShowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_show_response.cc b/src/components/application_manager/src/commands/hmi/ui_show_response.cc deleted file mode 100644 index 333d9e96c5..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_show_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_show_response.h" -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -UIShowResponse::UIShowResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UIShowResponse::~UIShowResponse() {} - -void UIShowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_Show); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/src/commands/hmi/ui_slider_request.cc deleted file mode 100644 index 26e6ed76b0..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_slider_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/ui_slider_request.h" - -namespace application_manager { - -namespace commands { - -UISliderRequest::UISliderRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UISliderRequest::~UISliderRequest() {} - -void UISliderRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_slider_response.cc b/src/components/application_manager/src/commands/hmi/ui_slider_response.cc deleted file mode 100644 index 091eb50e0d..0000000000 --- a/src/components/application_manager/src/commands/hmi/ui_slider_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/ui_slider_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UISliderResponse::UISliderResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UISliderResponse::~UISliderResponse() {} - -void UISliderResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::UI_Slider); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/update_app_list_request.cc b/src/components/application_manager/src/commands/hmi/update_app_list_request.cc deleted file mode 100644 index 286d269727..0000000000 --- a/src/components/application_manager/src/commands/hmi/update_app_list_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/update_app_list_request.h" - -namespace application_manager { - -namespace commands { - -UpdateAppListRequest::UpdateAppListRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UpdateAppListRequest::~UpdateAppListRequest() {} - -void UpdateAppListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/update_app_list_response.cc b/src/components/application_manager/src/commands/hmi/update_app_list_response.cc deleted file mode 100644 index 6546d03805..0000000000 --- a/src/components/application_manager/src/commands/hmi/update_app_list_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/update_app_list_response.h" - -namespace application_manager { - -namespace commands { - -UpdateAppListResponse::UpdateAppListResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UpdateAppListResponse::~UpdateAppListResponse() {} - -void UpdateAppListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // TODO(PV): add check -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/src/commands/hmi/update_device_list_request.cc deleted file mode 100644 index 74d104b36d..0000000000 --- a/src/components/application_manager/src/commands/hmi/update_device_list_request.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/update_device_list_request.h" - -#include "interfaces/HMI_API.h" - -#include <unistd.h> - -namespace application_manager { - -namespace commands { - -UpdateDeviceListRequest::UpdateDeviceListRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager_.event_dispatcher()) {} - -UpdateDeviceListRequest::~UpdateDeviceListRequest() {} - -void UpdateDeviceListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock auto_lock(wait_hmi_lock); - // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA. - // Flag conditional compilation for specific customer is used in order to - // exclude - // hit code to RTC - if (true == application_manager_.get_settings().launch_hmi()) { - if (!application_manager_.IsHMICooperating()) { - LOG4CXX_INFO(logger_, "Wait for HMI Cooperation"); - subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnReady); - termination_condition_.Wait(auto_lock); - LOG4CXX_DEBUG(logger_, "HMI Cooperation OK"); - } - } - - SendRequest(); -} - -void UpdateDeviceListRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock auto_lock(wait_hmi_lock); - switch (event.id()) { - case hmi_apis::FunctionID::BasicCommunication_OnReady: { - LOG4CXX_INFO(logger_, "received OnReady"); - unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady); - termination_condition_.Broadcast(); - break; - }; - default: { - LOG4CXX_ERROR(logger_, "Unknown event "); - break; - }; - } -} - -bool UpdateDeviceListRequest::CleanUp() { - sync_primitives::AutoLock auto_lock(wait_hmi_lock); - termination_condition_.Broadcast(); - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/update_device_list_response.cc b/src/components/application_manager/src/commands/hmi/update_device_list_response.cc deleted file mode 100644 index 6d9dec92f8..0000000000 --- a/src/components/application_manager/src/commands/hmi/update_device_list_response.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/update_device_list_response.h" - -namespace application_manager { - -namespace commands { - -UpdateDeviceListResponse::UpdateDeviceListResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UpdateDeviceListResponse::~UpdateDeviceListResponse() {} - -void UpdateDeviceListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // TODO(PV): add check for correctness. -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/update_sdl_request.cc b/src/components/application_manager/src/commands/hmi/update_sdl_request.cc deleted file mode 100644 index 44f7547964..0000000000 --- a/src/components/application_manager/src/commands/hmi/update_sdl_request.cc +++ /dev/null @@ -1,55 +0,0 @@ - -/** - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/update_sdl_request.h" - -namespace application_manager { - -namespace commands { - -UpdateSDLRequest::UpdateSDLRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -UpdateSDLRequest::~UpdateSDLRequest() {} - -void UpdateSDLRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.GetPolicyHandler().PTExchangeAtUserRequest( - (*message_)[strings::params][strings::correlation_id].asInt()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/update_sdl_response.cc b/src/components/application_manager/src/commands/hmi/update_sdl_response.cc deleted file mode 100644 index 0e8978fe89..0000000000 --- a/src/components/application_manager/src/commands/hmi/update_sdl_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/update_sdl_response.h" - -namespace application_manager { - -namespace commands { - -UpdateSDLResponse::UpdateSDLResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -UpdateSDLResponse::~UpdateSDLResponse() {} - -void UpdateSDLResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; - (*message_)[strings::params][strings::protocol_version] = protocol_version_; - - application_manager_.SendMessageToHMI(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc deleted file mode 100644 index 5fe81fcbd8..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_diagnostic_message_request.h" - -namespace application_manager { - -namespace commands { - -VIDiagnosticMessageRequest::VIDiagnosticMessageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {} - -void VIDiagnosticMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc b/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc deleted file mode 100644 index e19af75b54..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_diagnostic_message_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_diagnostic_message_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -VIDiagnosticMessageResponse::VIDiagnosticMessageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {} - -void VIDiagnosticMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event( - hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc deleted file mode 100644 index b373471c43..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_get_dtcs_request.h" - -namespace application_manager { - -namespace commands { - -VIGetDTCsRequest::VIGetDTCsRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VIGetDTCsRequest::~VIGetDTCsRequest() {} - -void VIGetDTCsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc deleted file mode 100644 index 3e720f9dbc..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_get_dtcs_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_get_dtcs_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -VIGetDTCsResponse::VIGetDTCsResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VIGetDTCsResponse::~VIGetDTCsResponse() {} - -void VIGetDTCsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc deleted file mode 100644 index 05424c4967..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_get_vehicle_data_request.h" - -namespace application_manager { - -namespace commands { - -VIGetVehicleDataRequest::VIGetVehicleDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {} - -void VIGetVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc deleted file mode 100644 index 2794f6eddd..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_data_response.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_get_vehicle_data_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { -namespace commands { - -VIGetVehicleDataResponse::VIGetVehicleDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {} - -void VIGetVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData); - - if ((*message_)[strings::params][strings::message_type] == - static_cast<int32_t>(hmi_apis::messageType::error_response)) { - smart_objects::SmartObject result(smart_objects::SmartType_Map); - - if ((*message_)[strings::params].keyExists(strings::data)) { - result[strings::msg_params] = (*message_)[strings::params][strings::data]; - result[strings::params][hmi_response::code] = - (*message_)[strings::params][hmi_response::code]; - result[strings::params][strings::correlation_id] = - (*message_)[strings::params][strings::correlation_id]; - result[strings::params][strings::error_msg] = - (*message_)[strings::params][strings::error_msg]; - result[strings::params][strings::message_type] = - (*message_)[strings::params][strings::message_type]; - result[strings::params][strings::protocol_type] = - (*message_)[strings::params][strings::protocol_type]; - result[strings::params][strings::protocol_version] = - (*message_)[strings::params][strings::protocol_version]; - } - - event.set_smart_object(result); - } else { - event.set_smart_object(*message_); - application_manager_.GetPolicyHandler().OnVehicleDataUpdated(*message_); - } - - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc deleted file mode 100644 index 64a3831e1c..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_get_vehicle_type_request.h" - -namespace application_manager { - -namespace commands { - -VIGetVehicleTypeRequest::VIGetVehicleTypeRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {} - -void VIGetVehicleTypeRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc b/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc deleted file mode 100644 index 2369eb7eee..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_get_vehicle_type_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_get_vehicle_type_response.h" - -namespace application_manager { - -namespace commands { - -VIGetVehicleTypeResponse::VIGetVehicleTypeResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {} - -void VIGetVehicleTypeResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_vehicle_type( - (*message_)[strings::msg_params][hmi_response::vehicle_type]); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc deleted file mode 100644 index ddd08695a0..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_is_ready_request.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_is_ready_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -VIIsReadyRequest::VIIsReadyRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) {} - -VIIsReadyRequest::~VIIsReadyRequest() {} - -void VIIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::VehicleInfo_IsReady, - correlation_id()); - SendRequest(); -} - -void VIIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::VehicleInfo_IsReady: { - LOG4CXX_DEBUG(logger_, "VehicleInfo_IsReady event"); - unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_IsReady); - const bool is_available = - ChangeInterfaceState(application_manager_, - message, - HmiInterfaces::HMI_INTERFACE_VehicleInfo); - - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - hmi_capabilities.set_is_ivi_cooperating(is_available); - application_manager_.GetPolicyHandler().OnVIIsReady(); - if (!CheckAvailabilityHMIInterfaces( - application_manager_, HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { - LOG4CXX_INFO( - logger_, - "HmiInterfaces::HMI_INTERFACE_VehicleInfo isn't available"); - return; - } - SendMessageToHMI(); - - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -void VIIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); -} - -void VIIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_type( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VehicleInfo_GetVehicleType, - application_manager_)); - application_manager_.ManageHMICommand(get_type); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc deleted file mode 100644 index 2f84190494..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_is_ready_response.h" - -namespace application_manager { - -namespace commands { - -VIIsReadyResponse::VIIsReadyResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VIIsReadyResponse::~VIIsReadyResponse() {} - -void VIIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_IsReady); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc b/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc deleted file mode 100644 index d72fcb8157..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_read_did_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_read_did_request.h" - -namespace application_manager { - -namespace commands { - -VIReadDIDRequest::VIReadDIDRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VIReadDIDRequest::~VIReadDIDRequest() {} - -void VIReadDIDRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc b/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc deleted file mode 100644 index 568a573f88..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_read_did_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_read_did_response.h" -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -VIReadDIDResponse::VIReadDIDResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VIReadDIDResponse::~VIReadDIDResponse() {} - -void VIReadDIDResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_ReadDID); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc deleted file mode 100644 index 5c953334bb..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h" - -namespace application_manager { - -namespace commands { - -VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {} - -void VISubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc deleted file mode 100644 index 4df2d9190a..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_subscribe_vehicle_data_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { -namespace commands { - -VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {} - -void VISubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event( - hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc deleted file mode 100644 index 2211cde19c..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h" - -namespace application_manager { - -namespace commands { - -VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {} - -void VIUnsubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc deleted file mode 100644 index 5044f0ef43..0000000000 --- a/src/components/application_manager/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { -namespace commands { - -VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {} - -void VIUnsubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event( - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc deleted file mode 100644 index 04af05d4e7..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_add_command_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_add_command_request.h" - -namespace application_manager { - -namespace commands { - -VRAddCommandRequest::VRAddCommandRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VRAddCommandRequest::~VRAddCommandRequest() {} - -void VRAddCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc b/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc deleted file mode 100644 index 496bd47605..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_add_command_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_add_command_response.h" -#include "application_manager/event_engine/event.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -VRAddCommandResponse::VRAddCommandResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRAddCommandResponse::~VRAddCommandResponse() {} - -void VRAddCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc b/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc deleted file mode 100644 index e64e7cc388..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_change_registration_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_change_registration_request.h" - -namespace application_manager { - -namespace commands { - -VRChangeRegistrationRequest::VRChangeRegistrationRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VRChangeRegistrationRequest::~VRChangeRegistrationRequest() {} - -void VRChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc deleted file mode 100644 index 8084688c15..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_change_registration_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -VRChangeRegistrationResponse::VRChangeRegistrationResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRChangeRegistrationResponse::~VRChangeRegistrationResponse() {} - -void VRChangeRegistrationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VR_ChangeRegistration); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc b/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc deleted file mode 100644 index 1db85529da..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_delete_command_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_delete_command_request.h" - -namespace application_manager { - -namespace commands { - -VRDeleteCommandRequest::VRDeleteCommandRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VRDeleteCommandRequest::~VRDeleteCommandRequest() {} - -void VRDeleteCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc b/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc deleted file mode 100644 index 08711be2c8..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_delete_command_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_delete_command_response.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -VRDeleteCommandResponse::VRDeleteCommandResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRDeleteCommandResponse::~VRDeleteCommandResponse() {} - -void VRDeleteCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - event_engine::Event event(hmi_apis::FunctionID::VR_DeleteCommand); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc deleted file mode 100644 index 3159380c17..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_get_capabilities_request.h" - -namespace application_manager { - -namespace commands { - -VRGetCapabilitiesRequest::VRGetCapabilitiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VRGetCapabilitiesRequest::~VRGetCapabilitiesRequest() {} - -void VRGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc deleted file mode 100644 index 9aa0fc6668..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_get_capabilities_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_get_capabilities_response.h" - -namespace application_manager { - -namespace commands { - -VRGetCapabilitiesResponse::VRGetCapabilitiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {} - -void VRGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - - hmi_capabilities.set_vr_capabilities( - (*message_)[strings::msg_params][strings::vr_capabilities]); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc deleted file mode 100644 index baf34c8017..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_get_language_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_get_language_request.h" - -namespace application_manager { - -namespace commands { - -VRGetLanguageRequest::VRGetLanguageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VRGetLanguageRequest::~VRGetLanguageRequest() {} - -void VRGetLanguageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc deleted file mode 100644 index a55dca44a3..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_get_language_response.h" - -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -VRGetLanguageResponse::VRGetLanguageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRGetLanguageResponse::~VRGetLanguageResponse() {} - -void VRGetLanguageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis; - - Common_Language::eType language = Common_Language::INVALID_ENUM; - - if ((*message_).keyExists(strings::msg_params) && - (*message_)[strings::msg_params].keyExists(hmi_response::language)) { - language = static_cast<Common_Language::eType>( - (*message_)[strings::msg_params][hmi_response::language].asInt()); - } - - application_manager_.hmi_capabilities().set_active_vr_language(language); - - LOG4CXX_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); - event_engine::Event event(FunctionID::VR_GetLanguage); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc deleted file mode 100644 index def4a64699..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_get_supported_languages_request.h" - -namespace application_manager { - -namespace commands { - -VRGetSupportedLanguagesRequest::VRGetSupportedLanguagesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VRGetSupportedLanguagesRequest::~VRGetSupportedLanguagesRequest() {} - -void VRGetSupportedLanguagesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc deleted file mode 100644 index e5a6ed0b86..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_get_supported_languages_response.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_get_supported_languages_response.h" - -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -VRGetSupportedLanguagesResponse::VRGetSupportedLanguagesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRGetSupportedLanguagesResponse::~VRGetSupportedLanguagesResponse() {} - -void VRGetSupportedLanguagesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const hmi_apis::Common_Result::eType code = - static_cast<hmi_apis::Common_Result::eType>( - (*message_)[strings::params][hmi_response::code].asInt()); - - if (hmi_apis::Common_Result::SUCCESS == code) { - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - hmi_capabilities.set_vr_supported_languages( - (*message_)[strings::msg_params][hmi_response::languages]); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc deleted file mode 100644 index 086b5d4490..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_is_ready_request.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_is_ready_request.h" - -namespace application_manager { - -namespace commands { - -VRIsReadyRequest::VRIsReadyRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) - , EventObserver(application_manager.event_dispatcher()) {} - -VRIsReadyRequest::~VRIsReadyRequest() {} - -void VRIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - subscribe_on_event(hmi_apis::FunctionID::VR_IsReady, correlation_id()); - SendRequest(); -} - -void VRIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::VR_IsReady: { - LOG4CXX_DEBUG(logger_, "Received VR_IsReady event"); - unsubscribe_from_event(hmi_apis::FunctionID::VR_IsReady); - const bool is_available = ChangeInterfaceState( - application_manager_, message, HmiInterfaces::HMI_INTERFACE_VR); - - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - hmi_capabilities.set_is_vr_cooperating(is_available); - if (!CheckAvailabilityHMIInterfaces(application_manager_, - HmiInterfaces::HMI_INTERFACE_VR)) { - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_VR isn't available"); - return; - } - SendMessageToHMI(); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -void VRIsReadyRequest::onTimeOut() { - // Note(dtrunov): According to new requirment APPLINK-27956 - SendMessageToHMI(); -} - -void VRIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( - MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, - application_manager_)); - HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); - hmi_capabilities.set_handle_response_for(*get_language); - application_manager_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VR_GetSupportedLanguages, - application_manager_)); - application_manager_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( - MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VR_GetCapabilities, application_manager_)); - application_manager_.ManageHMICommand(get_capabilities); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc deleted file mode 100644 index 78e2dae23b..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_is_ready_response.h" - -namespace application_manager { - -namespace commands { - -VRIsReadyResponse::VRIsReadyResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRIsReadyResponse::~VRIsReadyResponse() {} - -void VRIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::VR_IsReady); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc deleted file mode 100644 index c4646e59f4..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_request.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/hmi/vr_perform_interaction_request.h" - -namespace application_manager { - -namespace commands { - -VRPerformInteractionRequest::VRPerformInteractionRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : RequestToHMI(message, application_manager) {} - -VRPerformInteractionRequest::~VRPerformInteractionRequest() {} - -void VRPerformInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendRequest(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc b/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc deleted file mode 100644 index bb5ceb3755..0000000000 --- a/src/components/application_manager/src/commands/hmi/vr_perform_interaction_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "application_manager/commands/hmi/vr_perform_interaction_response.h" -#include "application_manager/event_engine/event.h" - -namespace application_manager { - -namespace commands { - -VRPerformInteractionResponse::VRPerformInteractionResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : ResponseFromHMI(message, application_manager) {} - -VRPerformInteractionResponse::~VRPerformInteractionResponse() {} - -void VRPerformInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - event_engine::Event event(hmi_apis::FunctionID::VR_PerformInteraction); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc deleted file mode 100644 index 69948b8122..0000000000 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ /dev/null @@ -1,616 +0,0 @@ -/* - - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string> -#include "application_manager/commands/mobile/add_command_request.h" - -#include "application_manager/application.h" -#include "application_manager/message_helper.h" -#include "utils/file_system.h" -#include "utils/helpers.h" -#include "utils/custom_string.h" - -namespace application_manager { - -namespace commands { - -namespace custom_str = utils::custom_string; - -AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , send_ui_(false) - , send_vr_(false) - , is_ui_received_(false) - , is_vr_received_(false) - , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} - -AddCommandRequest::~AddCommandRequest() {} - -void AddCommandRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); - RemoveCommand(); - CommandRequestImpl::onTimeOut(); -} - -bool AddCommandRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -void AddCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::params][strings::connection_key].asUInt()); - - if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) { - mobile_apis::Result::eType verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::cmd_icon], - app, - application_manager_); - - if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR( - logger_, "MessageHelper::VerifyImage return " << verification_result); - SendResponse(false, verification_result); - return; - } - } - - if (!((*message_)[strings::msg_params].keyExists(strings::cmd_id))) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (app->FindCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt())) { - LOG4CXX_ERROR(logger_, "INVALID_ID"); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return; - } - - bool data_exist = false; - - if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { - if (!CheckCommandName(app)) { - SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); - return; - } - if (((*message_)[strings::msg_params][strings::menu_params].keyExists( - hmi_request::parent_id)) && - (0 != - (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id].asUInt())) { - if (!CheckCommandParentId(app)) { - SendResponse( - false, mobile_apis::Result::INVALID_ID, "Parent ID doesn't exist"); - return; - } - } - data_exist = true; - } - - if (((*message_)[strings::msg_params].keyExists(strings::vr_commands)) && - ((*message_)[strings::msg_params][strings::vr_commands].length() > 0)) { - if (!CheckCommandVRSynonym(app)) { - SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); - return; - } - - data_exist = true; - } - - if (!data_exist) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Incoming add command has contains \t\n \\t \\n"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - app->AddCommand((*message_)[strings::msg_params][strings::cmd_id].asUInt(), - (*message_)[strings::msg_params]); - - smart_objects::SmartObject ui_msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { - ui_msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; - ui_msg_params[strings::menu_params] = - (*message_)[strings::msg_params][strings::menu_params]; - - ui_msg_params[strings::app_id] = app->app_id(); - - if (((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) && - ((*message_)[strings::msg_params][strings::cmd_icon].keyExists( - strings::value)) && - (0 < (*message_)[strings::msg_params][strings::cmd_icon][strings::value] - .length())) { - ui_msg_params[strings::cmd_icon] = - (*message_)[strings::msg_params][strings::cmd_icon]; - } - - send_ui_ = true; - } - - smart_objects::SmartObject vr_msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - if ((*message_)[strings::msg_params].keyExists(strings::vr_commands)) { - vr_msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; - vr_msg_params[strings::vr_commands] = - (*message_)[strings::msg_params][strings::vr_commands]; - vr_msg_params[strings::app_id] = app->app_id(); - - vr_msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - vr_msg_params[strings::grammar_id] = app->get_grammar_id(); - - send_vr_ = true; - } - - if (send_ui_) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_AddCommand, &ui_msg_params, true); - } - - if (send_vr_) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &vr_msg_params, true); - } -} - -bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { - if (!app) { - return false; - } - - const DataAccessor<CommandsMap> accessor = app->commands_map(); - const CommandsMap& commands = accessor.GetData(); - CommandsMap::const_iterator i = commands.begin(); - uint32_t saved_parent_id = 0; - uint32_t parent_id = 0; - if ((*message_)[strings::msg_params][strings::menu_params].keyExists( - hmi_request::parent_id)) { - parent_id = (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id].asUInt(); - } - - for (; commands.end() != i; ++i) { - if (!(*i->second).keyExists(strings::menu_params)) { - continue; - } - - saved_parent_id = 0; - if ((*i->second)[strings::menu_params].keyExists(hmi_request::parent_id)) { - saved_parent_id = - (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt(); - } - if (((*i->second)[strings::menu_params][strings::menu_name].asString() == - (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name].asString()) && - (saved_parent_id == parent_id)) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandName received" - " command name already exist in same level menu"); - return false; - } - } - return true; -} - -bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) { - if (!app) { - return false; - } - - const DataAccessor<CommandsMap> accessor = app->commands_map(); - const CommandsMap& commands = accessor.GetData(); - CommandsMap::const_iterator it = commands.begin(); - - for (; commands.end() != it; ++it) { - if (!(*it->second).keyExists(strings::vr_commands)) { - continue; - } - - for (size_t i = 0; i < (*it->second)[strings::vr_commands].length(); ++i) { - for (size_t j = 0; - j < (*message_)[strings::msg_params][strings::vr_commands].length(); - ++j) { - const custom_str::CustomString& vr_cmd_i = - (*it->second)[strings::vr_commands][i].asCustomString(); - const custom_str::CustomString& vr_cmd_j = - (*message_)[strings::msg_params][strings::vr_commands][j] - .asCustomString(); - - if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandVRSynonym" - " received command vr synonym already exist"); - return false; - } - } - } - } - return true; -} - -bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { - if (!app) { - return false; - } - - const int32_t parent_id = - (*message_)[strings::msg_params][strings::menu_params] - [hmi_request::parent_id].asInt(); - smart_objects::SmartObject* parent = app->FindSubMenu(parent_id); - - if (!parent) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandParentId received" - " submenu doesn't exist"); - return false; - } - return true; -} - -// TODO(AKUTSAN) APPLINK-26973: Refactor AddCommandRequest -void AddCommandRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - const smart_objects::SmartObject& message = event.smart_object(); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - smart_objects::SmartObject msg_param(smart_objects::SmartType_Map); - msg_param[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; - msg_param[strings::app_id] = application->app_id(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_AddCommand: { - LOG4CXX_INFO(logger_, "Received UI_AddCommand event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - is_ui_received_ = true; - ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, ui_info_); - if (hmi_apis::Common_Result::SUCCESS != ui_result_) { - (*message_)[strings::msg_params].erase(strings::menu_params); - } - break; - } - case hmi_apis::FunctionID::VR_AddCommand: { - LOG4CXX_INFO(logger_, "Received VR_AddCommand event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - is_vr_received_ = true; - vr_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, vr_info_); - if (hmi_apis::Common_Result::SUCCESS != vr_result_) { - (*message_)[strings::msg_params].erase(strings::vr_commands); - } - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } - - if (IsPendingResponseExist()) { - return; - } - - smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; - msg_params[strings::app_id] = application->app_id(); - - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - - const bool is_vr_invalid_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::INVALID_ENUM, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - const bool is_ui_invalid_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::INVALID_ENUM, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - const bool is_vr_unsupported = - vr_result_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - const bool is_ui_unsupported = - ui_result_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - - const bool is_no_ui_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - const bool is_no_vr_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - bool result = (is_no_ui_error && is_no_vr_error) || - (is_no_ui_error && is_vr_invalid_unsupported) || - (is_no_vr_error && is_ui_invalid_unsupported); - - LOG4CXX_DEBUG(logger_, - "calculated result " << ui_result_ << " " << is_no_ui_error - << " " << is_no_vr_error); - const bool is_vr_or_ui_warning = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_); - - const bool is_vr_or_ui_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - ui_result_, - vr_result_); - - const bool is_vr_and_ui_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ALL>( - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - ui_result_, - vr_result_); - - if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) { - result_code = MessageHelper::HMIToMobileResult(ui_result_); - } else if (result && is_vr_or_ui_unsupported) { - result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; - } else if (is_vr_or_ui_warning) { - result_code = mobile_apis::Result::WARNINGS; - } else { - result_code = - MessageHelper::HMIToMobileResult(std::max(ui_result_, vr_result_)); - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_) { - result_code = MessageHelper::HMIToMobileResult(vr_result_); - } - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == vr_result_) { - result_code = MessageHelper::HMIToMobileResult(ui_result_); - } - LOG4CXX_DEBUG(logger_, "HMIToMobileResult " << result_code); - } - - if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) { - const bool is_ui_not_ok = Compare<hmi_apis::Common_Result::eType, NEQ, ALL>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - if (is_ui_not_ok) { - result_code = ui_result_ == hmi_apis::Common_Result::REJECTED - ? mobile_apis::Result::REJECTED - : mobile_apis::Result::GENERIC_ERROR; - - msg_params[strings::grammar_id] = application->get_grammar_id(); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - application->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); - result = false; - LOG4CXX_DEBUG(logger_, "Result " << result); - } - } - - if (BothSend() && hmi_apis::Common_Result::SUCCESS == ui_result_ && - !is_no_vr_error && - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != vr_result_) { - result_code = vr_result_ == hmi_apis::Common_Result::REJECTED - ? mobile_apis::Result::REJECTED - : mobile_apis::Result::GENERIC_ERROR; - - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - - application->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); - result = false; - LOG4CXX_DEBUG(logger_, "Result " << result); - } - - HmiInterfaces::InterfaceState ui_interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_UI); - HmiInterfaces::InterfaceState vr_interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_VR); - - if (!BothSend() && - ((is_vr_unsupported && - HmiInterfaces::STATE_NOT_AVAILABLE == vr_interface_state) || - (is_ui_unsupported && - HmiInterfaces::STATE_NOT_AVAILABLE == ui_interface_state))) { - LOG4CXX_DEBUG(logger_, "!BothSend() && is_vr_or_ui_unsupported"); - result = false; - } - - if (is_vr_and_ui_unsupported) { - LOG4CXX_DEBUG(logger_, "UI and VR interface both unsupported"); - result = false; - } - - if (!result) { - RemoveCommand(); - } - - const std::string info = GenerateMobileResponseInfo(); - SendResponse(result, - result_code, - info.empty() ? NULL : info.c_str(), - &(message[strings::msg_params])); -} - -bool AddCommandRequest::IsPendingResponseExist() { - return send_ui_ != is_ui_received_ || send_vr_ != is_vr_received_; -} - -bool AddCommandRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { - str = (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed."); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::vr_commands)) { - const size_t len = - (*message_)[strings::msg_params][strings::vr_commands].length(); - - for (size_t i = 0; i < len; ++i) { - str = (*message_)[strings::msg_params][strings::vr_commands][i] - .asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) { - str = (*message_)[strings::msg_params][strings::cmd_icon][strings::value] - .asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid cmd_icon value syntax check failed"); - return true; - } - } - return false; -} - -bool AddCommandRequest::BothSend() const { - return send_vr_ && send_ui_; -} - -const std::string AddCommandRequest::GenerateMobileResponseInfo() { - // In case if vr_result_ is UNSUPPORTED_RESOURCE vr_info should be on the - // first place - // In case if ui_result_ is UNSUPPORTED_RESOURCE ui_info should be on the - // first place - // Other way order is doesn't matter - - HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - HmiInterfaces::InterfaceState ui_interface_state = - hmi_interfaces.GetInterfaceState(HmiInterfaces::HMI_INTERFACE_UI); - - HmiInterfaces::InterfaceState vr_interface_state = - hmi_interfaces.GetInterfaceState(HmiInterfaces::HMI_INTERFACE_VR); - - if ((ui_interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && - (vr_interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && - !vr_info_.empty()) { - return vr_info_; - } - - if ((vr_interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && - (ui_interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && - !ui_info_.empty()) { - return ui_info_; - } - - return MergeInfos(ui_info_, vr_info_); -} - -void AddCommandRequest::RemoveCommand() { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); - return; - } - - smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; - msg_params[strings::app_id] = app->app_id(); - - app->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); - - if (BothSend() && !(is_vr_received_ || is_ui_received_)) { - // in case we have send bth UI and VR and no one respond - // we have nothing to remove from HMI so no DeleteCommand expected - return; - } - - if (BothSend() && !is_vr_received_) { - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - } - - if (BothSend() && !is_ui_received_) { - msg_params[strings::grammar_id] = app->get_grammar_id(); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/add_command_response.cc b/src/components/application_manager/src/commands/mobile/add_command_response.cc deleted file mode 100644 index fc468f9c57..0000000000 --- a/src/components/application_manager/src/commands/mobile/add_command_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/add_command_response.h" - -namespace application_manager { - -namespace commands { - -AddCommandResponse::AddCommandResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -AddCommandResponse::~AddCommandResponse() {} - -void AddCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc deleted file mode 100644 index fe44e5a41f..0000000000 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc +++ /dev/null @@ -1,161 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/add_sub_menu_request.h" - -#include "application_manager/message_helper.h" -#include "application_manager/application.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -AddSubMenuRequest::~AddSubMenuRequest() {} - -void AddSubMenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const int32_t menu_id = - (*message_)[strings::msg_params][strings::menu_id].asInt(); - if (app->FindSubMenu(menu_id)) { - LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found."); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return; - } - - const std::string& menu_name = - (*message_)[strings::msg_params][strings::menu_name].asString(); - - if (app->IsSubMenuNameAlreadyExist(menu_name)) { - LOG4CXX_ERROR(logger_, "Menu name " << menu_name << " is duplicated."); - SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); - return; - } - - if (!CheckSubMenuName()) { - LOG4CXX_ERROR(logger_, "Sub-menu name is not valid."); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::menu_id] = - (*message_)[strings::msg_params][strings::menu_id]; - if ((*message_)[strings::msg_params].keyExists(strings::position)) { - msg_params[strings::menu_params][strings::position] = - (*message_)[strings::msg_params][strings::position]; - } - msg_params[strings::menu_params][strings::menu_name] = - (*message_)[strings::msg_params][strings::menu_name]; - msg_params[strings::app_id] = app->app_id(); - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true); -} - -void AddSubMenuRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_AddSubMenu: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - if (result) { - application->AddSubMenu( - (*message_)[strings::msg_params][strings::menu_id].asInt(), - (*message_)[strings::msg_params]); - } - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -bool AddSubMenuRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -bool AddSubMenuRequest::CheckSubMenuName() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - str = (*message_)[strings::msg_params][strings::menu_name].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_INFO(logger_, "Invalid subMenu name."); - return false; - } - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc deleted file mode 100644 index 1fbdb4e66c..0000000000 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/add_sub_menu_response.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -AddSubMenuResponse::AddSubMenuResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -AddSubMenuResponse::~AddSubMenuResponse() {} - -void AddSubMenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager 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 deleted file mode 100644 index d5767690d7..0000000000 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc +++ /dev/null @@ -1,267 +0,0 @@ -/* - Copyright (c) 2016, Ford Motor Company - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <cstring> -#include <string> -#include "application_manager/commands/mobile/alert_maneuver_request.h" -#include "application_manager/application_impl.h" -#include "application_manager/policies/policy_handler.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -AlertManeuverRequest::AlertManeuverRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , tts_speak_result_code_(hmi_apis::Common_Result::INVALID_ENUM) - , navi_alert_maneuver_result_code_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} - -AlertManeuverRequest::~AlertManeuverRequest() {} - -void AlertManeuverRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - if ((!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) && - (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks))) { - LOG4CXX_ERROR(logger_, "AlertManeuverRequest::Request without parameters!"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::params][strings::connection_key].asUInt()); - - if (NULL == app.get()) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming alert maneuver has contains \\t\\n \\\\t \\\\n" - "text contains only whitespace in ttsChunks"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - // ProcessSoftButtons checks strings on the contents incorrect character - - mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], - app, - application_manager_.GetPolicyHandler(), - application_manager_); - - if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); - SendResponse(false, processing_result); - return; - } - - // Checking parameters and how many HMI requests should be sent - bool tts_is_ok = false; - - // check TTSChunk parameter - if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { - if (0 < (*message_)[strings::msg_params][strings::tts_chunks].length()) { - pending_requests_.Add(hmi_apis::FunctionID::TTS_Speak); - tts_is_ok = true; - } - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::app_id] = app->app_id(); - - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - msg_params[hmi_request::soft_buttons] = - (*message_)[strings::msg_params][strings::soft_buttons]; - MessageHelper::SubscribeApplicationToSoftButton( - (*message_)[strings::msg_params], app, function_id()); - } - - pending_requests_.Add(hmi_apis::FunctionID::Navigation_AlertManeuver); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_AlertManeuver, &msg_params, true); - - if (tts_is_ok) { - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[hmi_request::tts_chunks] = - (*message_)[strings::msg_params][strings::tts_chunks]; - msg_params[hmi_request::speak_type] = - hmi_apis::Common_MethodName::ALERT_MANEUVER; - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, &msg_params, true); - } -} - -void AlertManeuverRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - hmi_apis::FunctionID::eType event_id = event.id(); - switch (event_id) { - case hmi_apis::FunctionID::Navigation_AlertManeuver: { - LOG4CXX_INFO(logger_, "Received Navigation_AlertManeuver event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - pending_requests_.Remove(event_id); - navi_alert_maneuver_result_code_ = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, info_navi_); - break; - } - case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - pending_requests_.Remove(event_id); - tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, info_tts_); - break; - } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); - - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - SendResponse( - false, mobile_apis::Result::INVALID_ENUM, "Received unknown event"); - return; - } - } - - if (!pending_requests_.IsFinal(event_id)) { - LOG4CXX_DEBUG(logger_, - "There are some pending responses from HMI." - "AlertManeuverRequest still waiting."); - return; - } - std::string return_info; - mobile_apis::Result::eType result_code; - const bool result = PrepareResponseParameters(result_code, return_info); - bool must_be_empty_info = false; - if (return_info.find("\n") != std::string::npos || - return_info.find("\t") != std::string::npos) { - must_be_empty_info = true; - } - SendResponse(result, - result_code, - (must_be_empty_info) ? NULL : return_info.c_str(), - &(message[strings::msg_params])); -} - -bool AlertManeuverRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, std::string& return_info) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - application_manager::commands::ResponseInfo navigation_alert_info( - navi_alert_maneuver_result_code_, - HmiInterfaces::HMI_INTERFACE_Navigation, - application_manager_); - - application_manager::commands::ResponseInfo tts_alert_info( - tts_speak_result_code_, - HmiInterfaces::HMI_INTERFACE_TTS, - application_manager_); - const bool result = - PrepareResultForMobileResponse(navigation_alert_info, tts_alert_info); - - if (result && (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == - tts_speak_result_code_ && - (HmiInterfaces::STATE_AVAILABLE == - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_TTS)))) { - result_code = mobile_apis::Result::WARNINGS; - return_info = std::string("Unsupported phoneme type sent in a prompt"); - return result; - } - result_code = - PrepareResultCodeForResponse(navigation_alert_info, tts_alert_info); - return_info = - MergeInfos(navigation_alert_info, info_navi_, tts_alert_info, info_tts_); - return result; -} - -bool AlertManeuverRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - using smart_objects::SmartArray; - - if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { - const SmartArray* tts_chunks_arr = - (*message_)[strings::msg_params][strings::tts_chunks].asArray(); - - SmartArray::const_iterator it_tts_chunk = tts_chunks_arr->begin(); - - for (; it_tts_chunk != tts_chunks_arr->end(); ++it_tts_chunk) { - const char* tts_chunk_text = (*it_tts_chunk)[strings::text].asCharArray(); - if (strlen(tts_chunk_text) && !CheckSyntax(tts_chunk_text)) { - LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); - return true; - } - } - } - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - DCHECK_OR_RETURN( - (*message_)[strings::msg_params][strings::soft_buttons].getType() == - smart_objects::SmartType_Array, - true); - const smart_objects::SmartArray* soft_button_array = - (*message_)[strings::msg_params][strings::soft_buttons].asArray(); - - SmartArray::const_iterator it_soft_button = soft_button_array->begin(); - - for (; it_soft_button != soft_button_array->end(); ++it_soft_button) { - const char* soft_button_text = - (*it_soft_button)[strings::text].asCharArray(); - if (!CheckSyntax(soft_button_text)) { - LOG4CXX_ERROR(logger_, "Invalid soft_buttons syntax check failed"); - return true; - } - } - } - - return false; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc deleted file mode 100644 index 2f441594c2..0000000000 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/alert_maneuver_response.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -AlertManeuverResponse::AlertManeuverResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -AlertManeuverResponse::~AlertManeuverResponse() {} - -void AlertManeuverResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc deleted file mode 100644 index 3c42e43767..0000000000 --- a/src/components/application_manager/src/commands/mobile/alert_request.cc +++ /dev/null @@ -1,426 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/alert_request.h" - -#include <string.h> - -#include "application_manager/message_helper.h" -#include "application_manager/application_impl.h" - -#include "application_manager/policies/policy_handler.h" -#include "utils/helpers.h" -#include "smart_objects/smart_object.h" - -namespace application_manager { - -namespace commands { - -AlertRequest::AlertRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , awaiting_ui_alert_response_(false) - , awaiting_tts_speak_response_(false) - , awaiting_tts_stop_speaking_response_(false) - , is_alert_succeeded_(false) - , is_ui_alert_sent_(false) - , alert_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} - -AlertRequest::~AlertRequest() {} - -bool AlertRequest::Init() { - /* Timeout in milliseconds. - If omitted a standard value of 10000 milliseconds is used.*/ - if ((*message_)[strings::msg_params].keyExists(strings::duration)) { - default_timeout_ = - (*message_)[strings::msg_params][strings::duration].asUInt(); - } else { - const int32_t def_value = 5000; - default_timeout_ = def_value; - } - - // If soft buttons are present, SDL will not use initiate timeout tracking for - // response. - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - LOG4CXX_INFO(logger_, - "Request contains soft buttons - request timeout " - "will be set to 0."); - default_timeout_ = 0; - } - - return true; -} - -void AlertRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - uint32_t app_id = - (*message_)[strings::params][strings::connection_key].asInt(); - - if (!Validate(app_id)) { - // Invalid command, abort execution - return; - } - bool tts_chunks_exists = - (*message_)[strings::msg_params].keyExists(strings::tts_chunks); - size_t length_tts_chunks = 0; - - if (tts_chunks_exists) { - length_tts_chunks = - (*message_)[strings::msg_params][strings::tts_chunks].length(); - } - - if ((tts_chunks_exists && length_tts_chunks) || - ((*message_)[strings::msg_params].keyExists(strings::play_tone) && - (*message_)[strings::msg_params][strings::play_tone].asBool())) { - awaiting_tts_speak_response_ = true; - } - - SendAlertRequest(app_id); - if (awaiting_tts_speak_response_) { - SendSpeakRequest(app_id, tts_chunks_exists, length_tts_chunks); - } -} - -void AlertRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::TTS_OnResetTimeout: - case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, - "Received UI_OnResetTimeout event " - " or TTS_OnResetTimeout event" - << awaiting_tts_speak_response_ << " " - << awaiting_tts_stop_speaking_response_ << " " - << awaiting_ui_alert_response_); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } - case hmi_apis::FunctionID::UI_Alert: { - LOG4CXX_INFO(logger_, "Received UI_Alert event"); - // Unsubscribe from event to avoid unwanted messages - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - unsubscribe_from_event(hmi_apis::FunctionID::UI_Alert); - awaiting_ui_alert_response_ = false; - HmiInterfaces::InterfaceState ui_interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_UI); - - if (awaiting_tts_speak_response_ && - HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state) { - awaiting_tts_stop_speaking_response_ = true; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL, true); - } - alert_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - - // Mobile Alert request is successful when UI_Alert is successful - alert_response_params_ = message[strings::msg_params]; - GetInfo(message, ui_response_info_); - break; - } - case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); - // Unsubscribe from event to avoid unwanted messages - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak); - awaiting_tts_speak_response_ = false; - tts_speak_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, tts_response_info_); - break; - } - case hmi_apis::FunctionID::TTS_StopSpeaking: { - LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - // Unsubscribe from event to avoid unwanted messages - unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking); - awaiting_tts_stop_speaking_response_ = false; - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } - - if (HasHmiResponsesToWait()) { - return; - } - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - std::string info; - const bool result = PrepareResponseParameters(result_code, info); - SendResponse(result, - result_code, - info.empty() ? NULL : info.c_str(), - &alert_response_params_); -} - -bool AlertRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, std::string& info) { - ResponseInfo ui_alert_info( - alert_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - ResponseInfo tts_alert_info(tts_speak_result_, - HmiInterfaces::HMI_INTERFACE_TTS, - application_manager_); - - bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info); - - /* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE - * and sdl receive TTS.IsReady=true or SDL doesn't receive responce for - * TTS.IsReady. - */ - if (result && ui_alert_info.is_ok && tts_alert_info.is_unsupported_resource && - HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) { - result = false; - } - result_code = mobile_apis::Result::WARNINGS; - if ((ui_alert_info.is_ok || ui_alert_info.is_not_used) && - tts_alert_info.is_unsupported_resource && - HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) { - tts_response_info_ = "Unsupported phoneme type sent in a prompt"; - info = MergeInfos( - ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_); - return result; - } - result_code = PrepareResultCodeForResponse(ui_alert_info, tts_alert_info); - info = MergeInfos( - ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_); - // Mobile Alert request is successful when UI_Alert is successful - if (is_ui_alert_sent_ && !ui_alert_info.is_ok) { - return false; - } - return result; -} - -bool AlertRequest::Validate(uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application(app_id); - - if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return false; - } - - if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() && - app->AreCommandLimitsExceeded( - static_cast<mobile_apis::FunctionID::eType>(function_id()), - application_manager::TLimitSource::POLICY_TABLE)) { - LOG4CXX_ERROR(logger_, "Alert frequency is too high."); - SendResponse(false, mobile_apis::Result::REJECTED); - return false; - } - - if (!CheckStringsOfAlertRequest()) { - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return false; - } - - // ProcessSoftButtons checks strings on the contents incorrect character - - mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], - app, - application_manager_.GetPolicyHandler(), - application_manager_); - - if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); - SendResponse(false, processing_result); - return false; - } - - // check if mandatory params(alertText1 and TTSChunk) specified - if ((!(*message_)[strings::msg_params].keyExists(strings::alert_text1)) && - (!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) && - (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) && - (1 > (*message_)[strings::msg_params][strings::tts_chunks].length()))) { - LOG4CXX_ERROR(logger_, "Mandatory parameters are missing"); - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "Mandatory parameters are missing"); - return false; - } - - return true; -} - -void AlertRequest::SendAlertRequest(int32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application(app_id); - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[hmi_request::alert_strings] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - int32_t index = 0; - if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { - msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = - hmi_apis::Common_TextFieldName::alertText1; - msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::alert_text1]; - index++; - } - if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { - msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = - hmi_apis::Common_TextFieldName::alertText2; - msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::alert_text2]; - index++; - } - if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) { - msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = - hmi_apis::Common_TextFieldName::alertText3; - msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::alert_text3]; - } - - // softButtons - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - msg_params[hmi_request::soft_buttons] = - (*message_)[strings::msg_params][strings::soft_buttons]; - MessageHelper::SubscribeApplicationToSoftButton( - (*message_)[strings::msg_params], app, function_id()); - } - // app_id - msg_params[strings::app_id] = app_id; - msg_params[strings::duration] = default_timeout_; - - // NAVI platform progressIndicator - if ((*message_)[strings::msg_params].keyExists(strings::progress_indicator)) { - msg_params[strings::progress_indicator] = - (*message_)[strings::msg_params][strings::progress_indicator]; - } - - // PASA Alert type - msg_params[strings::alert_type] = hmi_apis::Common_AlertType::UI; - if (awaiting_tts_speak_response_) { - msg_params[strings::alert_type] = hmi_apis::Common_AlertType::BOTH; - } - - // check out if there are alert strings or soft buttons - if (msg_params[hmi_request::alert_strings].length() > 0 || - msg_params.keyExists(hmi_request::soft_buttons)) { - awaiting_ui_alert_response_ = true; - is_ui_alert_sent_ = true; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_Alert, &msg_params, true); - } -} - -void AlertRequest::SendSpeakRequest(int32_t app_id, - bool tts_chunks_exists, - size_t length_tts_chunks) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis; - using namespace smart_objects; - // crate HMI speak request - SmartObject msg_params = smart_objects::SmartObject(SmartType_Map); - if (tts_chunks_exists && length_tts_chunks) { - msg_params[hmi_request::tts_chunks] = - smart_objects::SmartObject(SmartType_Array); - msg_params[hmi_request::tts_chunks] = - (*message_)[strings::msg_params][strings::tts_chunks]; - } - if ((*message_)[strings::msg_params].keyExists(strings::play_tone) && - (*message_)[strings::msg_params][strings::play_tone].asBool()) { - msg_params[strings::play_tone] = true; - } - msg_params[strings::app_id] = app_id; - msg_params[hmi_request::speak_type] = Common_MethodName::ALERT; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true); -} - -bool AlertRequest::CheckStringsOfAlertRequest() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { - str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed"); - return false; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { - str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed"); - return false; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) { - str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_3 syntax check failed"); - return false; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { - smart_objects::SmartObject& tts_chunks_array = - (*message_)[strings::msg_params][strings::tts_chunks]; - for (size_t i = 0; i < tts_chunks_array.length(); ++i) { - str = tts_chunks_array[i][strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_chunks text syntax check failed"); - return false; - } - } - } - return true; -} - -bool AlertRequest::HasHmiResponsesToWait() { - LOG4CXX_AUTO_TRACE(logger_); - return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ || - awaiting_tts_stop_speaking_response_; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/alert_response.cc b/src/components/application_manager/src/commands/mobile/alert_response.cc deleted file mode 100644 index f8ca487eae..0000000000 --- a/src/components/application_manager/src/commands/mobile/alert_response.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/alert_response.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -AlertResponse::AlertResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -AlertResponse::~AlertResponse() {} - -void AlertResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager 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 deleted file mode 100644 index f55767c723..0000000000 --- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc +++ /dev/null @@ -1,661 +0,0 @@ -/* - - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string.h> -#include <algorithm> -#include "application_manager/commands/mobile/change_registration_request.h" -#include "application_manager/application_manager.h" -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "application_manager/message_helper.h" - -namespace { -namespace custom_str = utils::custom_string; -struct IsSameNickname { - IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {} - bool operator()(const policy::StringArray::value_type& nickname) const { - return app_id_.CompareIgnoreCase(nickname.c_str()); - } - - private: - const custom_str::CustomString& app_id_; -}; -} - -namespace application_manager { - -namespace commands { - -ChangeRegistrationRequest::ChangeRegistrationRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} - -ChangeRegistrationRequest::~ChangeRegistrationRequest() {} - -void ChangeRegistrationRequest::SendVRRequest( - ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { - const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - auto function = hmi_apis::FunctionID::VR_ChangeRegistration; - pending_requests_.Add(function); - smart_objects::SmartObject vr_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - vr_params[strings::language] = msg_params[strings::language]; - - vr_params[strings::app_id] = app->app_id(); - if (msg_params.keyExists(strings::vr_synonyms)) { - vr_params[strings::vr_synonyms] = msg_params[strings::vr_synonyms]; - app->set_vr_synonyms(msg_params[strings::vr_synonyms]); - } - StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function)); - SendHMIRequest(function, &vr_params, true); -} - -void ChangeRegistrationRequest::SendTTSRequest( - ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { - const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - auto function = hmi_apis::FunctionID::TTS_ChangeRegistration; - pending_requests_.Add(function); - - smart_objects::SmartObject tts_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - tts_params[strings::language] = msg_params[strings::language]; - - tts_params[strings::app_id] = app->app_id(); - if (msg_params.keyExists(strings::tts_name)) { - tts_params[strings::tts_name] = msg_params[strings::tts_name]; - app->set_tts_name(msg_params[strings::tts_name]); - } - StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function)); - SendHMIRequest(function, &tts_params, true); -} - -void ChangeRegistrationRequest::SendUIRequest( - ApplicationSharedPtr app, - smart_objects::SmartObject& msg_params, - const int32_t hmi_language) { - const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - auto function = hmi_apis::FunctionID::UI_ChangeRegistration; - pending_requests_.Add(function); - // UI processing - smart_objects::SmartObject ui_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - ui_params[strings::language] = hmi_language; - ui_params[strings::app_id] = app->app_id(); - if (msg_params.keyExists(strings::app_name)) { - ui_params[strings::app_name] = msg_params[strings::app_name]; - app->set_name(msg_params[strings::app_name].asCustomString()); - } - if (msg_params.keyExists(strings::ngn_media_screen_app_name)) { - ui_params[strings::ngn_media_screen_app_name] = - msg_params[strings::ngn_media_screen_app_name]; - app->set_ngn_media_screen_name( - msg_params[strings::ngn_media_screen_app_name]); - } - - StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function)); - SendHMIRequest(function, &ui_params, true); -} - -void ChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace smart_objects; - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_INFO(logger_, - "Incoming request contains \t\n \\t \\n or whitespace"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (mobile_apis::Result::SUCCESS != CheckCoincidence()) { - SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); - return; - } - - SmartObject& msg_params = (*message_)[strings::msg_params]; - - const int32_t hmi_language = - msg_params[strings::hmi_display_language].asInt(); - - const int32_t language = msg_params[strings::language].asInt(); - - if (false == (IsLanguageSupportedByUI(hmi_language) && - IsLanguageSupportedByVR(language) && - IsLanguageSupportedByTTS(language))) { - LOG4CXX_ERROR(logger_, "Language is not supported"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - if (msg_params.keyExists(strings::app_name) && - !IsNicknameAllowed(msg_params[strings::app_name].asCustomString())) { - LOG4CXX_ERROR(logger_, "Nickname is not allowed."); - SendResponse(false, mobile_apis::Result::DISALLOWED); - return; - } - - const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - - const HmiInterfaces::InterfaceState vr_state = - hmi_interfaces.GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_VR); - const HmiInterfaces::InterfaceState ui_state = - hmi_interfaces.GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_UI); - const HmiInterfaces::InterfaceState tts_state = - hmi_interfaces.GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS); - - using helpers::Compare; - using helpers::EQ; - using helpers::ALL; - - if (Compare<HmiInterfaces::InterfaceState, EQ, ALL>( - HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE, - vr_state, - tts_state, - ui_state)) { - SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); - return; - } - if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != vr_state) { - // VR processing - SendVRRequest(app, msg_params); - } - if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != tts_state) { - // TTS processing - SendTTSRequest(app, msg_params); - } - - if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != ui_state) { - SendUIRequest(app, msg_params, hmi_language); - } -} - -void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - hmi_apis::FunctionID::eType event_id = event.id(); - - switch (event_id) { - case hmi_apis::FunctionID::UI_ChangeRegistration: { - LOG4CXX_INFO(logger_, "Received UI_ChangeRegistration event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - pending_requests_.Remove(event_id); - ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, ui_response_info_); - break; - } - case hmi_apis::FunctionID::VR_ChangeRegistration: { - LOG4CXX_INFO(logger_, "Received VR_ChangeRegistration event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - pending_requests_.Remove(event_id); - vr_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, vr_response_info_); - break; - } - case hmi_apis::FunctionID::TTS_ChangeRegistration: { - LOG4CXX_INFO(logger_, "Received TTS_ChangeRegistration event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - pending_requests_.Remove(event_id); - tts_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, tts_response_info_); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event_id); - return; - } - } - - if (pending_requests_.IsFinal(event_id)) { - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - if (hmi_apis::Common_Result::SUCCESS == ui_result_) { - application->set_ui_language(static_cast<mobile_api::Language::eType>( - (*message_)[strings::msg_params][strings::hmi_display_language] - .asInt())); - } - - if (hmi_apis::Common_Result::SUCCESS == vr_result_ || - hmi_apis::Common_Result::SUCCESS == tts_result_) { - application->set_language(static_cast<mobile_api::Language::eType>( - (*message_)[strings::msg_params][strings::language].asInt())); - } - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - std::string response_info; - const bool result = PrepareResponseParameters(result_code, response_info); - - (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::eType::ChangeRegistrationID; - - SendResponse(result, - result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - } else { - LOG4CXX_INFO(logger_, - "There are some pending responses from HMI." - "ChangeRegistrationRequest still waiting."); - } -} - -namespace { -void CheckInfo(std::string& str) { - if (std::string::npos != str.find("is not supported by system")) { - str.clear(); - } -} -} // namespace - -bool ChangeRegistrationRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, std::string& response_info) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - const bool is_tts_succeeded_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - tts_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - const bool is_ui_succeeded_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - const bool is_vr_succeeded_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - vr_result_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - const bool is_tts_ui_vr_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ALL>( - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - tts_result_, - ui_result_, - vr_result_); - - const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - const HmiInterfaces::InterfaceState tts_state = - hmi_interfaces.GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS); - const HmiInterfaces::InterfaceState vr_state = - hmi_interfaces.GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_VR); - const HmiInterfaces::InterfaceState ui_state = - hmi_interfaces.GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_UI); - - ResponseInfo ui_properties_info( - ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - - ResponseInfo tts_properties_info( - tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); - - ResponseInfo vr_properties_info( - ui_result_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_); - - bool result = ((!is_tts_ui_vr_unsupported) && is_tts_succeeded_unsupported && - is_ui_succeeded_unsupported && is_vr_succeeded_unsupported); - - const bool is_tts_or_ui_or_vr_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - tts_result_, - ui_result_, - vr_result_); - - if ((result && is_tts_or_ui_or_vr_unsupported)) { - result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; - result = - PrepareResultForMobileResponse(ui_properties_info, - tts_properties_info) && - PrepareResultForMobileResponse(tts_properties_info, vr_properties_info); - } else { - // If response contains erroneous result code SDL need return erroneus - // result code. - hmi_apis::Common_Result::eType ui_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType vr_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType tts_result = - hmi_apis::Common_Result::INVALID_ENUM; - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != ui_result_) { - ui_result = ui_result_; - } - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != vr_result_) { - vr_result = vr_result_; - } - if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != tts_result_) { - tts_result = tts_result_; - } - result_code = MessageHelper::HMIToMobileResult( - std::max(std::max(ui_result, vr_result), tts_result)); - if (mobile_api::Result::INVALID_ENUM == result_code) { - result_code = mobile_api::Result::UNSUPPORTED_RESOURCE; - } - } - - const bool is_tts_state_available = - tts_state == HmiInterfaces::STATE_AVAILABLE; - const bool is_vr_state_available = vr_state == HmiInterfaces::STATE_AVAILABLE; - const bool is_ui_state_available = ui_state == HmiInterfaces::STATE_AVAILABLE; - - const bool is_tts_hmi_info = - is_tts_state_available && !tts_response_info_.empty(); - const bool is_vr_hmi_info = - is_vr_state_available && !vr_response_info_.empty(); - const bool is_ui_hmi_info = - is_ui_state_available && !ui_response_info_.empty(); - - if (is_tts_hmi_info || is_vr_hmi_info || is_ui_hmi_info) { - if (!is_tts_hmi_info) - CheckInfo(tts_response_info_); - if (!is_vr_hmi_info) - CheckInfo(ui_response_info_); - if (!is_ui_hmi_info) - CheckInfo(vr_response_info_); - } - - response_info = - MergeInfos(ui_response_info_, vr_response_info_, tts_response_info_); - return result; -} - -bool ChangeRegistrationRequest::IsLanguageSupportedByUI( - const int32_t& hmi_display_lang) { - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - const smart_objects::SmartObject* ui_languages = - hmi_capabilities.ui_supported_languages(); - - if (!ui_languages) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return false; - } - - for (size_t i = 0; i < ui_languages->length(); ++i) { - if (hmi_display_lang == ui_languages->getElement(i).asInt()) { - return true; - } - } - - LOG4CXX_ERROR(logger_, "Language isn't supported by UI"); - - return false; -} - -bool ChangeRegistrationRequest::IsLanguageSupportedByVR( - const int32_t& hmi_display_lang) { - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - const smart_objects::SmartObject* vr_languages = - hmi_capabilities.vr_supported_languages(); - - if (!vr_languages) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return false; - } - - for (size_t i = 0; i < vr_languages->length(); ++i) { - if (hmi_display_lang == vr_languages->getElement(i).asInt()) { - return true; - } - } - - LOG4CXX_ERROR(logger_, "Language isn't supported by VR"); - - return false; -} - -bool ChangeRegistrationRequest::IsLanguageSupportedByTTS( - const int32_t& hmi_display_lang) { - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - const smart_objects::SmartObject* tts_languages = - hmi_capabilities.tts_supported_languages(); - - if (!tts_languages) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return false; - } - - for (size_t i = 0; i < tts_languages->length(); ++i) { - if (hmi_display_lang == tts_languages->getElement(i).asInt()) { - return true; - break; - } - } - - LOG4CXX_ERROR(logger_, "Language isn't supported by TTS"); - return false; -} - -bool ChangeRegistrationRequest::IsWhiteSpaceExist() { - const char* str = NULL; - - if ((*message_)[strings::msg_params].keyExists(strings::app_name)) { - str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) { - const smart_objects::SmartArray* tn_array = - (*message_)[strings::msg_params][strings::tts_name].asArray(); - - smart_objects::SmartArray::const_iterator it_tn = tn_array->begin(); - smart_objects::SmartArray::const_iterator it_tn_end = tn_array->end(); - - for (; it_tn != it_tn_end; ++it_tn) { - str = (*it_tn)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists( - strings::ngn_media_screen_app_name)) { - str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] - .asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid ngn_media_screen_app_name syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::vr_synonyms)) { - const smart_objects::SmartArray* vs_array = - (*message_)[strings::msg_params][strings::vr_synonyms].asArray(); - - smart_objects::SmartArray::const_iterator it_vs = vs_array->begin(); - smart_objects::SmartArray::const_iterator it_vs_end = vs_array->end(); - - for (; it_vs != it_vs_end; ++it_vs) { - str = (*it_vs).asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_synonyms syntax check failed"); - return true; - } - } - } - return false; -} - -mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() { - LOG4CXX_AUTO_TRACE(logger_); - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - ApplicationSet accessor = application_manager_.applications().GetData(); - custom_str::CustomString app_name; - uint32_t app_id = connection_key(); - if (msg_params.keyExists(strings::app_name)) { - app_name = msg_params[strings::app_name].asCustomString(); - } - - ApplicationSetConstIt it = accessor.begin(); - for (; accessor.end() != it; ++it) { - if (app_id == (*it)->app_id()) { - continue; - } - - const custom_str::CustomString& cur_name = (*it)->name(); - if (msg_params.keyExists(strings::app_name)) { - if (app_name.CompareIgnoreCase(cur_name)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); - return mobile_apis::Result::DUPLICATE_NAME; - } - - const smart_objects::SmartObject* vr = (*it)->vr_synonyms(); - const std::vector<smart_objects::SmartObject>* curr_vr = NULL; - if (NULL != vr) { - curr_vr = vr->asArray(); - CoincidencePredicateVR v(app_name); - - if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); - return mobile_apis::Result::DUPLICATE_NAME; - } - } - } - - // vr check - if (msg_params.keyExists(strings::vr_synonyms)) { - const std::vector<smart_objects::SmartObject>* new_vr = - msg_params[strings::vr_synonyms].asArray(); - - CoincidencePredicateVR v(cur_name); - if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); - return mobile_apis::Result::DUPLICATE_NAME; - } - } // end vr check - } // application for end - return mobile_apis::Result::SUCCESS; -} - -bool ChangeRegistrationRequest::IsNicknameAllowed( - const custom_str::CustomString& app_name) const { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, - "Can't find appication with connection key " - << connection_key()); - return false; - } - - const std::string policy_app_id = app->policy_app_id(); - - policy::StringArray app_nicknames; - policy::StringArray app_hmi_types; - - bool init_result = application_manager_.GetPolicyHandler().GetInitialAppData( - policy_app_id, &app_nicknames, &app_hmi_types); - - if (!init_result) { - LOG4CXX_ERROR(logger_, - "Error during getting of nickname list for application " - << policy_app_id); - return false; - } - - if (!app_nicknames.empty()) { - IsSameNickname compare(app_name); - policy::StringArray::const_iterator it = - std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); - if (app_nicknames.end() == it) { - LOG4CXX_WARN(logger_, - "Application name was not found in nicknames list."); - - usage_statistics::AppCounter count_of_rejections_nickname_mismatch( - application_manager_.GetPolicyHandler().GetStatisticManager(), - policy_app_id, - usage_statistics::REJECTIONS_NICKNAME_MISMATCH); - ++count_of_rejections_nickname_mismatch; - - return false; - } - } - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/src/commands/mobile/change_registration_response.cc deleted file mode 100644 index 210cae64c5..0000000000 --- a/src/components/application_manager/src/commands/mobile/change_registration_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/change_registration_response.h" - -namespace application_manager { - -namespace commands { - -ChangeRegistrationResponse::ChangeRegistrationResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -ChangeRegistrationResponse::~ChangeRegistrationResponse() {} - -void ChangeRegistrationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc deleted file mode 100644 index 20387ef230..0000000000 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc +++ /dev/null @@ -1,442 +0,0 @@ -/* - - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string> -#include <cstring> -#include <algorithm> -#include <vector> -#include "application_manager/commands/mobile/create_interaction_choice_set_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "utils/gen_hash.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , choice_set_id_(0) - , expected_chs_count_(0) - , received_chs_count_(0) - , error_from_hmi_(false) - , is_timed_out_(false) - , vr_commands_lock_(true) {} - -CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { - LOG4CXX_AUTO_TRACE(logger_); -} - -void CreateInteractionChoiceSetRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace mobile_apis; - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - for (uint32_t i = 0; - i < (*message_)[strings::msg_params][strings::choice_set].length(); - ++i) { - Result::eType verification_result_image = Result::SUCCESS; - Result::eType verification_result_secondary_image = Result::SUCCESS; - if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists( - strings::image)) { - verification_result_image = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::choice_set][i] - [strings::image], - app, - application_manager_); - } - if ((*message_)[strings::msg_params][strings::choice_set][i].keyExists( - strings::secondary_image)) { - verification_result_secondary_image = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::choice_set][i] - [strings::secondary_image], - app, - application_manager_); - } - if (verification_result_image == Result::INVALID_DATA || - verification_result_secondary_image == Result::INVALID_DATA) { - LOG4CXX_ERROR(logger_, "Image verification failed."); - SendResponse(false, Result::INVALID_DATA); - return; - } - } - - choice_set_id_ = - (*message_)[strings::msg_params][strings::interaction_choice_set_id] - .asInt(); - - if (app->FindChoiceSet(choice_set_id_)) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id_ << " is not found."); - SendResponse(false, Result::INVALID_ID); - return; - } - - Result::eType result = CheckChoiceSet(app); - if (Result::SUCCESS != result) { - SendResponse(false, result); - return; - } - uint32_t grammar_id = application_manager_.GenerateGrammarID(); - (*message_)[strings::msg_params][strings::grammar_id] = grammar_id; - app->AddChoiceSet(choice_set_id_, (*message_)[strings::msg_params]); - SendVRAddCommandRequests(app); -} - -mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( - ApplicationConstSharedPtr app) { - using namespace smart_objects; - LOG4CXX_AUTO_TRACE(logger_); - - std::set<uint32_t> choice_id_set; - - const SmartArray* choice_set = - (*message_)[strings::msg_params][strings::choice_set].asArray(); - - SmartArray::const_iterator current_choice_set_it = choice_set->begin(); - SmartArray::const_iterator next_choice_set_it; - - for (; choice_set->end() != current_choice_set_it; ++current_choice_set_it) { - std::pair<std::set<uint32_t>::iterator, bool> ins_res = - choice_id_set.insert( - (*current_choice_set_it)[strings::choice_id].asInt()); - if (!ins_res.second) { - LOG4CXX_ERROR(logger_, - "Choise with ID " - << (*current_choice_set_it)[strings::choice_id].asInt() - << " already exists"); - return mobile_apis::Result::INVALID_ID; - } - - if (IsWhiteSpaceExist(*current_choice_set_it)) { - LOG4CXX_ERROR(logger_, "Incoming choice set has contains \t\n \\t \\n"); - return mobile_apis::Result::INVALID_DATA; - } - for (next_choice_set_it = current_choice_set_it + 1; - choice_set->end() != next_choice_set_it; - ++next_choice_set_it) { - if (compareSynonyms(*current_choice_set_it, *next_choice_set_it)) { - return mobile_apis::Result::DUPLICATE_NAME; - } - } - } - return mobile_apis::Result::SUCCESS; -} - -bool CreateInteractionChoiceSetRequest::compareSynonyms( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1, - const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2) { - smart_objects::SmartArray* vr_cmds_1 = - choice1[strings::vr_commands].asArray(); - DCHECK(vr_cmds_1 != NULL); - smart_objects::SmartArray* vr_cmds_2 = - choice2[strings::vr_commands].asArray(); - DCHECK(vr_cmds_2 != NULL); - - smart_objects::SmartArray::iterator it; - it = std::find_first_of(vr_cmds_1->begin(), - vr_cmds_1->end(), - vr_cmds_2->begin(), - vr_cmds_2->end(), - CreateInteractionChoiceSetRequest::compareStr); - - if (it != vr_cmds_1->end()) { - LOG4CXX_INFO(logger_, - "Incoming choice set has duplicated VR synonyms " - << it->asString()); - return true; - } - - return false; -} - -bool CreateInteractionChoiceSetRequest::compareStr( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1, - const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2) { - return 0 == strcasecmp(str1.asCharArray(), str2.asCharArray()); -} - -bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( - const smart_objects::SmartObject& choice_set) { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - str = choice_set[strings::menu_name].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu_name syntax check failed"); - return true; - } - - if (choice_set.keyExists(strings::secondary_text)) { - str = choice_set[strings::secondary_text].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid secondary_text syntax check failed"); - return true; - } - } - - if (choice_set.keyExists(strings::tertiary_text)) { - str = choice_set[strings::tertiary_text].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tertiary_text syntax check failed"); - return true; - } - } - - if (choice_set.keyExists(strings::vr_commands)) { - const size_t len = choice_set[strings::vr_commands].length(); - - for (size_t i = 0; i < len; ++i) { - str = choice_set[strings::vr_commands][i].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); - return true; - } - } - } - - if (choice_set.keyExists(strings::image)) { - str = choice_set[strings::image][strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid image value syntax check failed"); - return true; - } - } - - if (choice_set.keyExists(strings::secondary_image)) { - str = choice_set[strings::secondary_image][strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid secondary_image value. " - "Syntax check failed"); - return true; - } - } - return false; -} - -void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( - application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params]; - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice; - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::grammar_id] = choice_set[strings::grammar_id]; - const uint32_t choice_count = choice_set[strings::choice_set].length(); - SetAllowedToTerminate(false); - - expected_chs_count_ = choice_count; - size_t chs_num = 0; - for (; chs_num < choice_count; ++chs_num) { - { - sync_primitives::AutoLock error_lock(error_from_hmi_lock_); - if (error_from_hmi_) { - LOG4CXX_WARN(logger_, - "Error from HMI received. Stop sending VRCommands"); - break; - } - } - - msg_params[strings::cmd_id] = - choice_set[strings::choice_set][chs_num][strings::choice_id]; - msg_params[strings::vr_commands] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - msg_params[strings::vr_commands] = - choice_set[strings::choice_set][chs_num][strings::vr_commands]; - - sync_primitives::AutoLock commands_lock(vr_commands_lock_); - const uint32_t vr_cmd_id = msg_params[strings::cmd_id].asUInt(); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - const uint32_t vr_corr_id = - SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &msg_params, true); - - VRCommandInfo vr_command(vr_cmd_id); - sent_commands_map_[vr_corr_id] = vr_command; - LOG4CXX_DEBUG(logger_, - "VR_command sent corr_id " << vr_corr_id << " cmd_id " - << vr_corr_id); - } - expected_chs_count_ = chs_num; - LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_); -} - -void CreateInteractionChoiceSetRequest::ProcessHmiError( - const hmi_apis::Common_Result::eType vr_result) { - LOG4CXX_DEBUG(logger_, - "Hmi response is not Success: " - << vr_result << ". Stop sending VRAddCommand requests"); - if (!error_from_hmi_) { - error_from_hmi_ = true; - std::string info = - vr_result == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE - ? "VR is not supported by system" - : ""; - SendResponse(false, GetMobileResultCode(vr_result), info.c_str()); - } -} - -bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( - const uint32_t corr_id) { - SentCommandsMap::iterator it = sent_commands_map_.find(corr_id); - if (sent_commands_map_.end() == it) { - LOG4CXX_WARN(logger_, "HMI response for unknown VR command received"); - return false; - } - VRCommandInfo& vr_command = it->second; - vr_command.succesful_response_received_ = true; - return true; -} - -void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { - received_chs_count_++; - LOG4CXX_DEBUG(logger_, - "Got VR.AddCommand response, there are " - << expected_chs_count_ - received_chs_count_ - << " more to wait."); - if (received_chs_count_ < expected_chs_count_) { - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - LOG4CXX_DEBUG(logger_, "Timeout for request was updated"); - } else { - OnAllHMIResponsesReceived(); - } -} - -void CreateInteractionChoiceSetRequest::on_event( - const event_engine::Event& event) { - using namespace hmi_apis; - using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); - - const smart_objects::SmartObject& message = event.smart_object(); - const Common_Result::eType result = static_cast<Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool is_no_error = Compare<Common_Result::eType, EQ, ONE>( - result, Common_Result::SUCCESS, Common_Result::WARNINGS); - uint32_t corr_id = static_cast<uint32_t>( - message[strings::params][strings::correlation_id].asUInt()); - if (event.id() == hmi_apis::FunctionID::VR_AddCommand) { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - { - sync_primitives::AutoLock commands_lock(vr_commands_lock_); - if (is_no_error) { - if (!ProcessSuccesfulHMIResponse(corr_id)) { - return; - } - } else { - ProcessHmiError(result); - } - } - CountReceivedVRResponses(); - } -} - -void CreateInteractionChoiceSetRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); - - if (!error_from_hmi_) { - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); - } - CommandRequestImpl::onTimeOut(); - DeleteChoices(); - - // We have to keep request alive until receive all responses from HMI - // according to SDLAQ-CRS-2976 - sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_); - is_timed_out_ = true; - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); -} - -bool CreateInteractionChoiceSetRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -void CreateInteractionChoiceSetRequest::DeleteChoices() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - application->RemoveChoiceSet(choice_set_id_); - - smart_objects::SmartObject msg_param(smart_objects::SmartType_Map); - msg_param[strings::app_id] = application->app_id(); - - sync_primitives::AutoLock commands_lock(vr_commands_lock_); - SentCommandsMap::const_iterator it = sent_commands_map_.begin(); - for (; it != sent_commands_map_.end(); ++it) { - const VRCommandInfo& vr_command_info = it->second; - if (vr_command_info.succesful_response_received_) { - msg_param[strings::cmd_id] = vr_command_info.cmd_id_; - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param); - } else { - LOG4CXX_WARN(logger_, - "succesful response has not been received for cmd_id = " - << vr_command_info.cmd_id_); - } - } - sent_commands_map_.clear(); -} - -void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { - LOG4CXX_AUTO_TRACE(logger_); - - if (!error_from_hmi_) { - SendResponse(true, mobile_apis::Result::SUCCESS); - } else { - DeleteChoices(); - } - - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc deleted file mode 100644 index 0cc137d6a0..0000000000 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_response.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/create_interaction_choice_set_response.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {} - -void CreateInteractionChoiceSetResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // check if response false - if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { - if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); - SendResponse(false); - return; - } - } - - SendResponse(true); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc deleted file mode 100644 index f894ed452c..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc +++ /dev/null @@ -1,224 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_command_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -DeleteCommandRequest::DeleteCommandRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , is_ui_send_(false) - , is_vr_send_(false) - , is_ui_received_(false) - , is_vr_received_(false) - , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} - -DeleteCommandRequest::~DeleteCommandRequest() {} - -void DeleteCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const int32_t cmd_id = - (*message_)[strings::msg_params][strings::cmd_id].asInt(); - - smart_objects::SmartObject* command = application->FindCommand(cmd_id); - - if (!command) { - LOG4CXX_ERROR(logger_, "Command with id " << cmd_id << " is not found."); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; - msg_params[strings::app_id] = application->app_id(); - - // we should specify amount of required responses in the 1st request - uint32_t chaining_counter = 0; - if ((*command).keyExists(strings::menu_params)) { - ++chaining_counter; - } - - if ((*command).keyExists(strings::vr_commands)) { - ++chaining_counter; - } - /* Need to set all flags before sending request to HMI - * for correct processing this flags in method on_event */ - if ((*command).keyExists(strings::menu_params)) { - is_ui_send_ = true; - } - // check vr params - if ((*command).keyExists(strings::vr_commands)) { - is_vr_send_ = true; - } - if (is_ui_send_) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true); - } - if (is_vr_send_) { - // VR params - msg_params[strings::grammar_id] = application->get_grammar_id(); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params, true); - } -} - -bool DeleteCommandRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, std::string& info) { - using namespace helpers; - ResponseInfo ui_delete_info( - ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - ResponseInfo vr_delete_info( - vr_result_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_); - const bool result = - PrepareResultForMobileResponse(ui_delete_info, vr_delete_info); - - const bool is_vr_or_ui_warning = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_); - info = MergeInfos(ui_delete_info, ui_info_, vr_delete_info, vr_info_); - if (is_vr_or_ui_warning && !ui_delete_info.is_unsupported_resource && - !vr_delete_info.is_unsupported_resource) { - LOG4CXX_DEBUG(logger_, "VR or UI result is warning"); - result_code = mobile_apis::Result::WARNINGS; - return result; - } - result_code = PrepareResultCodeForResponse(ui_delete_info, vr_delete_info); - LOG4CXX_DEBUG(logger_, "Result is " << (result ? "true" : "false")); - return result; -} - -void DeleteCommandRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::UI_DeleteCommand: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - is_ui_received_ = true; - ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - LOG4CXX_DEBUG(logger_, - "Received UI_DeleteCommand event with result " - << MessageHelper::HMIResultToString(ui_result_)); - GetInfo(message, ui_info_); - break; - } - case hmi_apis::FunctionID::VR_DeleteCommand: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - is_vr_received_ = true; - vr_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - LOG4CXX_DEBUG(logger_, - "Received VR_DeleteCommand event with result " - << MessageHelper::HMIResultToString(vr_result_)); - GetInfo(message, vr_info_); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } - - if (IsPendingResponseExist()) { - LOG4CXX_DEBUG(logger_, "Still awaiting for other responses."); - return; - } - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - - const int32_t cmd_id = msg_params[strings::cmd_id].asInt(); - - smart_objects::SmartObject* command = application->FindCommand(cmd_id); - - if (!command) { - LOG4CXX_ERROR(logger_, - "Command id " << cmd_id << " not found for " - "application with connection key " - << connection_key()); - return; - } - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - std::string info; - const bool result = PrepareResponseParameters(result_code, info); - if (result) { - application->RemoveCommand(msg_params[strings::cmd_id].asInt()); - } - SendResponse( - result, result_code, info.empty() ? NULL : info.c_str(), &msg_params); -} - -bool DeleteCommandRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -bool DeleteCommandRequest::IsPendingResponseExist() { - LOG4CXX_AUTO_TRACE(logger_); - return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/src/commands/mobile/delete_command_response.cc deleted file mode 100644 index 7abc1c11d4..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_command_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_command_response.h" - -namespace application_manager { - -namespace commands { - -DeleteCommandResponse::DeleteCommandResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -DeleteCommandResponse::~DeleteCommandResponse() {} - -void DeleteCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/src/commands/mobile/delete_file_request.cc deleted file mode 100644 index 984c7a1725..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_file_request.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* - - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_file_request.h" - -#include "application_manager/application_impl.h" - -#include "utils/file_system.h" - -namespace application_manager { - -namespace commands { - -DeleteFileRequest::DeleteFileRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -DeleteFileRequest::~DeleteFileRequest() {} - -void DeleteFileRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - - if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && - (application_manager_.get_settings().delete_file_in_none() <= - application->delete_file_in_none_count())) { - // If application is in the HMI_NONE level the quantity of allowed - // DeleteFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - const std::string& sync_file_name = - (*message_)[strings::msg_params][strings::sync_file_name].asString(); - - if (!file_system::IsFileNameValid(sync_file_name)) { - const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); - SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); - return; - } - - std::string full_file_path = - application_manager_.get_settings().app_storage_folder() + "/"; - full_file_path += application->folder_name(); - full_file_path += "/"; - full_file_path += sync_file_name; - - if (file_system::FileExists(full_file_path)) { - if (file_system::DeleteFile(full_file_path)) { - const AppFile* file = application->GetFile(full_file_path); - if (file) { - SendFileRemovedNotification(file); - } - - application->DeleteFile(full_file_path); - application->increment_delete_file_in_none_count(); - SendResponse(true, mobile_apis::Result::SUCCESS); - } else { - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); - } - } else { - SendResponse(false, mobile_apis::Result::REJECTED); - } -} - -void DeleteFileRequest::SendFileRemovedNotification(const AppFile* file) const { - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::app_id] = connection_key(); - msg_params[strings::file_name] = file->file_name; - msg_params[strings::file_type] = file->file_type; - - CreateHMINotification(hmi_apis::FunctionID::BasicCommunication_OnFileRemoved, - msg_params); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/src/commands/mobile/delete_file_response.cc deleted file mode 100644 index 8ed6f7ba2e..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_file_response.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_file_response.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -DeleteFileResponse::DeleteFileResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -DeleteFileResponse::~DeleteFileResponse() {} - -void DeleteFileResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = - (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = application_manager_.application(app_id); - if (!app) { - LOG4CXX_ERROR(logger_, "Application not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - (*message_)[strings::msg_params][strings::space_available] = - static_cast<uint32_t>(app->GetAvailableDiskSpace()); - SendResponse((*message_)[strings::msg_params][strings::success].asBool()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc deleted file mode 100644 index bfbb2429ac..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc +++ /dev/null @@ -1,159 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_interaction_choice_set_request.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {} - -void DeleteInteractionChoiceSetRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, - "No application associated with connection key " - << connection_key()); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const int32_t choice_set_id = - (*message_)[strings::msg_params][strings::interaction_choice_set_id] - .asInt(); - - if (!app->FindChoiceSet(choice_set_id)) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id << " is not found."); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return; - } - - if (ChoiceSetInUse(app)) { - LOG4CXX_ERROR(logger_, "Choice set currently in use."); - SendResponse(false, mobile_apis::Result::IN_USE); - return; - } - SendVrDeleteCommand(app); - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::interaction_choice_set_id] = choice_set_id; - msg_params[strings::app_id] = app->app_id(); - - app->RemoveChoiceSet(choice_set_id); - - // Checking of HMI responses will be implemented with APPLINK-14600 - const bool result = true; - SendResponse(result, mobile_apis::Result::SUCCESS); -} - -bool DeleteInteractionChoiceSetRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( - ApplicationConstSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); - if (!app->is_perform_interaction_active()) { - return false; - } - const DataAccessor<PerformChoiceSetMap> accessor = - app->performinteraction_choice_set_map(); - const PerformChoiceSetMap& choice_set_map = accessor.GetData(); - - const uint32_t choice_set_id = - (*message_)[strings::msg_params][strings::interaction_choice_set_id] - .asUInt(); - - PerformChoiceSetMap::const_iterator it = choice_set_map.begin(); - for (; choice_set_map.end() != it; ++it) { - const PerformChoice& choice = it->second; - PerformChoice::const_iterator choice_it = choice.begin(); - for (; choice.end() != choice_it; ++choice_it) { - if (choice_it->first == choice_set_id) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id << " is in use."); - return true; - } - } - } - return true; -} - -void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( - application_manager::ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); - - const uint32_t choice_set_id = - (*message_)[strings::msg_params][strings::interaction_choice_set_id] - .asUInt(); - - smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_set_id); - - if (!choice_set) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id << " is not found."); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice; - msg_params[strings::grammar_id] = (*choice_set)[strings::grammar_id]; - choice_set = &((*choice_set)[strings::choice_set]); - for (uint32_t i = 0; i < (*choice_set).length(); ++i) { - msg_params[strings::cmd_id] = (*choice_set)[i][strings::choice_id]; - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc deleted file mode 100644 index 97e07529af..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_response.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_interaction_choice_set_response.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {} - -void DeleteInteractionChoiceSetResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // check if response false - if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { - if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); - SendResponse(false); - return; - } - } - - const int32_t code = - (*message_)[strings::msg_params][strings::result_code].asInt(); - - if (hmi_apis::Common_Result::SUCCESS == code) { - SendResponse(true); - } else { - // TODO(DK): Some logic - SendResponse(false); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc deleted file mode 100644 index 09f3139245..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc +++ /dev/null @@ -1,192 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_sub_menu_request.h" - -#include "application_manager/message_helper.h" -#include "application_manager/application_impl.h" -#include "interfaces/HMI_API.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -DeleteSubMenuRequest::DeleteSubMenuRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -DeleteSubMenuRequest::~DeleteSubMenuRequest() {} - -void DeleteSubMenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - - const int32_t menu_id = - (*message_)[strings::msg_params][strings::menu_id].asInt(); - - if (!app->FindSubMenu(menu_id)) { - LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found."); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::menu_id] = - (*message_)[strings::msg_params][strings::menu_id]; - msg_params[strings::app_id] = app->app_id(); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params, true); -} - -void DeleteSubMenuRequest::DeleteSubMenuVRCommands( - ApplicationConstSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); - - const DataAccessor<CommandsMap> accessor = app->commands_map(); - const CommandsMap& commands = accessor.GetData(); - CommandsMap::const_iterator it = commands.begin(); - - for (; commands.end() != it; ++it) { - if (!(*it->second).keyExists(strings::vr_commands)) { - continue; - } - - if ((*message_)[strings::msg_params][strings::menu_id].asInt() == - (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) { - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt(); - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::grammar_id] = app->get_grammar_id(); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - } - } -} - -void DeleteSubMenuRequest::DeleteSubMenuUICommands( - ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); - - const DataAccessor<CommandsMap> accessor(app->commands_map()); - const CommandsMap& commands = accessor.GetData(); - CommandsMap::const_iterator it = commands.begin(); - - while (commands.end() != it) { - if (!(*it->second).keyExists(strings::menu_params)) { - LOG4CXX_ERROR(logger_, "menu_params not exist"); - ++it; - continue; - } - - if ((*message_)[strings::msg_params][strings::menu_id].asInt() == - (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) { - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt(); - app->RemoveCommand((*it->second)[strings::cmd_id].asInt()); - it = commands.begin(); // Can not relay on - // iterators after erase was called - - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - } else { - ++it; - } - } -} - -void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_DeleteSubMenu: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - if (result) { - // delete sub menu items from SDL and HMI - DeleteSubMenuVRCommands(application); - DeleteSubMenuUICommands(application); - application->RemoveSubMenu( - (*message_)[strings::msg_params][strings::menu_id].asInt()); - } - - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -bool DeleteSubMenuRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc deleted file mode 100644 index ad9d2ad858..0000000000 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/delete_sub_menu_response.h" - -namespace application_manager { - -namespace commands { - -DeleteSubMenuResponse::DeleteSubMenuResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -DeleteSubMenuResponse::~DeleteSubMenuResponse() {} - -void DeleteSubMenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc deleted file mode 100644 index 7704d700f9..0000000000 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <algorithm> -#include "application_manager/commands/mobile/diagnostic_message_request.h" - -#include "application_manager/application_impl.h" - -#include "interfaces/HMI_API.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -DiagnosticMessageRequest::DiagnosticMessageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -DiagnosticMessageRequest::~DiagnosticMessageRequest() {} - -void DiagnosticMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered."); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const std::vector<uint32_t>& supported_diag_modes = - application_manager_.get_settings().supported_diag_modes(); - - smart_objects::SmartObject& msg_data = - (*message_)[strings::msg_params][strings::message_data]; - - const uint8_t mode_position = 0; - const uint32_t msg_diagnostic_mode = msg_data[mode_position].asUInt(); - if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(), - supported_diag_modes.end(), - msg_diagnostic_mode)) { - LOG4CXX_ERROR(logger_, - "Received diagnostic mode " << msg_diagnostic_mode - << " is not supported."); - SendResponse(false, - mobile_apis::Result::REJECTED, - "Received diagnostic mode is not supported."); - return; - } - - // Add app_id for HMI request - (*message_)[strings::msg_params][strings::app_id] = app->app_id(); - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage, - &(*message_)[strings::msg_params], - true); -} - -void DiagnosticMessageRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo); - std::string response_info; - GetInfo(message, response_info); - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc deleted file mode 100644 index 8c59a97a8b..0000000000 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/diagnostic_message_response.h" - -namespace application_manager { - -namespace commands { - -DiagnosticMessageResponse::DiagnosticMessageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -DiagnosticMessageResponse::~DiagnosticMessageResponse() {} - -void DiagnosticMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/src/commands/mobile/dial_number_request.cc deleted file mode 100644 index d0ab42e266..0000000000 --- a/src/components/application_manager/src/commands/mobile/dial_number_request.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <algorithm> -#include <string> -#include "application_manager/commands/mobile/dial_number_request.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -DialNumberRequest::~DialNumberRequest() {} - -bool DialNumberRequest::Init() { - LOG4CXX_AUTO_TRACE(logger_); - - default_timeout_ = 0; - - return true; -} - -void DialNumberRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - std::string number = - (*message_)[strings::msg_params][strings::number].asString(); - if (!CheckSyntax(number)) { - LOG4CXX_ERROR(logger_, "Invalid incoming data"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - StripNumberParam(number); - if (number.empty()) { - LOG4CXX_ERROR(logger_, - "After strip number param is empty. Invalid incoming data"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::number] = - (*message_)[strings::msg_params][strings::number].asString(); - msg_params[strings::app_id] = application->hmi_app_id(); - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); - SendHMIRequest( - hmi_apis::FunctionID::BasicCommunication_DialNumber, &msg_params, true); -} - -void DialNumberRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - const smart_objects::SmartObject& message = event.smart_object(); - mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; - switch (event.id()) { - case hmi_apis::FunctionID::BasicCommunication_DialNumber: { - LOG4CXX_INFO(logger_, "Received DialNumber event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); - result_code = CommandRequestImpl::GetMobileResultCode( - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt())); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } - - const bool is_success = mobile_apis::Result::SUCCESS == result_code; - const bool is_info_valid = - message[strings::msg_params].keyExists(strings::info); - - if (is_info_valid) { - const char* info_char_array = - message[strings::msg_params][strings::info].asCharArray(); - SendResponse(is_success, result_code, info_char_array); - return; - } - - SendResponse(is_success, result_code); -} - -void DialNumberRequest::StripNumberParam(std::string& number) { - std::size_t found = 0; - while (std::string::npos != - (found = number.find_first_not_of("0123456789*#,;+"))) { - number.erase(number.begin() + found); - } - (*message_)[strings::msg_params][strings::number] = number; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/src/commands/mobile/dial_number_response.cc deleted file mode 100644 index 750dcf25c4..0000000000 --- a/src/components/application_manager/src/commands/mobile/dial_number_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/dial_number_response.h" - -namespace application_manager { - -namespace commands { - -DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -DialNumberResponse::~DialNumberResponse() {} - -void DialNumberResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc deleted file mode 100644 index fb168e4256..0000000000 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/end_audio_pass_thru_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -EndAudioPassThruRequest::EndAudioPassThruRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -EndAudioPassThruRequest::~EndAudioPassThruRequest() {} - -void EndAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_EndAudioPassThru, NULL, true); -} - -void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_EndAudioPassThru: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - if (result) { - uint32_t app_id = connection_key(); - bool ended_successfully = application_manager_.EndAudioPassThru(app_id); - if (ended_successfully) { - application_manager_.StopAudioPassThru(app_id); - } - } - - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc deleted file mode 100644 index bb477f5083..0000000000 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/end_audio_pass_thru_response.h" - -namespace application_manager { - -namespace commands { - -EndAudioPassThruResponse::EndAudioPassThruResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -EndAudioPassThruResponse::~EndAudioPassThruResponse() {} - -void EndAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/generic_response.cc b/src/components/application_manager/src/commands/mobile/generic_response.cc deleted file mode 100644 index 20f6931bb9..0000000000 --- a/src/components/application_manager/src/commands/mobile/generic_response.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/generic_response.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -void GenericResponse::Run() { - /*NsSmartDeviceLink::NsSmartObjects::SmartObject response; - - response[strings::params][strings::correlation_id] = - (*message_)[strings::params][strings::correlation_id]; - response[strings::params][strings::protocol_version] = - (*message_)[strings::params][strings::protocol_version]; - response[strings::params][strings::connection_key] = - (*message_)[strings::params][strings::connection_key]; - - response[strings::msg_params][strings::success] = false; - */ - - (*message_)[strings::params][strings::message_type] = MessageType::kResponse; - (*message_)[strings::msg_params][strings::success] = false; - (*message_)[strings::msg_params][strings::result_code] = - mobile_apis::Result::INVALID_DATA; - - SendResponse(false); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc deleted file mode 100644 index 88fd07234a..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/get_dtcs_request.h" - -#include "application_manager/application_impl.h" -#include "interfaces/HMI_API.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -GetDTCsRequest::GetDTCsRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -GetDTCsRequest::~GetDTCsRequest() {} - -void GetDTCsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::params][strings::connection_key].asUInt()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::ecu_name] = - (*message_)[strings::msg_params][strings::ecu_name]; - - if ((*message_)[strings::msg_params].keyExists(strings::dtc_mask)) { - msg_params[strings::dtc_mask] = - (*message_)[strings::msg_params][strings::dtc_mask]; - } - - msg_params[strings::app_id] = app->app_id(); - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_GetDTCs, &msg_params, true); -} - -void GetDTCsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::VehicleInfo_GetDTCs: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo); - std::string response_info; - GetInfo(message, response_info); - - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc deleted file mode 100644 index ecaf5c3d8f..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/get_dtcs_response.h" - -namespace application_manager { - -namespace commands { - -GetDTCsResponse::GetDTCsResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -GetDTCsResponse::~GetDTCsResponse() {} - -void GetDTCsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/src/commands/mobile/get_system_capability_request.cc deleted file mode 100644 index 71cde5158d..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_system_capability_request.cc +++ /dev/null @@ -1,95 +0,0 @@ -#include "application_manager/commands/mobile/get_system_capability_request.h" - -namespace application_manager { - -namespace commands { - -GetSystemCapabilityRequest::GetSystemCapabilityRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -GetSystemCapabilityRequest::~GetSystemCapabilityRequest() {} - -void GetSystemCapabilityRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - smart_objects::SmartObject response_params(smart_objects::SmartType_Map); - mobile_apis::SystemCapabilityType::eType response_type = - static_cast<mobile_apis::SystemCapabilityType::eType>( - (*message_)[strings::msg_params][strings::system_capability_type] - .asInt()); - response_params[strings::system_capability][strings::system_capability_type] = - response_type; - - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - - switch (response_type) { - case mobile_apis::SystemCapabilityType::NAVIGATION: { - if (hmi_capabilities.navigation_capability()) { - response_params[strings::system_capability] - [strings::navigation_capability] = - *hmi_capabilities.navigation_capability(); - } else { - SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); - return; - } - break; - } - case mobile_apis::SystemCapabilityType::PHONE_CALL: { - if (hmi_capabilities.phone_capability()) { - response_params[strings::system_capability][strings::phone_capability] = - *hmi_capabilities.phone_capability(); - } else { - SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); - return; - } - break; - } - case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: { - if (hmi_capabilities.rc_capability()) { - response_params[strings::system_capability][strings::rc_capability] = - *hmi_capabilities.rc_capability(); - } else { - SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); - return; - } - break; - } - case mobile_apis::SystemCapabilityType::VIDEO_STREAMING: - if (hmi_capabilities.video_streaming_capability()) { - response_params[strings::system_capability] - [strings::video_streaming_capability] = - *hmi_capabilities.video_streaming_capability(); - } else { - SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); - return; - } - break; - default: // Return unsupported resource - SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); - return; - } - SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); -} - -void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) { - LOG4CXX_INFO(logger_, "GetSystemCapabilityRequest on_event"); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_system_capability_response.cc b/src/components/application_manager/src/commands/mobile/get_system_capability_response.cc deleted file mode 100644 index 91c2562cd3..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_system_capability_response.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include "application_manager/application_manager.h" -#include "application_manager/commands/mobile/get_system_capability_response.h" - -namespace application_manager { - -namespace commands { - -GetSystemCapabilityResponse::GetSystemCapabilityResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -GetSystemCapabilityResponse::~GetSystemCapabilityResponse() {} - -void GetSystemCapabilityResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc deleted file mode 100644 index f81d0a8c2a..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc +++ /dev/null @@ -1,306 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string> -#include "application_manager/commands/mobile/get_vehicle_data_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -namespace str = strings; - -#ifdef HMI_DBUS_API -GetVehicleDataRequest::GetVehicleDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -GetVehicleDataRequest::~GetVehicleDataRequest() {} - -void GetVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - int32_t app_id = - (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = application_manager_.application(app_id); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const VehicleData& vehicle_data = MessageHelper::vehicle_data(); - VehicleData::const_iterator it = vehicle_data.begin(); - - for (; vehicle_data.end() != it; ++it) { - if (true == (*message_)[str::msg_params].keyExists(it->first) && - true == (*message_)[str::msg_params][it->first].asBool()) { - SendRequestsToHmi(app->app_id()); - return; - } - } - - SendResponse(false, mobile_apis::Result::INVALID_DATA); -} - -namespace { -struct Subrequest { - hmi_apis::FunctionID::eType func_id; - const char* str; -}; -Subrequest subrequests[] = { - {hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps}, - {hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed}, - {hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm}, - {hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level}, - {hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState, - str::fuel_level_state}, - {hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption, - str::instant_fuel_consumption}, - {hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature, - str::external_temp}, - {hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin}, - {hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl}, - {hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure}, - {hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer}, - {hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status}, - {hmi_apis::FunctionID::VehicleInfo_GetBodyInformation, - str::body_information}, - {hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status}, - {hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking}, - {hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status}, - {hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus, - str::head_lamp_status}, - {hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque}, - {hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos}, - {hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle, - str::steering_wheel_angle}, - {hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info}, - {hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status}, - {hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event}, - {hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus, - str::cluster_mode_status}, - {hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key}, -}; -} - -void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) { - smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app_id; - - for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) { - const Subrequest& sr = subrequests[i]; - if (true == (*message_)[str::msg_params].keyExists(sr.str) && - true == (*message_)[str::msg_params][sr.str].asBool()) { - HmiRequest hmi_request; - hmi_request.str = sr.str; - hmi_request.func_id = sr.func_id; - hmi_request.complete = false; - hmi_requests_.push_back(hmi_request); - } - } - - LOG4CXX_INFO(logger_, - hmi_requests_.size() << " requests are going to be sent to HMI"); - - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - SendHMIRequest(it->func_id, &msg_params, true); - } -} - -void GetVehicleDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_INFO(logger_, "GetVehicleDataRequest::on_event " << event.id()); - - const smart_objects::SmartObject& message = event.smart_object(); - - for (HmiRequests::iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - HmiRequest& hmi_request = *it; - if (hmi_request.func_id == event.id()) { - hmi_request.status = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - if (hmi_apis::Common_Result::SUCCESS == hmi_request.status) - hmi_request.value = message[str::msg_params][hmi_request.str]; - hmi_request.complete = true; - break; - } - } - - bool all_complete = true; - bool any_arg_success = false; - mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS; - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - if (!it->complete) { - all_complete = false; - break; - } - if (hmi_apis::Common_Result::SUCCESS != it->status) { - if (mobile_api::Result::SUCCESS == status) { - status = static_cast<mobile_apis::Result::eType>(it->status); - } else if (status != - static_cast<mobile_apis::Result::eType>(it->status)) { - status = mobile_api::Result::eType::GENERIC_ERROR; - } - LOG4CXX_TRACE(logger_, - "Status from HMI: " << it->status - << ", so response status become " - << status); - } else { - any_arg_success = true; - } - } - - if (all_complete) { - smart_objects::SmartObject response_params(smart_objects::SmartType_Map); - if (any_arg_success) { - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - response_params[it->str] = it->value; - } - } - LOG4CXX_INFO(logger_, "All HMI requests are complete"); - const char* info = NULL; - std::string error_message; - if (true == message[strings::params].keyExists(strings::error_msg)) { - error_message = message[strings::params][strings::error_msg].asString(); - info = error_message.c_str(); - } - SendResponse(any_arg_success, status, info, &response_params); - } -} -#else -GetVehicleDataRequest::GetVehicleDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -GetVehicleDataRequest::~GetVehicleDataRequest() {} - -void GetVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - int32_t app_id = - (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = application_manager_.application(app_id); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (app->AreCommandLimitsExceeded( - static_cast<mobile_apis::FunctionID::eType>(function_id()), - application_manager::TLimitSource::CONFIG_FILE)) { - LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high."); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - const VehicleData& vehicle_data = MessageHelper::vehicle_data(); - VehicleData::const_iterator it = vehicle_data.begin(); - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); - const uint32_t min_length_msg_params = 1; - for (; vehicle_data.end() != it; ++it) { - if (true == (*message_)[str::msg_params].keyExists(it->first) && - true == (*message_)[str::msg_params][it->first].asBool()) { - msg_params[it->first] = (*message_)[strings::msg_params][it->first]; - } - } - if (msg_params.length() > min_length_msg_params) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - SendHMIRequest( - hmi_apis::FunctionID::VehicleInfo_GetVehicleData, &msg_params, true); - return; - } else if (HasDisallowedParams()) { - SendResponse(false, mobile_apis::Result::DISALLOWED); - } else { - SendResponse(false, mobile_apis::Result::INVALID_DATA); - } -} - -void GetVehicleDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo); - std::string response_info; - GetInfo(message, response_info); - result = result || - ((hmi_apis::Common_Result::DATA_NOT_AVAILABLE == result_code) && - (message[strings::msg_params].length() > 1)); - - if (true == - message[strings::msg_params].keyExists(hmi_response::method)) { - message[strings::msg_params].erase(hmi_response::method); - } - if (true == message[strings::params].keyExists(strings::error_msg)) { - response_info = message[strings::params][strings::error_msg].asString(); - } - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -#endif // #ifdef HMI_DBUS_API - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc deleted file mode 100644 index 1e64746262..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/get_vehicle_data_response.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -GetVehicleDataResponse::GetVehicleDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -GetVehicleDataResponse::~GetVehicleDataResponse() {} - -void GetVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc deleted file mode 100644 index da4ce38646..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc +++ /dev/null @@ -1,75 +0,0 @@ -#include "application_manager/application_manager.h" -#include "application_manager/commands/mobile/get_way_points_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -GetWayPointsRequest::GetWayPointsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); -} - -GetWayPointsRequest::~GetWayPointsRequest() {} - -void GetWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params = (*message_)[strings::msg_params]; - msg_params[strings::app_id] = app->app_id(); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest(hmi_apis::FunctionID::Navigation_GetWayPoints, - msg_params.empty() ? NULL : &msg_params, - true); -} - -void GetWayPointsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } - case hmi_apis::FunctionID::Navigation_GetWayPoints: { - LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - const hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_Navigation); - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc deleted file mode 100644 index 7956b34cae..0000000000 --- a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include "application_manager/application_manager.h" -#include "application_manager/commands/mobile/get_way_points_response.h" - -namespace application_manager { - -namespace commands { - -GetWayPointsResponse::GetWayPointsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -GetWayPointsResponse::~GetWayPointsResponse() {} - -void GetWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/list_files_request.cc b/src/components/application_manager/src/commands/mobile/list_files_request.cc deleted file mode 100644 index 794fba631d..0000000000 --- a/src/components/application_manager/src/commands/mobile/list_files_request.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string> -#include "application_manager/commands/mobile/list_files_request.h" - -#include "application_manager/application_impl.h" - -#include "application_manager/mobile_command_factory.h" -#include "utils/file_system.h" - -namespace application_manager { - -namespace commands { - -ListFilesRequest::ListFilesRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -ListFilesRequest::~ListFilesRequest() {} - -void ListFilesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - - if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) && - (application_manager_.get_settings().list_files_in_none() <= - application->list_files_in_none_count())) { - // If application is in the HMI_NONE level the quantity of allowed - // DeleteFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - application->increment_list_files_in_none_count(); - - (*message_)[strings::msg_params][strings::space_available] = - static_cast<int32_t>(application->GetAvailableDiskSpace()); - // Enumarating through File system - uint32_t i = 0; - std::string directory_name = - application_manager_.get_settings().app_storage_folder(); - directory_name += "/" + application->folder_name(); - std::vector<std::string> persistent_files = - file_system::ListFiles(directory_name); - std::vector<std::string>::const_iterator it = persistent_files.begin(); - for (; it != persistent_files.end(); ++it) { - if (i < application_manager_.get_settings().list_files_response_size()) { - LOG4CXX_DEBUG(logger_, "File " + *it + " added to ListFiles response"); - (*message_)[strings::msg_params][strings::filenames][i++] = *it; - } else { - LOG4CXX_DEBUG(logger_, - "File " + *it + " not added to ListFiles response"); - } - } - (*message_)[strings::params][strings::message_type] = - application_manager::MessageType::kResponse; - SendResponse(true, - mobile_apis::Result::SUCCESS, - NULL, - &(*message_)[strings::msg_params]); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/list_files_response.cc b/src/components/application_manager/src/commands/mobile/list_files_response.cc deleted file mode 100644 index fde15a94ef..0000000000 --- a/src/components/application_manager/src/commands/mobile/list_files_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/list_files_response.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -ListFilesResponse::ListFilesResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -ListFilesResponse::~ListFilesResponse() {} - -void ListFilesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc deleted file mode 100644 index 6064374dab..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_app_interface_unregistered_notification.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_app_interface_unregistered_notification.h" -#include "application_manager/message.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { -namespace commands { - -OnAppInterfaceUnregisteredNotification::OnAppInterfaceUnregisteredNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnAppInterfaceUnregisteredNotification:: - ~OnAppInterfaceUnregisteredNotification() {} - -void OnAppInterfaceUnregisteredNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc deleted file mode 100644 index d0fa3597bc..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_audio_pass_thru_notification.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_audio_pass_thru_notification.h" - -namespace application_manager { -namespace commands { - -OnAudioPassThruNotification::OnAudioPassThruNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnAudioPassThruNotification::~OnAudioPassThruNotification() {} - -void OnAudioPassThruNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc deleted file mode 100644 index 7c631d6d4b..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_button_event_notification.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -namespace mobile { - -OnButtonEventNotification::OnButtonEventNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnButtonEventNotification::~OnButtonEventNotification() {} - -void OnButtonEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const uint32_t btn_id = static_cast<uint32_t>( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); - - const bool is_app_id_exists = - (*message_)[strings::msg_params].keyExists(strings::app_id); - ApplicationSharedPtr app; - - // CUSTOM_BUTTON notification - if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { - // app_id is mandatory for CUSTOM_BUTTON notification - if (!is_app_id_exists) { - LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id."); - return; - } - - app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asUInt()); - - // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == - (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - LOG4CXX_ERROR(logger_, - "CUSTOM_BUTTON OnButtonEvent without custom_button_id."); - return; - } - - if (!app) { - LOG4CXX_ERROR(logger_, "Application doesn't exist."); - return; - } - - uint32_t custom_btn_id = 0; - custom_btn_id = - (*message_)[strings::msg_params][hmi_response::custom_button_id] - .asUInt(); - - if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - LOG4CXX_ERROR(logger_, - "Application doesn't subscribed to this custom_button_id."); - return; - } - - if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) { - LOG4CXX_WARN(logger_, - "CUSTOM_BUTTON OnButtonEvent notification is allowed only " - << "in FULL or LIMITED hmi level"); - return; - } - - SendButtonEvent(app); - return; - } - - const std::vector<ApplicationSharedPtr>& subscribed_apps = - application_manager_.applications_by_button(btn_id); - - std::vector<ApplicationSharedPtr>::const_iterator it = - subscribed_apps.begin(); - for (; subscribed_apps.end() != it; ++it) { - ApplicationSharedPtr subscribed_app = *it; - if (!subscribed_app) { - LOG4CXX_WARN(logger_, "Null pointer to subscribed app."); - continue; - } - - // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { - LOG4CXX_WARN(logger_, - "OnButtonEvent notification is allowed only" - << "in FULL or LIMITED hmi level"); - continue; - } - // if "app_id" absent send notification only in HMI_FULL mode - if (is_app_id_exists || subscribed_app->IsFullscreen()) { - SendButtonEvent(subscribed_app); - } - } -} - -void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { - if (!app) { - LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer"); - return; - } - - smart_objects::SmartObjectSPtr on_btn_event = - new smart_objects::SmartObject(); - - if (!on_btn_event) { - LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer"); - return; - } - - (*on_btn_event)[strings::params][strings::connection_key] = app->app_id(); - - (*on_btn_event)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonEventID); - - (*on_btn_event)[strings::msg_params][strings::button_name] = - (*message_)[strings::msg_params][hmi_response::button_name]; - (*on_btn_event)[strings::msg_params][strings::button_event_mode] = - (*message_)[strings::msg_params][hmi_response::button_mode]; - - if ((*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - (*on_btn_event)[strings::msg_params][strings::custom_button_id] = - (*message_)[strings::msg_params][strings::custom_button_id]; - } - - message_ = on_btn_event; - SendNotification(); -} - -} // namespace mobile - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc deleted file mode 100644 index ae6658b93a..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc +++ /dev/null @@ -1,181 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_button_press_notification.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -namespace mobile { - -OnButtonPressNotification::OnButtonPressNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnButtonPressNotification::~OnButtonPressNotification() {} - -void OnButtonPressNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const uint32_t btn_id = static_cast<uint32_t>( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); - - const bool is_app_id_exists = - (*message_)[strings::msg_params].keyExists(strings::app_id); - ApplicationSharedPtr app; - - // CUSTOM_BUTTON notification - if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { - // app_id is mandatory for CUSTOM_BUTTON notification - if (!is_app_id_exists) { - LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonPress without app_id."); - return; - } - - app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asUInt()); - - // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == - (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - LOG4CXX_ERROR(logger_, - "CUSTOM_BUTTON OnButtonPress without custom_button_id."); - return; - } - - if (!app) { - LOG4CXX_ERROR(logger_, "Application doesn't exist."); - return; - } - - uint32_t custom_btn_id = 0; - custom_btn_id = - (*message_)[strings::msg_params][hmi_response::custom_button_id] - .asUInt(); - - if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - LOG4CXX_ERROR(logger_, - "Application doesn't subscribed to this custom_button_id."); - return; - } - - // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) { - LOG4CXX_WARN(logger_, - "CUSTOM_BUTTON OnButtonPress notification is allowed only " - << "in FULL or LIMITED hmi level"); - return; - } - - SendButtonPress(app); - return; - } - - const std::vector<ApplicationSharedPtr>& subscribed_apps = - application_manager_.applications_by_button(btn_id); - - std::vector<ApplicationSharedPtr>::const_iterator it = - subscribed_apps.begin(); - for (; subscribed_apps.end() != it; ++it) { - ApplicationSharedPtr subscribed_app = *it; - if (!subscribed_app) { - LOG4CXX_WARN(logger_, "Null pointer to subscribed app."); - continue; - } - - // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) && - (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) { - LOG4CXX_WARN(logger_, - "OnButtonPress notification is allowed only" - << "in FULL or LIMITED hmi level"); - continue; - } - // if "appID" is present, send it to named app only if its FULL or - // LIMITED - if (app.valid()) { - if (app->app_id() == subscribed_app->app_id()) { - SendButtonPress(subscribed_app); - } - } else if (subscribed_app->IsFullscreen()) { - // if No "appID" - send it FULL apps only. - SendButtonPress(subscribed_app); - } - } -} - -void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { - if (!app) { - LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer"); - return; - } - - smart_objects::SmartObjectSPtr on_btn_press = - new smart_objects::SmartObject(); - - if (!on_btn_press) { - LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer"); - return; - } - - (*on_btn_press)[strings::params][strings::connection_key] = app->app_id(); - - (*on_btn_press)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonPressID); - - (*on_btn_press)[strings::msg_params][strings::button_name] = - (*message_)[strings::msg_params][hmi_response::button_name]; - (*on_btn_press)[strings::msg_params][strings::button_press_mode] = - (*message_)[strings::msg_params][hmi_response::button_mode]; - - if ((*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - (*on_btn_press)[strings::msg_params][strings::custom_button_id] = - (*message_)[strings::msg_params][strings::custom_button_id]; - } - - message_ = on_btn_press; - SendNotification(); -} - -} // namespace mobile - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/src/commands/mobile/on_command_notification.cc deleted file mode 100644 index ae8aeff771..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_command_notification.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_command_notification.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -OnCommandNotification::OnCommandNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnCommandNotification::~OnCommandNotification() {} - -void OnCommandNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asInt()); - - if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); - return; - } - - const uint32_t cmd_id = - (*message_)[strings::msg_params][strings::cmd_id].asUInt(); - - if (!app->FindCommand(cmd_id)) { - LOG4CXX_ERROR(logger_, " No applications found for the command " << cmd_id); - return; - } - - (*message_)[strings::params][strings::connection_key] = app->app_id(); - // remove app_id from notification - if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { - (*message_)[strings::msg_params].erase(strings::app_id); - } - - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc deleted file mode 100644 index 44ed2cf3b7..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_driver_distraction_notification.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_driver_distraction_notification.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -namespace mobile { - -OnDriverDistractionNotification::OnDriverDistractionNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnDriverDistractionNotification::~OnDriverDistractionNotification() {} - -void OnDriverDistractionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} - -} // namespace mobile - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc deleted file mode 100644 index 19b93f2cbf..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_hash_change_notification.cc +++ /dev/null @@ -1,75 +0,0 @@ - -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_hash_change_notification.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include <string> - -namespace application_manager { - -namespace commands { - -namespace mobile { - -OnHashChangeNotification::OnHashChangeNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnHashChangeNotification::~OnHashChangeNotification() {} - -void OnHashChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - (*message_)[strings::params][strings::message_type] = - static_cast<int32_t>(application_manager::MessageType::kNotification); - - int32_t app_id; - app_id = (*message_)[strings::params][strings::connection_key].asInt(); - ApplicationSharedPtr app = application_manager_.application(app_id); - if (app) { - (*message_)[strings::msg_params][strings::hash_id] = app->curHash(); - SendNotification(); - } else { - LOG4CXX_WARN(logger_, - "Application with app_id " << app_id << " does not exist"); - } -} - -} // namespace mobile - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc deleted file mode 100644 index 5225002652..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_hmi_status_notification.h" - -#include "application_manager/message_helper.h" -#include "application_manager/message.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { -namespace commands { - -OnHMIStatusNotification::OnHMIStatusNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnHMIStatusNotification::~OnHMIStatusNotification() {} - -void OnHMIStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - (*message_)[strings::params][strings::message_type] = - static_cast<int32_t>(application_manager::MessageType::kNotification); - ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist"); - return; - } - - mobile_apis::HMILevel::eType hmi_level = - static_cast<mobile_apis::HMILevel::eType>( - (*message_)[strings::msg_params][strings::hmi_level].asInt()); - if ((mobile_apis::HMILevel::HMI_BACKGROUND == hmi_level) || - (mobile_apis::HMILevel::HMI_NONE == hmi_level)) { - if (!(app->tts_properties_in_none())) { - app->set_tts_properties_in_none(true); - LOG4CXX_INFO(logger_, - "OnHMIStatusNotification::Send TTS GlobalProperties" - " with empty array to HMI"); - MessageHelper::SendTTSGlobalProperties(app, false, application_manager_); - } - } else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) || - (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { - if (!(app->tts_properties_in_full())) { - app->set_tts_properties_in_full(true); - LOG4CXX_INFO(logger_, - "OnHMIStatusNotification AddAppToTTSGlobalPropertiesList"); - application_manager_.AddAppToTTSGlobalPropertiesList(app->app_id()); - } - } - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc deleted file mode 100644 index 4bb6cfe9d5..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h" -#include "application_manager/message_helper.h" -#include "application_manager/message.h" - -namespace application_manager { -namespace commands { - -OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationFromMobileImpl(message, application_manager) {} - -OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {} - -void OnHMIStatusNotificationFromMobile::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - (*message_)[strings::params][strings::message_type] = - static_cast<int32_t>(application_manager::MessageType::kNotification); - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app.valid()) { - LOG4CXX_ERROR( - logger_, "OnHMIStatusNotificationFromMobile application doesn't exist"); - return; - } - - mobile_apis::HMILevel::eType current_hmi_state = - static_cast<mobile_apis::HMILevel::eType>( - (*message_)[strings::msg_params][strings::hmi_level].asUInt()); - - bool is_current_state_foreground = - mobile_apis::HMILevel::HMI_FULL == current_hmi_state; - - app->set_foreground(is_current_state_foreground); - - connection_handler::DeviceHandle handle = app->device(); - bool is_apps_requested_before = - application_manager_.IsAppsQueriedFrom(handle); - - LOG4CXX_DEBUG(logger_, - "Mobile HMI state notication came for connection key:" - << connection_key() << " and handle: " << handle); - - if (!is_apps_requested_before && - Message::is_sufficient_version( - protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4, - app->protocol_version()) && - app->is_foreground()) { - // In case this notification will be received from mobile side with - // foreground level for app on mobile, this should trigger remote - // apps list query for SDL 4.0+ app - MessageHelper::SendQueryApps(connection_key(), application_manager_); - return; - } - - if (is_apps_requested_before) { - LOG4CXX_DEBUG(logger_, - "Remote apps list had been requested already " - " for handle: " - << handle); - - if (Message::is_sufficient_version( - protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4, - app->protocol_version())) { - const ApplicationSet& accessor = - application_manager_.applications().GetData(); - - bool is_another_foreground_sdl4_app = false; - ApplicationSetConstIt it = accessor.begin(); - for (; accessor.end() != it; ++it) { - if (connection_key() != (*it)->app_id() && - Message::is_sufficient_version( - protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4, - (*it)->protocol_version()) && - (*it)->is_foreground()) { - is_another_foreground_sdl4_app = true; - break; - } - } - - if (!is_another_foreground_sdl4_app) { - application_manager_.MarkAppsGreyOut(handle, - !is_current_state_foreground); - application_manager_.SendUpdateAppList(); - } - } - return; - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc deleted file mode 100644 index 427f52c12b..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_keyboard_input_notification.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -namespace mobile { - -OnKeyBoardInputNotification::OnKeyBoardInputNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {} - -void OnKeyBoardInputNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app_to_notify; - - DataAccessor<ApplicationSet> accessor = application_manager_.applications(); - ApplicationSetIt it = accessor.GetData().begin(); - for (; accessor.GetData().end() != it; ++it) { - // if there is app with active perform interaction use it for notification - ApplicationSharedPtr app = *it; - if (app->is_perform_interaction_active() && - (*it)->perform_interaction_layout() == - mobile_apis::LayoutMode::KEYBOARD) { - LOG4CXX_INFO(logger_, - "There is application with active PerformInteraction"); - app_to_notify = app; - break; - } - - if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level()) { - LOG4CXX_INFO(logger_, "There is application in HMI_FULL level"); - app_to_notify = app; - } - } - - if (app_to_notify.valid()) { - (*message_)[strings::params][strings::connection_key] = - app_to_notify->app_id(); - SendNotification(); - } -} - -} // namespace mobile - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc deleted file mode 100644 index 76420b85b6..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_language_change_notification.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_language_change_notification.h" - -namespace application_manager { - -namespace commands { - -OnLanguageChangeNotification::OnLanguageChangeNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnLanguageChangeNotification::~OnLanguageChangeNotification() {} - -void OnLanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc deleted file mode 100644 index 09c407b8b5..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_permissions_change_notification.h" -#include "application_manager/message.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnPermissionsChangeNotification::OnPermissionsChangeNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {} - -void OnPermissionsChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendNotification(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc deleted file mode 100644 index c29ff3e2d3..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc +++ /dev/null @@ -1,201 +0,0 @@ -/* - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <cstring> -#include <cstdio> -#include <string> -#include "application_manager/commands/mobile/on_system_request_notification.h" -#include "interfaces/MOBILE_API.h" -#include "utils/file_system.h" -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler_interface.h" - -namespace application_manager { - -namespace commands { - -namespace mobile { - -OnSystemRequestNotification::OnSystemRequestNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnSystemRequestNotification::~OnSystemRequestNotification() {} - -void OnSystemRequestNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - using namespace application_manager; - using namespace mobile_apis; - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app.valid()) { - LOG4CXX_ERROR(logger_, - "Application with connection key " << connection_key() - << " is not registered."); - return; - } - - RequestType::eType request_type = static_cast<RequestType::eType>( - (*message_)[strings::msg_params][strings::request_type].asInt()); - const policy::PolicyHandlerInterface& policy_handler = - application_manager_.GetPolicyHandler(); - if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(), - request_type)) { - LOG4CXX_WARN(logger_, - "Request type " << request_type - << " is not allowed by policies"); - return; - } - - if (RequestType::PROPRIETARY == request_type) { - /* According to requirements: - "If the requestType = PROPRIETARY, add to mobile API fileType = JSON - If the requestType = HTTP, add to mobile API fileType = BINARY" - Also in Genivi SDL we don't save the PT to file - we put it directly in - binary_data */ - - const std::string filename = - (*message_)[strings::msg_params][strings::file_name].asString(); - BinaryMessage binary_data; - file_system::ReadBinaryFile(filename, binary_data); -#if defined(PROPRIETARY_MODE) - AddHeader(binary_data); -#endif // PROPRIETARY_MODE - -#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE) - (*message_)[strings::params][strings::binary_data] = binary_data; -#endif // PROPRIETARY_MODE - - (*message_)[strings::msg_params][strings::file_type] = FileType::JSON; - } else if (RequestType::HTTP == request_type) { - (*message_)[strings::msg_params][strings::file_type] = FileType::BINARY; - if ((*message_)[strings::msg_params].keyExists(strings::url)) { - (*message_)[strings::msg_params][strings::timeout] = - policy_handler.TimeoutExchangeSec(); - } - } - - SendNotification(); -} - -#ifdef PROPRIETARY_MODE -void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const { - LOG4CXX_AUTO_TRACE(logger_); - const uint32_t timeout = - application_manager_.GetPolicyHandler().TimeoutExchangeSec(); - - size_t content_length; - char size_str[24]; - - if (0 > sprintf(size_str, "%zu", static_cast<size_t>(message.size()))) { - memset(size_str, 0, sizeof(size_str)); - } - - char timeout_str[24]; - if (0 > sprintf(timeout_str, "%d", timeout)) { - memset(timeout_str, 0, sizeof(timeout_str)); - } - - std::string policy_table_string = std::string(message.begin(), message.end()); - - /* The Content-Length to be sent in the HTTP Request header should be - calculated before additional escape characters are added to the - policy table string. The mobile proxy will remove the escape - characters after receiving this request. */ - - content_length = ParsePTString(policy_table_string); - - if (0 > sprintf(size_str, "%zu", content_length)) { - memset(size_str, 0, sizeof(size_str)); - } - - const std::string header = - - "{" - " \"HTTPRequest\": {" - "\"headers\": {" - "\"ContentType\": \"application/json\"," - "\"ConnectTimeout\": " + - std::string(timeout_str) + - "," - "\"DoOutput\": true," - "\"DoInput\": true," - "\"UseCaches\": false," - "\"RequestMethod\": \"POST\"," - "\"ReadTimeout\":" + - std::string(timeout_str) + - "," - "\"InstanceFollowRedirects\": false," - "\"charset\": \"utf-8\"," - "\"Content-Length\": " + - std::string(size_str) + - "}," - "\"body\": \"" + - policy_table_string + - "\"" - "}" - "}"; - - message.clear(); - message.assign(header.begin(), header.end()); - - LOG4CXX_DEBUG( - logger_, "Header added: " << std::string(message.begin(), message.end())); -} - -size_t OnSystemRequestNotification::ParsePTString( - std::string& pt_string) const { - std::string result; - size_t length = pt_string.length(); - size_t result_length = length; - result.reserve(length * 2); - for (size_t i = 0; i < length; ++i) { - if (pt_string[i] == '\"' || pt_string[i] == '\\') { - result += '\\'; - } else if (pt_string[i] == '\n') { - result_length--; // contentLength is adjusted when this character is not - // copied to result. - continue; - } - result += pt_string[i]; - } - pt_string = result; - return result_length; -} -#endif // PROPRIETARY_MODE - -} // namespace mobile - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc deleted file mode 100644 index 894469ac34..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_tbt_client_state_notification.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_tbt_client_state_notification.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnTBTClientStateNotification::OnTBTClientStateNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnTBTClientStateNotification::~OnTBTClientStateNotification() {} - -void OnTBTClientStateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - (*message_)[strings::params][strings::message_type] = - static_cast<int32_t>(application_manager::MessageType::kNotification); - - const std::vector<ApplicationSharedPtr>& applications = - application_manager_.applications_with_navi(); - - std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin(); - for (; applications.end() != it; ++it) { - ApplicationSharedPtr app = *it; - if (mobile_apis::HMILevel::eType::HMI_NONE != app->hmi_level()) { - (*message_)[strings::params][strings::connection_key] = app->app_id(); - SendNotification(); - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc deleted file mode 100644 index 2a9969eac4..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_touch_event_notification.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_touch_event_notification.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -namespace mobile { - -OnTouchEventNotification::OnTouchEventNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnTouchEventNotification::~OnTouchEventNotification() {} - -void OnTouchEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const std::vector<ApplicationSharedPtr>& applications_with_navi = - application_manager_.applications_with_navi(); - - const std::vector<ApplicationSharedPtr>& projection_applications = - application_manager_.applications_with_mobile_projection(); - - std::vector<ApplicationSharedPtr>::const_iterator nav_it = - applications_with_navi.begin(); - - for (; applications_with_navi.end() != nav_it; ++nav_it) { - ApplicationSharedPtr app = *nav_it; - if (app->IsFullscreen()) { - (*message_)[strings::params][strings::connection_key] = app->app_id(); - SendNotification(); - } - } - - std::vector<ApplicationSharedPtr>::const_iterator projection_it = - projection_applications.begin(); - - for (; projection_applications.end() != projection_it; ++projection_it) { - ApplicationSharedPtr projection_app = *projection_it; - if (projection_app->IsFullscreen()) { - (*message_)[strings::params][strings::connection_key] = - projection_app->app_id(); - SendNotification(); - } - } -} - -} // namespace mobile - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc deleted file mode 100644 index 37abbab351..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_vehicle_data_notification.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -OnVehicleDataNotification::OnVehicleDataNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnVehicleDataNotification::~OnVehicleDataNotification() {} - -void OnVehicleDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - std::vector<ApplicationSharedPtr> appNotification; - std::vector<ApplicationSharedPtr>::iterator appNotification_it = - appNotification.begin(); - std::vector<smart_objects::SmartObject> appSO; - - const VehicleData& vehicle_data = MessageHelper::vehicle_data(); - VehicleData::const_iterator it = vehicle_data.begin(); - - for (; vehicle_data.end() != it; ++it) { - if (true == (*message_)[strings::msg_params].keyExists(it->first)) { - const std::vector<ApplicationSharedPtr>& applications = - application_manager_.IviInfoUpdated( - it->second, (*message_)[strings::msg_params][it->first].asInt()); - - std::vector<ApplicationSharedPtr>::const_iterator app_it = - applications.begin(); - - for (; applications.end() != app_it; ++app_it) { - const ApplicationSharedPtr app = *app_it; - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - continue; - } - - appNotification_it = - find(appNotification.begin(), appNotification.end(), app); - if (appNotification_it == appNotification.end()) { - appNotification.push_back(app); - smart_objects::SmartObject msg_param = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_param[it->first] = (*message_)[strings::msg_params][it->first]; - appSO.push_back(msg_param); - } else { - size_t idx = - std::distance(appNotification.begin(), appNotification_it); - appSO[idx][it->first] = (*message_)[strings::msg_params][it->first]; - } - } - } - } - - LOG4CXX_DEBUG( - logger_, - "Number of Notifications to be send: " << appNotification.size()); - - for (size_t idx = 0; idx < appNotification.size(); idx++) { - LOG4CXX_INFO(logger_, - "Send OnVehicleData PRNDL notification to " - << appNotification[idx]->name().c_str() - << " application id " << appNotification[idx]->app_id()); - (*message_)[strings::params][strings::connection_key] = - appNotification[idx]->app_id(); - (*message_)[strings::msg_params] = appSO[idx]; - SendNotification(); - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc deleted file mode 100644 index 0b24228810..0000000000 --- a/src/components/application_manager/src/commands/mobile/on_way_point_change_notification.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/on_way_point_change_notification.h" -#include "application_manager/application_manager.h" - -namespace application_manager { -namespace commands { - -OnWayPointChangeNotification::OnWayPointChangeNotification( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandNotificationImpl(message, application_manager) {} - -OnWayPointChangeNotification::~OnWayPointChangeNotification() {} - -void OnWayPointChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - std::set<int32_t> subscribed_for_way_points = - application_manager_.GetAppsSubscribedForWayPoints(); - - for (std::set<int32_t>::const_iterator app_id = - subscribed_for_way_points.begin(); - app_id != subscribed_for_way_points.end(); - ++app_id) { - (*message_)[strings::params][strings::connection_key] = *app_id; - SendNotification(); - } -} -} // namespace commands -} // namespace application_manager 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 deleted file mode 100644 index 20076ac50c..0000000000 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ /dev/null @@ -1,433 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <cstring> -#include "application_manager/commands/mobile/perform_audio_pass_thru_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -namespace str = strings; - -PerformAudioPassThruRequest::PerformAudioPassThruRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , result_tts_speak_(hmi_apis::Common_Result::INVALID_ENUM) - , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} - -PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {} - -void PerformAudioPassThruRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); - - FinishTTSSpeak(); - CommandRequestImpl::onTimeOut(); -} - -bool PerformAudioPassThruRequest::Init() { - default_timeout_ += - (((*message_)[str::msg_params][str::max_duration].asUInt())); - return true; -} - -void PerformAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) { - LOG4CXX_ERROR(logger_, "application isn't activated"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming perform audio pass thru has contains " - "\\t\\n \\\\t \\\\n" - " text contains only whitespace in initialPrompt"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - // According with new implementation processing of UNSUPPORTE_RESOURCE - // 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())) { - // In case TTS Speak, subscribe on notification - SendSpeakRequest(); - SendPerformAudioPassThruRequest(); - } else { - SendPerformAudioPassThruRequest(); - SendRecordStartNotification(); - StartMicrophoneRecording(); - } -} - -void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_PerformAudioPassThru: { - LOG4CXX_TRACE(logger_, "Received UI_PerformAudioPassThru"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - - result_ui_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - GetInfo(message, ui_info_); - - // in case perform audio is started by other request skip stopping - if (hmi_apis::Common_Result::REJECTED == result_ui_) { - LOG4CXX_ERROR(logger_, "Request was rejected"); - SendResponse(false, - MessageHelper::HMIToMobileResult(result_ui_), - NULL, - &(message[strings::msg_params])); - return; - } - FinishTTSSpeak(); - break; - } - case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); - result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - GetInfo(message, tts_info_); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - const bool is_tts_speak_success_unsuported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - result_tts_speak_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - if (is_tts_speak_success_unsuported) { - SendRecordStartNotification(); - StartMicrophoneRecording(); - - // update request timeout to get time for perform audio recording - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - } - break; - } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); - - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } - if (IsWaitingHMIResponse()) { - return; - } - - const ResponseParams response_params = PrepareResponseParameters(); - - SendResponse( - response_params.success, - response_params.result_code, - response_params.info.empty() ? NULL : response_params.info.c_str(), - &(message[strings::msg_params])); -} - -const PerformAudioPassThruRequest::ResponseParams& -PerformAudioPassThruRequest::PrepareResponseParameters() { - LOG4CXX_AUTO_TRACE(logger_); - - ResponseInfo ui_perform_info( - result_ui_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - ResponseInfo tts_perform_info(result_tts_speak_, - HmiInterfaces::HMI_INTERFACE_TTS, - application_manager_); - - // Note(dtrunov): According to requirment "WARNINGS, success:true on getting - // UNSUPPORTED_RESOURCE for "ttsChunks" - if (ui_perform_info.is_ok && tts_perform_info.is_unsupported_resource && - HmiInterfaces::STATE_AVAILABLE == tts_perform_info.interface_state) { - response_params_.result_code = mobile_apis::Result::WARNINGS; - tts_info_ = "Unsupported phoneme type sent in a prompt"; - response_params_.info = - MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_); - response_params_.success = true; - return response_params_; - } - - response_params_.success = - PrepareResultForMobileResponse(ui_perform_info, tts_perform_info); - if (IsResultCodeUnsupported(ui_perform_info, tts_perform_info)) { - response_params_.result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; - } else { - AudioPassThruResults results = PrepareAudioPassThruResultCodeForResponse( - ui_perform_info, tts_perform_info); - response_params_.success = results.second; - response_params_.result_code = results.first; - } - response_params_.info = - MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_); - - return response_params_; -} - -bool PerformAudioPassThruRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, std::string& info) { - LOG4CXX_AUTO_TRACE(logger_); - NOTREACHED(); - return false; -} - -void PerformAudioPassThruRequest::SendSpeakRequest() { - LOG4CXX_AUTO_TRACE(logger_); - - using namespace hmi_apis; - using namespace smart_objects; - - SmartObject msg_params = smart_objects::SmartObject(SmartType_Map); - for (uint32_t i = 0; - i < (*message_)[str::msg_params][str::initial_prompt].length(); - ++i) { - msg_params[hmi_request::tts_chunks][i][str::text] = - (*message_)[str::msg_params][str::initial_prompt][i][str::text]; - msg_params[hmi_request::tts_chunks][i][str::type] = - (*message_)[str::msg_params][str::initial_prompt][i][str::type]; - } - // app_id - msg_params[strings::app_id] = connection_key(); - msg_params[hmi_request::speak_type] = Common_MethodName::AUDIO_PASS_THRU; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true); -} - -void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[str::app_id] = connection_key(); - - msg_params[hmi_request::max_duration] = - (*message_)[str::msg_params][str::max_duration]; - - msg_params[hmi_request::audio_pass_display_texts] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text1)) { - msg_params[hmi_request::audio_pass_display_texts][0] - [hmi_request::field_name] = static_cast<int32_t>( - hmi_apis::Common_TextFieldName::audioPassThruDisplayText1); - msg_params[hmi_request::audio_pass_display_texts][0] - [hmi_request::field_text] = - (*message_)[str::msg_params][str::audio_pass_display_text1]; - } - - if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text2)) { - msg_params[hmi_request::audio_pass_display_texts][1] - [hmi_request::field_name] = static_cast<int32_t>( - hmi_apis::Common_TextFieldName::audioPassThruDisplayText2); - msg_params[hmi_request::audio_pass_display_texts][1] - [hmi_request::field_text] = - (*message_)[str::msg_params][str::audio_pass_display_text2]; - } - - if ((*message_)[str::msg_params].keyExists(str::mute_audio)) { - msg_params[str::mute_audio] = - (*message_)[str::msg_params][str::mute_audio].asBool(); - } else { - // If omitted, the value is set to true - msg_params[str::mute_audio] = true; - } - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest( - hmi_apis::FunctionID::UI_PerformAudioPassThru, &msg_params, true); -} - -void PerformAudioPassThruRequest::SendRecordStartNotification() { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = connection_key(); - - CreateHMINotification(hmi_apis::FunctionID::UI_OnRecordStart, msg_params); -} - -void PerformAudioPassThruRequest::StartMicrophoneRecording() { - LOG4CXX_AUTO_TRACE(logger_); - - uint32_t app_id = connection_key(); - application_manager_.BeginAudioPassThru(app_id); - - application_manager_.StartAudioPassThruThread( - connection_key(), - correlation_id(), - (*message_)[str::msg_params][str::max_duration].asInt(), - (*message_)[str::msg_params][str::sampling_rate].asInt(), - (*message_)[str::msg_params][str::bits_per_sample].asInt(), - (*message_)[str::msg_params][str::audio_type].asInt()); -} - -bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { - const smart_objects::SmartArray* ip_array = - (*message_)[strings::msg_params][strings::initial_prompt].asArray(); - - smart_objects::SmartArray::const_iterator it_ip = ip_array->begin(); - smart_objects::SmartArray::const_iterator it_ip_end = ip_array->end(); - - for (; it_ip != it_ip_end; ++it_ip) { - str = (*it_ip)[strings::text].asCharArray(); - if (std::strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists( - strings::audio_pass_display_text1)) { - str = (*message_)[strings::msg_params][strings::audio_pass_display_text1] - .asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, - "Invalid audio_pass_display_text1 value syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists( - strings::audio_pass_display_text2)) { - str = (*message_)[strings::msg_params][strings::audio_pass_display_text2] - .asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, - "Invalid audio_pass_display_text2 value syntax check failed"); - return true; - } - } - return false; -} - -void PerformAudioPassThruRequest::FinishTTSSpeak() { - LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = connection_key(); - if (application_manager_.EndAudioPassThru(app_id)) { - LOG4CXX_DEBUG(logger_, "Stop AudioPassThru."); - application_manager_.StopAudioPassThru(app_id); - } - if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) { - LOG4CXX_WARN(logger_, "TTS Speak is inactive."); - return; - } - SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL); -} - -PerformAudioPassThruRequest::AudioPassThruResults -PerformAudioPassThruRequest::PrepareAudioPassThruResultCodeForResponse( - const ResponseInfo& ui_response, const ResponseInfo& tts_response) { - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - - hmi_apis::Common_Result::eType common_result = - hmi_apis::Common_Result::INVALID_ENUM; - const hmi_apis::Common_Result::eType ui_result = ui_response.result_code; - const hmi_apis::Common_Result::eType tts_result = tts_response.result_code; - bool result = false; - - if ((ui_result == hmi_apis::Common_Result::SUCCESS) && - (tts_result == hmi_apis::Common_Result::SUCCESS)) { - result = true; - } - - if ((ui_result == hmi_apis::Common_Result::SUCCESS) && - (tts_result == hmi_apis::Common_Result::INVALID_ENUM)) { - result = true; - } - - if ((ui_result == hmi_apis::Common_Result::SUCCESS) && - (tts_result != hmi_apis::Common_Result::SUCCESS) && - (tts_result != hmi_apis::Common_Result::INVALID_ENUM)) { - common_result = hmi_apis::Common_Result::WARNINGS; - result = true; - } else if (ui_response.is_ok && - tts_result == hmi_apis::Common_Result::WARNINGS) { - common_result = hmi_apis::Common_Result::WARNINGS; - result = true; - } else if (ui_result == hmi_apis::Common_Result::INVALID_ENUM) { - common_result = tts_result; - } else { - common_result = ui_result; - } - result_code = MessageHelper::HMIToMobileResult(common_result); - return std::make_pair(result_code, result); -} - -bool PerformAudioPassThruRequest::IsWaitingHMIResponse() { - LOG4CXX_AUTO_TRACE(logger_); - return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc deleted file mode 100644 index e8a638c076..0000000000 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/perform_audio_pass_thru_response.h" - -namespace application_manager { - -namespace commands { - -PerformAudioPassThruResponse::PerformAudioPassThruResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {} - -void PerformAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager 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 deleted file mode 100644 index 68940158b9..0000000000 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc +++ /dev/null @@ -1,953 +0,0 @@ -/* - - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string.h> -#include <string> -#include "application_manager/commands/mobile/perform_interaction_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" - -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/file_system.h" -#include "utils/helpers.h" -#include "utils/custom_string.h" -#include "utils/gen_hash.h" - -namespace application_manager { - -namespace commands { - -namespace custom_str = utils::custom_string; - -uint32_t PerformInteractionRequest::pi_requests_count_ = 0; - -PerformInteractionRequest::PerformInteractionRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM) - , ui_response_received_(false) - , vr_response_received_(false) - , app_pi_was_active_before_(false) - , vr_result_code_(hmi_apis::Common_Result::INVALID_ENUM) - , ui_result_code_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); - subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand); - subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress); -} - -PerformInteractionRequest::~PerformInteractionRequest() {} - -bool PerformInteractionRequest::Init() { - /* Timeout in milliseconds. - If omitted a standard value of 10000 milliseconds is used.*/ - if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = - (*message_)[strings::msg_params][strings::timeout].asUInt(); - } - - interaction_mode_ = static_cast<mobile_apis::InteractionMode::eType>( - (*message_)[strings::msg_params][strings::interaction_mode].asInt()); - - if (mobile_apis::InteractionMode::BOTH == interaction_mode_ || - mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) { - default_timeout_ *= 2; - } - return true; -} - -void PerformInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (app->is_perform_interaction_active()) { - LOG4CXX_DEBUG(logger_, "Application has active PerformInteraction"); - app_pi_was_active_before_ = true; - } - - smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - mobile_apis::LayoutMode::eType interaction_layout = - mobile_apis::LayoutMode::INVALID_ENUM; - - if (msg_params.keyExists(hmi_request::interaction_layout)) { - interaction_layout = static_cast<mobile_apis::LayoutMode::eType>( - msg_params[hmi_request::interaction_layout].asInt()); - } - - if ((mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) && - (mobile_apis::LayoutMode::KEYBOARD == interaction_layout)) { - LOG4CXX_ERROR(logger_, - "PerformInteraction contains InteractionMode" - "=VR_ONLY and interactionLayout=KEYBOARD"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - const size_t choice_set_id_list_length = - msg_params[strings::interaction_choice_set_id_list].length(); - - if (0 == choice_set_id_list_length) { - if (mobile_apis::LayoutMode::KEYBOARD == interaction_layout) { - if (mobile_apis::InteractionMode::BOTH == interaction_mode_) { - LOG4CXX_ERROR(logger_, - "interactionChoiceSetIDList is empty," - " InteractionMode=BOTH and" - " interactionLayout=KEYBOARD"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } else { - LOG4CXX_ERROR(logger_, - "interactionChoiceSetIDList is empty" - " and interactionLayout!=KEYBOARD"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } - - if (!CheckChoiceIDFromRequest( - app, - choice_set_id_list_length, - msg_params[strings::interaction_choice_set_id_list])) { - LOG4CXX_ERROR(logger_, - "PerformInteraction has choice sets with " - "duplicated IDs or application does not have choice sets"); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return; - } - - if (msg_params.keyExists(strings::vr_help)) { - if (mobile_apis::Result::SUCCESS != - MessageHelper::VerifyImageVrHelpItems( - msg_params[strings::vr_help], app, application_manager_)) { - LOG4CXX_ERROR(logger_, - "Verification of " << strings::vr_help << " failed."); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming perform interaction has contains \t\n \\t \\n"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - switch (interaction_mode_) { - case mobile_apis::InteractionMode::BOTH: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH"); - if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || - !CheckVrHelpItemPositions(app)) { - return; - } - break; - } - case mobile_apis::InteractionMode::MANUAL_ONLY: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: MANUAL_ONLY"); - if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || - !CheckVrHelpItemPositions(app)) { - return; - } - break; - } - case mobile_apis::InteractionMode::VR_ONLY: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY"); - if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app)) { - return; - } - break; - } - default: { - LOG4CXX_ERROR(logger_, "Unknown interaction mode"); - return; - } - } - - app->set_perform_interaction_mode(static_cast<int32_t>(interaction_mode_)); - app->set_perform_interaction_active(true); - app->set_perform_interaction_layout(interaction_layout); - // increment amount of active requests - ++pi_requests_count_; - SendVRPerformInteractionRequest(app); - SendUIPerformInteractionRequest(app); -} - -void PerformInteractionRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - smart_objects::SmartObject msg_param = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_DEBUG(logger_, "Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } - case hmi_apis::FunctionID::UI_PerformInteraction: { - LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - ui_response_received_ = true; - unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); - ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - GetInfo(message, ui_info_); - ProcessUIResponse(event.smart_object(), msg_param); - break; - } - case hmi_apis::FunctionID::VR_PerformInteraction: { - LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - vr_response_received_ = true; - unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction); - vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt()); - GetInfo(message, vr_info_); - if (ProcessVRResponse(event.smart_object(), msg_param)) { - return; - } - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } - - if (!HasHMIResponsesToWait()) { - LOG4CXX_DEBUG(logger_, "Send response in BOTH iteraction mode"); - SendBothModeResponse(msg_param); - } -} - -void PerformInteractionRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); - - switch (interaction_mode_) { - case mobile_apis::InteractionMode::BOTH: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH"); - if (true == vr_response_received_) { - unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); - DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); - } else { - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - } - break; - } - case mobile_apis::InteractionMode::VR_ONLY: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY"); - unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); - DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); - break; - } - case mobile_apis::InteractionMode::MANUAL_ONLY: { - LOG4CXX_DEBUG(logger_, "InteractionMode: MANUAL_ONLY"); - unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); - DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); - break; - } - default: { - LOG4CXX_ERROR(logger_, "INVALID ENUM"); - return; - } - }; -} - -bool PerformInteractionRequest::ProcessVRResponse( - const smart_objects::SmartObject& message, - smart_objects::SmartObject& msg_params) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis; - using namespace mobile_apis; - using namespace smart_objects; - using namespace helpers; - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return false; - } - - msg_params[strings::trigger_source] = - static_cast<int32_t>(TriggerSource::TS_VR); - - const bool is_vr_aborted_timeout = Compare<Common_Result::eType, EQ, ONE>( - vr_result_code_, Common_Result::ABORTED, Common_Result::TIMED_OUT); - - if (is_vr_aborted_timeout) { - LOG4CXX_DEBUG(logger_, "VR response aborted"); - if (InteractionMode::VR_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, "Aborted or Timeout Send Close Popup"); - TerminatePerformInteraction(); - SendResponse(false, MessageHelper::HMIToMobileResult(vr_result_code_)); - return true; - } - LOG4CXX_DEBUG(logger_, "Update timeout for UI"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - return false; - } - - if (Common_Result::SUCCESS == vr_result_code_ && - InteractionMode::MANUAL_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, - "VR response SUCCESS in MANUAL_ONLY mode " - << "Wait for UI response"); - // in case MANUAL_ONLY mode VR.PI SUCCESS just return - return false; - } - - const SmartObject& hmi_msg_params = message[strings::msg_params]; - if (hmi_msg_params.keyExists(strings::choice_id)) { - const int choise_id = hmi_msg_params[strings::choice_id].asInt(); - if (!CheckChoiceIDFromResponse(app, choise_id)) { - LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI"); - TerminatePerformInteraction(); - SendResponse( - false, Result::GENERIC_ERROR, "Wrong choiceID was received from HMI"); - return true; - } - msg_params[strings::choice_id] = choise_id; - } - return false; -} - -void PerformInteractionRequest::ProcessUIResponse( - const smart_objects::SmartObject& message, - smart_objects::SmartObject& msg_params) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - using namespace smart_objects; - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - HmiInterfaces::InterfaceState ui_interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_UI); - bool result = false; - result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_code_, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS); - - result = result || - (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_code_ && - HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state); - - const bool is_pi_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_code_, hmi_apis::Common_Result::WARNINGS); - - const bool is_pi_unsupported = - Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE); - - if (result) { - if (is_pi_warning) { - ui_result_code_ = hmi_apis::Common_Result::WARNINGS; - ui_info_ = message[strings::msg_params][strings::info].asString(); - if (message.keyExists(strings::params) && - message[strings::params].keyExists(strings::data)) { - msg_params = message[strings::params][strings::data]; - } - } else if (is_pi_unsupported) { - ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - ui_info_ = message[strings::msg_params][strings::info].asString(); - } else if (message.keyExists(strings::msg_params)) { - msg_params = message[strings::msg_params]; - } - // result code must be GENERIC_ERROR in case wrong choice_id - if (msg_params.keyExists(strings::choice_id)) { - if (!CheckChoiceIDFromResponse(app, - msg_params[strings::choice_id].asInt())) { - ui_result_code_ = hmi_apis::Common_Result::GENERIC_ERROR; - ui_info_ = "Wrong choiceID was received from HMI"; - } else { - msg_params[strings::trigger_source] = - mobile_apis::TriggerSource::TS_MENU; - } - } else if (msg_params.keyExists(strings::manual_text_entry)) { - msg_params[strings::trigger_source] = - mobile_apis::TriggerSource::TS_KEYBOARD; - if (msg_params[strings::manual_text_entry].empty()) { - msg_params.erase(strings::manual_text_entry); - } - } - } -} - -void PerformInteractionRequest::SendUIPerformInteractionRequest( - application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject& choice_set_id_list = - (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - mobile_apis::InteractionMode::eType mode = - static_cast<mobile_apis::InteractionMode::eType>( - (*message_)[strings::msg_params][strings::interaction_mode].asInt()); - - if (mobile_apis::InteractionMode::VR_ONLY != mode) { - msg_params[hmi_request::initial_text][hmi_request::field_name] = - static_cast<int32_t>( - hmi_apis::Common_TextFieldName::initialInteractionText); - msg_params[hmi_request::initial_text][hmi_request::field_text] = - (*message_)[strings::msg_params][hmi_request::initial_text]; - } - bool is_vr_help_item = false; - if (mobile_apis::InteractionMode::MANUAL_ONLY != mode) { - msg_params[strings::vr_help_title] = - (*message_)[strings::msg_params][strings::initial_text].asString(); - if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) { - is_vr_help_item = true; - msg_params[strings::vr_help] = - (*message_)[strings::msg_params][strings::vr_help]; - } - } - - if (mobile_apis::InteractionMode::BOTH == mode || - mobile_apis::InteractionMode::MANUAL_ONLY == mode) { - msg_params[strings::timeout] = default_timeout_ / 2; - } else { - msg_params[strings::timeout] = default_timeout_; - } - msg_params[strings::app_id] = app->app_id(); - if (mobile_apis::InteractionMode::VR_ONLY != mode) { - msg_params[strings::choice_set] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - } - int32_t index_array_of_vr_help = 0; - for (size_t i = 0; i < choice_set_id_list.length(); ++i) { - smart_objects::SmartObject* choice_set = - app->FindChoiceSet(choice_set_id_list[i].asInt()); - if (choice_set) { - // save perform interaction choice set - app->AddPerformInteractionChoiceSet( - correlation_id(), choice_set_id_list[i].asInt(), *choice_set); - for (size_t j = 0; j < (*choice_set)[strings::choice_set].length(); ++j) { - if (mobile_apis::InteractionMode::VR_ONLY != mode) { - size_t index = msg_params[strings::choice_set].length(); - msg_params[strings::choice_set][index] = - (*choice_set)[strings::choice_set][j]; - // vrCommands should be added via VR.AddCommand only - msg_params[strings::choice_set][index].erase(strings::vr_commands); - } - if (mobile_apis::InteractionMode::MANUAL_ONLY != mode && - !is_vr_help_item) { - smart_objects::SmartObject& vr_commands = - (*choice_set)[strings::choice_set][j][strings::vr_commands]; - if (0 < vr_commands.length()) { - // copy only first synonym - smart_objects::SmartObject item(smart_objects::SmartType_Map); - item[strings::text] = vr_commands[0].asString(); - item[strings::position] = index_array_of_vr_help + 1; - msg_params[strings::vr_help][index_array_of_vr_help++] = item; - } - } - } - } - } - if ((*message_)[strings::msg_params].keyExists( - hmi_request::interaction_layout) && - mobile_apis::InteractionMode::VR_ONLY != mode) { - msg_params[hmi_request::interaction_layout] = - (*message_)[strings::msg_params][hmi_request::interaction_layout] - .asInt(); - } - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest( - hmi_apis::FunctionID::UI_PerformInteraction, &msg_params, true); -} - -void PerformInteractionRequest::SendVRPerformInteractionRequest( - application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - smart_objects::SmartObject& choice_list = - (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; - - if (mobile_apis::InteractionMode::MANUAL_ONLY != interaction_mode_) { - msg_params[strings::grammar_id] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - int32_t grammar_id_index = 0; - for (uint32_t i = 0; i < choice_list.length(); ++i) { - smart_objects::SmartObject* choice_set = - app->FindChoiceSet(choice_list[i].asInt()); - if (!choice_set) { - LOG4CXX_WARN(logger_, "Couldn't found choiset"); - continue; - } - msg_params[strings::grammar_id][grammar_id_index++] = - (*choice_set)[strings::grammar_id].asUInt(); - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::help_prompt)) { - msg_params[strings::help_prompt] = - (*message_)[strings::msg_params][strings::help_prompt]; - } else { - if (choice_list.length() != 0) { - msg_params[strings::help_prompt] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - } - int32_t index = 0; - for (uint32_t i = 0; i < choice_list.length(); ++i) { - smart_objects::SmartObject* choice_set = - app->FindChoiceSet(choice_list[i].asInt()); - - if (choice_set) { - for (uint32_t j = 0; j < (*choice_set)[strings::choice_set].length(); - ++j) { - smart_objects::SmartObject& vr_commands = - (*choice_set)[strings::choice_set][j][strings::vr_commands]; - if (0 < vr_commands.length()) { - // copy only first synonym - smart_objects::SmartObject item(smart_objects::SmartType_Map); - // Since there is no custom data from application side, SDL should - // construct prompt and append delimiter to each item - item[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; - item[strings::text] = - vr_commands[0].asString() + - application_manager_.get_settings().tts_delimiter(); - msg_params[strings::help_prompt][index++] = item; - } - } - } else { - LOG4CXX_ERROR(logger_, "Can't found choiceSet!"); - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::timeout_prompt)) { - msg_params[strings::timeout_prompt] = - (*message_)[strings::msg_params][strings::timeout_prompt]; - } else { - if (msg_params.keyExists(strings::help_prompt)) { - msg_params[strings::timeout_prompt] = msg_params[strings::help_prompt]; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { - msg_params[strings::initial_prompt] = - (*message_)[strings::msg_params][strings::initial_prompt]; - } - - mobile_apis::InteractionMode::eType mode = - static_cast<mobile_apis::InteractionMode::eType>( - (*message_)[strings::msg_params][strings::interaction_mode].asInt()); - - if (mobile_apis::InteractionMode::BOTH == mode || - mobile_apis::InteractionMode::MANUAL_ONLY == mode) { - msg_params[strings::timeout] = default_timeout_ / 2; - } else { - msg_params[strings::timeout] = default_timeout_; - } - msg_params[strings::app_id] = app->app_id(); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - SendHMIRequest( - hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, true); -} - -bool PerformInteractionRequest::CheckChoiceSetMenuNames( - application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject& choice_list = - (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; - - for (size_t i = 0; i < choice_list.length(); ++i) { - // choice_set contains SmartObject msg_params - smart_objects::SmartObject* i_choice_set = - app->FindChoiceSet(choice_list[i].asInt()); - - for (size_t j = 0; j < choice_list.length(); ++j) { - smart_objects::SmartObject* j_choice_set = - app->FindChoiceSet(choice_list[j].asInt()); - - if (i == j) { - // skip check the same element - continue; - } - - if (!i_choice_set || !j_choice_set) { - LOG4CXX_ERROR(logger_, "Invalid ID"); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return false; - } - - size_t ii = 0; - size_t jj = 0; - for (; ii < (*i_choice_set)[strings::choice_set].length(); ++ii) { - for (; jj < (*j_choice_set)[strings::choice_set].length(); ++jj) { - const std::string& ii_menu_name = - (*i_choice_set)[strings::choice_set][ii][strings::menu_name] - .asString(); - const std::string& jj_menu_name = - (*j_choice_set)[strings::choice_set][jj][strings::menu_name] - .asString(); - - if (ii_menu_name == jj_menu_name) { - LOG4CXX_ERROR(logger_, "Choice set has duplicated menu name"); - SendResponse(false, - mobile_apis::Result::DUPLICATE_NAME, - "Choice set has duplicated menu name"); - return false; - } - } - } - } - } - - return true; -} - -bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( - application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject& choice_list = - (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; - - for (size_t i = 0; i < choice_list.length(); ++i) { - // choice_set contains SmartObject msg_params - smart_objects::SmartObject* i_choice_set = - app->FindChoiceSet(choice_list[i].asInt()); - - for (size_t j = 0; j < choice_list.length(); ++j) { - smart_objects::SmartObject* j_choice_set = - app->FindChoiceSet(choice_list[j].asInt()); - - if (i == j) { - // skip check the same element - continue; - } - - if ((!i_choice_set) || (!j_choice_set)) { - LOG4CXX_ERROR(logger_, "Invalid ID"); - SendResponse(false, mobile_apis::Result::INVALID_ID); - return false; - } - - size_t ii = 0; - size_t jj = 0; - for (; ii < (*i_choice_set)[strings::choice_set].length(); ++ii) { - for (; jj < (*j_choice_set)[strings::choice_set].length(); ++jj) { - // choice_set pointer contains SmartObject msg_params - smart_objects::SmartObject& ii_vr_commands = - (*i_choice_set)[strings::choice_set][ii][strings::vr_commands]; - - smart_objects::SmartObject& jj_vr_commands = - (*j_choice_set)[strings::choice_set][jj][strings::vr_commands]; - - for (size_t iii = 0; iii < ii_vr_commands.length(); ++iii) { - for (size_t jjj = 0; jjj < jj_vr_commands.length(); ++jjj) { - const custom_str::CustomString& vr_cmd_i = - ii_vr_commands[iii].asCustomString(); - const custom_str::CustomString& vr_cmd_j = - jj_vr_commands[jjj].asCustomString(); - if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOG4CXX_ERROR(logger_, "Choice set has duplicated VR synonym"); - SendResponse(false, - mobile_apis::Result::DUPLICATE_NAME, - "Choice set has duplicated VR synonym"); - return false; - } - } - } - } - } - } - } - return true; -} - -bool PerformInteractionRequest::CheckVrHelpItemPositions( - application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); - - if (!(*message_)[strings::msg_params].keyExists(strings::vr_help)) { - LOG4CXX_DEBUG(logger_, strings::vr_help << " is omitted."); - return true; - } - - smart_objects::SmartObject& vr_help = - (*message_)[strings::msg_params][strings::vr_help]; - - int32_t position = 1; - for (size_t i = 0; i < vr_help.length(); ++i) { - if (position != vr_help[i][strings::position].asInt()) { - LOG4CXX_ERROR(logger_, "Non-sequential vrHelp item position"); - SendResponse(false, - mobile_apis::Result::REJECTED, - "Non-sequential vrHelp item position"); - return false; - } - ++position; - } - return true; -} - -void PerformInteractionRequest::DisablePerformInteraction() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - if (app->is_perform_interaction_active()) { - // decrease amount of active requests - --pi_requests_count_; - if (!pi_requests_count_) { - app->set_perform_interaction_active(false); - app->set_perform_interaction_mode(-1); - } - } - app->DeletePerformInteractionChoiceSet(correlation_id()); -} - -bool PerformInteractionRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - str = (*message_)[strings::msg_params][strings::initial_text].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid initial_text syntax check failed"); - return true; - } - - if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { - const smart_objects::SmartArray* ip_array = - (*message_)[strings::msg_params][strings::initial_prompt].asArray(); - - smart_objects::SmartArray::const_iterator it_ip = ip_array->begin(); - smart_objects::SmartArray::const_iterator it_ip_end = ip_array->end(); - - for (; it_ip != it_ip_end; ++it_ip) { - str = (*it_ip)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::help_prompt)) { - const smart_objects::SmartArray* hp_array = - (*message_)[strings::msg_params][strings::help_prompt].asArray(); - - smart_objects::SmartArray::const_iterator it_hp = hp_array->begin(); - smart_objects::SmartArray::const_iterator it_hp_end = hp_array->end(); - - for (; it_hp != it_hp_end; ++it_hp) { - str = (*it_hp)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::timeout_prompt)) { - const smart_objects::SmartArray* tp_array = - (*message_)[strings::msg_params][strings::timeout_prompt].asArray(); - - smart_objects::SmartArray::const_iterator it_tp = tp_array->begin(); - smart_objects::SmartArray::const_iterator it_tp_end = tp_array->end(); - - for (; it_tp != it_tp_end; ++it_tp) { - str = (*it_tp)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) { - const smart_objects::SmartArray* vh_array = - (*message_)[strings::msg_params][strings::vr_help].asArray(); - - smart_objects::SmartArray::const_iterator it_vh = vh_array->begin(); - smart_objects::SmartArray::const_iterator it_vh_end = vh_array->end(); - - for (; it_vh != it_vh_end; ++it_vh) { - str = (*it_vh)[strings::text].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_help syntax check failed"); - return true; - } - - if ((*it_vh).keyExists(strings::image)) { - str = (*it_vh)[strings::image][strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid vr_help image value syntax check failed"); - return true; - } - } - } - } - return false; -} - -void PerformInteractionRequest::TerminatePerformInteraction() { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[hmi_request::method_name] = "UI.PerformInteraction"; - SendHMIRequest(hmi_apis::FunctionID::UI_ClosePopUp, &msg_params); - DisablePerformInteraction(); -} - -bool PerformInteractionRequest::CheckChoiceIDFromResponse( - ApplicationSharedPtr app, int32_t choice_id) { - LOG4CXX_AUTO_TRACE(logger_); - const DataAccessor<PerformChoiceSetMap> accessor = - app->performinteraction_choice_set_map(); - const PerformChoiceSetMap& choice_set_map = accessor.GetData(); - - PerformChoiceSetMap::const_iterator choice_set_map_it = - choice_set_map.find(correlation_id()); - if (choice_set_map.end() != choice_set_map_it) { - const PerformChoice& choice = choice_set_map_it->second; - PerformChoice::const_iterator it = choice.begin(); - for (; choice.end() != it; ++it) { - const smart_objects::SmartObject& choice_set = - (*it->second).getElement(strings::choice_set); - for (size_t j = 0; j < choice_set.length(); ++j) { - if (choice_id == - choice_set.getElement(j).getElement(strings::choice_id).asInt()) { - return true; - } - } - } - } - return false; -} - -bool PerformInteractionRequest::CheckChoiceIDFromRequest( - ApplicationSharedPtr app, - const size_t choice_set_id_list_length, - const smart_objects::SmartObject& choice_set_id_list) const { - LOG4CXX_AUTO_TRACE(logger_); - - size_t choice_list_length = 0; - std::set<uint32_t> choice_id_set; - smart_objects::SmartObject* choice_set = 0; - std::pair<std::set<uint32_t>::iterator, bool> ins_res; - - for (size_t i = 0; i < choice_set_id_list_length; ++i) { - choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt()); - if (!choice_set) { - LOG4CXX_ERROR( - logger_, - "Couldn't find choiset_id = " << choice_set_id_list[i].asInt()); - return false; - } - choice_list_length = (*choice_set)[strings::choice_set].length(); - const smart_objects::SmartObject& choices_list = - (*choice_set)[strings::choice_set]; - for (size_t k = 0; k < choice_list_length; ++k) { - ins_res = - choice_id_set.insert(choices_list[k][strings::choice_id].asInt()); - if (!ins_res.second) { - LOG4CXX_ERROR(logger_, - "Choise with ID " - << choices_list[k][strings::choice_id].asInt() - << " already exists"); - return false; - } - } - } - return true; -} - -const bool PerformInteractionRequest::HasHMIResponsesToWait() const { - LOG4CXX_AUTO_TRACE(logger_); - return !ui_response_received_ || !vr_response_received_; -} - -void PerformInteractionRequest::SendBothModeResponse( - const smart_objects::SmartObject& msg_param) { - LOG4CXX_AUTO_TRACE(logger_); - mobile_apis::Result::eType perform_interaction_result_code = - mobile_apis::Result::INVALID_ENUM; - ResponseInfo ui_perform_info( - ui_result_code_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - ResponseInfo vr_perform_info( - vr_result_code_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_); - const bool result = - PrepareResultForMobileResponse(ui_perform_info, vr_perform_info); - perform_interaction_result_code = - PrepareResultCodeForResponse(ui_perform_info, vr_perform_info); - const smart_objects::SmartObject* response_params = - msg_param.empty() ? NULL : &msg_param; - std::string info = - MergeInfos(ui_perform_info, ui_info_, vr_perform_info, vr_info_); - DisablePerformInteraction(); - SendResponse(result, - perform_interaction_result_code, - info.empty() ? NULL : info.c_str(), - response_params); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc deleted file mode 100644 index 6003751669..0000000000 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/perform_interaction_response.h" - -namespace application_manager { - -namespace commands { - -PerformInteractionResponse::PerformInteractionResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -PerformInteractionResponse::~PerformInteractionResponse() {} - -void PerformInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/put_file_request.cc b/src/components/application_manager/src/commands/mobile/put_file_request.cc deleted file mode 100644 index 602b420ba0..0000000000 --- a/src/components/application_manager/src/commands/mobile/put_file_request.cc +++ /dev/null @@ -1,283 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <algorithm> -#include "application_manager/commands/mobile/put_file_request.h" - -#include "application_manager/policies/policy_handler.h" -#include "application_manager/application_impl.h" - -#include "utils/file_system.h" - -namespace application_manager { - -namespace commands { - -PutFileRequest::PutFileRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , offset_(0) - , sync_file_name_() - , length_(0) - , file_type_(mobile_apis::FileType::INVALID_ENUM) - , is_persistent_file_(false) {} - -PutFileRequest::~PutFileRequest() {} - -void PutFileRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - smart_objects::SmartObject response_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() && - application_manager_.get_settings().put_file_in_none() <= - application->put_file_in_none_count()) { - // If application is in the HMI_NONE level the quantity of allowed - // PutFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); - SendResponse(false, - mobile_apis::Result::REJECTED, - "Too many requests from the app with HMILevel HMI_NONE", - &response_params); - return; - } - - if (!(*message_)[strings::params].keyExists(strings::binary_data)) { - LOG4CXX_ERROR(logger_, "Binary data empty"); - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "Binary data empty", - &response_params); - return; - } - - if (!(*message_)[strings::msg_params].keyExists(strings::sync_file_name)) { - LOG4CXX_ERROR(logger_, "No file name"); - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "No file name", - &response_params); - return; - } - - if (!(*message_)[strings::msg_params].keyExists(strings::file_type)) { - LOG4CXX_ERROR(logger_, "No file type"); - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "No file type", - &response_params); - return; - } - sync_file_name_ = - (*message_)[strings::msg_params][strings::sync_file_name].asString(); - - if (!file_system::IsFileNameValid(sync_file_name_)) { - const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - err_msg.c_str(), - &response_params); - return; - } - - file_type_ = static_cast<mobile_apis::FileType::eType>( - (*message_)[strings::msg_params][strings::file_type].asInt()); - const std::vector<uint8_t> binary_data = - (*message_)[strings::params][strings::binary_data].asBinary(); - - // Policy table update in json format is currently to be received via PutFile - // TODO(PV): after latest discussion has to be changed - if (mobile_apis::FileType::JSON == file_type_) { - application_manager_.GetPolicyHandler().ReceiveMessageFromSDK( - sync_file_name_, binary_data); - } - - offset_ = 0; - is_persistent_file_ = false; - bool is_system_file = false; - length_ = binary_data.size(); - bool is_download_compleate = true; - bool offset_exist = - (*message_)[strings::msg_params].keyExists(strings::offset); - - if (offset_exist) { - offset_ = (*message_)[strings::msg_params][strings::offset].asInt(); - } - - if ((*message_)[strings::msg_params].keyExists(strings::persistent_file)) { - is_persistent_file_ = - (*message_)[strings::msg_params][strings::persistent_file].asBool(); - } - if ((*message_)[strings::msg_params].keyExists(strings::system_file)) { - is_system_file = - (*message_)[strings::msg_params][strings::system_file].asBool(); - } - - std::string file_path; - - if (is_system_file) { - response_params[strings::space_available] = 0; - file_path = application_manager_.get_settings().system_files_path(); - } else { - file_path = application_manager_.get_settings().app_storage_folder(); - file_path += "/" + application->folder_name(); - - uint32_t space_available = application->GetAvailableDiskSpace(); - - if (binary_data.size() > space_available) { - response_params[strings::space_available] = - static_cast<uint32_t>(space_available); - - LOG4CXX_ERROR(logger_, "Out of memory"); - SendResponse(false, - mobile_apis::Result::OUT_OF_MEMORY, - "Out of memory", - &response_params); - return; - } - } - - if (!file_system::CreateDirectoryRecursively(file_path)) { - LOG4CXX_ERROR(logger_, "Can't create folder"); - SendResponse(false, - mobile_apis::Result::GENERIC_ERROR, - "Can't create folder.", - &response_params); - return; - } - const std::string full_path = file_path + "/" + sync_file_name_; - UNUSED(full_path); - LOG4CXX_DEBUG(logger_, - "Wrtiting " << binary_data.size() << "bytes to " << full_path - << " (current size is" - << file_system::FileSize(full_path) << ")"); - - mobile_apis::Result::eType save_result = application_manager_.SaveBinary( - binary_data, file_path, sync_file_name_, offset_); - - LOG4CXX_DEBUG(logger_, - "New size of " << full_path << " is " - << file_system::FileSize(full_path) << " bytes"); - if (!is_system_file) { - response_params[strings::space_available] = - static_cast<uint32_t>(application->GetAvailableDiskSpace()); - } - - sync_file_name_ = file_path + "/" + sync_file_name_; - switch (save_result) { - case mobile_apis::Result::SUCCESS: { - LOG4CXX_INFO(logger_, "PutFile is successful"); - if (!is_system_file) { - AppFile file(sync_file_name_, - is_persistent_file_, - is_download_compleate, - file_type_); - - if (0 == offset_) { - LOG4CXX_INFO(logger_, "New file downloading"); - if (!application->AddFile(file)) { - LOG4CXX_INFO(logger_, - "Couldn't add file to application (File already Exist" - << " in application and was rewritten on FS)"); - /* It can be first part of new big file, so we need to update - information about it's downloading status and persistence */ - if (!application->UpdateFile(file)) { - LOG4CXX_ERROR(logger_, "Couldn't update file"); - /* If it is impossible to update file, application doesn't - know about existing this file */ - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "Couldn't update file", - &response_params); - return; - } - } else { - /* if file added - increment it's count - ( may be application->AddFile have to incapsulate it? ) - Any way now this method evals not only in "none"*/ - application->increment_put_file_in_none_count(); - } - } - } - - SendResponse(true, save_result, "File was downloaded", &response_params); - if (is_system_file) { - SendOnPutFileNotification(); - } - break; - } - default: - LOG4CXX_WARN(logger_, - "PutFile is unsuccessful. Result = " << save_result); - SendResponse(false, save_result, "Can't save file", &response_params); - break; - } -} - -void PutFileRequest::SendOnPutFileNotification() { - LOG4CXX_INFO(logger_, "SendOnPutFileNotification"); - smart_objects::SmartObjectSPtr notification = - new smart_objects::SmartObject(smart_objects::SmartType_Map); - - smart_objects::SmartObject& message = *notification; - message[strings::params][strings::function_id] = - hmi_apis::FunctionID::BasicCommunication_OnPutFile; - - message[strings::params][strings::message_type] = MessageType::kNotification; - message[strings::msg_params][strings::app_id] = connection_key(); - message[strings::msg_params][strings::sync_file_name] = sync_file_name_; - message[strings::msg_params][strings::offset] = offset_; - if (0 == offset_) { - message[strings::msg_params][strings::file_size] = - (*message_)[strings::msg_params][strings::length]; - } - message[strings::msg_params][strings::length] = length_; - message[strings::msg_params][strings::persistent_file] = is_persistent_file_; - message[strings::msg_params][strings::file_type] = file_type_; - application_manager_.ManageHMICommand(notification); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/put_file_response.cc b/src/components/application_manager/src/commands/mobile/put_file_response.cc deleted file mode 100644 index 50c62aef7f..0000000000 --- a/src/components/application_manager/src/commands/mobile/put_file_response.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/put_file_response.h" -#include "utils/file_system.h" -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -PutFileResponse::PutFileResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -PutFileResponse::~PutFileResponse() {} - -void PutFileResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - uint32_t app_id = - (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = application_manager_.application(app_id); - if (!app) { - LOG4CXX_ERROR(logger_, "Application not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - SendResponse((*message_)[strings::msg_params][strings::success].asBool()); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc deleted file mode 100644 index c51f545e7e..0000000000 --- a/src/components/application_manager/src/commands/mobile/read_did_request.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright (c) 2016, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string> -#include "application_manager/commands/mobile/read_did_request.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -ReadDIDRequest::ReadDIDRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -ReadDIDRequest::~ReadDIDRequest() {} - -void ReadDIDRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - uint32_t app_id = - (*message_)[strings::params][strings::connection_key].asUInt(); - - ApplicationSharedPtr app = application_manager_.application(app_id); - LOG4CXX_INFO( - logger_, - "Correlation_id :" - << (*message_)[strings::params][strings::correlation_id].asUInt()); - - if (!app) { - LOG4CXX_ERROR(logger_, "An application is not registered."); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (app->AreCommandLimitsExceeded( - static_cast<mobile_apis::FunctionID::eType>(function_id()), - application_manager::TLimitSource::CONFIG_FILE)) { - LOG4CXX_ERROR(logger_, "ReadDID frequency is too high."); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - if ((*message_)[strings::msg_params][strings::did_location].empty()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::ecu_name] = - (*message_)[strings::msg_params][strings::ecu_name]; - msg_params[strings::did_location] = - (*message_)[strings::msg_params][strings::did_location]; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - - SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_ReadDID, &msg_params, true); -} - -void ReadDIDRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::VehicleInfo_ReadDID: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo); - std::string response_info; - GetInfo(message, response_info); - - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/read_did_response.cc b/src/components/application_manager/src/commands/mobile/read_did_response.cc deleted file mode 100644 index e54c4ba005..0000000000 --- a/src/components/application_manager/src/commands/mobile/read_did_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/read_did_response.h" - -namespace application_manager { - -namespace commands { - -ReadDIDResponse::ReadDIDResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -ReadDIDResponse::~ReadDIDResponse() {} - -void ReadDIDResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager 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 deleted file mode 100644 index a3a30ddb20..0000000000 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ /dev/null @@ -1,1287 +0,0 @@ -/* - - Copyright (c) 2015, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/register_app_interface_request.h" - -#include <unistd.h> -#include <algorithm> -#include <map> -#include <string.h> - -#include <utils/make_shared.h> -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler_interface.h" -#include "application_manager/application_impl.h" -#include "application_manager/app_launch/app_launch_ctrl.h" -#include "application_manager/message_helper.h" -#include "application_manager/resumption/resume_ctrl.h" -#include "application_manager/policies/policy_handler.h" -#include "application_manager/helpers/application_helper.h" -#include "config_profile/profile.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/generated_msg_version.h" - -namespace { -namespace custom_str = utils::custom_string; - -mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string& str) { - if ("DEFAULT" == str) { - return mobile_apis::AppHMIType::DEFAULT; - } else if ("COMMUNICATION" == str) { - return mobile_apis::AppHMIType::COMMUNICATION; - } else if ("MEDIA" == str) { - return mobile_apis::AppHMIType::MEDIA; - } else if ("MESSAGING" == str) { - return mobile_apis::AppHMIType::MESSAGING; - } else if ("NAVIGATION" == str) { - return mobile_apis::AppHMIType::NAVIGATION; - } else if ("INFORMATION" == str) { - return mobile_apis::AppHMIType::INFORMATION; - } else if ("SOCIAL" == str) { - return mobile_apis::AppHMIType::SOCIAL; - } else if ("BACKGROUND_PROCESS" == str) { - return mobile_apis::AppHMIType::BACKGROUND_PROCESS; - } else if ("TESTING" == str) { - return mobile_apis::AppHMIType::TESTING; - } else if ("SYSTEM" == str) { - return mobile_apis::AppHMIType::SYSTEM; - } else if ("PROJECTION" == str) { - return mobile_apis::AppHMIType::PROJECTION; -#ifdef SDL_REMOTE_CONTROL - } else if ("REMOTE_CONTROL" == str) { - return mobile_apis::AppHMIType::REMOTE_CONTROL; -#endif - } else { - return mobile_apis::AppHMIType::INVALID_ENUM; - } -} - -std::string AppHMITypeToString(mobile_apis::AppHMIType::eType type) { - const std::map<mobile_apis::AppHMIType::eType, std::string> app_hmi_type_map = - {{mobile_apis::AppHMIType::DEFAULT, "DEFAULT"}, -#ifdef SDL_REMOTE_CONTROL - {mobile_apis::AppHMIType::REMOTE_CONTROL, "REMOTE_CONTROL"}, -#endif // SDL_REMOTE_CONTROL - {mobile_apis::AppHMIType::COMMUNICATION, "COMMUNICATION"}, - {mobile_apis::AppHMIType::MEDIA, "MEDIA"}, - {mobile_apis::AppHMIType::MESSAGING, "MESSAGING"}, - {mobile_apis::AppHMIType::NAVIGATION, "NAVIGATION"}, - {mobile_apis::AppHMIType::INFORMATION, "INFORMATION"}, - {mobile_apis::AppHMIType::SOCIAL, "SOCIAL"}, - {mobile_apis::AppHMIType::BACKGROUND_PROCESS, "BACKGROUND_PROCESS"}, - {mobile_apis::AppHMIType::TESTING, "TESTING"}, - {mobile_apis::AppHMIType::SYSTEM, "SYSTEM"}, - {mobile_apis::AppHMIType::PROJECTION, "PROJECTION"}}; - - std::map<mobile_apis::AppHMIType::eType, std::string>::const_iterator iter = - app_hmi_type_map.find(type); - - return app_hmi_type_map.end() != iter ? iter->second : std::string(""); -} - -struct AppHMITypeInserter { - AppHMITypeInserter(smart_objects::SmartObject& so_array) - : index_(0), so_array_(so_array) {} - - bool operator()(const std::string& app_hmi_type) { - so_array_[index_] = StringToAppHMIType(app_hmi_type); - ++index_; - return true; - } - - private: - uint32_t index_; - smart_objects::SmartObject& so_array_; -}; - -struct CheckMissedTypes { - CheckMissedTypes(const policy::StringArray& policy_app_types, - std::string& log) - : policy_app_types_(policy_app_types), log_(log) {} - - bool operator()(const smart_objects::SmartArray::value_type& value) { - std::string app_type_str = AppHMITypeToString( - static_cast<mobile_apis::AppHMIType::eType>(value.asInt())); - if (!app_type_str.empty()) { - policy::StringArray::const_iterator it = policy_app_types_.begin(); - policy::StringArray::const_iterator it_end = policy_app_types_.end(); - for (; it != it_end; ++it) { - if (app_type_str == *it) { - return true; - } - } - } - - log_ += app_type_str; - log_ += ","; - - return true; - } - - private: - const policy::StringArray& policy_app_types_; - std::string& log_; -}; - -class SmartArrayValueExtractor { - public: - AppHmiType operator()(const smart_objects::SmartObject& so) const { - return static_cast<AppHmiType>(so.asInt()); - } -}; - -struct IsSameNickname { - IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {} - bool operator()(const policy::StringArray::value_type& nickname) const { - return app_id_.CompareIgnoreCase(nickname.c_str()); - } - - private: - const custom_str::CustomString& app_id_; -}; -} - -namespace application_manager { - -namespace commands { - -RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) {} - -RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {} - -bool RegisterAppInterfaceRequest::Init() { - LOG4CXX_AUTO_TRACE(logger_); - return true; -} - -void RegisterAppInterfaceRequest::Run() { - using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Connection key is " << connection_key()); - - // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA. - // Flag conditional compilation specific to customer is used in order to - // exclude hit code - // to RTC - // FIXME(EZamakhov): on shutdown - get freez - - // wait till HMI started - while (!application_manager_.IsStopping() && - !application_manager_.IsHMICooperating()) { - LOG4CXX_DEBUG(logger_, - "Waiting for the HMI... conn_key=" - << connection_key() - << ", correlation_id=" << correlation_id() - << ", default_timeout=" << default_timeout() - << ", thread=" << pthread_self()); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - sleep(1); - // TODO(DK): timer_->StartWait(1); - } - - if (application_manager_.IsStopping()) { - LOG4CXX_WARN(logger_, "The ApplicationManager is stopping!"); - return; - } - - if (IsApplicationSwitched()) { - return; - } - - const std::string mobile_app_id = - (*message_)[strings::msg_params][strings::app_id].asString(); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (application) { - SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); - return; - } - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - const std::string policy_app_id = msg_params[strings::app_id].asString(); - std::string new_policy_app_id = policy_app_id; - std::transform(policy_app_id.begin(), - policy_app_id.end(), - new_policy_app_id.begin(), - ::tolower); - (*message_)[strings::msg_params][strings::app_id] = new_policy_app_id; - - if (application_manager_.IsApplicationForbidden(connection_key(), - policy_app_id)) { - SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS); - return; - } - - if (IsApplicationWithSameAppIdRegistered()) { - SendResponse(false, mobile_apis::Result::DISALLOWED); - return; - } - - mobile_apis::Result::eType policy_result = CheckWithPolicyData(); - - if (Compare<mobile_apis::Result::eType, NEQ, ALL>( - policy_result, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::WARNINGS)) { - SendResponse(false, policy_result); - return; - } - - mobile_apis::Result::eType coincidence_result = CheckCoincidence(); - - if (mobile_apis::Result::SUCCESS != coincidence_result) { - LOG4CXX_ERROR(logger_, "Coincidence check failed."); - if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) { - usage_statistics::AppCounter count_of_rejections_duplicate_name( - GetPolicyHandler().GetStatisticManager(), - policy_app_id, - usage_statistics::REJECTIONS_DUPLICATE_NAME); - ++count_of_rejections_duplicate_name; - } - SendResponse(false, coincidence_result); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_INFO(logger_, - "Incoming register app interface has contains \t\n \\t \\n"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - application = application_manager_.RegisterApplication(message_); - - if (!application) { - LOG4CXX_ERROR(logger_, "Application hasn't been registered!"); - return; - } - // For resuming application need to restore hmi_app_id from resumeCtrl - resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); - const std::string& device_mac = application->mac_address(); - - // there is side affect with 2 mobile app with the same mobile app_id - if (resumer.IsApplicationSaved(policy_app_id, device_mac)) { - application->set_hmi_application_id( - resumer.GetHMIApplicationID(policy_app_id, device_mac)); - } else { - application->set_hmi_application_id( - application_manager_.GenerateNewHMIAppID()); - } - - application->set_is_media_application( - msg_params[strings::is_media_application].asBool()); - - if (msg_params.keyExists(strings::vr_synonyms)) { - application->set_vr_synonyms(msg_params[strings::vr_synonyms]); - } - - if (msg_params.keyExists(strings::ngn_media_screen_app_name)) { - application->set_ngn_media_screen_name( - msg_params[strings::ngn_media_screen_app_name]); - } - - if (msg_params.keyExists(strings::tts_name)) { - application->set_tts_name(msg_params[strings::tts_name]); - } - - if (msg_params.keyExists(strings::app_hmi_type)) { - application->set_app_types(msg_params[strings::app_hmi_type]); - - // check app type - const smart_objects::SmartObject& app_type = - msg_params.getElement(strings::app_hmi_type); - - for (size_t i = 0; i < app_type.length(); ++i) { - if (mobile_apis::AppHMIType::NAVIGATION == - static_cast<mobile_apis::AppHMIType::eType>( - app_type.getElement(i).asUInt())) { - application->set_is_navi(true); - } - if (mobile_apis::AppHMIType::COMMUNICATION == - static_cast<mobile_apis::AppHMIType::eType>( - app_type.getElement(i).asUInt())) { - application->set_voice_communication_supported(true); - } - if (mobile_apis::AppHMIType::PROJECTION == - static_cast<mobile_apis::AppHMIType::eType>( - app_type.getElement(i).asUInt())) { - application->set_mobile_projection_enabled(true); - } - } - } - - // Add device to policy table and set device info, if any - policy::DeviceParams dev_params; - if (-1 == - application_manager_.connection_handler() - .get_session_observer() - .GetDataOnDeviceID(application->device(), - &dev_params.device_name, - NULL, - &dev_params.device_mac_address, - &dev_params.device_connection_type)) { - LOG4CXX_ERROR(logger_, - "Failed to extract information for device " - << application->device()); - } - policy::DeviceInfo device_info; - device_info.AdoptDeviceType(dev_params.device_connection_type); - if (msg_params.keyExists(strings::device_info)) { - FillDeviceInfo(&device_info); - } - - GetPolicyHandler().SetDeviceInfo(device_mac, device_info); - - SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication); - smart_objects::SmartObjectSPtr so = - GetLockScreenIconUrlNotification(connection_key(), application); - application_manager_.ManageMobileCommand(so, commands::Command::ORIGIN_SDL); -} - -smart_objects::SmartObjectSPtr -RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification( - const uint32_t connection_key, ApplicationSharedPtr app) { - DCHECK_OR_RETURN(app.get(), smart_objects::SmartObjectSPtr()); - smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( - smart_objects::SmartType_Map); - (*message)[strings::params][strings::function_id] = - mobile_apis::FunctionID::OnSystemRequestID; - (*message)[strings::params][strings::connection_key] = connection_key; - (*message)[strings::params][strings::message_type] = - mobile_apis::messageType::notification; - (*message)[strings::params][strings::protocol_type] = - commands::CommandImpl::mobile_protocol_type_; - (*message)[strings::params][strings::protocol_version] = - commands::CommandImpl::protocol_version_; - (*message)[strings::msg_params][strings::request_type] = - mobile_apis::RequestType::LOCK_SCREEN_ICON_URL; - (*message)[strings::msg_params][strings::url] = - GetPolicyHandler().GetLockScreenIconUrl(); - return message; -} - -void FillVRRelatedFields(smart_objects::SmartObject& response_params, - const HMICapabilities& hmi_capabilities) { - response_params[strings::language] = hmi_capabilities.active_vr_language(); - if (hmi_capabilities.vr_capabilities()) { - response_params[strings::vr_capabilities] = - *hmi_capabilities.vr_capabilities(); - } -} - -void FillVIRelatedFields(smart_objects::SmartObject& response_params, - const HMICapabilities& hmi_capabilities) { - if (hmi_capabilities.vehicle_type()) { - response_params[hmi_response::vehicle_type] = - *hmi_capabilities.vehicle_type(); - } -} - -void FillTTSRelatedFields(smart_objects::SmartObject& response_params, - const HMICapabilities& hmi_capabilities) { - response_params[strings::language] = hmi_capabilities.active_tts_language(); - if (hmi_capabilities.speech_capabilities()) { - response_params[strings::speech_capabilities] = - *hmi_capabilities.speech_capabilities(); - } - if (hmi_capabilities.prerecorded_speech()) { - response_params[strings::prerecorded_speech] = - *(hmi_capabilities.prerecorded_speech()); - } -} - -void FillUIRelatedFields(smart_objects::SmartObject& response_params, - const HMICapabilities& hmi_capabilities) { - response_params[strings::hmi_display_language] = - hmi_capabilities.active_ui_language(); - if (hmi_capabilities.display_capabilities()) { - response_params[hmi_response::display_capabilities] = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - smart_objects::SmartObject& display_caps = - response_params[hmi_response::display_capabilities]; - - display_caps[hmi_response::display_type] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::display_type); - - display_caps[hmi_response::text_fields] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::text_fields); - - display_caps[hmi_response::image_fields] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::image_fields); - - display_caps[hmi_response::media_clock_formats] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::media_clock_formats); - - display_caps[hmi_response::templates_available] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::templates_available); - - display_caps[hmi_response::screen_params] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::screen_params); - - display_caps[hmi_response::num_custom_presets_available] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::num_custom_presets_available); - - display_caps[hmi_response::graphic_supported] = - (hmi_capabilities.display_capabilities() - ->getElement(hmi_response::image_capabilities) - .length() > 0); - - display_caps[hmi_response::templates_available] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::templates_available); - - display_caps[hmi_response::screen_params] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::screen_params); - - display_caps[hmi_response::num_custom_presets_available] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::num_custom_presets_available); - } - - if (hmi_capabilities.audio_pass_thru_capabilities()) { - if (smart_objects::SmartType_Array == - hmi_capabilities.audio_pass_thru_capabilities()->getType()) { - // hmi_capabilities json contains array and HMI response object - response_params[strings::audio_pass_thru_capabilities] = - *hmi_capabilities.audio_pass_thru_capabilities(); - } else { - response_params[strings::audio_pass_thru_capabilities][0] = - *hmi_capabilities.audio_pass_thru_capabilities(); - } - } - response_params[strings::hmi_capabilities] = - smart_objects::SmartObject(smart_objects::SmartType_Map); - response_params[strings::hmi_capabilities][strings::navigation] = - hmi_capabilities.navigation_supported(); - response_params[strings::hmi_capabilities][strings::phone_call] = - hmi_capabilities.phone_call_supported(); - response_params[strings::hmi_capabilities][strings::video_streaming] = - hmi_capabilities.video_streaming_supported(); - response_params[strings::hmi_capabilities][strings::remote_control] = - hmi_capabilities.rc_supported(); -} - -void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( - ApplicationType app_type) { - LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObject response_params(smart_objects::SmartType_Map); - - mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; - - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - - const uint32_t key = connection_key(); - ApplicationSharedPtr application = application_manager_.application(key); - - resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); - - if (!application) { - LOG4CXX_ERROR(logger_, - "There is no application for such connection key" << key); - LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer"); - resumer.OnAppRegistrationEnd(); - return; - } - - response_params[strings::sync_msg_version][strings::major_version] = - major_version; // From generated file interfaces/generated_msg_version.h - response_params[strings::sync_msg_version][strings::minor_version] = - minor_version; // From generated file interfaces/generated_msg_version.h - response_params[strings::sync_msg_version][strings::patch_version] = - patch_version; // From generated file interfaces/generated_msg_version.h - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - if (msg_params[strings::language_desired].asInt() != - hmi_capabilities.active_vr_language() || - msg_params[strings::hmi_display_language_desired].asInt() != - hmi_capabilities.active_ui_language()) { - LOG4CXX_WARN(logger_, - "Wrong language on registering application " - << application->name().c_str()); - - LOG4CXX_ERROR( - logger_, - "VR language desired code is " - << msg_params[strings::language_desired].asInt() - << " , active VR language code is " - << hmi_capabilities.active_vr_language() << ", UI language code is " - << msg_params[strings::hmi_display_language_desired].asInt() - << " , active UI language code is " - << hmi_capabilities.active_ui_language()); - - result_code = mobile_apis::Result::WRONG_LANGUAGE; - } - - if (HmiInterfaces::STATE_NOT_AVAILABLE != - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_TTS)) { - FillTTSRelatedFields(response_params, hmi_capabilities); - } - - if (HmiInterfaces::STATE_NOT_AVAILABLE != - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_VR)) { - FillVRRelatedFields(response_params, hmi_capabilities); - } - - if (HmiInterfaces::STATE_NOT_AVAILABLE != - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_UI)) { - FillUIRelatedFields(response_params, hmi_capabilities); - } - - if (HmiInterfaces::STATE_NOT_AVAILABLE != - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { - FillVIRelatedFields(response_params, hmi_capabilities); - } - - if (hmi_capabilities.button_capabilities()) { - response_params[hmi_response::button_capabilities] = - *hmi_capabilities.button_capabilities(); - } - - if (hmi_capabilities.soft_button_capabilities()) { - response_params[hmi_response::soft_button_capabilities] = - *hmi_capabilities.soft_button_capabilities(); - } - - if (hmi_capabilities.preset_bank_capabilities()) { - response_params[hmi_response::preset_bank_capabilities] = - *hmi_capabilities.preset_bank_capabilities(); - } - - if (hmi_capabilities.hmi_zone_capabilities()) { - if (smart_objects::SmartType_Array == - hmi_capabilities.hmi_zone_capabilities()->getType()) { - // hmi_capabilities json contains array and HMI response object - response_params[hmi_response::hmi_zone_capabilities] = - *hmi_capabilities.hmi_zone_capabilities(); - } else { - response_params[hmi_response::hmi_zone_capabilities][0] = - *hmi_capabilities.hmi_zone_capabilities(); - } - } - - if (hmi_capabilities.pcm_stream_capabilities()) { - response_params[strings::pcm_stream_capabilities] = - *hmi_capabilities.pcm_stream_capabilities(); - } - - const std::vector<uint32_t>& diag_modes = - application_manager_.get_settings().supported_diag_modes(); - if (!diag_modes.empty()) { - std::vector<uint32_t>::const_iterator it = diag_modes.begin(); - uint32_t index = 0; - for (; it != diag_modes.end(); ++it) { - response_params[strings::supported_diag_modes][index] = *it; - ++index; - } - } - - response_params[strings::sdl_version] = - application_manager_.get_settings().sdl_version(); - const std::string ccpu_version = - application_manager_.hmi_capabilities().ccpu_version(); - if (!ccpu_version.empty()) { - response_params[strings::system_software_version] = ccpu_version; - } - - if (ApplicationType::kSwitchedApplicationWrongHashId == app_type) { - LOG4CXX_DEBUG(logger_, - "Application has been switched from another transport, " - "but doesn't have correct hashID."); - - application_manager::DeleteApplicationData(application, - application_manager_); - - SendResponse( - true, mobile_apis::Result::RESUME_FAILED, NULL, &response_params); - return; - } - - if (ApplicationType::kSwitchedApplicationHashOk == app_type) { - LOG4CXX_DEBUG(logger_, - "Application has been switched from another transport " - "and has correct hashID."); - SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); - return; - } - - bool resumption = - (*message_)[strings::msg_params].keyExists(strings::hash_id); - - bool need_restore_vr = resumption; - - std::string hash_id; - std::string add_info; - if (resumption) { - hash_id = (*message_)[strings::msg_params][strings::hash_id].asString(); - if (!resumer.CheckApplicationHash(application, hash_id)) { - LOG4CXX_WARN(logger_, - "Hash from RAI does not match to saved resume data."); - result_code = mobile_apis::Result::RESUME_FAILED; - add_info = "Hash from RAI does not match to saved resume data."; - need_restore_vr = false; - } else if (!resumer.CheckPersistenceFilesForResumption(application)) { - LOG4CXX_WARN(logger_, "Persistent data is missing."); - result_code = mobile_apis::Result::RESUME_FAILED; - add_info = "Persistent data is missing."; - need_restore_vr = false; - } else { - add_info = "Resume succeeded."; - } - } - if ((mobile_apis::Result::SUCCESS == result_code) && - (mobile_apis::Result::INVALID_ENUM != result_checking_app_hmi_type_)) { - add_info += response_info_; - result_code = result_checking_app_hmi_type_; - } - - // in case application exist in resumption we need to send resumeVrgrammars - if (false == resumption) { - resumption = resumer.IsApplicationSaved(application->policy_app_id(), - application->mac_address()); - } - - AppHmiTypes hmi_types; - if ((*message_)[strings::msg_params].keyExists(strings::app_hmi_type)) { - smart_objects::SmartArray* hmi_types_ptr = - (*message_)[strings::msg_params][strings::app_hmi_type].asArray(); - DCHECK_OR_RETURN_VOID(hmi_types_ptr); - SmartArrayValueExtractor extractor; - if (hmi_types_ptr && 0 < hmi_types_ptr->size()) { - std::transform(hmi_types_ptr->begin(), - hmi_types_ptr->end(), - std::back_inserter(hmi_types), - extractor); - } - } - policy::StatusNotifier notify_upd_manager = GetPolicyHandler().AddApplication( - application->policy_app_id(), hmi_types); - SendResponse(true, result_code, add_info.c_str(), &response_params); - SendOnAppRegisteredNotificationToHMI( - *(application.get()), resumption, need_restore_vr); -#ifdef SDL_REMOTE_CONTROL - if (msg_params.keyExists(strings::app_hmi_type)) { - GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(), - &(msg_params[strings::app_hmi_type])); - } -#endif // SDL_REMOTE_CONTROL - - // Default HMI level should be set before any permissions validation, since it - // relies on HMI level. - application_manager_.OnApplicationRegistered(application); - (*notify_upd_manager)(); - - // Start PTU after successfull registration - // Sends OnPermissionChange notification to mobile right after RAI response - // and HMI level set-up - GetPolicyHandler().OnAppRegisteredOnMobile(application->policy_app_id()); - - if (result_code != mobile_apis::Result::RESUME_FAILED) { - resumer.StartResumption(application, hash_id); - } else { - resumer.StartResumptionOnlyHMILevel(application); - } - - // By default app subscribed to CUSTOM_BUTTON - SendSubscribeCustomButtonNotification(); - SendChangeRegistrationOnHMI(application); -} - -DEPRECATED void -RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { - SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication); -} - -void RegisterAppInterfaceRequest::SendChangeRegistration( - const hmi_apis::FunctionID::eType function_id, - const int32_t language, - const uint32_t app_id) { - using helpers::Compare; - using helpers::EQ; - using helpers::ONE; - const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - const HmiInterfaces::InterfaceID interface = - hmi_interfaces.GetInterfaceFromFunction(function_id); - if (hmi_interfaces.GetInterfaceState(interface) != - HmiInterfaces::STATE_NOT_AVAILABLE) { - smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::language] = language; - msg_params[strings::app_id] = app_id; - SendHMIRequest(function_id, &msg_params); - } else { - LOG4CXX_DEBUG(logger_, "Interface " << interface << "is not avaliable"); - } -} - -void RegisterAppInterfaceRequest::SendChangeRegistrationOnHMI( - ApplicationConstSharedPtr app) { - using namespace hmi_apis::FunctionID; - DCHECK_OR_RETURN_VOID(app); - DCHECK_OR_RETURN_VOID(mobile_apis::Language::INVALID_ENUM != app->language()); - SendChangeRegistration(VR_ChangeRegistration, app->language(), app->app_id()); - SendChangeRegistration( - TTS_ChangeRegistration, app->language(), app->app_id()); - SendChangeRegistration(UI_ChangeRegistration, app->language(), app->app_id()); -} - -void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( - const Application& application_impl, - bool resumption, - bool need_restore_vr) { - using namespace smart_objects; - SmartObjectSPtr notification = utils::MakeShared<SmartObject>(SmartType_Map); - if (!notification) { - LOG4CXX_ERROR(logger_, "Failed to create smart object"); - return; - } - - (*notification)[strings::params] = SmartObject(SmartType_Map); - smart_objects::SmartObject& params = (*notification)[strings::params]; - params[strings::function_id] = static_cast<int32_t>( - hmi_apis::FunctionID::BasicCommunication_OnAppRegistered); - params[strings::message_type] = static_cast<int32_t>(kNotification); - params[strings::protocol_version] = commands::CommandImpl::protocol_version_; - params[strings::protocol_type] = commands::CommandImpl::hmi_protocol_type_; - - (*notification)[strings::msg_params] = SmartObject(SmartType_Map); - smart_objects::SmartObject& msg_params = (*notification)[strings::msg_params]; - // Due to current requirements in case when we're in resumption mode - // we have to always send resumeVRGrammar field. - if (resumption) { - msg_params[strings::resume_vr_grammars] = need_restore_vr; - } - - if (application_impl.vr_synonyms()) { - msg_params[strings::vr_synonyms] = *(application_impl.vr_synonyms()); - } - - if (application_impl.tts_name()) { - msg_params[strings::tts_name] = *(application_impl.tts_name()); - } - - std::string priority; - GetPolicyHandler().GetPriority(application_impl.policy_app_id(), &priority); - - if (!priority.empty()) { - msg_params[strings::priority] = MessageHelper::GetPriorityCode(priority); - } - - msg_params[strings::msg_params] = SmartObject(SmartType_Map); - smart_objects::SmartObject& application = msg_params[strings::application]; - application[strings::app_name] = application_impl.name(); - application[strings::app_id] = application_impl.app_id(); - application[hmi_response::policy_app_id] = application_impl.policy_app_id(); - application[strings::icon] = application_impl.app_icon_path(); - - const smart_objects::SmartObject* ngn_media_screen_name = - application_impl.ngn_media_screen_name(); - if (ngn_media_screen_name) { - application[strings::ngn_media_screen_app_name] = *ngn_media_screen_name; - } - - application[strings::hmi_display_language_desired] = - static_cast<int32_t>(application_impl.ui_language()); - - application[strings::is_media_application] = - application_impl.is_media_application(); - - const smart_objects::SmartObject* app_type = application_impl.app_types(); - if (app_type) { - application[strings::app_type] = *app_type; - } - - std::vector<std::string> request_types = - GetPolicyHandler().GetAppRequestTypes(application_impl.policy_app_id()); - - application[strings::request_type] = SmartObject(SmartType_Array); - smart_objects::SmartObject& request_array = - application[strings::request_type]; - - uint32_t index = 0; - std::vector<std::string>::const_iterator it = request_types.begin(); - for (; request_types.end() != it; ++it) { - request_array[index] = *it; - ++index; - } - - application[strings::device_info] = SmartObject(SmartType_Map); - smart_objects::SmartObject& device_info = application[strings::device_info]; - const protocol_handler::SessionObserver& session_observer = - application_manager_.connection_handler().get_session_observer(); - std::string device_name; - std::string mac_address; - std::string transport_type; - const connection_handler::DeviceHandle handle = application_impl.device(); - if (-1 == - session_observer.GetDataOnDeviceID( - handle, &device_name, NULL, &mac_address, &transport_type)) { - LOG4CXX_ERROR(logger_, - "Failed to extract information for device " << handle); - } - - device_info[strings::name] = device_name; - device_info[strings::id] = mac_address; - - const policy::DeviceConsent device_consent = - GetPolicyHandler().GetUserConsentForDevice(mac_address); - device_info[strings::isSDLAllowed] = - policy::DeviceConsent::kDeviceAllowed == device_consent; - - device_info[strings::transport_type] = - application_manager_.GetDeviceTransportType(transport_type); - - DCHECK(application_manager_.ManageHMICommand(notification)); -} - -mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - ApplicationSet accessor = application_manager_.applications().GetData(); - - ApplicationSetConstIt it = accessor.begin(); - const custom_str::CustomString& app_name = - msg_params[strings::app_name].asCustomString(); - - for (; accessor.end() != it; ++it) { - // name check - const custom_str::CustomString& cur_name = (*it)->name(); - if (app_name.CompareIgnoreCase(cur_name)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); - return mobile_apis::Result::DUPLICATE_NAME; - } - - const smart_objects::SmartObject* vr = (*it)->vr_synonyms(); - const std::vector<smart_objects::SmartObject>* curr_vr = NULL; - if (NULL != vr) { - curr_vr = vr->asArray(); - CoincidencePredicateVR v(app_name); - - if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); - return mobile_apis::Result::DUPLICATE_NAME; - } - } - - // vr check - if (msg_params.keyExists(strings::vr_synonyms)) { - const std::vector<smart_objects::SmartObject>* new_vr = - msg_params[strings::vr_synonyms].asArray(); - - CoincidencePredicateVR v(cur_name); - if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); - return mobile_apis::Result::DUPLICATE_NAME; - } - } // end vr check - - } // application for end - - return mobile_apis::Result::SUCCESS; -} // method end - -mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { - LOG4CXX_AUTO_TRACE(logger_); - // TODO(AOleynik): Check is necessary to allow register application in case - // of disabled policy - // Remove this check, when HMI will support policy - if (!GetPolicyHandler().PolicyEnabled()) { - return mobile_apis::Result::WARNINGS; - } - - smart_objects::SmartObject& message = *message_; - policy::StringArray app_nicknames; - policy::StringArray app_hmi_types; - - const std::string mobile_app_id = - message[strings::msg_params][strings::app_id].asString(); - const bool init_result = GetPolicyHandler().GetInitialAppData( - mobile_app_id, &app_nicknames, &app_hmi_types); - - if (!init_result) { - LOG4CXX_ERROR(logger_, "Error during initial application data check."); - return mobile_apis::Result::INVALID_DATA; - } - - if (!app_nicknames.empty()) { - IsSameNickname compare( - message[strings::msg_params][strings::app_name].asCustomString()); - policy::StringArray::const_iterator it = - std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); - if (app_nicknames.end() == it) { - LOG4CXX_WARN(logger_, - "Application name was not found in nicknames list."); - // App should be unregistered, if its name is not present in nicknames - // list - usage_statistics::AppCounter count_of_rejections_nickname_mismatch( - GetPolicyHandler().GetStatisticManager(), - mobile_app_id, - usage_statistics::REJECTIONS_NICKNAME_MISMATCH); - ++count_of_rejections_nickname_mismatch; - return mobile_apis::Result::DISALLOWED; - } - } - - mobile_apis::Result::eType result = mobile_apis::Result::SUCCESS; - - // If AppHMIType is not included in policy - allow any type - if (!app_hmi_types.empty()) { - if (message[strings::msg_params].keyExists(strings::app_hmi_type)) { - // If AppHmiTypes are partially same, the system should allow those listed - // in the policy table and send warning info on missed values - smart_objects::SmartArray app_types = - *(message[strings::msg_params][strings::app_hmi_type].asArray()); - - std::string log; - CheckMissedTypes checker(app_hmi_types, log); - std::for_each(app_types.begin(), app_types.end(), checker); - if (!log.empty()) { - response_info_ = - "Following AppHmiTypes are not present in policy " - "table:" + - log; - result_checking_app_hmi_type_ = mobile_apis::Result::WARNINGS; - } - } - // Replace AppHmiTypes in request with values allowed by policy table - message[strings::msg_params][strings::app_hmi_type] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - smart_objects::SmartObject& app_hmi_type = - message[strings::msg_params][strings::app_hmi_type]; - - AppHMITypeInserter inserter(app_hmi_type); - std::for_each(app_hmi_types.begin(), app_hmi_types.end(), inserter); - } - - return result; -} - -void RegisterAppInterfaceRequest::FillDeviceInfo( - policy::DeviceInfo* device_info) { - const std::string hardware = "hardware"; - const std::string firmware_rev = "firmwareRev"; - const std::string os = "os"; - const std::string os_ver = "osVersion"; - const std::string carrier = "carrier"; - const std::string max_number_rfcom_ports = "maxNumberRFCOMMPorts"; - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - const smart_objects::SmartObject& device_info_so = - msg_params[strings::device_info]; - - if (device_info_so.keyExists(hardware)) { - device_info->hardware = - msg_params[strings::device_info][hardware].asString(); - } - if (device_info_so.keyExists(firmware_rev)) { - device_info->firmware_rev = - msg_params[strings::device_info][firmware_rev].asString(); - } - if (device_info_so.keyExists(os)) { - device_info->os = device_info_so[os].asString(); - } - if (device_info_so.keyExists(os_ver)) { - device_info->os_ver = device_info_so[os_ver].asString(); - } - if (device_info_so.keyExists(carrier)) { - device_info->carrier = device_info_so[carrier].asString(); - } - if (device_info_so.keyExists(max_number_rfcom_ports)) { - device_info->max_number_rfcom_ports = - device_info_so[max_number_rfcom_ports].asInt(); - } -} - -bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { - LOG4CXX_AUTO_TRACE(logger_); - - const custom_string::CustomString mobile_app_id = - (*message_)[strings::msg_params][strings::app_id].asCustomString(); - - const ApplicationSet& applications = - application_manager_.applications().GetData(); - - ApplicationSetConstIt it = applications.begin(); - ApplicationSetConstIt it_end = applications.end(); - - for (; it != it_end; ++it) { - if (mobile_app_id.CompareIgnoreCase((*it)->policy_app_id().c_str())) { - return true; - } - } - - return false; -} - -bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed"); - return true; - } - - if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) { - const smart_objects::SmartArray* tn_array = - (*message_)[strings::msg_params][strings::tts_name].asArray(); - - smart_objects::SmartArray::const_iterator it_tn = tn_array->begin(); - smart_objects::SmartArray::const_iterator it_tn_end = tn_array->end(); - - for (; it_tn != it_tn_end; ++it_tn) { - str = (*it_tn)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists( - strings::ngn_media_screen_app_name)) { - str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] - .asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid ngn_media_screen_app_name syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::vr_synonyms)) { - const smart_objects::SmartArray* vs_array = - (*message_)[strings::msg_params][strings::vr_synonyms].asArray(); - - smart_objects::SmartArray::const_iterator it_vs = vs_array->begin(); - smart_objects::SmartArray::const_iterator it_vs_end = vs_array->end(); - - for (; it_vs != it_vs_end; ++it_vs) { - str = (*it_vs).asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_synonyms syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) { - str = (*message_)[strings::msg_params][strings::hash_id].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid hash_id syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::device_info)) { - if ((*message_)[strings::msg_params][strings::device_info].keyExists( - strings::hardware)) { - str = (*message_)[strings::msg_params][strings::device_info] - [strings::hardware].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info hardware syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params][strings::device_info].keyExists( - strings::firmware_rev)) { - str = (*message_)[strings::msg_params][strings::device_info] - [strings::firmware_rev].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info firmware_rev syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params][strings::device_info].keyExists( - strings::os)) { - str = (*message_)[strings::msg_params][strings::device_info][strings::os] - .asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid device_info os syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params][strings::device_info].keyExists( - strings::os_version)) { - str = (*message_)[strings::msg_params][strings::device_info] - [strings::os_version].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info os_version syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params][strings::device_info].keyExists( - strings::carrier)) { - str = (*message_)[strings::msg_params][strings::device_info] - [strings::carrier].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info carrier syntax check failed"); - return true; - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { - str = (*message_)[strings::msg_params][strings::app_id].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid app_id syntax check failed"); - return true; - } - } - - return false; -} - -void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam( - smart_objects::SmartObject& vehicle_type, - const std::string& param, - const std::string& backup_value) { - using namespace hmi_response; - if (!vehicle_type.keyExists(param) || vehicle_type[param].empty()) { - if (!backup_value.empty()) { - LOG4CXX_DEBUG(logger_, - param << " is missing." - "Will be replaced with policy table value."); - vehicle_type[param] = backup_value; - } else { - vehicle_type.erase(param); - } - } -} - -void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { - using namespace smart_objects; - using namespace hmi_apis; - - SmartObject msg_params = SmartObject(SmartType_Map); - msg_params[strings::app_id] = connection_key(); - msg_params[strings::name] = Common_ButtonName::CUSTOM_BUTTON; - msg_params[strings::is_suscribed] = true; - CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); -} - -bool RegisterAppInterfaceRequest::IsApplicationSwitched() { - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - const std::string& policy_app_id = msg_params[strings::app_id].asString(); - - LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id); - - auto app = application_manager_.application_by_policy_id(policy_app_id); - - if (!app) { - LOG4CXX_DEBUG(logger_, - "Application with policy id " << policy_app_id - << " is not found."); - return false; - } - - LOG4CXX_DEBUG(logger_, - "Application with policy id " << policy_app_id << " is found."); - if (!application_manager_.IsAppInReconnectMode(policy_app_id)) { - LOG4CXX_DEBUG(logger_, - "Policy id " << policy_app_id - << " is not found in reconnection list."); - SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); - return false; - } - - LOG4CXX_DEBUG(logger_, "Application is found in reconnection list."); - - auto app_type = ApplicationType::kSwitchedApplicationWrongHashId; - if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) { - const auto hash_id = - (*message_)[strings::msg_params][strings::hash_id].asString(); - - auto& resume_ctrl = application_manager_.resume_controller(); - if (resume_ctrl.CheckApplicationHash(app, hash_id)) { - app_type = ApplicationType::kSwitchedApplicationHashOk; - } - } - - application_manager_.ProcessReconnection(app, connection_key()); - SendRegisterAppInterfaceResponseToMobile(app_type); - - application_manager_.SendHMIStatusNotification(app); - - application_manager_.OnApplicationSwitched(app); - - return true; -} - -policy::PolicyHandlerInterface& -RegisterAppInterfaceRequest::GetPolicyHandler() { - return application_manager_.GetPolicyHandler(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc deleted file mode 100644 index 3e94e652d4..0000000000 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/register_app_interface_response.h" -#include "interfaces/MOBILE_API.h" -#include "application_manager/application_manager.h" -#include "application_manager/policies/policy_handler_interface.h" -#include "connection_handler/connection_handler.h" -#include "application_manager/policies/policy_handler_interface.h" - -namespace application_manager { - -namespace commands { - -void RegisterAppInterfaceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; - bool success = (*message_)[strings::msg_params][strings::success].asBool(); - bool last_message = !success; - // Do not close connection in case of APPLICATION_NOT_REGISTERED despite it is - // an error - if (!success && - (*message_)[strings::msg_params].keyExists(strings::result_code)) { - result_code = static_cast<mobile_apis::Result::eType>( - (*message_)[strings::msg_params][strings::result_code].asInt()); - if (result_code == mobile_apis::Result::APPLICATION_REGISTERED_ALREADY) { - last_message = false; - } - } - - SendResponse(success, result_code, last_message); - - if (mobile_apis::Result::SUCCESS != result_code) { - return; - } - - // Add registered application to the policy db right after response sent to - // mobile to be able to check all other API according to app permissions - application_manager::ApplicationSharedPtr application = - application_manager_.application(connection_key()); - if (!application) { - LOG4CXX_ERROR(logger_, - "Application with connection key " << connection_key() - << " is not registered."); - return; - } - - SetHeartBeatTimeout(connection_key(), application->policy_app_id()); -} - -void RegisterAppInterfaceResponse::SetHeartBeatTimeout( - uint32_t connection_key, const std::string& mobile_app_id) { - LOG4CXX_AUTO_TRACE(logger_); - policy::PolicyHandlerInterface& policy_handler = - application_manager_.GetPolicyHandler(); - if (policy_handler.PolicyEnabled()) { - const uint32_t timeout = policy_handler.HeartBeatTimeout(mobile_app_id); - if (timeout > 0) { - application_manager_.connection_handler().SetHeartBeatTimeout( - connection_key, timeout); - } - } else { - LOG4CXX_INFO(logger_, "Policy is turn off"); - } -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc deleted file mode 100644 index a7c2db0e65..0000000000 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc +++ /dev/null @@ -1,327 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/reset_global_properties_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" - -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} - -ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {} - -void ResetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - uint32_t app_id = - (*message_)[strings::params][strings::connection_key].asUInt(); - ApplicationSharedPtr app = application_manager_.application(app_id); - - if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - size_t obj_length = - (*message_)[strings::msg_params][strings::properties].length(); - // if application waits for sending ttsGlobalProperties need to remove this - // application from tts_global_properties_app_list_ - LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList"); - application_manager_.RemoveAppFromTTSGlobalPropertiesList(app_id); - - bool helpt_promt = false; - bool timeout_prompt = false; - bool vr_help_title_items = false; - bool menu_name = false; - bool menu_icon = false; - bool is_key_board_properties = false; - int number_of_reset_vr = 0; - mobile_apis::GlobalProperty::eType global_property = - mobile_apis::GlobalProperty::INVALID_ENUM; - - for (size_t i = 0; i < obj_length; ++i) { - global_property = static_cast<mobile_apis::GlobalProperty::eType>( - (*message_)[strings::msg_params][strings::properties][i].asInt()); - - if (mobile_apis::GlobalProperty::HELPPROMPT == global_property) { - helpt_promt = ResetHelpPromt(app); - } else if (mobile_apis::GlobalProperty::TIMEOUTPROMPT == global_property) { - timeout_prompt = ResetTimeoutPromt(app); - } else if (((mobile_apis::GlobalProperty::VRHELPTITLE == global_property) || - (mobile_apis::GlobalProperty::VRHELPITEMS == - global_property)) && - (0 == number_of_reset_vr)) { - ++number_of_reset_vr; - vr_help_title_items = ResetVrHelpTitleItems(app); - } else if (mobile_apis::GlobalProperty::MENUNAME == global_property) { - menu_name = true; - } else if (mobile_apis::GlobalProperty::MENUICON == global_property) { - menu_icon = true; - } else if (mobile_apis::GlobalProperty::KEYBOARDPROPERTIES == - global_property) { - is_key_board_properties = true; - } - } - - if (vr_help_title_items || menu_name || menu_icon || - is_key_board_properties) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - } - - if (timeout_prompt || helpt_promt) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - } - - app->set_reset_global_properties_active(true); - - if (vr_help_title_items || menu_name || menu_icon || - is_key_board_properties) { - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - if (vr_help_title_items) { - smart_objects::SmartObjectSPtr vr_help = - MessageHelper::CreateAppVrHelp(app); - if (!vr_help) { - return; - } - msg_params = *vr_help; - } - if (menu_name) { - msg_params[hmi_request::menu_title] = ""; - app->set_menu_title(msg_params[hmi_request::menu_title]); - } - // TODO(DT): clarify the sending parameter menuIcon - // if (menu_icon) { - //} - if (is_key_board_properties) { - smart_objects::SmartObject key_board_properties = - smart_objects::SmartObject(smart_objects::SmartType_Map); - key_board_properties[strings::language] = - static_cast<int32_t>(hmi_apis::Common_Language::EN_US); - key_board_properties[hmi_request::keyboard_layout] = - static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY); - - // Look for APPLINK-4432 for details. - /*smart_objects::SmartObject limited_character_list = - smart_objects::SmartObject( - smart_objects::SmartType_Array); - limited_character_list[0] = ""; - key_board_properties[hmi_request::limited_character_list] = - limited_character_list;*/ - - key_board_properties[hmi_request::auto_complete_text] = ""; - msg_params[hmi_request::keyboard_properties] = key_board_properties; - } - - msg_params[strings::app_id] = app->app_id(); - SendHMIRequest( - hmi_apis::FunctionID::UI_SetGlobalProperties, &msg_params, true); - } - - if (timeout_prompt || helpt_promt) { - // create ui request - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - if (helpt_promt) { - msg_params[strings::help_prompt] = (*app->help_prompt()); - } - - if (timeout_prompt) { - msg_params[strings::timeout_prompt] = (*app->timeout_prompt()); - } - - msg_params[strings::app_id] = app->app_id(); - - SendHMIRequest( - hmi_apis::FunctionID::TTS_SetGlobalProperties, &msg_params, true); - } -} - -bool ResetGlobalPropertiesRequest::ResetHelpPromt( - application_manager::ApplicationSharedPtr app) { - if (!app) { - LOG4CXX_ERROR(logger_, "Null pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return false; - } - smart_objects::SmartObject so_help_prompt = - smart_objects::SmartObject(smart_objects::SmartType_Array); - app->set_help_prompt(so_help_prompt); - return true; -} - -bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( - application_manager::ApplicationSharedPtr const app) { - if (!app) { - LOG4CXX_ERROR(logger_, "Null pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return false; - } - - const std::vector<std::string>& time_out_promt = - application_manager_.get_settings().time_out_promt(); - - smart_objects::SmartObject so_time_out_promt = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - for (uint32_t i = 0; i < time_out_promt.size(); ++i) { - smart_objects::SmartObject timeoutPrompt = - smart_objects::SmartObject(smart_objects::SmartType_Map); - timeoutPrompt[strings::text] = time_out_promt[i]; - timeoutPrompt[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; - so_time_out_promt[i] = timeoutPrompt; - } - - app->set_timeout_prompt(so_time_out_promt); - - return true; -} - -bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems( - application_manager::ApplicationSharedPtr const app) { - if (!app) { - LOG4CXX_ERROR(logger_, "Null pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return false; - } - app->reset_vr_help_title(); - app->reset_vr_help(); - - return true; -} - -void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, ui_response_info_); - break; - } - case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - tts_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, tts_response_info_); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } - - if (IsPendingResponseExist()) { - LOG4CXX_DEBUG(logger_, "Waiting for remaining responses"); - return; - } - - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - std::string response_info; - const bool result = PrepareResponseParameters(result_code, response_info); - - SendResponse(result, - static_cast<mobile_apis::Result::eType>(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); -} - -bool ResetGlobalPropertiesRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -bool ResetGlobalPropertiesRequest::PrepareResponseParameters( - mobile_apis::Result::eType& out_result_code, - std::string& out_response_info) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - bool result = false; - ResponseInfo ui_properties_info( - ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - ResponseInfo tts_properties_info( - tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); - - HmiInterfaces::InterfaceState tts_interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_TTS); - - if (hmi_apis::Common_Result::SUCCESS == ui_result_ && - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_ && - HmiInterfaces::STATE_AVAILABLE == tts_interface_state) { - result = true; - out_result_code = mobile_apis::Result::WARNINGS; - out_response_info = "Unsupported phoneme type sent in a prompt"; - } else { - result = - PrepareResultForMobileResponse(ui_properties_info, tts_properties_info); - out_result_code = - PrepareResultCodeForResponse(ui_properties_info, tts_properties_info); - out_response_info = MergeInfos(tts_properties_info, - tts_response_info_, - ui_properties_info, - ui_response_info_); - } - - return result; -} - -bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { - return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc deleted file mode 100644 index c621977868..0000000000 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/reset_global_properties_response.h" - -namespace application_manager { - -namespace commands { - -ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {} - -void ResetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc deleted file mode 100644 index b0b2d5f464..0000000000 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc +++ /dev/null @@ -1,154 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string.h> -#include "application_manager/commands/mobile/scrollable_message_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/policies/policy_handler.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -ScrollableMessageRequest::ScrollableMessageRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); -} - -ScrollableMessageRequest::~ScrollableMessageRequest() {} - -bool ScrollableMessageRequest::Init() { - /* Timeout in milliseconds. - If omitted a standard value of 10000 milliseconds is used.*/ - if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = - (*message_)[strings::msg_params][strings::timeout].asUInt(); - } else { - const int32_t def_value = 30000; - default_timeout_ = def_value; - } - - return true; -} - -void ScrollableMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - // ProcessSoftButtons checks strings on the contents incorrect character - - mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], - app, - application_manager_.GetPolicyHandler(), - application_manager_); - - if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); - SendResponse(false, processing_result); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[hmi_request::message_text][hmi_request::field_name] = - static_cast<int32_t>( - hmi_apis::Common_TextFieldName::scrollableMessageBody); - msg_params[hmi_request::message_text][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::scroll_message_body]; - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::timeout] = default_timeout_; - - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - msg_params[strings::soft_buttons] = - (*message_)[strings::msg_params][strings::soft_buttons]; - MessageHelper::SubscribeApplicationToSoftButton( - (*message_)[strings::msg_params], app, function_id()); - } - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_ScrollableMessage, &msg_params, true); -} - -void ScrollableMessageRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } - case hmi_apis::FunctionID::UI_ScrollableMessage: { - LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc deleted file mode 100644 index a5b16bdb70..0000000000 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_response.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/scrollable_message_response.h" - -#include "interfaces/HMI_API.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -ScrollableMessageResponse::ScrollableMessageResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -void ScrollableMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - mobile_apis::Result::eType result_code = - static_cast<mobile_apis::Result::eType>( - (*message_)[strings::msg_params][strings::result_code].asInt()); - ApplicationSharedPtr application = application_manager_.application( - (*message_)[strings::params][strings::connection_key].asInt()); - if ((mobile_apis::Result::REJECTED != result_code) && application) { - application->UnsubscribeFromSoftButtons( - (*message_)[strings::params][strings::function_id].asInt()); - } - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc deleted file mode 100644 index 569eba6c02..0000000000 --- a/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2017 Xevo Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Xevo Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/send_haptic_data_request.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { - -namespace commands { - -namespace custom_str = utils::custom_string; - -SendHapticDataRequest::SendHapticDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SendHapticDataRequest::~SendHapticDataRequest() {} - -void SendHapticDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (app->is_navi() || app->mobile_projection_enabled()) { - SendHMIRequest(hmi_apis::FunctionID::UI_SendHapticData, &msg_params, true); - } else { - SendResponse(false, - mobile_apis::Result::DISALLOWED, - "Application is not of type Navigation or Mobile Projection"); - } -} - -void SendHapticDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_SendHapticData: { - mobile_apis::Result::eType result_code = - GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt())); - - const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); - - SendResponse(result, result_code, NULL, &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc b/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc deleted file mode 100644 index c8649d34af..0000000000 --- a/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017 Xevo Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Xevo Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/send_haptic_data_response.h" - -namespace application_manager { - -namespace commands { - -SendHapticDataResponse::SendHapticDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SendHapticDataResponse::~SendHapticDataResponse() {} - -void SendHapticDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/send_location_request.cc b/src/components/application_manager/src/commands/mobile/send_location_request.cc deleted file mode 100644 index 54664a8771..0000000000 --- a/src/components/application_manager/src/commands/mobile/send_location_request.cc +++ /dev/null @@ -1,276 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -#include <algorithm> -#include "application_manager/commands/mobile/send_location_request.h" -#include "application_manager/message_helper.h" -#include "utils/custom_string.h" - -namespace application_manager { - -namespace commands { - -SendLocationRequest::SendLocationRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SendLocationRequest::~SendLocationRequest() {} - -void SendLocationRequest::Run() { - using namespace hmi_apis; - using smart_objects::SmartObject; - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - if (msg_params.keyExists(strings::delivery_mode)) { - const RPCParams& allowed_params = parameters_permissions().allowed_params; - - if (helpers::in_range(allowed_params, strings::delivery_mode)) { - msg_params.erase(strings::delivery_mode); - } - } - - std::vector<Common_TextFieldName::eType> fields_to_check; - if (msg_params.keyExists(strings::location_name)) { - fields_to_check.push_back(Common_TextFieldName::locationName); - } - if (msg_params.keyExists(strings::location_description)) { - fields_to_check.push_back(Common_TextFieldName::locationDescription); - } - if (msg_params.keyExists(strings::address_lines)) { - fields_to_check.push_back(Common_TextFieldName::addressLines); - } - if (msg_params.keyExists(strings::phone_number)) { - fields_to_check.push_back(Common_TextFieldName::phoneNumber); - } - - if (!CheckHMICapabilities(fields_to_check)) { - SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Strings contain invalid characters"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (msg_params.keyExists(strings::address)) { - const utils::custom_string::CustomString& address = - msg_params[strings::address].asCustomString(); - if (address.empty()) { - msg_params.erase(strings::address); - } - } - - if (!CheckFieldsCompatibility()) { - LOG4CXX_ERROR(logger_, "CheckFieldsCompatibility failed"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (msg_params.keyExists(strings::location_image)) { - mobile_apis::Result::eType verification_result = - mobile_apis::Result::SUCCESS; - verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::location_image], - app, - application_manager_); - if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); - SendResponse(false, verification_result); - return; - } - } - - SmartObject request_msg_params = SmartObject(smart_objects::SmartType_Map); - request_msg_params = msg_params; - request_msg_params[strings::app_id] = app->hmi_app_id(); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_SendLocation, &request_msg_params, true); -} - -void SendLocationRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis; - const smart_objects::SmartObject& message = event.smart_object(); - if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) { - LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - const Common_Result::eType result_code = static_cast<Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_Navigation); - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::params])); - return; - } - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); -} - -bool SendLocationRequest::CheckFieldsCompatibility() { - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - MessageHelper::PrintSmartObject(msg_params); - const bool longitude_degrees_exist = - msg_params.keyExists(strings::longitude_degrees); - const bool latitude_degrees_exist = - msg_params.keyExists(strings::latitude_degrees); - const bool address_exist = msg_params.keyExists(strings::address); - - if (latitude_degrees_exist ^ longitude_degrees_exist) { - LOG4CXX_DEBUG(logger_, - "latitude and longitude should be provided only in pair"); - return false; - } - - if (!address_exist && !longitude_degrees_exist && !latitude_degrees_exist) { - LOG4CXX_DEBUG(logger_, - "address or latitude/longtitude should should be provided"); - return false; - } - return true; -} -void insert_if_contains( - const smart_objects::SmartObject& msg_params, - const std::string& param_key, - std::vector<utils::custom_string::CustomString>& output_vector) { - if (msg_params.keyExists(param_key)) { - output_vector.push_back(msg_params[param_key].asCustomString()); - } -} - -bool SendLocationRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - std::vector<utils::custom_string::CustomString> fields_to_check; - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - insert_if_contains(msg_params, strings::location_name, fields_to_check); - insert_if_contains( - msg_params, strings::location_description, fields_to_check); - insert_if_contains(msg_params, strings::phone_number, fields_to_check); - - if (msg_params.keyExists(strings::address_lines)) { - const smart_objects::SmartArray* al_array = - msg_params[strings::address_lines].asArray(); - smart_objects::SmartArray::const_iterator it_al = al_array->begin(); - smart_objects::SmartArray::const_iterator it_al_end = al_array->end(); - for (; it_al != it_al_end; ++it_al) { - const utils::custom_string::CustomString& val = (*it_al).asCustomString(); - fields_to_check.push_back(val); - } - } - - if (msg_params.keyExists(strings::address)) { - const smart_objects::SmartObject& address_so = msg_params[strings::address]; - insert_if_contains(address_so, strings::country_name, fields_to_check); - insert_if_contains(address_so, strings::country_code, fields_to_check); - insert_if_contains(address_so, strings::postal_code, fields_to_check); - insert_if_contains( - address_so, strings::administrative_area, fields_to_check); - insert_if_contains(address_so, strings::locality, fields_to_check); - insert_if_contains(address_so, strings::sub_locality, fields_to_check); - insert_if_contains(address_so, strings::thoroughfare, fields_to_check); - insert_if_contains(address_so, strings::sub_thoroughfare, fields_to_check); - } - - std::vector<utils::custom_string::CustomString>::iterator it = - fields_to_check.begin(); - for (; it != fields_to_check.end(); ++it) { - const std::string& str = it->AsMBString(); - if (!CheckSyntax(str, false)) { - LOG4CXX_ERROR(logger_, - "string '" << str << "'' contains invalid characters"); - return true; - } - } - return false; -} - -bool SendLocationRequest::CheckHMICapabilities( - std::vector<hmi_apis::Common_TextFieldName::eType>& fields_names) { - using namespace smart_objects; - using namespace hmi_apis; - if (fields_names.empty()) { - return true; - } - - const HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - if (!hmi_capabilities.is_ui_cooperating()) { - LOG4CXX_ERROR(logger_, "UI is not supported."); - return false; - } - - if (hmi_capabilities.display_capabilities()) { - const SmartObject disp_cap = (*hmi_capabilities.display_capabilities()); - const SmartObject& text_fields = - disp_cap.getElement(hmi_response::text_fields); - const size_t len = text_fields.length(); - for (size_t i = 0; i < len; ++i) { - const SmartObject& text_field = text_fields[i]; - const Common_TextFieldName::eType filed_name = - static_cast<Common_TextFieldName::eType>( - text_field.getElement(strings::name).asInt()); - const std::vector<Common_TextFieldName::eType>::iterator it = - std::find(fields_names.begin(), fields_names.end(), filed_name); - if (it != fields_names.end()) { - fields_names.erase(it); - } - } - } - - if (!fields_names.empty()) { - LOG4CXX_ERROR(logger_, "Some fields are not supported by capabilities"); - return false; - } - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/send_location_response.cc b/src/components/application_manager/src/commands/mobile/send_location_response.cc deleted file mode 100644 index 167642e390..0000000000 --- a/src/components/application_manager/src/commands/mobile/send_location_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/send_location_response.h" - -#include "application_manager/application_impl.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -SendLocationResponse::SendLocationResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SendLocationResponse::~SendLocationResponse() {} - -void SendLocationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc deleted file mode 100644 index ee544e956a..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc +++ /dev/null @@ -1,286 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <algorithm> -#include "application_manager/commands/mobile/set_app_icon_request.h" - -#include "application_manager/message_helper.h" -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/file_system.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , is_icons_saving_enabled_(false) { - const std::string path = - application_manager_.get_settings().app_icons_folder(); - is_icons_saving_enabled_ = file_system::IsWritingAllowed(path) && - file_system::IsReadingAllowed(path); -} - -SetAppIconRequest::~SetAppIconRequest() {} - -void SetAppIconRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const std::string& sync_file_name = - (*message_)[strings::msg_params][strings::sync_file_name].asString(); - - if (!file_system::IsFileNameValid(sync_file_name)) { - const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); - SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); - return; - } - - std::string full_file_path = - application_manager_.get_settings().app_storage_folder() + "/"; - full_file_path += app->folder_name(); - full_file_path += "/"; - full_file_path += sync_file_name; - - if (!file_system::FileExists(full_file_path)) { - LOG4CXX_ERROR(logger_, "No such file " << full_file_path); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (is_icons_saving_enabled_) { - CopyToIconStorage(full_file_path); - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::sync_file_name] = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - // Panasonic requres unchanged path value without encoded special characters - const std::string full_file_path_for_hmi = - file_system::ConvertPathForURL(full_file_path); - - msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi; - - // TODO(VS): research why is image_type hardcoded - msg_params[strings::sync_file_name][strings::image_type] = - static_cast<int32_t>(SetAppIconRequest::ImageType::DYNAMIC); - - // for further use in on_event function - (*message_)[strings::msg_params][strings::sync_file_name] = - msg_params[strings::sync_file_name]; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true); -} - -void SetAppIconRequest::CopyToIconStorage( - const std::string& path_to_file) const { - if (!(application_manager_.protocol_handler() - .get_settings() - .max_supported_protocol_version() >= - protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4)) { - LOG4CXX_WARN(logger_, - "Icon copying skipped, since protocol ver. 4 is not enabled."); - return; - } - - std::vector<uint8_t> file_content; - if (!file_system::ReadBinaryFile(path_to_file, file_content)) { - LOG4CXX_ERROR(logger_, "Can't read icon file: " << path_to_file); - return; - } - - const std::string icon_storage = - application_manager_.get_settings().app_icons_folder(); - const uint64_t storage_max_size = static_cast<uint64_t>( - application_manager_.get_settings().app_icons_folder_max_size()); - const uint64_t file_size = file_system::FileSize(path_to_file); - - if (storage_max_size < file_size) { - LOG4CXX_ERROR(logger_, - "Icon size (" << file_size << ") is bigger, than " - " icons storage maximum size (" - << storage_max_size << ")." - "Copying skipped."); - return; - } - - const uint64_t storage_size = - static_cast<uint64_t>(file_system::DirectorySize(icon_storage)); - if (storage_max_size < (file_size + storage_size)) { - const uint32_t icons_amount = - application_manager_.get_settings().app_icons_amount_to_remove(); - - if (!icons_amount) { - LOG4CXX_DEBUG(logger_, - "No icons will be deleted, since amount icons to remove " - "is zero. Icon saving skipped."); - return; - } - - while (!IsEnoughSpaceForIcon(file_size)) { - RemoveOldestIcons(icon_storage, icons_amount); - } - } - ApplicationConstSharedPtr app = - application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR( - logger_, - "Can't get application for connection key: " << connection_key()); - return; - } - - const std::string icon_path = icon_storage + "/" + app->policy_app_id(); - if (!file_system::CreateFile(icon_path)) { - LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path); - return; - } - - if (!file_system::Write(icon_path, file_content)) { - LOG4CXX_ERROR(logger_, "Can't write icon: " << icon_path); - return; - } - - LOG4CXX_DEBUG(logger_, - "Icon was successfully copied from :" << path_to_file << " to " - << icon_path); - - return; -} - -void SetAppIconRequest::RemoveOldestIcons(const std::string& storage, - const uint32_t icons_amount) const { - const std::vector<std::string> icons_list = file_system::ListFiles(storage); - std::map<uint64_t, std::string> icon_modification_time; - std::vector<std::string>::const_iterator it = icons_list.begin(); - for (; it != icons_list.end(); ++it) { - const std::string file_name = *it; - const std::string file_path = storage + "/" + file_name; - if (!file_system::FileExists(file_path)) { - continue; - } - const uint64_t time = file_system::GetFileModificationTime(file_path); - icon_modification_time[time] = file_name; - } - - for (size_t counter = 0; counter < icons_amount; ++counter) { - if (!icon_modification_time.size()) { - LOG4CXX_ERROR(logger_, "No more icons left for deletion."); - return; - } - const std::string file_name = icon_modification_time.begin()->second; - const std::string file_path = storage + "/" + file_name; - if (!file_system::DeleteFile(file_path)) { - LOG4CXX_DEBUG(logger_, "Error while deleting icon " << file_path); - } - icon_modification_time.erase(icon_modification_time.begin()); - LOG4CXX_DEBUG(logger_, - "Old icon " << file_path << " was deleted successfully."); - } -} - -bool SetAppIconRequest::IsEnoughSpaceForIcon(const uint64_t icon_size) const { - const std::string icon_storage = - application_manager_.get_settings().app_icons_folder(); - const uint64_t storage_max_size = static_cast<uint64_t>( - application_manager_.get_settings().app_icons_folder_max_size()); - const uint64_t storage_size = - static_cast<uint64_t>(file_system::DirectorySize(icon_storage)); - return storage_max_size >= (icon_size + storage_size); -} - -void SetAppIconRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_SetAppIcon: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - std::string response_info; - GetInfo(message, response_info); - if (result) { - ApplicationSharedPtr app = - application_manager_.application(connection_key()); - - if (!message_.valid() || !app.valid()) { - LOG4CXX_ERROR(logger_, "NULL pointer."); - return; - } - - const std::string& path = - (*message_)[strings::msg_params][strings::sync_file_name] - [strings::value].asString(); - app->set_app_icon_path(path); - - LOG4CXX_INFO(logger_, - "Icon path was set to '" << app->app_icon_path() << "'"); - } - - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc deleted file mode 100644 index 29f3950ffc..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_app_icon_response.h" - -namespace application_manager { - -namespace commands { - -SetAppIconResponse::SetAppIconResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SetAppIconResponse::~SetAppIconResponse() {} - -void SetAppIconResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc deleted file mode 100644 index 38b62ce731..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_display_layout_request.h" - -#include "application_manager/message_helper.h" -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -SetDisplayLayoutRequest::SetDisplayLayoutRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {} - -void SetDisplayLayoutRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationConstSharedPtr app = - application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - (*message_)[strings::msg_params][strings::app_id] = app->app_id(); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_SetDisplayLayout, - &((*message_)[strings::msg_params]), - true); -} - -void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::UI_SetDisplayLayout: { - LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool response_success = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - std::string info; - GetInfo(message, info); - smart_objects::SmartObject msg_params = message[strings::msg_params]; - if (response_success) { - HMICapabilities& hmi_capabilities = - application_manager_.hmi_capabilities(); - - // in case templates_available is empty copy from hmi capabilities - if (msg_params.keyExists(hmi_response::display_capabilities)) { - if (0 == - msg_params[hmi_response::display_capabilities] - [hmi_response::templates_available].length()) { - msg_params[hmi_response::display_capabilities] - [hmi_response::templates_available] = - hmi_capabilities.display_capabilities()->getElement( - hmi_response::templates_available); - } - } - } - SendResponse(response_success, - MessageHelper::HMIToMobileResult(result_code), - info.empty() ? NULL : info.c_str(), - &msg_params); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc deleted file mode 100644 index b5e53803c8..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_display_layout_response.h" -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -SetDisplayLayoutResponse::SetDisplayLayoutResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {} - -void SetDisplayLayoutResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager 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 deleted file mode 100644 index e811f5d154..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ /dev/null @@ -1,560 +0,0 @@ -/* - Copyright (c) 2015, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string.h> -#include <algorithm> -#include "application_manager/commands/mobile/set_global_properties_request.h" - -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , is_ui_send_(false) - , is_tts_send_(false) - , is_ui_received_(false) - , is_tts_received_(false) - , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} - -SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {} - -void SetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, - "No application associated with connection key " - << connection_key()); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (!ValidateConditionalMandatoryParameters(msg_params)) { - SendResponse(false, - mobile_apis::Result::INVALID_DATA, - "There are no parameters present in request."); - return; - } - - mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; - - if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) { - verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::menu_icon], - app, - application_manager_); - if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR( - logger_, "MessageHelper::VerifyImage return " << verification_result); - SendResponse(false, verification_result); - return; - } - } - // Check for image file(s) in vrHelpItem - if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) { - if (mobile_apis::Result::SUCCESS != - MessageHelper::VerifyImageVrHelpItems( - (*message_)[strings::msg_params][strings::vr_help], - app, - application_manager_)) { - LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "White spaces found"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - // if application waits for sending ttsGlobalProperties need to remove this - // application from tts_global_properties_app_list_ - application_manager_.RemoveAppFromTTSGlobalPropertiesList(connection_key()); - bool is_help_prompt_present = msg_params.keyExists(strings::help_prompt); - bool is_timeout_prompt_present = - msg_params.keyExists(strings::timeout_prompt); - bool is_vr_help_title_present = msg_params.keyExists(strings::vr_help_title); - bool is_vr_help_present = msg_params.keyExists(strings::vr_help); - - // check VR params - if (is_vr_help_title_present ^ is_vr_help_present) { - LOG4CXX_ERROR(logger_, - "Reject because of vr_help or vr_help_title only provided"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - /* Need to set flags before sending request to HMI - * for correct processing this flags in method on_event */ - if (is_help_prompt_present || is_timeout_prompt_present) { - is_tts_send_ = true; - } - if (is_vr_help_title_present && is_vr_help_present) { - LOG4CXX_DEBUG(logger_, "VRHelp params presents"); - - if (!CheckVrHelpItemsOrder(msg_params[strings::vr_help])) { - LOG4CXX_ERROR(logger_, - "VR Help Items contains nonsequential positions" - << " (e.g. [1,2,4]) or not started from 1"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - smart_objects::SmartObject params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - PrepareUIRequestVRHelpData(app, msg_params, params); - PrepareUIRequestMenuAndKeyboardData(app, msg_params, params); - - params[strings::app_id] = app->app_id(); - SendUIRequest(params, true); - } else { - LOG4CXX_DEBUG(logger_, "VRHelp params does not present"); - DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present); - - smart_objects::SmartObject params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - if (ValidateVRHelpTitle(app->vr_help_title())) { - LOG4CXX_DEBUG(logger_, "App already contains VRHelp data"); - } else { - if (!PrepareUIRequestDefaultVRHelpData(app, params)) { - LOG4CXX_ERROR(logger_, "default VRHElp data could not be generated"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } - PrepareUIRequestMenuAndKeyboardData(app, msg_params, params); - - // Preparing data - if (params.empty()) { - LOG4CXX_DEBUG(logger_, "No UI info provided"); - } else { - params[strings::app_id] = app->app_id(); - SendUIRequest(params, true); - } - } - - // check TTS params - if (is_help_prompt_present || is_timeout_prompt_present) { - LOG4CXX_DEBUG(logger_, "TTS params presents"); - smart_objects::SmartObject params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - if (is_help_prompt_present) { - app->set_help_prompt(msg_params.getElement(strings::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()); - } - - params[strings::app_id] = app->app_id(); - SendTTSRequest(params, true); - } -} - -bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( - const smart_objects::SmartObject& vr_help) { - LOG4CXX_AUTO_TRACE(logger_); - DCHECK_OR_RETURN(vr_help.getType() == smart_objects::SmartType_Array, false); - const size_t vr_help_length = vr_help.length(); - DCHECK_OR_RETURN(vr_help_length > 0, false); - - for (size_t j = 0; j < vr_help_length; ++j) { - const size_t position = - vr_help.getElement(j).getElement(strings::position).asUInt(); - // Elements shall start from 1 and increment one by one - if (position != (j + 1)) { - LOG4CXX_ERROR(logger_, - "VR help items order is wrong" - << " at " << j << ", position value:" << position); - return false; - } - } - return true; -} - -void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - is_ui_received_ = true; - ui_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, ui_response_info_); - break; - } - case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - is_tts_received_ = true; - tts_result_ = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - GetInfo(message, tts_response_info_); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } - - if (IsPendingResponseExist()) { - LOG4CXX_DEBUG(logger_, "Continue waiting for response"); - return; - } - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - std::string response_info; - const bool result = PrepareResponseParameters(result_code, response_info); - - // TODO{ALeshin} APPLINK-15858. connection_key removed during SendResponse - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - SendResponse(result, - result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); -} - -bool SetGlobalPropertiesRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -bool SetGlobalPropertiesRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, std::string& info) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - ResponseInfo ui_properties_info( - ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - - ResponseInfo tts_properties_info( - tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); - const bool result = - PrepareResultForMobileResponse(ui_properties_info, tts_properties_info); - if (result && - (HmiInterfaces::STATE_AVAILABLE == tts_properties_info.interface_state) && - (tts_properties_info.is_unsupported_resource)) { - result_code = mobile_apis::Result::WARNINGS; - tts_response_info_ = "Unsupported phoneme type sent in a prompt"; - info = MergeInfos(tts_properties_info, - tts_response_info_, - ui_properties_info, - ui_response_info_); - return result; - } - result_code = - PrepareResultCodeForResponse(ui_properties_info, tts_properties_info); - info = MergeInfos(tts_properties_info, - tts_response_info_, - ui_properties_info, - ui_response_info_); - return result; -} - -bool SetGlobalPropertiesRequest::ValidateVRHelpTitle( - const smart_objects::SmartObject* const vr_help_so_ptr) { - LOG4CXX_AUTO_TRACE(logger_); - if (vr_help_so_ptr) { - const std::string& vr_help = vr_help_so_ptr->asString(); - LOG4CXX_TRACE(logger_, "App contains vr_help_title: \"" << vr_help << '"'); - return !vr_help.empty(); - } - return false; -} - -void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( - const ApplicationSharedPtr app, - const smart_objects::SmartObject& msg_params, - smart_objects::SmartObject& out_params) { - LOG4CXX_AUTO_TRACE(logger_); - DCHECK_OR_RETURN_VOID(app); - - app->set_vr_help_title(msg_params.getElement(strings::vr_help_title)); - app->set_vr_help(msg_params.getElement(strings::vr_help)); - - out_params[strings::vr_help_title] = (*app->vr_help_title()); - out_params[strings::vr_help] = (*app->vr_help()); -} - -bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData( - const ApplicationSharedPtr app, smart_objects::SmartObject& out_params) { - LOG4CXX_AUTO_TRACE(logger_); - DCHECK_OR_RETURN(app, false); - - LOG4CXX_DEBUG(logger_, "Generate default VRHelp data"); - const DataAccessor<CommandsMap> accessor = app->commands_map(); - const CommandsMap& cmdMap = accessor.GetData(); - - int32_t index = 0; - smart_objects::SmartObject vr_help_items; - for (CommandsMap::const_iterator command_it = cmdMap.begin(); - cmdMap.end() != command_it; - ++command_it) { - const smart_objects::SmartObject& command = *command_it->second; - if (!command.keyExists(strings::vr_commands)) { - LOG4CXX_ERROR(logger_, "VR synonyms are empty"); - return false; - } - // use only first - vr_help_items[index][strings::position] = (index + 1); - vr_help_items[index++][strings::text] = - (*command_it->second)[strings::vr_commands][0]; - } - - app->set_vr_help_title(smart_objects::SmartObject(app->name())); - - out_params[strings::vr_help_title] = (*app->vr_help_title()); - if (vr_help_items.length() > 0) { - app->set_vr_help(vr_help_items); - out_params[strings::vr_help] = (*app->vr_help()); - } - return true; -} - -void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( - const ApplicationSharedPtr app, - const smart_objects::SmartObject& msg_params, - smart_objects::SmartObject& out_params) { - LOG4CXX_AUTO_TRACE(logger_); - DCHECK_OR_RETURN_VOID(app); - - const bool is_menu_title_present = - msg_params.keyExists(hmi_request::menu_title); - const bool is_menu_icon_present = - msg_params.keyExists(hmi_request::menu_icon); - const bool is_keyboard_props_present = - msg_params.keyExists(hmi_request::keyboard_properties); - - if (is_menu_title_present) { - out_params[hmi_request::menu_title] = - msg_params[hmi_request::menu_title].asString(); - app->set_menu_title(msg_params[hmi_request::menu_title]); - } - if (is_menu_icon_present) { - out_params[hmi_request::menu_icon] = msg_params[hmi_request::menu_icon]; - app->set_menu_icon(msg_params[hmi_request::menu_icon]); - } - if (is_keyboard_props_present) { - out_params[hmi_request::keyboard_properties] = - msg_params[hmi_request::keyboard_properties]; - app->set_keyboard_props(msg_params[hmi_request::keyboard_properties]); - } -} - -void SetGlobalPropertiesRequest::SendTTSRequest( - const smart_objects::SmartObject& params, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); - is_tts_send_ = true; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - SendHMIRequest( - hmi_apis::FunctionID::TTS_SetGlobalProperties, ¶ms, use_events); -} - -void SetGlobalPropertiesRequest::SendUIRequest( - const smart_objects::SmartObject& params, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); - is_ui_send_ = true; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest( - hmi_apis::FunctionID::UI_SetGlobalProperties, ¶ms, use_events); -} - -bool SetGlobalPropertiesRequest::IsPendingResponseExist() { - return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_; -} - -bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( - const smart_objects::SmartObject& params) { - LOG4CXX_AUTO_TRACE(logger_); - return params.keyExists(strings::help_prompt) || - params.keyExists(strings::timeout_prompt) || - params.keyExists(strings::vr_help_title) || - params.keyExists(strings::vr_help) || - params.keyExists(strings::menu_title) || - params.keyExists(strings::menu_icon) || - params.keyExists(strings::keyboard_properties); -} - -bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str; - - const smart_objects::SmartObject& msg_params = - (*message_)[strings::msg_params]; - - if (msg_params.keyExists(strings::help_prompt)) { - const smart_objects::SmartArray* hp_array = - msg_params[strings::help_prompt].asArray(); - - smart_objects::SmartArray::const_iterator it_hp = hp_array->begin(); - smart_objects::SmartArray::const_iterator it_hp_end = hp_array->end(); - - for (; it_hp != it_hp_end; ++it_hp) { - str = (*it_hp)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed"); - return true; - } - } - } - - if (msg_params.keyExists(strings::timeout_prompt)) { - const smart_objects::SmartArray* tp_array = - msg_params[strings::timeout_prompt].asArray(); - - smart_objects::SmartArray::const_iterator it_tp = tp_array->begin(); - smart_objects::SmartArray::const_iterator it_tp_end = tp_array->end(); - - for (; it_tp != it_tp_end; ++it_tp) { - str = (*it_tp)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); - return true; - } - } - } - - if (msg_params.keyExists(strings::vr_help)) { - const smart_objects::SmartArray* vh_array = - msg_params[strings::vr_help].asArray(); - - smart_objects::SmartArray::const_iterator it_vh = vh_array->begin(); - smart_objects::SmartArray::const_iterator it_vh_end = vh_array->end(); - - for (; it_vh != it_vh_end; ++it_vh) { - str = (*it_vh)[strings::text].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_help text syntax check failed"); - return true; - } - - if ((*it_vh).keyExists(strings::image)) { - str = (*it_vh)[strings::image][strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid vr_help image value syntax check failed"); - return true; - } - } // if image exists - } // for - vh_array iteration - } - - if (msg_params.keyExists(strings::menu_icon)) { - str = msg_params[strings::menu_icon][strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu_icon value syntax check failed"); - return true; - } - } - - if (msg_params.keyExists(strings::vr_help_title)) { - str = msg_params[strings::vr_help_title].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_help_title value syntax check failed"); - return true; - } - } - - if (msg_params.keyExists(strings::menu_title)) { - str = msg_params[strings::menu_title].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu_title value syntax check failed"); - return true; - } - } - - if (msg_params.keyExists(strings::keyboard_properties)) { - if (msg_params[strings::keyboard_properties].keyExists( - strings::limited_character_list)) { - const smart_objects::SmartArray* lcl_array = - msg_params[strings::keyboard_properties] - [strings::limited_character_list].asArray(); - - smart_objects::SmartArray::const_iterator it_lcl = lcl_array->begin(); - smart_objects::SmartArray::const_iterator it_lcl_end = lcl_array->end(); - - for (; it_lcl != it_lcl_end; ++it_lcl) { - str = (*it_lcl).asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid keyboard_properties " - "limited_character_list syntax check failed"); - return true; - } - } - } - - if (msg_params[strings::keyboard_properties].keyExists( - strings::auto_complete_text)) { - str = - msg_params[strings::keyboard_properties][strings::auto_complete_text] - .asCharArray(); - - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid keyboard_properties " - "auto_complete_text syntax check failed"); - return true; - } - } - } - return false; -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc deleted file mode 100644 index 5cfbcb2d58..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_global_properties_response.h" - -namespace application_manager { - -namespace commands { - -SetGlobalPropertiesResponse::SetGlobalPropertiesResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {} - -void SetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_icon_request.cc deleted file mode 100644 index 037de54456..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_icon_request.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_icon_request.h" -#include "application_manager/application_manager.h" -#include "application_manager/application_impl.h" -#include "config_profile/profile.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/file_system.h" - -namespace application_manager { - -namespace commands { - -SetIconRequest::SetIconRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SetIconRequest::~SetIconRequest() {} - -void SetIconRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const std::string& sync_file_name = - (*message_)[strings::msg_params][strings::sync_file_name].asString(); - - std::string full_file_path = - application_manager_.get_settings().app_storage_folder() + "/"; - full_file_path += app->folder_name(); - full_file_path += "/"; - full_file_path += sync_file_name; - - if (!file_system::FileExists(full_file_path)) { - LOG4CXX_ERROR(logger_, "No such file " << full_file_path); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - msg_params[strings::app_id] = app->app_id(); - msg_params[strings::sync_file_name] = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - // Panasonic requres unchanged path value without encoded special characters - const std::string full_file_path_for_hmi = - file_system::ConvertPathForURL(full_file_path); - - msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi; - - // TODO(VS): research why is image_type hardcoded - msg_params[strings::sync_file_name][strings::image_type] = - static_cast<int32_t>(SetIconRequest::ImageType::DYNAMIC); - - // for further use in on_event function - (*message_)[strings::msg_params][strings::sync_file_name] = - msg_params[strings::sync_file_name]; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true); -} - -void SetIconRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_SetAppIcon: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - mobile_apis::Result::eType result_code = - static_cast<mobile_apis::Result::eType>( - message[strings::params][hmi_response::code].asInt()); - - bool result = mobile_apis::Result::SUCCESS == result_code; - - if (result) { - ApplicationSharedPtr app = - application_manager_.application(connection_key()); - - const std::string path = - (*message_)[strings::msg_params][strings::sync_file_name] - [strings::value].asString(); - app->set_app_icon_path(path); - - LOG4CXX_INFO(logger_, - "Icon path was set to '" << app->app_icon_path() << "'"); - } - - SendResponse(result, result_code, NULL, &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_icon_response.cc deleted file mode 100644 index c140d04f51..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_icon_response.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_icon_response.h" -#include "application_manager/application_manager.h" - -namespace application_manager { - -namespace commands { - -SetIconResponse::SetIconResponse(const MessageSharedPtr& message, - ApplicationManager& app_man) - : CommandResponseImpl(message, app_man) {} - -SetIconResponse::~SetIconResponse() {} - -void SetIconResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc deleted file mode 100644 index 54727abe01..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc +++ /dev/null @@ -1,157 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_media_clock_timer_request.h" - -#include "application_manager/message_helper.h" -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -SetMediaClockRequest::SetMediaClockRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SetMediaClockRequest::~SetMediaClockRequest() {} - -void SetMediaClockRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - - if (!app->is_media_application()) { - LOG4CXX_ERROR(logger_, "Application is not media application"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - if (isDataValid()) { - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - // copy entirely msg - msg_params = (*message_)[strings::msg_params]; - msg_params[strings::app_id] = app->app_id(); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - - SendHMIRequest( - hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true); - } else { - SendResponse(false, mobile_apis::Result::INVALID_DATA); - } -} - -void SetMediaClockRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_SetMediaClockTimer: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - std::string response_info; - GetInfo(message, response_info); - - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -bool SetMediaClockRequest::isDataValid() { - smart_objects::SmartObject msg_params = (*message_)[strings::msg_params]; - mobile_apis::UpdateMode::eType update_mode = - static_cast<mobile_apis::UpdateMode::eType>( - msg_params[strings::update_mode].asUInt()); - - if (update_mode == mobile_apis::UpdateMode::COUNTUP || - update_mode == mobile_apis::UpdateMode::COUNTDOWN) { - if (!msg_params.keyExists(strings::start_time)) { - LOG4CXX_INFO(logger_, "Invalid data"); - return false; - } - - if (msg_params.keyExists(strings::end_time)) { - unsigned int start_time_in_seconds = 0; - start_time_in_seconds = - (msg_params[strings::start_time][strings::hours].asUInt()) * 3600; - start_time_in_seconds += - (msg_params[strings::start_time][strings::minutes].asUInt()) * 60; - start_time_in_seconds += - (msg_params[strings::start_time][strings::seconds].asUInt()); - - unsigned int end_time_in_seconds = 0; - end_time_in_seconds = - (msg_params[strings::end_time][strings::hours].asUInt()) * 3600; - end_time_in_seconds += - (msg_params[strings::end_time][strings::minutes].asUInt()) * 60; - end_time_in_seconds += - (msg_params[strings::end_time][strings::seconds].asUInt()); - - if (((end_time_in_seconds > start_time_in_seconds) && - (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) || - ((end_time_in_seconds < start_time_in_seconds) && - (update_mode == mobile_apis::UpdateMode::COUNTUP))) { - LOG4CXX_INFO(logger_, "Invalid data"); - return false; - } - } - } - - LOG4CXX_INFO(logger_, "Data is valid"); - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc deleted file mode 100644 index 30e802a1db..0000000000 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/set_media_clock_timer_response.h" - -namespace application_manager { - -namespace commands { - -SetMediaClockTimerResponse::SetMediaClockTimerResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {} - -void SetMediaClockTimerResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc deleted file mode 100644 index 42bfea4864..0000000000 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc +++ /dev/null @@ -1,285 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <cstring> -#include "application_manager/commands/mobile/show_constant_tbt_request.h" - -#include "application_manager/policies/policy_handler.h" -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "application_manager/policies/policy_handler_interface.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -ShowConstantTBTRequest::ShowConstantTBTRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -ShowConstantTBTRequest::~ShowConstantTBTRequest() {} - -void ShowConstantTBTRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::params][strings::connection_key].asUInt()); - - if (!app) { - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - // SDLAQ-CRS-664, VC3.1 - if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params = (*message_)[strings::msg_params]; - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming show constant TBT has contains \t\n \\t \\n"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - // ProcessSoftButtons checks strings on the contents incorrect character - - mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons(msg_params, - app, - application_manager_.GetPolicyHandler(), - application_manager_); - - if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); - SendResponse(false, processing_result); - return; - } - - mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; - if (msg_params.keyExists(strings::turn_icon)) { - verification_result = MessageHelper::VerifyImage( - msg_params[strings::turn_icon], app, application_manager_); - if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); - SendResponse(false, verification_result); - return; - } - } - - if (msg_params.keyExists(strings::next_turn_icon)) { - verification_result = MessageHelper::VerifyImage( - msg_params[strings::next_turn_icon], app, application_manager_); - if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); - SendResponse(false, verification_result); - return; - } - } - - msg_params[strings::app_id] = app->app_id(); - - msg_params[hmi_request::navi_texts] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - int32_t index = 0; - if (msg_params.keyExists(strings::navigation_text_1)) { - // erase useless parametr - msg_params.erase(strings::navigation_text_1); - msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::navigationText1); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::navigation_text_1]; - } - - if (msg_params.keyExists(strings::navigation_text_2)) { - // erase useless param - msg_params.erase(strings::navigation_text_2); - msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::navigationText2); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::navigation_text_2]; - } - - if (msg_params.keyExists(strings::eta)) { - // erase useless param - msg_params.erase(strings::eta); - msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::ETA); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::eta]; - } - - if (msg_params.keyExists(strings::total_distance)) { - // erase useless param - msg_params.erase(strings::total_distance); - msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::totalDistance); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::total_distance]; - } - - if (msg_params.keyExists(strings::time_to_destination)) { - // erase useless param - msg_params.erase(strings::time_to_destination); - msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::timeToDestination); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::time_to_destination]; - } - - if (msg_params.keyExists(strings::soft_buttons)) { - MessageHelper::SubscribeApplicationToSoftButton( - msg_params, app, function_id()); - } - - app->set_tbt_show_command(msg_params); - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_ShowConstantTBT, &msg_params, true); -} - -void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace hmi_apis; - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_ShowConstantTBT: { - LOG4CXX_INFO(logger_, "Received Navigation_ShowConstantTBT event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - const Common_Result::eType result_code = - static_cast<Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_Navigation); - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } -} - -bool ShowConstantTBTRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) { - str = (*message_)[strings::msg_params][strings::turn_icon][strings::value] - .asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid turn_icon value syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::next_turn_icon)) { - str = (*message_)[strings::msg_params][strings::next_turn_icon] - [strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid next_turn_icon value syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::navigation_text_1)) { - str = (*message_)[strings::msg_params][strings::navigation_text_1] - .asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid navigation_text_1 value syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::navigation_text_2)) { - str = (*message_)[strings::msg_params][strings::navigation_text_2] - .asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid navigation_text_2 value syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::eta)) { - str = (*message_)[strings::msg_params][strings::eta].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid eta value syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::total_distance)) { - str = - (*message_)[strings::msg_params][strings::total_distance].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid total_distance value syntax check failed"); - return true; - } - } - - if ((*message_)[strings::msg_params].keyExists( - strings::time_to_destination)) { - str = (*message_)[strings::msg_params][strings::time_to_destination] - .asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid time_to_destination value syntax check failed"); - return true; - } - } - return false; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc deleted file mode 100644 index 80a36129cf..0000000000 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/show_constant_tbt_response.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -ShowConstantTBTResponse::ShowConstantTBTResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - - : CommandResponseImpl(message, application_manager) {} - -ShowConstantTBTResponse::~ShowConstantTBTResponse() {} - -void ShowConstantTBTResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc deleted file mode 100644 index ad598efc1d..0000000000 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ /dev/null @@ -1,403 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -#include <string.h> -#include "application_manager/commands/mobile/show_request.h" - -#include "application_manager/policies/policy_handler.h" -#include "application_manager/application.h" -#include "application_manager/message_helper.h" -#include "utils/file_system.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -ShowRequest::ShowRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) - , core_result_code_(mobile_apis::Result::INVALID_ENUM) {} - -ShowRequest::~ShowRequest() {} - -void ShowRequest::HandleMetadata(const char* field_id, - int32_t field_index, - smart_objects::SmartObject& msg_params) { - smart_objects::SmartObject& metadata_tags = - (*message_)[strings::msg_params][strings::metadata_tags]; - - if (metadata_tags.keyExists(field_id)) { - if (field_index != -1) { - msg_params[hmi_request::show_strings][field_index] - [hmi_request::field_types] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - const size_t num_tags = metadata_tags[field_id].length(); - for (size_t i = 0; i < num_tags; ++i) { - const int32_t current_tag = metadata_tags[field_id][i].asInt(); - msg_params[hmi_request::show_strings][field_index] - [hmi_request::field_types][i] = current_tag; - } - } else { - LOG4CXX_INFO(logger_, - "metadata tag provided with no item for " - << field_id << ", ignoring with warning"); - // tag provided with no item, ignore with warning - if (mobile_apis::Result::INVALID_ENUM == core_result_code_) { - core_result_code_ = mobile_apis::Result::WARNINGS; - core_response_info_ = - "Metadata tag was provided for a field with no data."; - } - } - } else { - LOG4CXX_INFO(logger_, - "No metadata tagging provided for field: " << field_id); - } -} - -void ShowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - // SDLAQ-CRS-494, VC3.1 - if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (!CheckStringsOfShowRequest()) { - LOG4CXX_ERROR(logger_, "Incorrect characters in string"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - // ProcessSoftButtons checks strings on the contents incorrect character - - mobile_apis::Result::eType processing_result = mobile_apis::Result::SUCCESS; - if (((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) && - ((*message_)[strings::msg_params][strings::soft_buttons].length() > 0)) { - processing_result = MessageHelper::ProcessSoftButtons( - (*message_)[strings::msg_params], - app, - application_manager_.GetPolicyHandler(), - application_manager_); - } - - if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "Processing of soft buttons failed."); - SendResponse(false, processing_result); - return; - } - - mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS; - if (((*message_)[strings::msg_params].keyExists(strings::graphic)) && - ((*message_)[strings::msg_params][strings::graphic][strings::value] - .asString()).length()) { - verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::graphic], - app, - application_manager_); - if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR(logger_, "Image verification failed."); - SendResponse(false, verification_result); - return; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { - verification_result = MessageHelper::VerifyImage( - (*message_)[strings::msg_params][strings::secondary_graphic], - app, - application_manager_); - if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_ERROR(logger_, "Image verification failed."); - SendResponse(false, verification_result); - return; - } - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); - - msg_params[hmi_request::show_strings] = - smart_objects::SmartObject(smart_objects::SmartType_Array); - - int32_t index = 0; - int32_t main_field_1_index = -1; - if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) { - msg_params[hmi_request::show_strings][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField1); - msg_params[hmi_request::show_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::main_field_1]; - main_field_1_index = index; - ++index; - } - - int32_t main_field_2_index = -1; - if ((*message_)[strings::msg_params].keyExists(strings::main_field_2)) { - msg_params[hmi_request::show_strings][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField2); - msg_params[hmi_request::show_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::main_field_2]; - main_field_2_index = index; - ++index; - } - - int32_t main_field_3_index = -1; - if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) { - msg_params[hmi_request::show_strings][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField3); - msg_params[hmi_request::show_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::main_field_3]; - main_field_3_index = index; - ++index; - } - - int32_t main_field_4_index = -1; - if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) { - msg_params[hmi_request::show_strings][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::mainField4); - msg_params[hmi_request::show_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::main_field_4]; - main_field_4_index = index; - ++index; - } - - if ((*message_)[strings::msg_params].keyExists(strings::metadata_tags)) { - HandleMetadata(strings::main_field_1, main_field_1_index, msg_params); - HandleMetadata(strings::main_field_2, main_field_2_index, msg_params); - HandleMetadata(strings::main_field_3, main_field_3_index, msg_params); - HandleMetadata(strings::main_field_4, main_field_4_index, msg_params); - } - - if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) { - msg_params[hmi_request::show_strings][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::mediaClock); - msg_params[hmi_request::show_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::media_clock]; - ++index; - } - - if ((*message_)[strings::msg_params].keyExists(strings::media_track)) { - msg_params[hmi_request::show_strings][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::mediaTrack); - msg_params[hmi_request::show_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::media_track]; - ++index; - } - - if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) { - msg_params[hmi_request::show_strings][index][hmi_request::field_name] = - static_cast<int32_t>(hmi_apis::Common_TextFieldName::statusBar); - msg_params[hmi_request::show_strings][index][hmi_request::field_text] = - (*message_)[strings::msg_params][strings::status_bar]; - ++index; - } - - if ((*message_)[strings::msg_params].keyExists(strings::alignment)) { - msg_params[strings::alignment] = - (*message_)[strings::msg_params][strings::alignment]; - } - - if ((*message_)[strings::msg_params].keyExists(strings::graphic)) { - msg_params[strings::graphic] = - (*message_)[strings::msg_params][strings::graphic]; - } - - if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { - msg_params[strings::secondary_graphic] = - (*message_)[strings::msg_params][strings::secondary_graphic]; - } - - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - msg_params[strings::soft_buttons] = - (*message_)[strings::msg_params][strings::soft_buttons]; - if ((*message_)[strings::msg_params][strings::soft_buttons].length() == 0) { - app->UnsubscribeFromSoftButtons(function_id()); - } else { - MessageHelper::SubscribeApplicationToSoftButton( - (*message_)[strings::msg_params], app, function_id()); - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::custom_presets)) { - msg_params[strings::custom_presets] = - (*message_)[strings::msg_params][strings::custom_presets]; - } - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_Show, &msg_params, true); - - MessageSharedPtr persistentData = new smart_objects::SmartObject(msg_params); - app->set_show_command(*persistentData); -} - -void ShowRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::UI_Show: { - LOG4CXX_DEBUG(logger_, "Received UI_Show event."); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - std::string response_info; - hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - GetInfo(message, response_info); - if (hmi_apis::Common_Result::WARNINGS == result_code && - message[strings::params].keyExists(hmi_response::message)) { - response_info = - message[strings::params][hmi_response::message].asString(); - } - mobile_apis::Result::eType converted_result_code = - MessageHelper::HMIToMobileResult(result_code); - if (mobile_apis::Result::SUCCESS == converted_result_code && - mobile_apis::Result::INVALID_ENUM != core_result_code_) { - converted_result_code = core_result_code_; - response_info = core_response_info_; - } - SendResponse(result, - converted_result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event " << event.id()); - break; - } - } -} - -bool ShowRequest::CheckStringsOfShowRequest() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str; - - if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) { - str = (*message_)[strings::msg_params][strings::main_field_4].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_4 syntax check failed"); - return false; - } - } - if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) { - str = (*message_)[strings::msg_params][strings::main_field_3].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_3 syntax check failed"); - return false; - } - } - if ((*message_)[strings::msg_params].keyExists(strings::main_field_2)) { - str = (*message_)[strings::msg_params][strings::main_field_2].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_2 syntax check failed"); - return false; - } - } - if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) { - str = (*message_)[strings::msg_params][strings::main_field_1].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_1 syntax check failed"); - return false; - } - } - if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) { - str = (*message_)[strings::msg_params][strings::status_bar].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid status_bar syntax check failed"); - return false; - } - } - if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) { - str = (*message_)[strings::msg_params][strings::media_clock].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid media_clock syntax check failed"); - return false; - } - } - if ((*message_)[strings::msg_params].keyExists(strings::media_track)) { - str = (*message_)[strings::msg_params][strings::media_track].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid media_track syntax check failed"); - return false; - } - } - if ((*message_)[strings::msg_params].keyExists(strings::custom_presets)) { - smart_objects::SmartObject& custom_presets_array = - (*message_)[strings::msg_params][strings::custom_presets]; - for (size_t i = 0; i < custom_presets_array.length(); ++i) { - str = custom_presets_array[i].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid custom_presets syntax check failed"); - return false; - } - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::graphic)) { - str = (*message_)[strings::msg_params][strings::graphic][strings::value] - .asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid graphic value syntax check failed"); - return false; - } - } - - if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { - str = (*message_)[strings::msg_params][strings::secondary_graphic] - [strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid secondary_graphic value syntax check failed"); - return false; - } - } - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/show_response.cc b/src/components/application_manager/src/commands/mobile/show_response.cc deleted file mode 100644 index 8027c908f1..0000000000 --- a/src/components/application_manager/src/commands/mobile/show_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/show_response.h" - -#include "application_manager/application_impl.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -ShowResponse::ShowResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -ShowResponse::~ShowResponse() {} - -void ShowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc deleted file mode 100644 index f98869b08f..0000000000 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ /dev/null @@ -1,198 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/slider_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "utils/helpers.h" -#include "config_profile/profile.h" - -namespace application_manager { - -namespace commands { - -SliderRequest::SliderRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); -} - -SliderRequest::~SliderRequest() {} - -bool SliderRequest::Init() { - /* Timeout in milliseconds. - If omitted a standard value of 10000 milliseconds is used.*/ - if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = - application_manager_.get_settings().default_timeout() + - (*message_)[strings::msg_params][strings::timeout].asUInt(); - } - - return true; -} - -void SliderRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = application_manager_.application( - (*message_)[strings::params][strings::connection_key].asUInt()); - - if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if ((*message_)[strings::msg_params][strings::num_ticks].asInt() < - (*message_)[strings::msg_params][strings::position].asInt()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if ((*message_)[strings::msg_params].keyExists(strings::slider_footer)) { - if (1 < (*message_)[strings::msg_params][strings::slider_footer].length()) { - if ((*message_)[strings::msg_params][strings::num_ticks].asUInt() != - (*message_)[strings::msg_params][strings::slider_footer].length()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Incoming slider has contains \t\n \\t \\n"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params = (*message_)[strings::msg_params]; - msg_params[strings::app_id] = application->app_id(); - - if (!(*message_)[strings::msg_params].keyExists(strings::timeout)) { - msg_params[strings::timeout] = default_timeout_; - } - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - SendHMIRequest(hmi_apis::FunctionID::UI_Slider, &msg_params, true); -} - -void SliderRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - using namespace smart_objects; - using namespace hmi_apis; - - const SmartObject& message = event.smart_object(); - - const event_engine::Event::EventID event_id = event.id(); - if (event_id == FunctionID::UI_OnResetTimeout) { - LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - return; - } - - if (event_id != FunctionID::UI_Slider) { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - - LOG4CXX_DEBUG(logger_, "Received UI_Slider event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - const Common_Result::eType response_code = static_cast<Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - - SmartObject response_msg_params = message[strings::msg_params]; - - const bool is_timeout_aborted = Compare<Common_Result::eType, EQ, ONE>( - response_code, Common_Result::TIMED_OUT, Common_Result::ABORTED); - - if (is_timeout_aborted) { - if (message[strings::params][strings::data].keyExists( - strings::slider_position)) { - // Copy slider_position info to msg_params section - response_msg_params[strings::slider_position] = - message[strings::params][strings::data][strings::slider_position]; - } else { - LOG4CXX_ERROR(logger_, - strings::slider_position << " field is absent" - " in response."); - response_msg_params[strings::slider_position] = 0; - } - } - std::string response_info; - GetInfo(message, response_info); - const bool is_response_success = PrepareResultForMobileResponse( - response_code, HmiInterfaces::HMI_INTERFACE_UI); - - SendResponse(is_response_success, - MessageHelper::HMIToMobileResult(response_code), - response_info.empty() ? NULL : response_info.c_str(), - &response_msg_params); -} - -bool SliderRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - str = (*message_)[strings::msg_params][strings::slider_header].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid slider_header value syntax check failed"); - return true; - } - - if ((*message_)[strings::msg_params].keyExists(strings::slider_footer)) { - const smart_objects::SmartArray* sf_array = - (*message_)[strings::msg_params][strings::slider_footer].asArray(); - - smart_objects::SmartArray::const_iterator it_sf = sf_array->begin(); - smart_objects::SmartArray::const_iterator it_sf_end = sf_array->end(); - - for (; it_sf != it_sf_end; ++it_sf) { - str = (*it_sf).asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid slider_footer syntax check failed"); - return true; - } - } - } - return false; -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/slider_response.cc b/src/components/application_manager/src/commands/mobile/slider_response.cc deleted file mode 100644 index 2cfcaf48fd..0000000000 --- a/src/components/application_manager/src/commands/mobile/slider_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/slider_response.h" - -namespace application_manager { - -namespace commands { - -SliderResponse::SliderResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SliderResponse::~SliderResponse() {} - -void SliderResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc deleted file mode 100644 index 1954cde181..0000000000 --- a/src/components/application_manager/src/commands/mobile/speak_request.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string.h> -#include "application_manager/commands/mobile/speak_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "utils/helpers.h" - -namespace application_manager { - -namespace commands { - -SpeakRequest::SpeakRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) { - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} - -SpeakRequest::~SpeakRequest() {} - -void SpeakRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming speak has contains \\t\\n \\\\t \\\\n " - " text contains only whitespace in ttsChunks"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - (*message_)[strings::msg_params][strings::app_id] = app->app_id(); - (*message_)[strings::msg_params][hmi_request::speak_type] = - hmi_apis::Common_MethodName::SPEAK; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, - &message_->getElement(strings::msg_params), - true); -} - -void SpeakRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - switch (event.id()) { - case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - ProcessTTSSpeakResponse(event.smart_object()); - break; - } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); - - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } -} - -void SpeakRequest::ProcessTTSSpeakResponse( - const smart_objects::SmartObject& message) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - hmi_apis::Common_Result::eType hmi_result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - - mobile_apis::Result::eType result_code = - MessageHelper::HMIToMobileResult(hmi_result_code); - - const bool result = PrepareResultForMobileResponse( - hmi_result_code, HmiInterfaces::HMI_INTERFACE_TTS); - - (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::SpeakID; - - const char* return_info = NULL; - - SendResponse( - result, result_code, return_info, &(message[strings::msg_params])); -} - -bool SpeakRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { - const smart_objects::SmartArray* tc_array = - (*message_)[strings::msg_params][strings::tts_chunks].asArray(); - - smart_objects::SmartArray::const_iterator it_tc = tc_array->begin(); - smart_objects::SmartArray::const_iterator it_tc_end = tc_array->end(); - - for (; it_tc != it_tc_end; ++it_tc) { - str = (*it_tc)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); - return true; - } - } - } - return false; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/speak_response.cc b/src/components/application_manager/src/commands/mobile/speak_response.cc deleted file mode 100644 index 612d32c913..0000000000 --- a/src/components/application_manager/src/commands/mobile/speak_response.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/speak_response.h" - -#include "application_manager/application_impl.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -SpeakResponse::SpeakResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SpeakResponse::~SpeakResponse() {} - -void SpeakResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc deleted file mode 100644 index 4d11467d2d..0000000000 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/subscribe_button_request.h" - -namespace application_manager { - -namespace commands { - -namespace str = strings; - -SubscribeButtonRequest::SubscribeButtonRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SubscribeButtonRequest::~SubscribeButtonRequest() {} - -void SubscribeButtonRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const mobile_apis::ButtonName::eType btn_id = - static_cast<mobile_apis::ButtonName::eType>( - (*message_)[str::msg_params][str::button_name].asInt()); - - if (!IsSubscriptionAllowed(app, btn_id)) { - LOG4CXX_ERROR(logger_, - "Subscribe on button " << btn_id << " isn't allowed"); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - - if (!CheckHMICapabilities(btn_id)) { - LOG4CXX_ERROR(logger_, - "Subscribe on button " - << btn_id << " isn't allowed by HMI capabilities"); - SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); - return; - } - - if (app->IsSubscribedToButton(btn_id)) { - LOG4CXX_ERROR(logger_, "Already subscribed to button " << btn_id); - SendResponse(false, mobile_apis::Result::IGNORED); - return; - } - - app->SubscribeToButton(static_cast<mobile_apis::ButtonName::eType>(btn_id)); - SendSubscribeButtonNotification(); - - const bool is_succedeed = true; - SendResponse(is_succedeed, mobile_apis::Result::SUCCESS); -} - -bool SubscribeButtonRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -bool SubscribeButtonRequest::IsSubscriptionAllowed( - ApplicationSharedPtr app, mobile_apis::ButtonName::eType btn_id) { - if (!app->is_media_application() && - ((mobile_apis::ButtonName::SEEKLEFT == btn_id) || - (mobile_apis::ButtonName::SEEKRIGHT == btn_id) || - (mobile_apis::ButtonName::TUNEUP == btn_id) || - (mobile_apis::ButtonName::TUNEDOWN == btn_id))) { - return false; - } - return true; -} - -void SubscribeButtonRequest::SendSubscribeButtonNotification() { - using namespace smart_objects; - using namespace hmi_apis; - - // send OnButtonSubscription notification - SmartObject msg_params = SmartObject(SmartType_Map); - msg_params[strings::app_id] = connection_key(); - msg_params[strings::name] = static_cast<Common_ButtonName::eType>( - (*message_)[strings::msg_params][strings::button_name].asUInt()); - msg_params[strings::is_suscribed] = true; - CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc deleted file mode 100644 index a92e58b19a..0000000000 --- a/src/components/application_manager/src/commands/mobile/subscribe_button_response.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/subscribe_button_response.h" - -namespace application_manager { - -namespace commands { - -SubscribeButtonResponse::SubscribeButtonResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SubscribeButtonResponse::~SubscribeButtonResponse() {} - -void SubscribeButtonResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // check if response false - if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { - if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); - SendResponse(false); - return; - } - } - - // TODO(DK): Some logic - SendResponse(true); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc deleted file mode 100644 index 15ba7999bd..0000000000 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc +++ /dev/null @@ -1,497 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Copyright (c) 2017, Livio, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/subscribe_vehicle_data_request.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "utils/helpers.h" - -namespace application_manager { -namespace commands { - -SubscribeVehicleDataRequest::SubscribeVehicleDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {} - -#ifdef HMI_DBUS_API -namespace { -struct Subrequest { - hmi_apis::FunctionID::eType func_id; - const char* str; -}; -Subrequest subrequests[] = { - {hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State, - strings::fuel_level_state}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption, - strings::instant_fuel_consumption}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature, - strings::external_temp}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin}, - {hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure, - strings::tire_pressure}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus, - strings::belt_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation, - strings::body_information}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus, - strings::device_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking, - strings::driver_braking}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus, - strings::wiper_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus, - strings::head_lamp_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque, - strings::engine_torque}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition, - strings::acc_pedal_pos}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle, - strings::steering_wheel_angle}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo, - strings::e_call_info}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus, - strings::airbag_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent, - strings::emergency_event}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus, - strings::cluster_mode_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key}, -}; -} -#endif // #ifdef HMI_DBUS_API - -void SubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - std::string info; - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - smart_objects::SmartObject response_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - bool result = false; - CheckVISubscriptions( - app, info, result_code, response_params, msg_params, result); - - if (mobile_apis::Result::INVALID_ENUM != result_code) { - SendResponse(result, - result_code, - info.empty() ? NULL : info.c_str(), - response_params.empty() ? NULL : &response_params); - return; - } - -#ifdef HMI_DBUS_API - // Generate list of subrequests - for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) { - const Subrequest& sr = subrequests[i]; - if (true == (*message_)[strings::msg_params].keyExists(sr.str) && - true == (*message_)[strings::msg_params][sr.str].asBool()) { - HmiRequest hmi_request; - hmi_request.str = sr.str; - hmi_request.func_id = sr.func_id; - hmi_request.complete = false; - hmi_requests_.push_back(hmi_request); - } - } - LOG4CXX_DEBUG( - logger_, hmi_requests_.size() << " requests are going to be sent to HMI"); - - // Send subrequests - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) - SendHMIRequest(it->func_id, &msg_params, true); -#else - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData, - &msg_params, - true); -#endif // #ifdef HMI_DBUS_API -} - -void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - const smart_objects::SmartObject& message = event.smart_object(); - - if (hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData != event.id()) { - LOG4CXX_ERROR(logger_, "Received unknown event."); - return; - } - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer."); - return; - } - -#ifdef HMI_DBUS_API - for (HmiRequests::iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - HmiRequest& hmi_request = *it; - if (hmi_request.func_id == event.id()) { - hmi_request.status = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - if (hmi_apis::Common_Result::SUCCESS == hmi_request.status) - hmi_request.value = message[strings::msg_params][hmi_request.str]; - hmi_request.complete = true; - break; - } - } - bool all_complete = true; - bool any_arg_success = false; - mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS; - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - if (!it->complete) { - all_complete = false; - break; - } - if (hmi_apis::Common_Result::SUCCESS != it->status) { - if (mobile_api::Result::SUCCESS == status) { - status = static_cast<mobile_apis::Result::eType>(it->status); - } else if (status != - static_cast<mobile_apis::Result::eType>(it->status)) { - status = mobile_api::Result::eType::GENERIC_ERROR; - } - LOG4CXX_TRACE(logger_, - "Status from HMI: " << it->status - << ", so response status become " - << status); - } else { - any_arg_success = true; - } - } - - if (all_complete) { - smart_objects::SmartObject response_params(smart_objects::SmartType_Map); - if (any_arg_success) { - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - response_params[it->str] = it->value; - } - } - LOG4CXX_DEBUG(logger_, "All HMI requests are complete"); - const bool result = any_arg_success; - SendResponse(any_arg_success, status, NULL, &response_params); - if (result) { - app->UpdateHash(); - } - } -#else - - hmi_apis::Common_Result::eType hmi_result = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - hmi_result, HmiInterfaces::HMI_INTERFACE_VehicleInfo); - - bool is_succeeded = result || !vi_already_subscribed_by_another_apps_.empty(); - - mobile_apis::Result::eType result_code = - MessageHelper::HMIToMobileResult(hmi_result); - - if (is_succeeded) { - if (!vi_already_subscribed_by_this_app_.empty()) { - result_code = mobile_apis::Result::IGNORED; - response_info = "Already subscribed on some provided VehicleData."; - } - - if (!vi_waiting_for_subscribe_.empty()) { - LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData"); - VehicleInfoSubscriptions::const_iterator key = - vi_waiting_for_subscribe_.begin(); - for (; key != vi_waiting_for_subscribe_.end(); ++key) { - app->SubscribeToIVI(*key); - } - } - } - - UnsubscribeFailedSubscriptions(app, message[strings::msg_params]); - - if (!vi_already_subscribed_by_another_apps_.empty() || - !vi_already_subscribed_by_this_app_.empty()) { - AddAlreadySubscribedVI( - const_cast<smart_objects::SmartObject&>(message[strings::msg_params])); - } - - SendResponse(is_succeeded, - result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); -#endif // #ifdef HMI_DBUS_API -} - -bool SubscribeVehicleDataRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( - smart_objects::SmartObject& msg_params) const { - LOG4CXX_AUTO_TRACE(logger_); - using namespace mobile_apis; - auto vi_to_string = - [](const mobile_apis::VehicleDataType::eType vehicle_data) { - for (auto& vi_str_to_int_pair : MessageHelper::vehicle_data()) { - if (vehicle_data == vi_str_to_int_pair.second) { - return vi_str_to_int_pair.first; - } - } - return std::string(); - }; - - VehicleInfoSubscriptions::const_iterator it_same_app = - vi_already_subscribed_by_this_app_.begin(); - for (; vi_already_subscribed_by_this_app_.end() != it_same_app; - ++it_same_app) { - msg_params[vi_to_string(*it_same_app)][strings::result_code] = - VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED; - msg_params[vi_to_string(*it_same_app)][strings::data_type] = *it_same_app; - } - - VehicleInfoSubscriptions::const_iterator it_another_app = - vi_already_subscribed_by_another_apps_.begin(); - for (; vi_already_subscribed_by_another_apps_.end() != it_another_app; - ++it_another_app) { - msg_params[vi_to_string(*it_another_app)][strings::result_code] = - VehicleDataResultCode::VDRC_SUCCESS; - msg_params[vi_to_string(*it_another_app)][strings::data_type] = - *it_another_app; - } -} - -void SubscribeVehicleDataRequest::UnsubscribeFailedSubscriptions( - ApplicationSharedPtr app, - const smart_objects::SmartObject& msg_params) const { - LOG4CXX_AUTO_TRACE(logger_); - const VehicleData& vehicle_data = MessageHelper::vehicle_data(); - VehicleData::const_iterator it = vehicle_data.begin(); - - for (; vehicle_data.end() != it; ++it) { - if (msg_params.keyExists(it->first)) { - if (msg_params[it->first][strings::result_code].asInt() != - hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS) { - LOG4CXX_DEBUG(logger_, - "Subscription for VehicleDataType " - << it->first - << " is unsuccessfull. " - "Unsubscribing app with connection key " - << connection_key() << " from it."); - app->UnsubscribeFromIVI(it->second); - } - } - } -} - -struct SubscribedToIVIPredicate { - int32_t vehicle_info_; - SubscribedToIVIPredicate(int32_t vehicle_info) - : vehicle_info_(vehicle_info) {} - bool operator()(const ApplicationSharedPtr app) const { - return app ? app->IsSubscribedToIVI(vehicle_info_) : false; - } -}; - -bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor( - const uint32_t param_id) const { - LOG4CXX_AUTO_TRACE(logger_); - SubscribedToIVIPredicate finder(param_id); - DataAccessor<ApplicationSet> accessor = application_manager_.applications(); - ApplicationSetConstIt it = std::find_if( - accessor.GetData().begin(), accessor.GetData().end(), finder); - return it != accessor.GetData().end(); -} - -void SubscribeVehicleDataRequest::CheckVISubscribtions( - ApplicationSharedPtr app, - std::string& out_info, - mobile_apis::Result::eType& out_result_code, - smart_objects::SmartObject& out_response_params, - smart_objects::SmartObject& out_request_params, - bool& out_result) { - CheckVISubscriptions(app, - out_info, - out_result_code, - out_response_params, - out_request_params, - out_result); -} - -void SubscribeVehicleDataRequest::CheckVISubscriptions( - ApplicationSharedPtr app, - std::string& out_info, - mobile_apis::Result::eType& out_result_code, - smart_objects::SmartObject& out_response_params, - smart_objects::SmartObject& out_request_params, - bool& out_result) { - // counter for items to subscribe - VehicleInfoSubscriptions::size_type items_to_subscribe = 0; - // counter for subscribed items by application - uint32_t subscribed_items = 0; - - const VehicleData& vehicle_data = MessageHelper::vehicle_data(); - VehicleData::const_iterator it = vehicle_data.begin(); - - HmiInterfaces::InterfaceState interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_VehicleInfo); - - const bool is_interface_not_available = - interface_state == HmiInterfaces::STATE_NOT_AVAILABLE; - - for (; vehicle_data.end() != it; ++it) { - const std::string& key_name = it->first; - if ((*message_)[strings::msg_params].keyExists(key_name)) { - const bool is_key_enabled = - (*message_)[strings::msg_params][key_name].asBool(); - if (is_key_enabled) { - ++items_to_subscribe; - } - if (!is_interface_not_available && is_key_enabled) { - mobile_apis::VehicleDataType::eType key_type = it->second; - if (app->IsSubscribedToIVI(key_type)) { - LOG4CXX_DEBUG(logger_, - "App with connection key " - << connection_key() - << " is subscribed already for VehicleDataType: " - << key_type); - ++subscribed_items; - vi_already_subscribed_by_this_app_.insert(key_type); - out_response_params[key_name][strings::data_type] = key_type; - out_response_params[key_name][strings::result_code] = - mobile_apis::VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED; - continue; - } - - if (IsSomeoneSubscribedFor(key_type)) { - LOG4CXX_DEBUG(logger_, - "There are apps subscribed already for " - "VehicleDataType: " - << key_type); - if (!app->SubscribeToIVI(static_cast<uint32_t>(key_type))) { - LOG4CXX_ERROR( - logger_, - "Unable to subscribe for VehicleDataType: " << key_type); - continue; - } - LOG4CXX_DEBUG( - logger_, - "App with connection key " - << connection_key() - << " have been subscribed for VehicleDataType: " << key_type); - ++subscribed_items; - vi_already_subscribed_by_another_apps_.insert(key_type); - out_response_params[key_name][strings::data_type] = key_type; - out_response_params[key_name][strings::result_code] = - mobile_apis::VehicleDataResultCode::VDRC_SUCCESS; - continue; - } - - out_request_params[key_name] = is_key_enabled; - - if (is_key_enabled) { - vi_waiting_for_subscribe_.insert(key_type); - LOG4CXX_DEBUG( - logger_, - "App with connection key " - << connection_key() - << " will be subscribed for VehicleDataType: " << key_type); - ++subscribed_items; - } - } - } - } - - const bool is_everything_already_subscribed = - items_to_subscribe == - vi_already_subscribed_by_another_apps_.size() + - vi_already_subscribed_by_this_app_.size(); - - if (0 == items_to_subscribe) { - if (HasDisallowedParams()) { - out_result_code = mobile_apis::Result::DISALLOWED; - } else { - out_result_code = mobile_apis::Result::INVALID_DATA; - out_info = "No data in the request"; - } - out_result = false; - } - - if (0 == subscribed_items && !is_interface_not_available) { - out_result_code = mobile_apis::Result::IGNORED; - out_info = "Already subscribed on provided VehicleData."; - out_result = false; - } - - if (is_everything_already_subscribed) { - out_result_code = vi_already_subscribed_by_this_app_.size() - ? mobile_apis::Result::IGNORED - : mobile_apis::Result::SUCCESS; - if (!(vi_already_subscribed_by_this_app_.empty())) { - out_info = "Already subscribed on some provided VehicleData."; - } - out_result = true; - } -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc deleted file mode 100644 index 7ed16407a5..0000000000 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/subscribe_vehicle_data_response.h" - -#include "application_manager/application_impl.h" -#include "interfaces/MOBILE_API.h" - -namespace application_manager { -namespace commands { - -SubscribeVehicleDataResponse::SubscribeVehicleDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {} - -void SubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc deleted file mode 100644 index 8195697dfc..0000000000 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc +++ /dev/null @@ -1,82 +0,0 @@ -#include "application_manager/application_manager.h" -#include "application_manager/commands/mobile/subscribe_way_points_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -SubscribeWayPointsRequest::SubscribeWayPointsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} - -void SubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (application_manager_.IsAppSubscribedForWayPoints(app)) { - SendResponse(false, mobile_apis::Result::IGNORED); - return; - } - - if (application_manager_.IsAnyAppSubscribedForWayPoints()) { - application_manager_.SubscribeAppForWayPoints(app); - SendResponse(true, mobile_apis::Result::SUCCESS); - return; - } - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_SubscribeWayPoints, NULL, true); -} - -void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application(connection_key()); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: { - LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - const hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_Navigation); - if (result) { - application_manager_.SubscribeAppForWayPoints(app); - } - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } -} - -bool SubscribeWayPointsRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc deleted file mode 100644 index c2e642619a..0000000000 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_response.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include "application_manager/application_manager.h" -#include "application_manager/commands/mobile/subscribe_way_points_response.h" - -namespace application_manager { - -namespace commands { - -SubscribeWayPointsResponse::SubscribeWayPointsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SubscribeWayPointsResponse::~SubscribeWayPointsResponse() {} - -void SubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc deleted file mode 100644 index fe38b93732..0000000000 --- a/src/components/application_manager/src/commands/mobile/system_request.cc +++ /dev/null @@ -1,659 +0,0 @@ -/* - -Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/system_request.h" - -#include <vector> -#include <string> -#include <stdio.h> -#include <algorithm> -#include <sstream> -#include "application_manager/policies/policy_handler_interface.h" -#include "interfaces/MOBILE_API.h" -#include "utils/file_system.h" -#include "formatters/CFormatterJsonBase.h" -#include "json/json.h" -#include "utils/helpers.h" -#include "utils/custom_string.h" - -namespace application_manager { - -CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") -namespace { - -#ifdef ENABLE_LOG -const char* kQueryAppsValidationFailedPrefix = - ":QUERY_APPS_VALIDATION_FAILED: "; -#endif - -const unsigned int kVrSynonymLengthMax = 40U; -const unsigned int kVrSynonymLengthMin = 1U; -const unsigned int kTtsNameLengthMax = 500U; -const unsigned int kVrArraySizeMax = 100U; -const unsigned int kVrArraySizeMin = 1U; -const unsigned int kUrlSchemaLengthMax = 255U; -const unsigned int kPackageNameLengthMax = 255U; -const unsigned int kAppIdLengthMax = 40U; -const unsigned int kAppNameLengthMax = 100U; -const unsigned int kLanguageArraySizeMax = 100U; - -class QueryAppsDataValidator { - public: - typedef std::set<std::string> SynonymsSet; - typedef std::map<std::string, SynonymsSet> SynonymsMap; - - QueryAppsDataValidator(smart_objects::SmartObject& object, - const ApplicationManager& manager) - : data_(object), manager_(manager) {} - - bool Validate() { - LOG4CXX_AUTO_TRACE(logger_); - if (!data_.isValid()) { - LOG4CXX_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not valid."); - return false; - } - if (!HasResponseKey()) { - return false; - } - return ValidateAppDataAndOsAndLanguagesData(); - } - - private: - bool HasResponseKey() const { - if (!data_.keyExists(json::response)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response does not contain '" - << json::response << "' parameter."); - return false; - } - return true; - } - - bool ValidateAppDataAndOsAndLanguagesData() { - smart_objects::SmartArray* objects_array = data_[json::response].asArray(); - - if (!objects_array) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not array."); - return false; - } - - SynonymsMap synonyms_map; - bool has_response_valid_application = false; - - smart_objects::SmartArray::iterator applications_iterator = - objects_array->begin(); - - for (; applications_iterator != objects_array->end();) { - const smart_objects::SmartObject& app_data = *applications_iterator; - - if (!app_data.isValid()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "Wrong application data in json file."); - return false; - } - - if (!CheckMandatoryParametersPresent(app_data)) { - LOG4CXX_WARN(logger_, - "Application hasn`t some of mandatory parameters. " - "Application will be skipped."); - - applications_iterator = objects_array->erase(applications_iterator); - continue; - } - - if (!ValidateAppIdAndAppName(app_data)) { - return false; - } - - // If we dont have any of android/ios field - // we skip this json in CheckMandatoryParametersPresent - const std::string os_type = - (app_data.keyExists(json::android)) ? json::android : json::ios; - - // Verify os and dependent languages data - if (json::ios == os_type) { - if (app_data[json::ios][json::urlScheme].asString().length() > - kUrlSchemaLengthMax) { - LOG4CXX_WARN( - logger_, - kQueryAppsValidationFailedPrefix - << "An urlscheme length exceeds maximum allowed [" - << app_data[json::ios][json::urlScheme].asString().length() - << "]>[" << kUrlSchemaLengthMax << "]"); - return false; - } - } - - if (json::android == os_type) { - if (app_data[json::android][json::packageName].asString().length() > - kPackageNameLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "Package name length [" - << app_data[json::android][json::packageName] - .asString() - .length() << "] exceeds max length [" - << kPackageNameLengthMax << "]in json file."); - return false; - } - } - - // Languages verification - if (!app_data[os_type].keyExists(json::languages)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages' doesn't exist"); - return false; - } - if (!ValidateLanguages(app_data[os_type][json::languages], - synonyms_map)) { - return false; - } - has_response_valid_application = true; - ++applications_iterator; - } - return has_response_valid_application; - } - - bool ValidateAppIdAndAppName(const smart_objects::SmartObject& app_data) { - // Verify appid length - const std::string app_id(app_data[json::appId].asString()); - if (app_id.length() > kAppIdLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "An Object ID length exceeds maximum allowed [" - << app_id.length() << "]>[" << kAppIdLengthMax << "]"); - return false; - } - - // Verify that appid is unique - if (applications_id_set_.find(app_id) != applications_id_set_.end()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "An Object ID is not unigue [" << app_id << "]"); - return false; - } - applications_id_set_.insert(app_id); - - // Verify that app is not registered yet - ApplicationSharedPtr registered_app = - manager_.application_by_policy_id(app_id); - if (registered_app) { - LOG4CXX_INFO(logger_, - "Application with the id: " << app_id - << " is already registered."); - } - // And app name length - const std::string appName(app_data[json::name].asString()); - if (appName.length() > kAppNameLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "Name of application exceeds maximum allowed [" - << appName.length() << "]>[" << kAppNameLengthMax - << "]."); - return false; - } - return true; - } - - bool ValidateLanguages(const smart_objects::SmartObject& languages, - SynonymsMap& synonyms_map) const { - bool default_language_found = false; - const size_t languages_array_size = languages.length(); - if (languages_array_size > kLanguageArraySizeMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages' array exceeds max size [" - << languages_array_size << "]>[" << kLanguageArraySizeMax - << "]"); - return false; - } - // Every language has ttsname string and vrsynonyms array - for (size_t idx = 0; idx < languages_array_size; ++idx) { - const smart_objects::SmartObject& language = languages.getElement(idx); - if (smart_objects::SmartType_Map != language.getType()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "language is not a map."); - return false; - } - if (language.length() != 1) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "language map size is not equal 1."); - return false; - } - const std::string language_name = (*language.map_begin()).first; - if (!language_name.length()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "language name is empty"); - return false; - } - // Verify default language defined - if (!(language_name).compare(json::default_)) { - default_language_found = true; - } - // Add set for synonyms' duplicates validation - if (synonyms_map.find(language_name) == synonyms_map.end()) { - synonyms_map[language_name] = SynonymsSet(); - } - // ttsName verification - if (!language[language_name].keyExists(json::ttsName)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages.ttsName' doesn't exist"); - return false; - } - const smart_objects::SmartObject& ttsNameObject = - language[language_name][json::ttsName]; - // ttsName is string - if (smart_objects::SmartType_String == ttsNameObject.getType()) { - const std::string ttsName = - language[language_name][json::ttsName].asString(); - if (ttsName.length() > kTtsNameLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "ttsName string exceeds max length [" - << ttsName.length() << "]>[" << kTtsNameLengthMax - << "]"); - return false; - } - } else { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "ttsName is not the string type."); - return false; - } - - if (!ValidateSynonymsAtLanguage(language, language_name, synonyms_map)) { - return false; - } - } - if (!default_language_found) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << " 'languages'.default' doesn't exist"); - return false; - } - return true; - } - - bool ValidateSynonymsAtLanguage(const smart_objects::SmartObject& language, - const std::string& language_name, - SynonymsMap& synonyms_map) const { - if (!language[language_name].keyExists(json::vrSynonyms)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages.vrSynonyms' doesn't exist"); - return false; - } - const smart_objects::SmartArray* synonyms_array = - language[language_name][json::vrSynonyms].asArray(); - if (!synonyms_array) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynonyms is not array."); - return false; - } - const size_t synonyms_array_size = synonyms_array->size(); - if (synonyms_array_size < kVrArraySizeMin) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynomyms array has [" << synonyms_array_size - << "] size < allowed min size [" << kVrArraySizeMin - << "]"); - return false; - } - if (synonyms_array_size > kVrArraySizeMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynomyms array size [" << synonyms_array_size - << "] exceeds maximum allowed size [" << kVrArraySizeMax - << "]"); - return false; - } - - for (std::size_t idx = 0; idx < synonyms_array_size; ++idx) { - const smart_objects::SmartObject& synonym = (*synonyms_array)[idx]; - const std::string vrSynonym = synonym.asString(); - if (vrSynonym.length() > kVrSynonymLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item [" << idx - << "] exceeds max length [" << vrSynonym.length() - << "]>[" << kVrSynonymLengthMax << "]"); - return false; - } - if (vrSynonym.length() < kVrSynonymLengthMin) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item [" << idx << "] length [" - << vrSynonym.length() << "] is less then min length [" - << kVrSynonymLengthMin << "] allowed."); - return false; - } - // Verify duplicates - SynonymsMap::iterator synonyms_map_iter = - synonyms_map.find(language_name); - if (synonyms_map_iter != synonyms_map.end()) { - if (!(*synonyms_map_iter).second.insert(vrSynonym).second) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item already defined [" - << vrSynonym.c_str() << "] for language [" - << language_name << "]"); - return false; - } - } - } - return true; - } - - bool CheckMandatoryParametersPresent( - const smart_objects::SmartObject& app_data) const { - if (!app_data.keyExists(json::android) && !app_data.keyExists(json::ios)) { - return false; - } - - if (app_data.keyExists(json::android) && - !app_data[json::android].keyExists(json::packageName)) { - return false; - } - - if (app_data.keyExists(json::ios) && - !app_data[json::ios].keyExists(json::urlScheme)) { - return false; - } - - if (!app_data.keyExists(json::appId)) { - return false; - } - - if (!app_data.keyExists(json::name)) { - return false; - } - - return true; - } - - smart_objects::SmartObject& data_; - std::set<std::string> applications_id_set_; - const ApplicationManager& manager_; - - DISALLOW_COPY_AND_ASSIGN(QueryAppsDataValidator); -}; -} - -namespace commands { - -namespace custom_str = utils::custom_string; - -uint32_t SystemRequest::index = 0; - -const std::string kSYNC = "SYNC"; -const std::string kIVSU = "IVSU"; - -SystemRequest::SystemRequest(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -SystemRequest::~SystemRequest() {} - -void SystemRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!(application.valid())) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const mobile_apis::RequestType::eType request_type = - static_cast<mobile_apis::RequestType::eType>( - (*message_)[strings::msg_params][strings::request_type].asInt()); - - const policy::PolicyHandlerInterface& policy_handler = - application_manager_.GetPolicyHandler(); - if (!policy_handler.IsRequestTypeAllowed(application->policy_app_id(), - request_type)) { - SendResponse(false, mobile_apis::Result::DISALLOWED); - return; - } - - std::string file_name; - if ((*message_)[strings::msg_params].keyExists(strings::file_name)) { - file_name = (*message_)[strings::msg_params][strings::file_name].asString(); - } else { - file_name = kSYNC; - } - - if (!CheckSyntax(file_name)) { - LOG4CXX_ERROR(logger_, - "Incoming request contains \t\n \\t \\n or whitespace"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - if (!file_system::IsFileNameValid(file_name)) { - const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); - SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); - return; - } - - bool is_system_file = std::string::npos != file_name.find(kSYNC) || - std::string::npos != file_name.find(kIVSU); - - // to avoid override existing file - if (is_system_file) { - const uint8_t max_size = 255; - char buf[max_size] = {'\0'}; - snprintf(buf, max_size - 1, "%d%s", index++, file_name.c_str()); - file_name = buf; - } - - std::vector<uint8_t> binary_data; - std::string binary_data_folder; - if ((*message_)[strings::params].keyExists(strings::binary_data)) { - binary_data = (*message_)[strings::params][strings::binary_data].asBinary(); - binary_data_folder = - application_manager_.get_settings().system_files_path(); - } else { - binary_data_folder = - application_manager_.get_settings().app_storage_folder(); - binary_data_folder += "/"; - binary_data_folder += application->folder_name(); - binary_data_folder += "/"; - } - - std::string file_dst_path = - application_manager_.get_settings().system_files_path(); - file_dst_path += "/"; - file_dst_path += file_name; - - if ((*message_)[strings::params].keyExists(strings::binary_data)) { - LOG4CXX_DEBUG( - logger_, - "Binary data is present. Trying to save it to: " << binary_data_folder); - if (mobile_apis::Result::SUCCESS != - (application_manager_.SaveBinary( - binary_data, binary_data_folder, file_name, 0))) { - LOG4CXX_DEBUG(logger_, "Binary data can't be saved."); - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); - return; - } - } else { - std::string app_full_file_path = binary_data_folder; - app_full_file_path += file_name; - - LOG4CXX_DEBUG(logger_, - "Binary data is not present. Trying to find file " - << file_name << " within previously saved app file in " - << binary_data_folder); - - const AppFile* file = application->GetFile(app_full_file_path); - if (!file || !file->is_download_complete || - !file_system::MoveFile(app_full_file_path, file_dst_path)) { - LOG4CXX_DEBUG(logger_, "Binary data not found."); - SendResponse(false, mobile_apis::Result::REJECTED); - return; - } - processing_file_ = file_dst_path; - } - - LOG4CXX_DEBUG(logger_, "Binary data ok."); - - if (mobile_apis::RequestType::HTTP == request_type && - (*message_)[strings::msg_params].keyExists(strings::file_name)) { - const std::string& file = - (*message_)[strings::msg_params][strings::file_name].asString(); - application_manager_.GetPolicyHandler().ReceiveMessageFromSDK(file, - binary_data); - SendResponse(true, mobile_apis::Result::SUCCESS); - return; - } else if (mobile_apis::RequestType::QUERY_APPS == request_type) { - using namespace NsSmartDeviceLink::NsJSONHandler::Formatters; - - smart_objects::SmartObject sm_object; - Json::Reader reader; - std::string json(binary_data.begin(), binary_data.end()); - Json::Value root; - if (!reader.parse(json.c_str(), root)) { - LOG4CXX_DEBUG(logger_, "Unable to parse query_app json file."); - return; - } - - CFormatterJsonBase::jsonValueToObj(root, sm_object); - if (!ValidateQueryAppData(sm_object)) { - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); - return; - } - - application_manager_.ProcessQueryApp(sm_object, connection_key()); - SendResponse(true, mobile_apis::Result::SUCCESS); - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - if (std::string::npos != file_name.find(kIVSU)) { - msg_params[strings::file_name] = file_name; - } else { - msg_params[strings::file_name] = file_dst_path; - } - - // expected int, mandatory=true, all Policies flow (HTTP,Proprietary,External) - msg_params[strings::app_id] = application->hmi_app_id(); - - msg_params[strings::request_type] = - (*message_)[strings::msg_params][strings::request_type]; - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); - SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_SystemRequest, - &msg_params, - true); -} - -void SystemRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::BasicCommunication_SystemRequest: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); - mobile_apis::Result::eType result_code = - GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asUInt())); - - const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( - result_code, - mobile_api::Result::SUCCESS, - mobile_api::Result::WARNINGS); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!(application.valid())) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - return; - } - - if (!processing_file_.empty()) { - file_system::DeleteFile(processing_file_); - processing_file_.clear(); - } - - SendResponse(result, result_code, NULL, &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - return; - } - } -} - -bool SystemRequest::ValidateQueryAppData( - smart_objects::SmartObject& data) const { - if (!data.isValid()) { - LOG4CXX_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not valid."); - return false; - } - if (!data.keyExists(json::response)) { - LOG4CXX_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response does not contain '" - << json::response << "' parameter."); - return false; - } - - QueryAppsDataValidator validator(data, application_manager_); - return validator.Validate(); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/system_response.cc b/src/components/application_manager/src/commands/mobile/system_response.cc deleted file mode 100644 index f5bc03f4a5..0000000000 --- a/src/components/application_manager/src/commands/mobile/system_response.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/system_response.h" - -namespace application_manager { - -namespace commands { - -SystemResponse::SystemResponse(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -SystemResponse::~SystemResponse() {} - -void SystemResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc deleted file mode 100644 index d40ad9c870..0000000000 --- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_request.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/unregister_app_interface_request.h" - -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -void UnregisterAppInterfaceRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - if (!application_manager_.application(connection_key())) { - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - - application_manager_.ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - connection_key(), - mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM), - commands::Command::ORIGIN_SDL); - application_manager_.EndNaviServices(connection_key()); - application_manager_.UnregisterApplication(connection_key(), - mobile_apis::Result::SUCCESS); - SendResponse(true, mobile_apis::Result::SUCCESS); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc deleted file mode 100644 index 49d9276d35..0000000000 --- a/src/components/application_manager/src/commands/mobile/unregister_app_interface_response.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/unregister_app_interface_response.h" - -namespace application_manager { - -namespace commands { - -void UnregisterAppInterfaceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - SendResponse((*message_)[strings::msg_params][strings::success].asBool()); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc deleted file mode 100644 index 7e798bcb4e..0000000000 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/unsubscribe_button_request.h" - -#include "application_manager/application_impl.h" - -namespace application_manager { - -namespace commands { - -namespace str = strings; - -UnsubscribeButtonRequest::UnsubscribeButtonRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {} - -void UnsubscribeButtonRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - const mobile_apis::ButtonName::eType btn_id = - static_cast<mobile_apis::ButtonName::eType>( - (*message_)[str::msg_params][str::button_name].asInt()); - - if (!CheckHMICapabilities(btn_id)) { - LOG4CXX_ERROR(logger_, - "Button " << btn_id << " isn't allowed by HMI capabilities"); - SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); - return; - } - - if (!app->UnsubscribeFromButton( - static_cast<mobile_apis::ButtonName::eType>(btn_id))) { - LOG4CXX_ERROR(logger_, "App doesn't subscibe to button " << btn_id); - SendResponse(false, mobile_apis::Result::IGNORED); - return; - } - - SendUnsubscribeButtonNotification(); - SendResponse(true, mobile_apis::Result::SUCCESS); -} - -bool UnsubscribeButtonRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() { - using namespace smart_objects; - using namespace hmi_apis; - - // send OnButtonSubscription notification - SmartObject msg_params = SmartObject(SmartType_Map); - msg_params[strings::app_id] = connection_key(); - msg_params[strings::name] = static_cast<Common_ButtonName::eType>( - (*message_)[strings::msg_params][strings::button_name].asInt()); - msg_params[strings::is_suscribed] = false; - CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc deleted file mode 100644 index 9ac98a27f7..0000000000 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_response.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/unsubscribe_button_response.h" -#include "smart_objects/smart_object.h" - -namespace application_manager { - -namespace commands { - -UnsubscribeButtonResponse::UnsubscribeButtonResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {} - -void UnsubscribeButtonResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // check if response false - if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { - if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); - SendResponse(false); - return; - } - } - - // TODO(DK): Some logic - SendResponse(true); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc deleted file mode 100644 index d6ad928bf7..0000000000 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ /dev/null @@ -1,407 +0,0 @@ -/* - - Copyright (c) 2017, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/unsubscribe_vehicle_data_request.h" -#include "application_manager/commands/command_impl.h" - -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "application_manager/smart_object_keys.h" -#include "utils/helpers.h" - -namespace application_manager { -namespace commands { - -UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {} - -#ifdef HMI_DBUS_API -namespace { -struct Subrequest { - hmi_apis::FunctionID::eType func_id; - const char* str; -}; -Subrequest subrequests[] = { - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps, strings::gps}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed, strings::speed}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm, strings::rpm}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel, - strings::fuel_level}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State, - strings::fuel_level_state}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption, - strings::instant_fuel_consumption}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature, - strings::external_temp}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin, strings::vin}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl, strings::prndl}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure, - strings::tire_pressure}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer, strings::odometer}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus, - strings::belt_status}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation, - strings::body_information}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus, - strings::device_status}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking, - strings::driver_braking}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus, - strings::wiper_status}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus, - strings::head_lamp_status}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque, - strings::engine_torque}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition, - strings::acc_pedal_pos}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle, - strings::steering_wheel_angle}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo, - strings::e_call_info}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus, - strings::airbag_status}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent, - strings::emergency_event}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus, - strings::cluster_mode_status}, - {hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey, strings::my_key}, -}; -} -#endif // #ifdef HMI_DBUS_API - -void UnsubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - int32_t items_to_unsubscribe = 0; - int32_t unsubscribed_items = 0; - - const VehicleData& vehicle_data = MessageHelper::vehicle_data(); - VehicleData::const_iterator it = vehicle_data.begin(); - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - smart_objects::SmartObject response_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - for (; vehicle_data.end() != it; ++it) { - const std::string& key_name = it->first; - if ((*message_)[strings::msg_params].keyExists(key_name)) { - bool is_key_enabled = (*message_)[strings::msg_params][key_name].asBool(); - if (is_key_enabled) { - ++items_to_unsubscribe; - - mobile_apis::VehicleDataType::eType key_type = it->second; - if (!app->IsSubscribedToIVI(key_type)) { - ++unsubscribed_items; - vi_already_unsubscribed_by_this_app_.insert(key_type); - response_params[key_name][strings::data_type] = key_type; - response_params[key_name][strings::result_code] = - mobile_apis::VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED; - continue; - } - - if (!app->UnsubscribeFromIVI(static_cast<uint32_t>(key_type))) { - LOG4CXX_ERROR(logger_, - "Unable to unsubscribe from " - "VehicleDataType: " - << key_type); - continue; - } - - LOG4CXX_DEBUG(logger_, - "Unsubscribed app with connection key " - << connection_key() - << " from VehicleDataType: " << key_type); - - ++unsubscribed_items; - - if (IsSomeoneSubscribedFor(key_type)) { - LOG4CXX_DEBUG(logger_, - "There are another apps still subscribed for " - "VehicleDataType: " - << key_type); - - vi_still_subscribed_by_another_apps_.insert(key_type); - response_params[key_name][strings::data_type] = key_type; - response_params[key_name][strings::result_code] = - mobile_apis::VehicleDataResultCode::VDRC_SUCCESS; - continue; - } - - msg_params[key_name] = is_key_enabled; - } - } - } - - bool is_everything_already_unsubscribed = - static_cast<uint32_t>(items_to_unsubscribe) == - vi_still_subscribed_by_another_apps_.size() + - vi_already_unsubscribed_by_this_app_.size(); - - if (0 == items_to_unsubscribe) { - if (HasDisallowedParams()) { - SendResponse(false, mobile_apis::Result::DISALLOWED); - } else { - SendResponse( - false, mobile_apis::Result::INVALID_DATA, "No data in the request."); - } - return; - } - - if (0 == unsubscribed_items) { - SendResponse(false, - mobile_apis::Result::IGNORED, - "Was not subscribed on any VehicleData.", - &response_params); - return; - } - - if (is_everything_already_unsubscribed) { - if (!vi_already_unsubscribed_by_this_app_.empty()) { - SendResponse(false, - mobile_apis::Result::IGNORED, - "Some provided VehicleData was not subscribed.", - &response_params); - } else { - SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); - } - return; - } - -#ifdef HMI_DBUS_API - // Generate list of subrequests - for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) { - const Subrequest& sr = subrequests[i]; - if (true == (*message_)[strings::msg_params].keyExists(sr.str) && - true == (*message_)[strings::msg_params][sr.str].asBool()) { - HmiRequest hmi_request; - hmi_request.str = sr.str; - hmi_request.func_id = sr.func_id; - hmi_request.complete = false; - hmi_requests_.push_back(hmi_request); - } - } - LOG4CXX_INFO(logger_, - hmi_requests_.size() << " requests are going to be sent to HMI"); - - // Send subrequests - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) - SendHMIRequest(it->func_id, &msg_params, true); -#else - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData, - &msg_params, - true); -#endif // #ifdef HMI_DBUS_API -} - -void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; - - const smart_objects::SmartObject& message = event.smart_object(); - - if (hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData != event.id()) { - LOG4CXX_ERROR(logger_, "Received unknown event."); - return; - } - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); - - ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer."); - return; - } - -#ifdef HMI_DBUS_API - for (HmiRequests::iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - HmiRequest& hmi_request = *it; - if (hmi_request.func_id == event.id()) { - hmi_request.status = static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - if (hmi_apis::Common_Result::SUCCESS == hmi_request.status) - hmi_request.value = message[strings::msg_params][hmi_request.str]; - hmi_request.complete = true; - break; - } - } - bool all_complete = true; - bool any_arg_success = false; - mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS; - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - if (!it->complete) { - all_complete = false; - break; - } - if (hmi_apis::Common_Result::SUCCESS != it->status) { - if (mobile_api::Result::SUCCESS == status) { - status = static_cast<mobile_apis::Result::eType>(it->status); - } else if (status != - static_cast<mobile_apis::Result::eType>(it->status)) { - status = mobile_api::Result::eType::GENERIC_ERROR; - } - LOG4CXX_TRACE(logger_, - "Status from HMI: " << it->status - << ", so response status become " - << status); - } else { - any_arg_success = true; - } - } - if (all_complete) { - smart_objects::SmartObject response_params(smart_objects::SmartType_Map); - if (any_arg_success) { - for (HmiRequests::const_iterator it = hmi_requests_.begin(); - it != hmi_requests_.end(); - ++it) { - response_params[it->str] = it->value; - } - } - - LOG4CXX_INFO(logger_, "All HMI requests are complete"); - if (true == any_arg_success) { - SetAllowedToTerminate(false); - } - SendResponse(any_arg_success, status, NULL, &response_params); - if (true == any_arg_success) { - app->UpdateHash(); - } - } -#else - hmi_apis::Common_Result::eType hmi_result = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - hmi_result, HmiInterfaces::HMI_INTERFACE_VehicleInfo); - - mobile_apis::Result::eType result_code = - MessageHelper::HMIToMobileResult(hmi_result); - - if (result) { - if (vi_already_unsubscribed_by_this_app_.size()) { - result_code = mobile_apis::Result::IGNORED; - response_info = "Some provided VehicleData was not subscribed."; - } - } - - if (!vi_still_subscribed_by_another_apps_.empty() || - !vi_already_unsubscribed_by_this_app_.empty()) { - AddAlreadyUnsubscribedVI( - const_cast<smart_objects::SmartObject&>(message[strings::msg_params])); - } - - if (result) { - SetAllowedToTerminate(false); - } - SendResponse(result, - result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - if (result) { - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); - } -#endif // #ifdef HMI_DBUS_API -} - -bool UnsubscribeVehicleDataRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -struct SubscribedToIVIPredicate { - int32_t vehicle_info_; - SubscribedToIVIPredicate(int32_t vehicle_info) - : vehicle_info_(vehicle_info) {} - bool operator()(const ApplicationSharedPtr app) const { - return app ? app->IsSubscribedToIVI(vehicle_info_) : false; - } -}; - -bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor( - const uint32_t param_id) const { - LOG4CXX_AUTO_TRACE(logger_); - SubscribedToIVIPredicate finder(param_id); - DataAccessor<ApplicationSet> accessor = application_manager_.applications(); - ApplicationSetConstIt it = std::find_if( - accessor.GetData().begin(), accessor.GetData().end(), finder); - return it != accessor.GetData().end(); -} - -void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( - smart_objects::SmartObject& response) const { - LOG4CXX_AUTO_TRACE(logger_); - using namespace mobile_apis; - VehicleInfoSubscriptions::const_iterator it_same_app = - vi_already_unsubscribed_by_this_app_.begin(); - for (; vi_already_unsubscribed_by_this_app_.end() != it_same_app; - ++it_same_app) { - response[*it_same_app][strings::result_code] = - VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED; - } - - VehicleInfoSubscriptions::const_iterator it_another_app = - vi_still_subscribed_by_another_apps_.begin(); - for (; vi_still_subscribed_by_another_apps_.end() != it_another_app; - ++it_another_app) { - response[*it_another_app][strings::result_code] = - VehicleDataResultCode::VDRC_SUCCESS; - } -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc deleted file mode 100644 index 986256d377..0000000000 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_response.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/unsubscribe_vehicle_data_response.h" -#include "smart_objects/smart_object.h" - -namespace application_manager { -namespace commands { - -UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {} - -void UnsubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - // check if response false - if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { - if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); - SendResponse(false); - return; - } - } - - // TODO(DK): Some logic - SendResponse(true); -} - -} // namespace commands -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc deleted file mode 100644 index dc3404c022..0000000000 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc +++ /dev/null @@ -1,76 +0,0 @@ -#include "application_manager/application_manager.h" -#include "application_manager/commands/mobile/unsubscribe_way_points_request.h" -#include "application_manager/message_helper.h" - -namespace application_manager { - -namespace commands { - -UnSubscribeWayPointsRequest::UnSubscribeWayPointsRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -UnSubscribeWayPointsRequest::~UnSubscribeWayPointsRequest() {} - -void UnSubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application(connection_key()); - - if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - return; - } - - if (!application_manager_.IsAppSubscribedForWayPoints(app)) { - SendResponse(false, mobile_apis::Result::IGNORED); - return; - } - - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true); -} - -void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application_manager_.application(connection_key()); - const smart_objects::SmartObject& message = event.smart_object(); - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { - LOG4CXX_INFO(logger_, "Received Navigation_UnSubscribeWayPoints event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - const hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_Navigation); - if (result) { - application_manager_.UnsubscribeAppFromWayPoints(app); - } - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } -} - -bool UnSubscribeWayPointsRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc deleted file mode 100644 index f6430d1f0d..0000000000 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_response.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include "application_manager/application_manager.h" -#include "application_manager/commands/mobile/unsubscribe_way_points_response.h" - -namespace application_manager { - -namespace commands { - -UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -UnsubscribeWayPointsResponse::~UnsubscribeWayPointsResponse() {} - -void UnsubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc deleted file mode 100644 index 44fe9d0d07..0000000000 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc +++ /dev/null @@ -1,234 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include <string> -#include "application_manager/commands/mobile/update_turn_list_request.h" - -#include "application_manager/policies/policy_handler.h" -#include "application_manager/application_impl.h" -#include "application_manager/message_helper.h" -#include "interfaces/MOBILE_API.h" -#include "interfaces/HMI_API.h" -#include "utils/custom_string.h" - -namespace application_manager { - -namespace commands { - -namespace custom_str = utils::custom_string; - -UpdateTurnListRequest::UpdateTurnListRequest( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandRequestImpl(message, application_manager) {} - -UpdateTurnListRequest::~UpdateTurnListRequest() {} - -void UpdateTurnListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::params][strings::connection_key].asUInt()); - - if (!app) { - SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); - return; - } - - if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming update turn list has contains \t\n \\t \\n"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - // ProcessSoftButtons checks strings on the contents incorrect character - - mobile_apis::Result::eType processing_result = - MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], - app, - application_manager_.GetPolicyHandler(), - application_manager_); - - if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); - SendResponse(false, processing_result); - return; - } - - if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { - smart_objects::SmartObject& turn_list_array = - ((*message_)[strings::msg_params][strings::turn_list]); - for (uint32_t i = 0; i < turn_list_array.length(); ++i) { - if ((turn_list_array[i].keyExists(strings::turn_icon)) && - (mobile_apis::Result::SUCCESS != - MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon], - app, - application_manager_))) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyImage return INVALID_DATA"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params = (*message_)[strings::msg_params]; - - if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { - if (!CheckTurnListArray()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - - for (uint32_t i = 0; i < msg_params[strings::turn_list].length(); ++i) { - if (msg_params[strings::turn_list][i].keyExists(hmi_request::navi_text)) { - const custom_str::CustomString& navigation_text = - msg_params[strings::turn_list][i][hmi_request::navi_text] - .asCustomString(); - msg_params[strings::turn_list][i].erase(hmi_request::navi_text); - msg_params[strings::turn_list][i][hmi_request::navi_text] - [hmi_request::field_name] = static_cast<int>( - hmi_apis::Common_TextFieldName::turnText); - msg_params[strings::turn_list][i][hmi_request::navi_text] - [hmi_request::field_text] = navigation_text; - } - } - } - - msg_params[strings::app_id] = app->app_id(); - - if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - MessageHelper::SubscribeApplicationToSoftButton( - (*message_)[strings::msg_params], app, function_id()); - } - - if ((*message_)[strings::msg_params].keyExists(strings::turn_list) || - (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - SendHMIRequest( - hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params, true); - } else { - // conditional mandatory - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - } -} - -void UpdateTurnListRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); - const smart_objects::SmartObject& message = event.smart_object(); - - switch (event.id()) { - case hmi_apis::FunctionID::Navigation_UpdateTurnList: { - LOG4CXX_INFO(logger_, "Received Navigation_UpdateTurnList event"); - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); - const hmi_apis::Common_Result::eType result_code = - static_cast<hmi_apis::Common_Result::eType>( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_Navigation); - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - break; - } - default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); - break; - } - } -} - -bool UpdateTurnListRequest::CheckTurnListArray() { - int32_t length = - (*message_)[strings::msg_params][strings::turn_list].length(); - if (0 == length) { - return false; - } - - for (int32_t i = 0; i < length; ++i) { - if (!((*message_)[strings::msg_params][strings::turn_list][i].keyExists( - hmi_request::navi_text)) && - !((*message_)[strings::msg_params][strings::turn_list][i].keyExists( - strings::turn_icon))) { - return false; - } - } - return true; -} - -bool UpdateTurnListRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; - - if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { - const smart_objects::SmartArray* tl_array = - (*message_)[strings::msg_params][strings::turn_list].asArray(); - - smart_objects::SmartArray::const_iterator it_tl = tl_array->begin(); - smart_objects::SmartArray::const_iterator it_tl_end = tl_array->end(); - - for (; it_tl != it_tl_end; ++it_tl) { - if ((*it_tl).keyExists(strings::navigation_text)) { - str = (*it_tl)[strings::navigation_text].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, - "Invalid turn_list navigation_text text syntax check failed"); - return true; - } - } - - if ((*it_tl).keyExists(strings::turn_icon)) { - str = (*it_tl)[strings::turn_icon][strings::value].asCharArray(); - if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, "Invalid turn_list turn_icon value syntax check failed"); - return true; - } - } - } - } - return false; -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc deleted file mode 100644 index d40a4546fc..0000000000 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_response.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/commands/mobile/update_turn_list_response.h" - -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace commands { - -UpdateTurnListResponse::UpdateTurnListResponse( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandResponseImpl(message, application_manager) {} - -UpdateTurnListResponse::~UpdateTurnListResponse() {} - -void UpdateTurnListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - - application_manager_.SendMessageToMobile(message_); -} - -} // namespace commands - -} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc b/src/components/application_manager/src/commands/notification_from_hmi.cc index 3c2d73b10c..75e49b180e 100644 --- a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc +++ b/src/components/application_manager/src/commands/notification_from_hmi.cc @@ -30,8 +30,9 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/commands/hmi/notification_from_hmi.h" +#include "application_manager/commands/notification_from_hmi.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" #include "smart_objects/smart_object.h" namespace application_manager { @@ -39,8 +40,16 @@ namespace application_manager { namespace commands { NotificationFromHMI::NotificationFromHMI( - const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandImpl(message, application_manager) { + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) { // Replace HMI app id with Mobile connection id ReplaceHMIWithMobileAppId(*message); } @@ -61,13 +70,14 @@ void NotificationFromHMI::SendNotificationToMobile( const MessageSharedPtr& message) { (*message)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); - application_manager_.ManageMobileCommand(message, ORIGIN_SDL); + rpc_service_.ManageMobileCommand(message, SOURCE_SDL); } void NotificationFromHMI::CreateHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr result = + std::make_shared<smart_objects::SmartObject>(); if (!result) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); return; @@ -77,7 +87,7 @@ void NotificationFromHMI::CreateHMIRequest( const uint32_t hmi_correlation_id_ = application_manager_.GetNextHMICorrelationID(); - NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result; + ns_smart_device_link::ns_smart_objects::SmartObject& request = *result; request[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kRequest); request[strings::params][strings::function_id] = @@ -90,7 +100,7 @@ void NotificationFromHMI::CreateHMIRequest( request[strings::msg_params] = msg_params; - if (!application_manager_.ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send request"); return; } diff --git a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc b/src/components/application_manager/src/commands/notification_to_hmi.cc index d52df950c3..2e5f54e950 100644 --- a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc +++ b/src/components/application_manager/src/commands/notification_to_hmi.cc @@ -30,16 +30,25 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/commands/hmi/notification_to_hmi.h" +#include "application_manager/commands/notification_to_hmi.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" namespace application_manager { namespace commands { -NotificationToHMI::NotificationToHMI(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandImpl(message, application_manager) {} +NotificationToHMI::NotificationToHMI( + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} NotificationToHMI::~NotificationToHMI() {} @@ -57,7 +66,7 @@ void NotificationToHMI::Run() {} void NotificationToHMI::SendNotification() { (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; - application_manager_.SendMessageToHMI(message_); + rpc_service_.SendMessageToHMI(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index 5a4e7b149e..ff760c2d2a 100644 --- a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -30,17 +30,24 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/commands/hmi/request_from_hmi.h" +#include "application_manager/commands/request_from_hmi.h" #include "application_manager/application_manager.h" -#include "utils/make_shared.h" +#include "application_manager/rpc_service.h" namespace application_manager { namespace commands { RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandImpl(message, application_manager) + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , EventObserver(application_manager.event_dispatcher()) { // Replace HMI app id with Mobile connection id ReplaceHMIWithMobileAppId(*message); @@ -66,7 +73,7 @@ void RequestFromHMI::SendResponse( const hmi_apis::FunctionID::eType function_id, const hmi_apis::Common_Result::eType result_code) { smart_objects::SmartObjectSPtr message = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); FillCommonParametersOfSO(*message, correlation_id, function_id); (*message)[strings::params][strings::message_type] = MessageType::kResponse; @@ -74,7 +81,7 @@ void RequestFromHMI::SendResponse( (*message)[strings::msg_params][strings::success] = success; (*message)[strings::msg_params][strings::result_code] = result_code; - application_manager_.ManageHMICommand(message); + rpc_service_.ManageHMICommand(message); } void RequestFromHMI::SendErrorResponse( @@ -83,7 +90,7 @@ void RequestFromHMI::SendErrorResponse( const hmi_apis::Common_Result::eType result_code, const std::string error_message) { smart_objects::SmartObjectSPtr message = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); FillCommonParametersOfSO(*message, correlation_id, function_id); (*message)[strings::params][strings::message_type] = @@ -91,7 +98,7 @@ void RequestFromHMI::SendErrorResponse( (*message)[strings::params][hmi_response::code] = result_code; (*message)[strings::params][strings::error_msg] = error_message; - application_manager_.ManageHMICommand(message); + rpc_service_.ManageHMICommand(message); } void RequestFromHMI::FillCommonParametersOfSO( diff --git a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc index 6905e7cdef..1acbc9ace7 100644 --- a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/request_to_hmi.cc @@ -30,7 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/commands/hmi/request_to_hmi.h" +#include "application_manager/commands/request_to_hmi.h" +#include "application_manager/rpc_service.h" namespace application_manager { @@ -60,8 +61,15 @@ bool ChangeInterfaceState(ApplicationManager& application_manager, } RequestToHMI::RequestToHMI(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandImpl(message, application_manager) {} + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} RequestToHMI::~RequestToHMI() {} @@ -74,12 +82,14 @@ bool RequestToHMI::CleanUp() { return true; } -void RequestToHMI::Run() {} +void RequestToHMI::Run() { + SendRequest(); +} void RequestToHMI::SendRequest() { (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; - application_manager_.SendMessageToHMI(message_); + rpc_service_.SendMessageToHMI(message_); } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc b/src/components/application_manager/src/commands/response_from_hmi.cc index d6d5d95d07..c88b14bf9c 100644 --- a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc +++ b/src/components/application_manager/src/commands/response_from_hmi.cc @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/commands/hmi/response_from_hmi.h" - +#include "application_manager/commands/response_from_hmi.h" +#include "application_manager/rpc_service.h" #include "smart_objects/smart_object.h" namespace application_manager { @@ -39,8 +39,15 @@ namespace application_manager { namespace commands { ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandImpl(message, application_manager) { + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) { // If it is error response, shift info if ((*message)[strings::params].keyExists(hmi_response::message)) { (*message)[strings::msg_params][strings::info] = @@ -67,13 +74,14 @@ void ResponseFromHMI::SendResponseToMobile( const MessageSharedPtr& message, ApplicationManager& application_manager) { (*message)[strings::params][strings::message_type] = MessageType::kResponse; - application_manager_.ManageMobileCommand(message, ORIGIN_SDL); + rpc_service_.ManageMobileCommand(message, SOURCE_SDL); } void ResponseFromHMI::CreateHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr result = + std::make_shared<smart_objects::SmartObject>(); if (!result) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); @@ -84,7 +92,7 @@ void ResponseFromHMI::CreateHMIRequest( const uint32_t hmi_correlation_id_ = application_manager_.GetNextHMICorrelationID(); - NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result; + ns_smart_device_link::ns_smart_objects::SmartObject& request = *result; request[strings::params][strings::message_type] = MessageType::kRequest; request[strings::params][strings::function_id] = function_id; request[strings::params][strings::correlation_id] = hmi_correlation_id_; @@ -95,7 +103,7 @@ void ResponseFromHMI::CreateHMIRequest( request[strings::msg_params] = msg_params; - if (!application_manager_.ManageHMICommand(result)) { + if (!rpc_service_.ManageHMICommand(result)) { LOG4CXX_ERROR(logger_, "Unable to send request"); return; } diff --git a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc b/src/components/application_manager/src/commands/response_to_hmi.cc index de1e1e0fde..01a2ec789e 100644 --- a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc +++ b/src/components/application_manager/src/commands/response_to_hmi.cc @@ -30,16 +30,24 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/commands/hmi/response_to_hmi.h" +#include "application_manager/commands/response_to_hmi.h" #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" namespace application_manager { namespace commands { ResponseToHMI::ResponseToHMI(const MessageSharedPtr& message, - ApplicationManager& application_manager) - : CommandImpl(message, application_manager) {} + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : CommandImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} ResponseToHMI::~ResponseToHMI() {} @@ -56,7 +64,7 @@ void ResponseToHMI::Run() { (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; - application_manager_.SendMessageToHMI(message_); + rpc_service_.SendMessageToHMI(message_); } } // namespace commands diff --git a/src/components/application_manager/src/core_service.cc b/src/components/application_manager/src/core_service.cc deleted file mode 100644 index 2a96502cde..0000000000 --- a/src/components/application_manager/src/core_service.cc +++ /dev/null @@ -1,231 +0,0 @@ -/** - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <vector> -#include <algorithm> -#include "application_manager/core_service.h" -#include "application_manager/application_manager_impl.h" -#include "application_manager/policies/policy_handler.h" -#include "application_manager/message_helper.h" -#include "json/json.h" -#include "interfaces/HMI_API.h" - -namespace application_manager { - -namespace { -struct AppExtensionPredicate { - AppExtensionUID uid; - bool operator()(const ApplicationSharedPtr app) { - return app ? app->QueryInterface(uid).valid() : false; - } -}; -} - -CoreService::CoreService(ApplicationManager& application_manager) - : application_manager_(application_manager) {} - -CoreService::~CoreService() {} - -mobile_apis::Result::eType CoreService::CheckPolicyPermissions(MessagePtr msg) { - ApplicationSharedPtr app = GetApplication(msg->connection_key()); - if (!app) { - return mobile_apis::Result::eType::APPLICATION_NOT_REGISTERED; - } - -#ifdef SDL_REMOTE_CONTROL - const RPCParams rpc_params; - CommandParametersPermissions params; - const mobile_apis::Result::eType ret = - application_manager_.CheckPolicyPermissions( - app, msg->function_name(), rpc_params, ¶ms); - - if (ret != mobile_apis::Result::eType::SUCCESS) { - return ret; - } - - if (!AreParametersAllowed(msg, params)) { - return mobile_apis::Result::eType::DISALLOWED; - } - - return ret; -#else - return mobile_apis::Result::eType::SUCCESS; -#endif // SDL_REMOTE_CONTROL -} - -bool CoreService::CheckModule(const ApplicationId& app_id, - const std::string& module) { -#ifdef SDL_REMOTE_CONTROL - ApplicationSharedPtr app = GetApplication(app_id); - if (app) { - return application_manager_.GetPolicyHandler().CheckModule( - app->policy_app_id(), module); - } -#endif // SDL_REMOTE_CONTROL - return false; -} - -bool CoreService::IsRemoteControlApplication(ApplicationSharedPtr app) const { -#ifdef SDL_REMOTE_CONTROL - DCHECK_OR_RETURN(app, false); - return application_manager_.GetPolicyHandler().CheckHMIType( - app->policy_app_id(), - mobile_apis::AppHMIType::eType::REMOTE_CONTROL, - app->app_types()); -#endif // SDL_REMOTE_CONTROL - return false; -} - -bool CoreService::IsInterfaceAvailable( - const HmiInterfaces::InterfaceID interface) const { -#ifdef SDL_REMOTE_CONTROL - HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - const HmiInterfaces::InterfaceState state = - hmi_interfaces.GetInterfaceState(interface); - return HmiInterfaces::STATE_NOT_AVAILABLE != state; -#endif // SDL_REMOTE_CONTROL - return false; -} - -void CoreService::RemoveHMIFakeParameters( - application_manager::MessagePtr& message) { - application_manager_.RemoveHMIFakeParameters(message); -} - -ApplicationSharedPtr CoreService::GetApplication(ApplicationId app_id) { - return application_manager_.application(app_id); -} - -void CoreService::SendMessageToHMI(const MessagePtr& message) { - application_manager_.SendPostMessageToHMI(message); -} - -void CoreService::SendMessageToMobile(const MessagePtr& message) { - application_manager_.SendPostMessageToMobile(message); -} - -uint32_t CoreService::GetNextCorrelationID() { - return application_manager_.GetNextHMICorrelationID(); -} - -std::vector<ApplicationSharedPtr> CoreService::GetApplications( - AppExtensionUID uid) { - ApplicationSet accessor = application_manager_.applications().GetData(); - AppExtensionPredicate predicate; - predicate.uid = uid; - - std::vector<ApplicationSharedPtr> result; - ApplicationSetConstIt it = - std::find_if(accessor.begin(), accessor.end(), predicate); - while (it != accessor.end()) { - result.push_back(*it); - it = std::find_if(++it, accessor.end(), predicate); - } - return result; -} - -void CoreService::ChangeNotifyHMILevel(ApplicationSharedPtr app, - mobile_apis::HMILevel::eType level) { - DCHECK_OR_RETURN_VOID(app); - application_manager_.ChangeAppsHMILevel(app->app_id(), level); -} - -const smart_objects::SmartObject* CoreService::GetRCCapabilities() const { - return application_manager_.hmi_capabilities().rc_capability(); -} - -void CoreService::NotifyHMIAboutHMILevel(ApplicationSharedPtr app, - mobile_apis::HMILevel::eType level) { - DCHECK_OR_RETURN_VOID(app); - if (app->hmi_level() != mobile_apis::HMILevel::eType::HMI_FULL) { - MessageHelper::SendActivateAppToHMI( - app->app_id(), - application_manager_, - static_cast<hmi_apis::Common_HMILevel::eType>(level), - true); - } -} - -bool CoreService::AreParametersAllowed( - MessagePtr msg, const CommandParametersPermissions& params) { - Json::Reader reader; - Json::Value json; - bool ret = reader.parse(msg->json_message(), json); - if (ret) { - return CheckParams(json.get(strings::params, Json::Value(Json::nullValue)), - params.allowed_params); - } - return false; -} - -bool CoreService::CheckParams(const Json::Value& object, - const RPCParams& allowed_params) { - if (!object.isObject()) { - return true; - } - for (Json::Value::iterator i = object.begin(); i != object.end(); ++i) { - std::string name = i.memberName(); - if (!IsAllowed(name, allowed_params)) { - return false; - } - } - return true; -} - -bool CoreService::IsAllowed(const std::string& name, - const RPCParams& allowed_params) { - return std::find(allowed_params.begin(), allowed_params.end(), name) != - allowed_params.end(); -} - -bool CoreService::GetModuleTypes(const std::string& policy_app_id, - std::vector<std::string>* modules) const { -#ifdef SDL_REMOTE_CONTROL - return application_manager_.GetPolicyHandler().GetModuleTypes(policy_app_id, - modules); -#endif // SDL_REMOTE_CONTROL - return false; -} - -MessageValidationResult CoreService::ValidateMessageBySchema( - const Message& message) { - const MessageValidationResult result = - application_manager_.ValidateMessageBySchema(message); - LOG4CXX_DEBUG(logger_, "Validation result : " << result); - return result; -} - -const ApplicationManagerSettings& CoreService::GetSettings() const { - return application_manager_.get_settings(); -} - -} // namespace application_manager diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc index b19a6f9194..f1e5bf9735 100644 --- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc +++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc @@ -39,8 +39,7 @@ namespace application_manager { namespace event_engine { using namespace sync_primitives; -EventDispatcherImpl::EventDispatcherImpl() - : state_lock_(false), observer_lock_(true), observers_event_() {} +EventDispatcherImpl::EventDispatcherImpl() : observers_event_() {} EventDispatcherImpl::~EventDispatcherImpl() {} diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc new file mode 100644 index 0000000000..803a0e6743 --- /dev/null +++ b/src/components/application_manager/src/help_prompt_manager_impl.cc @@ -0,0 +1,395 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "application_manager/help_prompt_manager_impl.h" +#include "application_manager/application.h" +#include "application_manager/application_manager.h" +#include "application_manager/commands/command_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" +#include "utils/logger.h" + +CREATE_LOGGERPTR_GLOBAL(logger_, "HelpPromptManagerImpl") + +namespace { +const size_t kLimitCommand = 30; +} + +namespace application_manager { + +HelpPromptManagerImpl::HelpPromptManagerImpl(Application& app, + ApplicationManager& app_manager) + : app_(app) + , app_manager_(app_manager) + , sending_type_(SendingType::kSendBoth) + , is_tts_send_(false) + , is_ui_send_(false) {} + +HelpPromptManagerImpl::~HelpPromptManagerImpl() { + LOG4CXX_AUTO_TRACE(logger_); +} + +bool HelpPromptManagerImpl::AddCommand( + const uint32_t cmd_id, const smart_objects::SmartObject& command) { + if (!command.keyExists(strings::vr_commands)) { + LOG4CXX_DEBUG(logger_, "vr_commands does`t present"); + return false; + } + + sync_primitives::AutoLock lock(vr_commands_lock_); + auto it = std::find_if( + vr_commands_.begin(), + vr_commands_.end(), + [cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; }); + + if (vr_commands_.end() != it) { + LOG4CXX_DEBUG(logger_, "Commands with id:" << cmd_id << " already exists"); + return false; + } + + const smart_objects::SmartObject& commands = command[strings::vr_commands]; + const size_t count_new_commands = commands.length(); + const bool limit_exceeded = + kLimitCommand <= GetCommandsCount(vr_commands_.end()); + + LOG4CXX_DEBUG(logger_, "Will be added " << count_new_commands << " commands"); + + smart_objects::SmartObjectSPtr vr_item = + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Array); + smart_objects::SmartArray& ar_vr_cmd = *(vr_item->asArray()); + smart_objects::SmartArray& ar_cmd = *(commands.asArray()); + ar_vr_cmd.reserve(count_new_commands); + ar_vr_cmd.insert( + ar_vr_cmd.end(), ar_cmd.begin(), ar_cmd.begin() + count_new_commands); + vr_commands_.push_back(std::make_pair(cmd_id, vr_item)); + + LOG4CXX_DEBUG(logger_, + "VR commands with id: " << cmd_id << " added for appID: " + << app_.app_id() << ". Total " + << vr_commands_.size() << " in cache"); + + return !limit_exceeded; +} + +bool HelpPromptManagerImpl::DeleteCommand(const uint32_t cmd_id) { + LOG4CXX_AUTO_TRACE(logger_); + + sync_primitives::AutoLock lock(vr_commands_lock_); + + auto it = std::find_if( + vr_commands_.begin(), + vr_commands_.end(), + [cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; }); + + if (vr_commands_.end() == it) { + LOG4CXX_WARN(logger_, "VR command with id: " << cmd_id << " not found"); + return false; + } + + const size_t commands_before_current = GetCommandsCount(it); + vr_commands_.erase(it); + LOG4CXX_DEBUG(logger_, + "VR command with id: " + << cmd_id << " found after " << commands_before_current + << " commands was deleted for appID: " << app_.app_id() + << " Cache size after deleting: " << vr_commands_.size()); + + return commands_before_current < kLimitCommand; +} + +void HelpPromptManagerImpl::OnVrCommandAdded( + const uint32_t cmd_id, + const smart_objects::SmartObject& command, + const bool is_resumption) { + LOG4CXX_AUTO_TRACE(logger_); + if (SendingType::kNoneSend == sending_type_) { + LOG4CXX_DEBUG(logger_, + "SendingType::kNoneSend" + << " commands with id:" << cmd_id + << " will not be added"); + return; + } + if (AddCommand(cmd_id, command) && !is_resumption) { + SendRequests(); + } +} + +void HelpPromptManagerImpl::OnVrCommandDeleted(const uint32_t cmd_id, + const bool is_resumption) { + LOG4CXX_AUTO_TRACE(logger_); + if (SendingType::kNoneSend == sending_type_) { + LOG4CXX_DEBUG(logger_, + "SendingType::kNoneSend" + << " commands with id:" << cmd_id + << " will not be deleted"); + return; + } + if (DeleteCommand(cmd_id) && !is_resumption) { + SendRequests(); + } +} + +void HelpPromptManagerImpl::OnSetGlobalPropertiesReceived( + const smart_objects::SmartObject& msg, const bool is_response) { + LOG4CXX_AUTO_TRACE(logger_); + if (SendingType::kNoneSend == sending_type_) { + LOG4CXX_DEBUG(logger_, + "SendingType::kNoneSend" + " do not track SetGlobalProperties"); + return; + } + + if (!is_response) { + if (msg.keyExists(strings::help_prompt)) { + is_tts_send_ = true; + } + if (msg.keyExists(strings::vr_help)) { + is_ui_send_ = true; + } + + LOG4CXX_DEBUG(logger_, "is_tts_send_:" << is_tts_send_); + LOG4CXX_DEBUG(logger_, "is_ui_send_:" << is_ui_send_); + return; + } + + SetSendingType(msg); +} + +HelpPromptManagerImpl::SendingType HelpPromptManagerImpl::GetSendingType() + const { + return sending_type_; +} + +size_t HelpPromptManagerImpl::GetCommandsCount( + VRCommandPairs::const_iterator end_element) const { + size_t commands_count = 0; + std::for_each(vr_commands_.begin(), + end_element, + [&commands_count](const VRCommandPair& pair) { + commands_count += pair.second->length(); + }); + return commands_count; +} + +void HelpPromptManagerImpl::SendTTSRequest() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "TTS request for appID:" << app_.app_id()); + smart_objects::SmartObjectSPtr tts_global_properties = + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); + if (tts_global_properties) { + smart_objects::SmartObject& ref = *tts_global_properties; + + ref[strings::params][strings::message_type] = + hmi_apis::messageType::request; + ref[strings::params][strings::protocol_version] = + commands::CommandImpl::protocol_version_; + ref[strings::params][strings::protocol_type] = + commands::CommandImpl::hmi_protocol_type_; + ref[strings::params][strings::correlation_id] = + app_manager_.GetNextHMICorrelationID(); + + smart_objects::SmartObject& so_to_send = *tts_global_properties; + so_to_send[strings::params][strings::function_id] = + hmi_apis::FunctionID::TTS_SetGlobalProperties; + + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + CreatePromptMsg(msg_params); + + msg_params[strings::app_id] = app_.app_id(); + so_to_send[strings::msg_params] = msg_params; + app_manager_.GetRPCService().ManageHMICommand(tts_global_properties); + } + is_tts_send_ = false; +} + +void HelpPromptManagerImpl::SendUIRequest() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "UI request for appID:" << app_.app_id()); + smart_objects::SmartObjectSPtr ui_global_properties = + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); + if (ui_global_properties) { + smart_objects::SmartObject& ref = *ui_global_properties; + + ref[strings::params][strings::message_type] = + hmi_apis::messageType::request; + ref[strings::params][strings::protocol_version] = + commands::CommandImpl::protocol_version_; + ref[strings::params][strings::protocol_type] = + commands::CommandImpl::hmi_protocol_type_; + ref[strings::params][strings::correlation_id] = + app_manager_.GetNextHMICorrelationID(); + + smart_objects::SmartObject& so_to_send = *ui_global_properties; + so_to_send[strings::params][strings::function_id] = + hmi_apis::FunctionID::UI_SetGlobalProperties; + + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + CreateVRMsg(msg_params); + + msg_params[strings::app_id] = app_.app_id(); + so_to_send[strings::msg_params] = msg_params; + app_manager_.GetRPCService().ManageHMICommand(ui_global_properties); + } + is_ui_send_ = false; +} + +void HelpPromptManagerImpl::SendBothRequests() { + LOG4CXX_AUTO_TRACE(logger_); + SendTTSRequest(); + SendUIRequest(); +} + +void HelpPromptManagerImpl::SendRequests() { + LOG4CXX_AUTO_TRACE(logger_); + + sync_primitives::AutoLock lock(vr_commands_lock_); + switch (sending_type_) { + case SendingType::kSendHelpPrompt: + SendTTSRequest(); + return; + case SendingType::kSendVRHelp: + SendUIRequest(); + return; + case SendingType::kSendBoth: + SendBothRequests(); + return; + case SendingType::kNoneSend: + break; + } + LOG4CXX_DEBUG(logger_, + "SendingType:" << static_cast<uint32_t>(sending_type_) + << " request not sending"); +} + +void HelpPromptManagerImpl::CreatePromptMsg( + smart_objects::SmartObject& out_msg_params) { + LOG4CXX_AUTO_TRACE(logger_); + out_msg_params[strings::help_prompt] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + uint32_t index = 0; + for (size_t i = 0; i < vr_commands_.size(); ++i) { + const VRCommandPair& pair = vr_commands_[i]; + for (size_t j = 0; j < pair.second->length() && index < kLimitCommand; + ++j) { + smart_objects::SmartObject item(smart_objects::SmartType_Map); + + item[strings::text] = pair.second->getElement(j).asString(); + item[strings::type] = mobile_apis::SpeechCapabilities::SC_TEXT; + + out_msg_params[strings::help_prompt][index++] = item; + } + } + app_.set_help_prompt(out_msg_params[strings::help_prompt]); +} + +void HelpPromptManagerImpl::CreateVRMsg( + smart_objects::SmartObject& out_msg_params) { + LOG4CXX_AUTO_TRACE(logger_); + if (false == out_msg_params.keyExists(strings::vr_help_title)) { + if (app_.vr_help_title()) { + out_msg_params[strings::vr_help_title] = (*app_.vr_help_title()); + } else { + out_msg_params[strings::vr_help_title] = app_.name(); + } + } + out_msg_params[strings::vr_help] = + smart_objects::SmartObject(smart_objects::SmartType_Array); + uint32_t index = 0; + for (size_t i = 0; i < vr_commands_.size(); ++i) { + const VRCommandPair& pair = vr_commands_[i]; + for (size_t j = 0; j < pair.second->length() && index < kLimitCommand; + ++j) { + smart_objects::SmartObject item(smart_objects::SmartType_Map); + + item[strings::text] = pair.second->getElement(j).asString(); + item[strings::position] = index + 1; + + out_msg_params[strings::vr_help][index++] = item; + } + } + if (out_msg_params[strings::vr_help].empty()) { + out_msg_params.erase(strings::vr_help); + app_.reset_vr_help(); + } else { + app_.set_vr_help(out_msg_params[strings::vr_help]); + } +} + +void HelpPromptManagerImpl::SetSendingType( + const smart_objects::SmartObject& msg) { + LOG4CXX_AUTO_TRACE(logger_); + + hmi_apis::Common_Result::eType result = + static_cast<hmi_apis::Common_Result::eType>( + msg[strings::params][hmi_response::code].asInt()); + LOG4CXX_DEBUG(logger_, "HMI response result:" << result); + if (hmi_apis::Common_Result::eType::SUCCESS == result) { + hmi_apis::FunctionID::eType function_id = + static_cast<hmi_apis::FunctionID::eType>( + msg[strings::params][strings::function_id].asUInt()); + LOG4CXX_DEBUG(logger_, "Function id:" << function_id); + switch (function_id) { + case hmi_apis::FunctionID::TTS_SetGlobalProperties: { + if (is_tts_send_) { + is_tts_send_ = false; + sending_type_ = SendingType::kSendHelpPrompt == sending_type_ + ? SendingType::kNoneSend + : SendingType::kSendVRHelp; + } + break; + } + case hmi_apis::FunctionID::UI_SetGlobalProperties: { + if (is_ui_send_) { + is_ui_send_ = false; + sending_type_ = SendingType::kSendVRHelp == sending_type_ + ? SendingType::kNoneSend + : SendingType::kSendHelpPrompt; + } + break; + } + default: { break; } + } + LOG4CXX_DEBUG( + logger_, + "Sending type set to:" << static_cast<uint32_t>(sending_type_)); + } +} + +} // namespace application_manager diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc index 16b49faa2a..59f1c6caf2 100644 --- a/src/components/application_manager/src/helpers/application_helper.cc +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -21,6 +21,7 @@ void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) { for (auto cmd : cmap) { MessageHelper::SendDeleteCommandRequest(cmd.second, app, app_manager); app->RemoveCommand(cmd.first); + app->help_prompt_manager().OnVrCommandDeleted(cmd.first, true); } } @@ -87,20 +88,6 @@ void DeleteButtonSubscriptions(ApplicationSharedPtr app, } } -void DeleteVISubscriptions(ApplicationSharedPtr app, - ApplicationManager& app_manager) { - VehicleInfoSubscriptions ivi = app->SubscribedIVI().GetData(); - - for (auto i : ivi) { - app->UnsubscribeFromIVI(i); - SubscribedToIVIPredicate p(i); - auto app = FindApp(app_manager.applications(), p); - if (!app) { - MessageHelper::SendUnsubscribeIVIRequest(i, app, app_manager); - } - } -} - void CleanupAppFiles(ApplicationSharedPtr app) { const auto icon_file = app->app_icon_path(); @@ -120,14 +107,6 @@ namespace application_manager { CREATE_LOGGERPTR_GLOBAL(logger, "ApplicationManager") -SubscribedToIVIPredicate::SubscribedToIVIPredicate(uint32_t vehicle_info) - : vehicle_info_(vehicle_info) {} - -bool SubscribedToIVIPredicate::operator()( - const ApplicationSharedPtr app) const { - return app ? app->IsSubscribedToIVI(vehicle_info_) : false; -} - void DeleteApplicationData(ApplicationSharedPtr app, ApplicationManager& app_manager) { LOG4CXX_AUTO_TRACE(logger); @@ -139,8 +118,12 @@ void DeleteApplicationData(ApplicationSharedPtr app, DeleteChoiceSets(app, app_manager); DeleteGlobalProperties(app, app_manager); DeleteButtonSubscriptions(app, app_manager); - DeleteVISubscriptions(app, app_manager); CleanupAppFiles(app); + app_manager.GetPluginManager().ForEachPlugin( + [&app](plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent( + plugin_manager::ApplicationEvent::kDeleteApplicationData, app); + }); } } // namespace application_manager diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc index e39b728155..f67590543d 100644 --- a/src/components/application_manager/src/hmi_capabilities_impl.cc +++ b/src/components/application_manager/src/hmi_capabilities_impl.cc @@ -44,7 +44,7 @@ #include "utils/file_system.h" namespace application_manager { -namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; +namespace formatters = ns_smart_device_link::ns_json_handler::formatters; namespace { std::map<std::string, hmi_apis::Common_VrCapabilities::eType> @@ -93,10 +93,14 @@ 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)); button_enum_name.insert(std::make_pair( + std::string("PLAY_PAUSE"), hmi_apis::Common_ButtonName::PLAY_PAUSE)); + button_enum_name.insert(std::make_pair( std::string("SEEKLEFT"), hmi_apis::Common_ButtonName::SEEKLEFT)); button_enum_name.insert(std::make_pair( std::string("SEEKRIGHT"), hmi_apis::Common_ButtonName::SEEKRIGHT)); @@ -282,6 +286,9 @@ void InitCapabilities() { image_field_name_enum.insert(std::make_pair( std::string("graphic"), hmi_apis::Common_ImageFieldName::graphic)); image_field_name_enum.insert( + std::make_pair(std::string("secondaryGraphic"), + hmi_apis::Common_ImageFieldName::secondaryGraphic)); + image_field_name_enum.insert( std::make_pair(std::string("showConstantTBTIcon"), hmi_apis::Common_ImageFieldName::showConstantTBTIcon)); image_field_name_enum.insert(std::make_pair( @@ -548,10 +555,15 @@ void HMICapabilitiesImpl::set_vr_supported_languages( void HMICapabilitiesImpl::set_display_capabilities( const smart_objects::SmartObject& display_capabilities) { - if (display_capabilities_) { - delete display_capabilities_; + if (app_mngr_.IsSOStructValid( + hmi_apis::StructIdentifiers::Common_DisplayCapabilities, + display_capabilities)) { + if (display_capabilities_) { + delete display_capabilities_; + } + display_capabilities_ = + new smart_objects::SmartObject(display_capabilities); } - display_capabilities_ = new smart_objects::SmartObject(display_capabilities); } void HMICapabilitiesImpl::set_hmi_zone_capabilities( @@ -874,7 +886,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { if (check_existing_json_member(ui, "displayCapabilities")) { smart_objects::SmartObject display_capabilities_so; Json::Value display_capabilities = ui.get("displayCapabilities", ""); - Formatters::CFormatterJsonBase::jsonValueToObj(display_capabilities, + formatters::CFormatterJsonBase::jsonValueToObj(display_capabilities, display_capabilities_so); if (display_capabilities_so.keyExists(hmi_response::display_type)) { @@ -1071,7 +1083,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { Json::Value soft_button_capabilities = ui.get("softButtonCapabilities", ""); smart_objects::SmartObject soft_button_capabilities_so; - Formatters::CFormatterJsonBase::jsonValueToObj( + formatters::CFormatterJsonBase::jsonValueToObj( soft_button_capabilities, soft_button_capabilities_so); set_soft_button_capabilities(soft_button_capabilities_so); } @@ -1082,7 +1094,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { Json::Value navigation_capability = system_capabilities.get("navigationCapability", ""); smart_objects::SmartObject navigation_capability_so; - Formatters::CFormatterJsonBase::jsonValueToObj( + formatters::CFormatterJsonBase::jsonValueToObj( navigation_capability, navigation_capability_so); set_navigation_capability(navigation_capability_so); if (!navigation_capability_so.empty()) { @@ -1094,7 +1106,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { Json::Value phone_capability = system_capabilities.get("phoneCapability", ""); smart_objects::SmartObject phone_capability_so; - Formatters::CFormatterJsonBase::jsonValueToObj(phone_capability, + formatters::CFormatterJsonBase::jsonValueToObj(phone_capability, phone_capability_so); set_phone_capability(phone_capability_so); if (!phone_capability_so.empty()) { @@ -1106,7 +1118,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { Json::Value vs_capability = system_capabilities.get("videoStreamingCapability", ""); smart_objects::SmartObject vs_capability_so; - Formatters::CFormatterJsonBase::jsonValueToObj(vs_capability, + formatters::CFormatterJsonBase::jsonValueToObj(vs_capability, vs_capability_so); if (vs_capability_so.keyExists("supportedFormats")) { @@ -1156,7 +1168,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { Json::Value rc_capability = system_capabilities.get("remoteControlCapability", ""); smart_objects::SmartObject rc_capability_so; - Formatters::CFormatterJsonBase::jsonValueToObj(rc_capability, + formatters::CFormatterJsonBase::jsonValueToObj(rc_capability, rc_capability_so); set_rc_capability(rc_capability_so); if (!rc_capability_so.empty()) { @@ -1235,7 +1247,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { if (check_existing_json_member(buttons, "capabilities")) { Json::Value bt_capabilities = buttons.get("capabilities", ""); smart_objects::SmartObject buttons_capabilities_so; - Formatters::CFormatterJsonBase::jsonValueToObj(bt_capabilities, + formatters::CFormatterJsonBase::jsonValueToObj(bt_capabilities, buttons_capabilities_so); for (uint32_t i = 0; i < buttons_capabilities_so.length(); ++i) { @@ -1255,7 +1267,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { if (check_existing_json_member(buttons, "presetBankCapabilities")) { Json::Value presetBank = buttons.get("presetBankCapabilities", ""); smart_objects::SmartObject preset_bank_so; - Formatters::CFormatterJsonBase::jsonValueToObj(presetBank, + formatters::CFormatterJsonBase::jsonValueToObj(presetBank, preset_bank_so); set_preset_bank_capabilities(preset_bank_so); } @@ -1265,7 +1277,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() { if (check_existing_json_member(root_json, "VehicleInfo")) { Json::Value vehicle_info = root_json.get("VehicleInfo", ""); smart_objects::SmartObject vehicle_type_so; - Formatters::CFormatterJsonBase::jsonValueToObj(vehicle_info, + formatters::CFormatterJsonBase::jsonValueToObj(vehicle_info, vehicle_type_so); set_vehicle_type(vehicle_type_so); } // VehicleType end diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc deleted file mode 100644 index a7f3ce7e6b..0000000000 --- a/src/components/application_manager/src/hmi_command_factory.cc +++ /dev/null @@ -1,2317 +0,0 @@ -/* - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Copyright (c) 2017 Xevo Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the copyright holders nor the names of their contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/hmi_command_factory.h" - -#include "application_manager/message.h" -#include "interfaces/HMI_API.h" - -#include "application_manager/commands/hmi/update_device_list_request.h" -#include "application_manager/commands/hmi/update_device_list_response.h" -#include "application_manager/commands/hmi/on_update_device_list.h" -#include "application_manager/commands/hmi/on_start_device_discovery.h" -#include "application_manager/commands/hmi/update_app_list_request.h" -#include "application_manager/commands/hmi/update_app_list_response.h" -#include "application_manager/commands/hmi/on_find_applications.h" -#include "application_manager/commands/hmi/allow_all_apps_request.h" -#include "application_manager/commands/hmi/allow_all_apps_response.h" -#include "application_manager/commands/hmi/allow_app_request.h" -#include "application_manager/commands/hmi/allow_app_response.h" -#include "application_manager/commands/hmi/sdl_get_list_of_permissions_request.h" -#include "application_manager/commands/hmi/sdl_get_list_of_permissions_response.h" -#include "application_manager/commands/hmi/sdl_get_user_friendly_message_request.h" -#include "application_manager/commands/hmi/sdl_get_user_friendly_message_response.h" -#include "application_manager/commands/hmi/sdl_get_status_update_request.h" -#include "application_manager/commands/hmi/sdl_get_status_update_response.h" -#include "application_manager/commands/hmi/on_status_update_notification.h" -#include "application_manager/commands/hmi/update_sdl_request.h" -#include "application_manager/commands/hmi/update_sdl_response.h" -#include "application_manager/commands/hmi/activate_app_request.h" -#include "application_manager/commands/hmi/activate_app_response.h" -#include "application_manager/commands/hmi/mixing_audio_supported_request.h" -#include "application_manager/commands/hmi/mixing_audio_supported_response.h" -#include "application_manager/commands/hmi/on_allow_sdl_functionality_notification.h" -#include "application_manager/commands/hmi/on_app_permission_changed_notification.h" -#include "application_manager/commands/hmi/on_app_permission_consent_notification.h" -#include "application_manager/commands/hmi/on_app_activated_notification.h" -#include "application_manager/commands/hmi/on_audio_data_streaming_notification.h" -#include "application_manager/commands/hmi/on_video_data_streaming_notification.h" -#include "application_manager/commands/hmi/on_sdl_consent_needed_notification.h" -#include "application_manager/commands/hmi/on_exit_all_applications_notification.h" -#include "application_manager/commands/hmi/on_exit_application_notification.h" -#include "application_manager/commands/hmi/on_put_file_notification.h" -#include "application_manager/commands/hmi/on_resume_audio_source_notification.h" -#include "application_manager/commands/hmi/on_ignition_cycle_over_notification.h" -#include "application_manager/commands/hmi/on_system_info_changed_notification.h" -#include "application_manager/commands/hmi/get_system_info_request.h" -#include "application_manager/commands/hmi/get_system_info_response.h" -#include "application_manager/commands/hmi/close_popup_request.h" -#include "application_manager/commands/hmi/close_popup_response.h" -#include "application_manager/commands/hmi/button_get_capabilities_request.h" -#include "application_manager/commands/hmi/button_get_capabilities_response.h" -#include "application_manager/commands/hmi/ui_add_command_request.h" -#include "application_manager/commands/hmi/ui_add_command_response.h" -#include "application_manager/commands/hmi/ui_delete_command_request.h" -#include "application_manager/commands/hmi/ui_delete_command_response.h" -#include "application_manager/commands/hmi/ui_add_submenu_request.h" -#include "application_manager/commands/hmi/ui_add_submenu_response.h" -#include "application_manager/commands/hmi/ui_delete_submenu_request.h" -#include "application_manager/commands/hmi/ui_delete_submenu_response.h" -#include "application_manager/commands/hmi/ui_get_supported_languages_request.h" -#include "application_manager/commands/hmi/ui_get_supported_languages_response.h" -#include "application_manager/commands/hmi/ui_get_language_request.h" -#include "application_manager/commands/hmi/ui_get_language_response.h" -#include "application_manager/commands/hmi/ui_get_capabilities_request.h" -#include "application_manager/commands/hmi/ui_get_capabilities_response.h" -#include "application_manager/commands/hmi/ui_change_registration_request.h" -#include "application_manager/commands/hmi/ui_change_registration_response.h" -#include "application_manager/commands/hmi/ui_show_request.h" -#include "application_manager/commands/hmi/ui_show_response.h" -#include "application_manager/commands/hmi/ui_alert_request.h" -#include "application_manager/commands/hmi/ui_alert_response.h" -#include "application_manager/commands/hmi/ui_is_ready_request.h" -#include "application_manager/commands/hmi/ui_is_ready_response.h" -#include "application_manager/commands/hmi/ui_slider_request.h" -#include "application_manager/commands/hmi/ui_slider_response.h" -#include "application_manager/commands/hmi/ui_set_media_clock_timer_request.h" -#include "application_manager/commands/hmi/ui_set_media_clock_timer_response.h" -#include "application_manager/commands/hmi/ui_set_global_properties_request.h" -#include "application_manager/commands/hmi/ui_set_global_properties_response.h" -#include "application_manager/commands/hmi/ui_scrollable_message_request.h" -#include "application_manager/commands/hmi/ui_scrollable_message_response.h" -#include "application_manager/commands/hmi/ui_set_app_icon_request.h" -#include "application_manager/commands/hmi/ui_set_app_icon_response.h" -#include "application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h" -#include "application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h" -#include "application_manager/commands/hmi/ui_end_audio_pass_thru_response.h" -#include "application_manager/commands/hmi/ui_end_audio_pass_thru_request.h" -#include "application_manager/commands/hmi/ui_perform_interaction_request.h" -#include "application_manager/commands/hmi/ui_perform_interaction_response.h" -#include "application_manager/commands/hmi/vr_is_ready_request.h" -#include "application_manager/commands/hmi/vr_is_ready_response.h" -#include "application_manager/commands/hmi/vr_add_command_request.h" -#include "application_manager/commands/hmi/vr_add_command_response.h" -#include "application_manager/commands/hmi/vr_delete_command_request.h" -#include "application_manager/commands/hmi/vr_delete_command_response.h" -#include "application_manager/commands/hmi/vr_change_registration_request.h" -#include "application_manager/commands/hmi/vr_change_registration_response.h" -#include "application_manager/commands/hmi/vr_get_supported_languages_request.h" -#include "application_manager/commands/hmi/vr_get_supported_languages_response.h" -#include "application_manager/commands/hmi/vr_get_language_request.h" -#include "application_manager/commands/hmi/vr_get_language_response.h" -#include "application_manager/commands/hmi/vr_get_capabilities_request.h" -#include "application_manager/commands/hmi/vr_get_capabilities_response.h" -#include "application_manager/commands/hmi/tts_is_ready_request.h" -#include "application_manager/commands/hmi/tts_is_ready_response.h" -#include "application_manager/commands/hmi/tts_change_registration_request.h" -#include "application_manager/commands/hmi/tts_change_registration_response.h" -#include "application_manager/commands/hmi/tts_get_supported_languages_request.h" -#include "application_manager/commands/hmi/tts_get_supported_languages_response.h" -#include "application_manager/commands/hmi/tts_get_language_request.h" -#include "application_manager/commands/hmi/tts_get_language_response.h" -#include "application_manager/commands/hmi/tts_stop_speaking_request.h" -#include "application_manager/commands/hmi/tts_stop_speaking_response.h" -#include "application_manager/commands/hmi/tts_speak_request.h" -#include "application_manager/commands/hmi/tts_speak_response.h" -#include "application_manager/commands/hmi/tts_set_global_properties_request.h" -#include "application_manager/commands/hmi/tts_set_global_properties_response.h" -#include "application_manager/commands/hmi/tts_get_capabilities_request.h" -#include "application_manager/commands/hmi/tts_get_capabilities_response.h" -#include "application_manager/commands/hmi/vr_perform_interaction_request.h" -#include "application_manager/commands/hmi/vr_perform_interaction_response.h" -#include "application_manager/commands/hmi/vi_is_ready_request.h" -#include "application_manager/commands/hmi/vi_is_ready_response.h" -#include "application_manager/commands/hmi/vi_read_did_request.h" -#include "application_manager/commands/hmi/vi_read_did_response.h" -#include "application_manager/commands/hmi/sdl_activate_app_request.h" -#include "application_manager/commands/hmi/sdl_activate_app_response.h" -#include "application_manager/commands/hmi/on_app_permission_changed_notification.h" -#include "application_manager/commands/hmi/on_event_changed_notification.h" - -#ifdef EXTERNAL_PROPRIETARY_MODE -#include "application_manager/commands/hmi/decrypt_certificate_request.h" -#include "application_manager/commands/hmi/decrypt_certificate_response.h" -#endif // EXTERNAL_PROPRIETARY_MODE - -#ifdef HMI_DBUS_API -#include "application_manager/commands/hmi/vi_get_vehicle_data_request_template.h" -#include "application_manager/commands/hmi/vi_get_vehicle_data_response_template.h" -#include "application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h" -#include "application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h" -#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h" -#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h" -#include "application_manager/commands/hmi/on_vi_gps_data_notification.h" -#include "application_manager/commands/hmi/on_vi_speed_notification.h" -#include "application_manager/commands/hmi/on_vi_rpm_notification.h" -#include "application_manager/commands/hmi/on_vi_fuel_level_notification.h" -#include "application_manager/commands/hmi/on_vi_fuel_level_state_notification.h" -#include "application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h" -#include "application_manager/commands/hmi/on_vi_external_temperature_notification.h" -#include "application_manager/commands/hmi/on_vi_vin_notification.h" -#include "application_manager/commands/hmi/on_vi_prndl_notification.h" -#include "application_manager/commands/hmi/on_vi_tire_pressure_notification.h" -#include "application_manager/commands/hmi/on_vi_odometer_notification.h" -#include "application_manager/commands/hmi/on_vi_belt_status_notification.h" -#include "application_manager/commands/hmi/on_vi_body_information_notification.h" -#include "application_manager/commands/hmi/on_vi_device_status_notification.h" -#include "application_manager/commands/hmi/on_vi_driver_braking_notification.h" -#include "application_manager/commands/hmi/on_vi_wiper_status_notification.h" -#include "application_manager/commands/hmi/on_vi_head_lamp_status_notification.h" -#include "application_manager/commands/hmi/on_vi_engine_torque_notification.h" -#include "application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h" -#include "application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h" -#include "application_manager/commands/hmi/on_vi_my_key_notification.h" -#else -#include "application_manager/commands/hmi/vi_get_vehicle_data_request.h" -#include "application_manager/commands/hmi/vi_get_vehicle_data_response.h" -#include "application_manager/commands/hmi/on_vi_vehicle_data_notification.h" -#include "application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h" -#include "application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h" -#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h" -#include "application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h" -#endif // #ifdef HMI_DBUS_API - -#include "application_manager/commands/hmi/vi_get_dtcs_request.h" -#include "application_manager/commands/hmi/vi_get_dtcs_response.h" -#include "application_manager/commands/hmi/vi_diagnostic_message_request.h" -#include "application_manager/commands/hmi/vi_diagnostic_message_response.h" -#include "application_manager/commands/hmi/vi_get_vehicle_type_request.h" -#include "application_manager/commands/hmi/vi_get_vehicle_type_response.h" -#include "application_manager/commands/hmi/navi_is_ready_request.h" -#include "application_manager/commands/hmi/navi_show_constant_tbt_request.h" -#include "application_manager/commands/hmi/navi_show_constant_tbt_response.h" -#include "application_manager/commands/hmi/navi_is_ready_response.h" -#include "application_manager/commands/hmi/navi_alert_maneuver_request.h" -#include "application_manager/commands/hmi/navi_alert_maneuver_response.h" -#include "application_manager/commands/hmi/navi_update_turn_list_request.h" -#include "application_manager/commands/hmi/navi_update_turn_list_response.h" -#include "application_manager/commands/hmi/navi_subscribe_way_points_request.h" -#include "application_manager/commands/hmi/navi_subscribe_way_points_response.h" -#include "application_manager/commands/hmi/navi_unsubscribe_way_points_request.h" -#include "application_manager/commands/hmi/navi_unsubscribe_way_points_response.h" -#include "application_manager/commands/hmi/navi_get_way_points_request.h" -#include "application_manager/commands/hmi/navi_get_way_points_response.h" -#include "application_manager/commands/hmi/on_ready_notification.h" -#include "application_manager/commands/hmi/on_device_chosen_notification.h" -#include "application_manager/commands/hmi/on_file_removed_notification.h" -#include "application_manager/commands/hmi/on_system_context_notification.h" -#include "application_manager/commands/hmi/on_app_registered_notification.h" -#include "application_manager/commands/hmi/on_app_unregistered_notification.h" -#include "application_manager/commands/hmi/on_driver_distraction_notification.h" -#include "application_manager/commands/hmi/on_tts_started_notification.h" -#include "application_manager/commands/hmi/on_tts_stopped_notification.h" -#include "application_manager/commands/hmi/on_vr_started_notification.h" -#include "application_manager/commands/hmi/on_vr_stopped_notification.h" -#include "application_manager/commands/hmi/on_vr_command_notification.h" -#include "application_manager/commands/hmi/on_ui_command_notification.h" -#include "application_manager/commands/hmi/on_app_deactivated_notification.h" -#include "application_manager/commands/hmi/on_ui_language_change_notification.h" -#include "application_manager/commands/hmi/on_vr_language_change_notification.h" -#include "application_manager/commands/hmi/on_tts_language_change_notification.h" -#include "application_manager/commands/hmi/on_navi_tbt_client_state_notification.h" -#include "application_manager/commands/hmi/on_navi_way_point_change_notification.h" -#include "application_manager/commands/hmi/on_button_event_notification.h" -#include "application_manager/commands/hmi/on_button_press_notification.h" -#include "application_manager/commands/hmi/on_button_subscription_notification.h" -#include "application_manager/commands/hmi/on_vi_vehicle_data_notification.h" -#include "application_manager/commands/hmi/on_ui_keyboard_input_notification.h" -#include "application_manager/commands/hmi/on_ui_touch_event_notification.h" -#include "application_manager/commands/hmi/on_ui_reset_timeout_notification.h" -#include "application_manager/commands/hmi/navi_set_video_config_request.h" -#include "application_manager/commands/hmi/navi_set_video_config_response.h" -#include "application_manager/commands/hmi/navi_start_stream_request.h" -#include "application_manager/commands/hmi/navi_start_stream_response.h" -#include "application_manager/commands/hmi/navi_stop_stream_request.h" -#include "application_manager/commands/hmi/navi_stop_stream_response.h" -#include "application_manager/commands/hmi/navi_audio_start_stream_request.h" -#include "application_manager/commands/hmi/navi_audio_start_stream_response.h" -#include "application_manager/commands/hmi/navi_audio_stop_stream_request.h" -#include "application_manager/commands/hmi/navi_audio_stop_stream_response.h" -#include "application_manager/commands/hmi/on_system_request_notification.h" -#include "application_manager/commands/hmi/ui_set_display_layout_request.h" -#include "application_manager/commands/hmi/ui_set_display_layout_response.h" -#include "application_manager/commands/hmi/on_sdl_close_notification.h" -#include "application_manager/commands/hmi/on_sdl_persistence_complete_notification.h" -#include "application_manager/commands/hmi/on_record_start_notification.h" -#include "application_manager/commands/hmi/add_statistics_info_notification.h" -#include "application_manager/commands/hmi/on_system_error_notification.h" -#include "application_manager/commands/hmi/basic_communication_system_request.h" -#include "application_manager/commands/hmi/basic_communication_system_response.h" -#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h" -#include "application_manager/commands/hmi/sdl_policy_update.h" -#include "application_manager/commands/hmi/sdl_policy_update_response.h" -#include "application_manager/commands/hmi/on_received_policy_update.h" -#include "application_manager/commands/hmi/on_policy_update.h" -#include "application_manager/commands/hmi/get_urls.h" -#include "application_manager/commands/hmi/get_urls_response.h" -#include "application_manager/commands/hmi/on_device_state_changed_notification.h" -#include "application_manager/commands/hmi/navi_send_location_request.h" -#include "application_manager/commands/hmi/navi_send_location_response.h" -#include "application_manager/commands/hmi/on_tts_reset_timeout_notification.h" -#include "application_manager/commands/hmi/dial_number_request.h" -#include "application_manager/commands/hmi/dial_number_response.h" -#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" -#include "application_manager/commands/hmi/ui_send_haptic_data_response.h" - -#include "application_manager/commands/hmi/rc_is_ready_request.h" -#include "application_manager/commands/hmi/rc_is_ready_response.h" -#include "application_manager/commands/hmi/rc_get_capabilities_request.h" -#include "application_manager/commands/hmi/rc_get_capabilities_response.h" - -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") -namespace application_manager { - -CommandSharedPtr HMICommandFactory::CreateCommand( - const commands::MessageSharedPtr& message, - ApplicationManager& application_manager) { - const int function_id = - (*message)[strings::params][strings::function_id].asInt(); - LOG4CXX_DEBUG( - logger_, "HMICommandFactory::CreateCommand function_id: " << function_id); - - CommandSharedPtr command(new application_manager::commands::CommandImpl( - message, application_manager)); - - bool is_response = false; - const int msg_type = - (*message)[strings::params][strings::message_type].asInt(); - if (msg_type == - static_cast<int>(application_manager::MessageType::kResponse)) { - is_response = true; - LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand response"); - } else if ((*message)[strings::params][strings::message_type] == - static_cast<int>( - application_manager::MessageType::kErrorResponse)) { - is_response = true; - LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand error response"); - } else { - LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand request"); - } - - switch (function_id) { - case hmi_apis::FunctionID::BasicCommunication_OnStartDeviceDiscovery: { - command.reset( - new commands::OnStartDeviceDiscovery(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList: { - if (is_response) { - command.reset(new commands::UpdateDeviceListResponse( - message, application_manager)); - } else { - command.reset(new commands::UpdateDeviceListRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::BasicCommunication_ActivateApp: { - if (is_response) { - command.reset( - new commands::ActivateAppResponse(message, application_manager)); - } else { - command.reset( - new commands::ActivateAppRequest(message, application_manager)); - } - break; - } -#ifdef EXTERNAL_PROPRIETARY_MODE - case hmi_apis::FunctionID::BasicCommunication_DecryptCertificate: { - if (is_response) { - command.reset(new commands::DecryptCertificateResponse( - message, application_manager)); - } else { - command.reset(new commands::DecryptCertificateRequest( - message, application_manager)); - } - break; - } -#endif // EXTERNAL_PROPRIETARY_MODE - case hmi_apis::FunctionID::BasicCommunication_GetSystemInfo: { - if (is_response) { - command.reset( - new commands::GetSystemInfoResponse(message, application_manager)); - } else { - command.reset( - new commands::GetSystemInfoRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_ActivateApp: { - if (is_response) { - command.reset( - new commands::SDLActivateAppResponse(message, application_manager)); - } else { - command.reset( - new commands::SDLActivateAppRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::BasicCommunication_PolicyUpdate: { - if (is_response) { - command.reset(new commands::SDLPolicyUpdateResponse( - message, application_manager)); - } else { - command.reset( - new commands::SDLPolicyUpdate(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_GetURLS: { - if (is_response) { - command.reset( - new commands::GetUrlsResponse(message, application_manager)); - } else { - command.reset(new commands::GetUrls(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_OnAppPermissionChanged: { - command.reset(new commands::OnAppPermissionChangedNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_GetListOfPermissions: { - if (is_response) { - command.reset(new commands::SDLGetListOfPermissionsResponse( - message, application_manager)); - } else { - command.reset(new commands::SDLGetListOfPermissionsRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_GetUserFriendlyMessage: { - if (is_response) { - command.reset(new commands::SDLGetUserFriendlyMessageResponse( - message, application_manager)); - } else { - command.reset(new commands::SDLGetUserFriendlyMessageRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_GetStatusUpdate: { - if (is_response) { - command.reset(new commands::SDLGetStatusUpdateResponse( - message, application_manager)); - } else { - command.reset(new commands::SDLGetStatusUpdateRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_OnStatusUpdate: { - command.reset(new commands::OnStatusUpdateNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_OnAppPermissionConsent: { - command.reset(new commands::OnAppPermissionConsentNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported: { - if (is_response) { - command.reset(new commands::MixingAudioSupportedResponse( - message, application_manager)); - } else { - command.reset(new commands::MixingAudioSupportedRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnExitAllApplications: { - command.reset(new commands::OnExitAllApplicationsNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_AddCommand: { - if (is_response) { - command.reset( - new commands::UIAddCommandResponse(message, application_manager)); - } else { - command.reset( - new commands::UIAddCommandRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_DeleteCommand: { - if (is_response) { - command.reset(new commands::UIDeleteCommandResponse( - message, application_manager)); - } else { - command.reset( - new commands::UIDeleteCommandRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_AddSubMenu: { - if (is_response) { - command.reset( - new commands::UIAddSubmenuResponse(message, application_manager)); - } else { - command.reset( - new commands::UIAddSubmenuRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_DeleteSubMenu: { - if (is_response) { - command.reset(new commands::UIDeleteSubmenuResponse( - message, application_manager)); - } else { - command.reset( - new commands::UIDeleteSubmenuRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_SetMediaClockTimer: { - if (is_response) { - command.reset(new commands::UISetMediaClockTimerResponse( - message, application_manager)); - } else { - command.reset(new commands::UISetMediaClockTimerRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_PerformInteraction: { - if (is_response) { - command.reset(new commands::UIPerformInteractionResponse( - message, application_manager)); - } else { - command.reset(new commands::UIPerformInteractionRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_SetGlobalProperties: { - if (is_response) { - command.reset(new commands::UISetGlobalPropertiesResponse( - message, application_manager)); - } else { - command.reset(new commands::UISetGlobalPropertiesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_ScrollableMessage: { - if (is_response) { - command.reset(new commands::UIScrollableMessageResponse( - message, application_manager)); - } else { - command.reset(new commands::UIScrollableMessageRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_SetAppIcon: { - if (is_response) { - command.reset( - new commands::UISetAppIconResponse(message, application_manager)); - } else { - command.reset( - new commands::UISetAppIconRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_GetSupportedLanguages: { - if (is_response) { - command.reset(new commands::UIGetSupportedLanguagesResponse( - message, application_manager)); - } else { - command.reset(new commands::UIGetSupportedLanguagesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_GetLanguage: { - if (is_response) { - command.reset( - new commands::UIGetLanguageResponse(message, application_manager)); - } else { - command.reset( - new commands::UIGetLanguageRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_GetCapabilities: { - if (is_response) { - command.reset(new commands::UIGetCapabilitiesResponse( - message, application_manager)); - } else { - command.reset(new commands::UIGetCapabilitiesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_ChangeRegistration: { - if (is_response) { - command.reset(new commands::UIChangeRegistratioResponse( - message, application_manager)); - } else { - command.reset(new commands::UIChangeRegistrationRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_PerformAudioPassThru: { - if (is_response) { - command.reset(new commands::UIPerformAudioPassThruResponse( - message, application_manager)); - } else { - command.reset(new commands::UIPerformAudioPassThruRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_EndAudioPassThru: { - if (is_response) { - command.reset(new commands::UIEndAudioPassThruResponse( - message, application_manager)); - } else { - command.reset(new commands::UIEndAudioPassThruRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_Alert: { - if (is_response) { - command.reset( - new commands::UIAlertResponse(message, application_manager)); - } else { - command.reset( - new commands::UIAlertRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_IsReady: { - if (is_response) { - command.reset( - new commands::VRIsReadyResponse(message, application_manager)); - } else { - command.reset( - new commands::VRIsReadyRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_AddCommand: { - if (is_response) { - command.reset( - new commands::VRAddCommandResponse(message, application_manager)); - } else { - command.reset( - new commands::VRAddCommandRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_DeleteCommand: { - if (is_response) { - command.reset(new commands::VRDeleteCommandResponse( - message, application_manager)); - } else { - command.reset( - new commands::VRDeleteCommandRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_ChangeRegistration: { - if (is_response) { - command.reset(new commands::VRChangeRegistrationResponse( - message, application_manager)); - } else { - command.reset(new commands::VRChangeRegistrationRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_GetSupportedLanguages: { - if (is_response) { - command.reset(new commands::VRGetSupportedLanguagesResponse( - message, application_manager)); - } else { - command.reset(new commands::VRGetSupportedLanguagesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_GetLanguage: { - if (is_response) { - command.reset( - new commands::VRGetLanguageResponse(message, application_manager)); - } else { - command.reset( - new commands::VRGetLanguageRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_GetCapabilities: { - if (is_response) { - command.reset(new commands::VRGetCapabilitiesResponse( - message, application_manager)); - } else { - command.reset(new commands::VRGetCapabilitiesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_IsReady: { - if (is_response) { - command.reset( - new commands::TTSIsReadyResponse(message, application_manager)); - } else { - command.reset( - new commands::TTSIsReadyRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_ChangeRegistration: { - if (is_response) { - command.reset(new commands::TTSChangeRegistratioResponse( - message, application_manager)); - } else { - command.reset(new commands::TTSChangeRegistrationRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_GetSupportedLanguages: { - if (is_response) { - command.reset(new commands::TTSGetSupportedLanguagesResponse( - message, application_manager)); - } else { - command.reset(new commands::TTSGetSupportedLanguagesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_StopSpeaking: { - if (is_response) { - command.reset(new commands::TTSStopSpeakingResponse( - message, application_manager)); - } else { - command.reset( - new commands::TTSStopSpeakingRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_GetLanguage: { - if (is_response) { - command.reset( - new commands::TTSGetLanguageResponse(message, application_manager)); - } else { - command.reset( - new commands::TTSGetLanguageRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_Speak: { - if (is_response) { - command.reset( - new commands::TTSSpeakResponse(message, application_manager)); - } else { - command.reset( - new commands::TTSSpeakRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - if (is_response) { - command.reset(new commands::TTSSetGlobalPropertiesResponse( - message, application_manager)); - } else { - command.reset(new commands::TTSSetGlobalPropertiesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_GetCapabilities: { - if (is_response) { - command.reset(new commands::TTSGetCapabilitiesResponse( - message, application_manager)); - } else { - command.reset(new commands::TTSGetCapabilitiesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::TTS_Started: { - command.reset( - new commands::OnTTSStartedNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::TTS_Stopped: { - command.reset( - new commands::OnTTSStoppedNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnAppActivated: { - command.reset(new commands::OnAppActivatedNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnAwakeSDL: { - command.reset( - new commands::OnAwakeSDLNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnExitApplication: { - command.reset(new commands::OnExitApplicationNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_Show: { - if (is_response) { - command.reset( - new commands::UIShowResponse(message, application_manager)); - } else { - command.reset( - new commands::UIShowRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_Slider: { - if (is_response) { - command.reset( - new commands::UISliderResponse(message, application_manager)); - } else { - command.reset( - new commands::UISliderRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_ClosePopUp: { - if (is_response) { - command.reset( - new commands::ClosePopupResponse(message, application_manager)); - } else { - command.reset( - new commands::ClosePopupRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_IsReady: { - if (is_response) { - command.reset( - new commands::UIIsReadyResponse(message, application_manager)); - } else { - command.reset( - new commands::UIIsReadyRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VehicleInfo_IsReady: { - if (is_response) { - command.reset( - new commands::VIIsReadyResponse(message, application_manager)); - } else { - command.reset( - new commands::VIIsReadyRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VehicleInfo_ReadDID: { - if (is_response) { - command.reset( - new commands::VIReadDIDResponse(message, application_manager)); - } else { - command.reset( - new commands::VIReadDIDRequest(message, application_manager)); - } - break; - } -#ifdef HMI_DBUS_API - case hmi_apis::FunctionID::VehicleInfo_GetGpsData: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetGpsData>(message, - application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetGpsData>(message, - application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetSpeed: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSpeed>(message, - application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSpeed>(message, - application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetRpm: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetRpm>(message, - application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetRpm>(message, - application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetFuelLevel: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevel>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevel>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetPrndl: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetPrndl>(message, - application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetPrndl>(message, - application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetVin: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetVin>(message, - application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetVin>(message, - application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetTirePressure: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetTirePressure>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetTirePressure>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetOdometer: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetOdometer>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetOdometer>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetBeltStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBeltStatus>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBeltStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetBodyInformation: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBodyInformation>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetBodyInformation>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetDriverBraking: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDriverBraking>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetDriverBraking>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetWiperStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetWiperStatus>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetWiperStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetEngineTorque: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEngineTorque>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEngineTorque>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetECallInfo: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetECallInfo>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetECallInfo>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus>( - message, application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetMyKey: { - if (is_response) - command.reset(new commands::VIGetVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_GetMyKey>(message, - application_manager)); - else - command.reset(new commands::VIGetVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_GetMyKey>(message, - application_manager)); - break; - } -#else - case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: { - if (is_response) { - command.reset(new commands::VIGetVehicleDataResponse( - message, application_manager)); - } else { - command.reset(new commands::VIGetVehicleDataRequest( - message, application_manager)); - } - break; - } -#endif // #ifdef HMI_DBUS_API - case hmi_apis::FunctionID::VehicleInfo_GetDTCs: { - if (is_response) { - command.reset( - new commands::VIGetDTCsResponse(message, application_manager)); - } else { - command.reset( - new commands::VIGetDTCsRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage: { - if (is_response) { - command.reset(new commands::VIDiagnosticMessageResponse( - message, application_manager)); - } else { - command.reset(new commands::VIDiagnosticMessageRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VehicleInfo_GetVehicleType: { - if (is_response) { - command.reset(new commands::VIGetVehicleTypeResponse( - message, application_manager)); - } else { - command.reset(new commands::VIGetVehicleTypeRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_IsReady: { - if (is_response) { - command.reset( - new commands::NaviIsReadyResponse(message, application_manager)); - } else { - command.reset( - new commands::NaviIsReadyRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_AlertManeuver: { - if (is_response) { - command.reset(new commands::NaviAlertManeuverResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviAlertManeuverRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_GetWayPoints: { - if (is_response) { - command.reset(new commands::NaviGetWayPointsResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviGetWayPointsRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_UpdateTurnList: { - if (is_response) { - command.reset(new commands::NaviUpdateTurnListResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviUpdateTurnListRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_ShowConstantTBT: { - if (is_response) { - command.reset(new commands::NaviShowConstantTBTResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviShowConstantTBTRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: { - if (is_response) { - command.reset(new commands::NaviSubscribeWayPointsResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviSubscribeWayPointsRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { - if (is_response) { - command.reset(new commands::NaviUnsubscribeWayPointsResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviUnSubscribeWayPointsRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Buttons_GetCapabilities: { - if (is_response) { - command.reset(new commands::ButtonGetCapabilitiesResponse( - message, application_manager)); - } else { - command.reset(new commands::ButtonGetCapabilitiesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_OnAllowSDLFunctionality: { - command.reset(new commands::OnAllowSDLFunctionalityNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_OnSDLConsentNeeded: { - command.reset(new commands::OnSDLConsentNeededNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_UpdateSDL: { - if (is_response) { - command.reset( - new commands::UpdateSDLResponse(message, application_manager)); - } else { - command.reset( - new commands::UpdateSDLRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnIgnitionCycleOver: { - command.reset(new commands::OnIgnitionCycleOverNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnSystemInfoChanged: { - command.reset(new commands::OnSystemInfoChangedNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnReady: { - command.reset( - new commands::OnReadyNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnDeviceChosen: { - command.reset(new commands::OnDeviceChosenNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnSystemContext: { - command.reset(new commands::OnSystemContextNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnDriverDistraction: { - command.reset(new commands::hmi::OnDriverDistractionNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnUpdateDeviceList: { - command.reset( - new commands::OnUpdateDeviceList(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered: { - command.reset(new commands::OnAppRegisteredNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered: { - command.reset(new commands::OnAppUnregisteredNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnFindApplications: { - command.reset( - new commands::OnFindApplications(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_UpdateAppList: { - if (is_response) { - command.reset( - new commands::UpdateAppListResponse(message, application_manager)); - } else { - command.reset( - new commands::UpdateAppListRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::VR_Started: { - command.reset( - new commands::OnVRStartedNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VR_Stopped: { - command.reset( - new commands::OnVRStoppedNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VR_OnCommand: { - command.reset( - new commands::OnVRCommandNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnCommand: { - command.reset( - new commands::OnUICommandNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated: { - command.reset(new commands::OnAppDeactivatedNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnLanguageChange: { - command.reset(new commands::OnUILanguageChangeNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VR_OnLanguageChange: { - command.reset(new commands::OnVRLanguageChangeNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::TTS_OnLanguageChange: { - command.reset(new commands::OnTTSLanguageChangeNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::Buttons_OnButtonEvent: { - command.reset(new commands::hmi::OnButtonEventNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::Buttons_OnButtonPress: { - command.reset(new commands::hmi::OnButtonPressNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::Buttons_OnButtonSubscription: { - command.reset(new commands::hmi::OnButtonSubscriptionNotification( - message, application_manager)); - break; - } -#ifdef HMI_DBUS_API - case hmi_apis::FunctionID::VehicleInfo_SubscribeGps: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeGps>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeGps>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeRpm: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeRpm>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeRpm>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribePrndl: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribePrndl>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribePrndl>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeVin: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeVin>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeVin>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey: { - if (is_response) - command.reset(new commands::VISubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey>( - message, application_manager)); - else - command.reset(new commands::VISubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey>( - message, application_manager)); - break; - } -#else - case hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData: { - if (is_response) { - command.reset(new commands::VISubscribeVehicleDataResponse( - message, application_manager)); - } else { - command.reset(new commands::VISubscribeVehicleDataRequest( - message, application_manager)); - } - break; - } -#endif // #ifdef HMI_DBUS_API -#ifdef HMI_DBUS_API - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID:: - VehicleInfo_UnsubscribeInstantFuelConsumption>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID:: - VehicleInfo_UnsubscribeInstantFuelConsumption>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus>( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey: { - if (is_response) - command.reset(new commands::VIUnsubscribeVehicleDataResponseTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>( - message, application_manager)); - else - command.reset(new commands::VIUnsubscribeVehicleDataRequestTemplate< - hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>( - message, application_manager)); - break; - } -#else - case hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData: { - if (is_response) { - command.reset(new commands::VIUnsubscribeVehicleDataResponse( - message, application_manager)); - } else { - command.reset(new commands::VIUnsubscribeVehicleDataRequest( - message, application_manager)); - } - break; - } -#endif // #ifdef HMI_DBUS_API -#ifdef HMI_DBUS_API - case hmi_apis::FunctionID::VehicleInfo_OnGpsData: { - command.reset( - new commands::OnVIGpsDataNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnSpeed: { - command.reset( - new commands::OnVISpeedNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnRpm: { - command.reset( - new commands::OnVIRpmNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnFuelLevel: { - command.reset(new commands::OnVIFuelLevelNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnFuelLevelState: { - command.reset(new commands::OnVIFuelLevelStateNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnInstantFuelConsumption: { - command.reset(new commands::OnVIInstantFuelConsumptionNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnExternalTemperature: { - command.reset(new commands::OnVIExternalTemperatureNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnVin: { - command.reset( - new commands::OnVIVinNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnPrndl: { - command.reset( - new commands::OnVIPrndlNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnTirePressure: { - command.reset(new commands::OnVITirePressureNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnOdometer: { - command.reset( - new commands::OnVIOdometerNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnBeltStatus: { - command.reset(new commands::OnVIBeltStatusNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnBodyInformation: { - command.reset(new commands::OnVIBodyInformationNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnDeviceStatus: { - command.reset(new commands::OnVIDeviceStatusNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnDriverBraking: { - command.reset(new commands::OnVIDriverBrakingNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnWiperStatus: { - command.reset(new commands::OnVIWiperStatusNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnHeadLampStatus: { - command.reset(new commands::OnVIHeadLampStatusNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnEngineTorque: { - command.reset(new commands::OnVIEngineTorqueNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnAccPedalPosition: { - command.reset(new commands::OnVIAccPedalPositionNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnSteeringWheelAngle: { - command.reset(new commands::OnVISteeringWheelAngleNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VehicleInfo_OnMyKey: { - command.reset( - new commands::OnVIMyKeyNotification(message, application_manager)); - break; - } -#else - case hmi_apis::FunctionID::VehicleInfo_OnVehicleData: { - command.reset(new commands::OnVIVehicleDataNotification( - message, application_manager)); - break; - } -#endif // #ifdef HMI_DBUS_API - case hmi_apis::FunctionID::Navigation_OnTBTClientState: { - command.reset(new commands::OnNaviTBTClientStateNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnKeyboardInput: { - command.reset(new commands::hmi::OnUIKeyBoardInputNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnTouchEvent: { - command.reset(new commands::hmi::OnUITouchEventNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnResetTimeout: { - command.reset(new commands::hmi::OnUIResetTimeoutNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::Navigation_SetVideoConfig: { - if (is_response) { - command.reset(new commands::NaviSetVideoConfigResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviSetVideoConfigRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_StartStream: { - if (is_response) { - command.reset(new commands::NaviStartStreamResponse( - message, application_manager)); - } else { - command.reset( - new commands::NaviStartStreamRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_StopStream: { - if (is_response) { - command.reset( - new commands::NaviStopStreamResponse(message, application_manager)); - } else { - command.reset( - new commands::NaviStopStreamRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_StartAudioStream: { - if (is_response) { - command.reset(new commands::AudioStartStreamResponse( - message, application_manager)); - } else { - command.reset(new commands::AudioStartStreamRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_StopAudioStream: { - if (is_response) { - command.reset(new commands::AudioStopStreamResponse( - message, application_manager)); - } else { - command.reset( - new commands::AudioStopStreamRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_OnAudioDataStreaming: { - command.reset(new commands::OnAudioDataStreamingNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::Navigation_OnVideoDataStreaming: { - command.reset(new commands::OnVideoDataStreamingNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::VR_PerformInteraction: { - if (is_response) { - command.reset(new commands::VRPerformInteractionResponse( - message, application_manager)); - } else { - command.reset(new commands::VRPerformInteractionRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnSystemRequest: { - command.reset(new commands::OnSystemRequestNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnPutFile: { - command.reset( - new commands::OnPutFileNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource: { - command.reset(new commands::OnResumeAudioSourceNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_SetDisplayLayout: { - if (is_response) { - command.reset(new commands::UiSetDisplayLayoutResponse( - message, application_manager)); - } else { - command.reset(new commands::UiSetDisplayLayoutRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnSDLClose: { - command.reset( - new commands::OnSDLCloseNotification(message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete: { - command.reset(new commands::OnSDLPersistenceCompleteNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnFileRemoved: { - command.reset(new commands::OnFileRemovedNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::UI_OnRecordStart: { - command.reset(new commands::OnRecordStartdNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_SystemRequest: { - if (is_response) { - command.reset(new commands::BasicCommunicationSystemResponse( - message, application_manager)); - } else { - command.reset(new commands::BasicCommunicationSystemRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_SendLocation: { - if (is_response) { - command.reset(new commands::NaviSendLocationResponse( - message, application_manager)); - } else { - command.reset(new commands::NaviSendLocationRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::SDL_AddStatisticsInfo: { - command.reset(new commands::AddStatisticsInfoNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_OnSystemError: { - command.reset(new commands::OnSystemErrorNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_OnReceivedPolicyUpdate: { - command.reset( - new commands::OnReceivedPolicyUpdate(message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_OnPolicyUpdate: { - command.reset(new commands::OnPolicyUpdate(message, application_manager)); - break; - } - case hmi_apis::FunctionID::SDL_OnDeviceStateChanged: { - command.reset(new commands::OnDeviceStateChangedNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - command.reset(new commands::hmi::OnTTSResetTimeoutNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_OnEventChanged: { - command.reset(new commands::OnEventChangedNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::BasicCommunication_DialNumber: { - if (is_response) { - command.reset(new commands::hmi::DialNumberResponse( - message, application_manager)); - } else { - command.reset( - new commands::hmi::DialNumberRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::Navigation_OnWayPointChange: { - command.reset(new commands::OnNaviWayPointChangeNotification( - message, application_manager)); - break; - } - case hmi_apis::FunctionID::RC_IsReady: { - if (is_response) { - command.reset( - new commands::RCIsReadyResponse(message, application_manager)); - } else { - command.reset( - new commands::RCIsReadyRequest(message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::RC_GetCapabilities: { - if (is_response) { - command.reset(new commands::RCGetCapabilitiesResponse( - message, application_manager)); - } else { - command.reset(new commands::RCGetCapabilitiesRequest( - message, application_manager)); - } - break; - } - case hmi_apis::FunctionID::UI_SendHapticData: { - if (is_response) { - command.reset(new commands::UISendHapticDataResponse( - message, application_manager)); - } else { - command.reset(new commands::UISendHapticDataRequest( - message, application_manager)); - } - break; - } - } - return command; -} - -} // namespace application_manager diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index 4479665f64..452b5ab79d 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -61,8 +61,6 @@ generate_function_to_interface_convert_map() { HmiInterfaces::HMI_INTERFACE_BasicCommunication; convert_map[BasicCommunication_OnFileRemoved] = HmiInterfaces::HMI_INTERFACE_BasicCommunication; - convert_map[BasicCommunication_AllowDeviceToConnect] = - HmiInterfaces::HMI_INTERFACE_BasicCommunication; convert_map[BasicCommunication_OnDeviceChosen] = HmiInterfaces::HMI_INTERFACE_BasicCommunication; convert_map[BasicCommunication_OnFindApplications] = @@ -222,6 +220,13 @@ generate_function_to_interface_convert_map() { convert_map[SDL_GetURLS] = HmiInterfaces::HMI_INTERFACE_SDL; convert_map[RC_IsReady] = HmiInterfaces::HMI_INTERFACE_RC; convert_map[RC_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_RC; + convert_map[Buttons_ButtonPress] = HmiInterfaces::HMI_INTERFACE_RC; + convert_map[RC_SetInteriorVehicleData] = HmiInterfaces::HMI_INTERFACE_RC; + convert_map[RC_GetInteriorVehicleData] = HmiInterfaces::HMI_INTERFACE_RC; + convert_map[RC_GetInteriorVehicleDataConsent] = + HmiInterfaces::HMI_INTERFACE_RC; + convert_map[RC_OnInteriorVehicleData] = HmiInterfaces::HMI_INTERFACE_RC; + convert_map[RC_OnRemoteControlSettings] = HmiInterfaces::HMI_INTERFACE_RC; return convert_map; } diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index 4e5390a1b4..6e89b2419c 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -33,6 +33,7 @@ #include "application_manager/hmi_language_handler.h" #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" #include "application_manager/hmi_capabilities.h" #include "utils/helpers.h" #include "resumption/last_state.h" @@ -222,7 +223,8 @@ void HMILanguageHandler::SendOnLanguageChangeToMobile( const uint32_t connection_key) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr notification = + std::make_shared<smart_objects::SmartObject>(); DCHECK_OR_RETURN_VOID(notification); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = @@ -236,8 +238,8 @@ void HMILanguageHandler::SendOnLanguageChangeToMobile( hmi_capabilities.active_ui_language(); message[strings::msg_params][strings::language] = hmi_capabilities.active_vr_language(); - if (application_manager_.ManageMobileCommand(notification, - commands::Command::ORIGIN_SDL)) { + if (application_manager_.GetRPCService().ManageMobileCommand( + notification, commands::Command::SOURCE_SDL)) { LOG4CXX_INFO(logger_, "Mobile command sent"); } else { LOG4CXX_WARN(logger_, "Cannot send mobile command"); @@ -306,11 +308,11 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) { } } SendOnLanguageChangeToMobile(app.first); - application_manager_.ManageMobileCommand( + application_manager_.GetRPCService().ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app.first, mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE), - commands::Command::ORIGIN_SDL); + commands::Command::SOURCE_SDL); application_manager_.UnregisterApplication( app.first, mobile_apis::Result::SUCCESS, false); LOG4CXX_INFO(logger_, diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index bc1ccd8f42..aa4c979ae7 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -32,12 +32,17 @@ */ #include "application_manager/hmi_state.h" +#include <ostream> +#include <boost/assign.hpp> +#include <boost/bimap.hpp> #include "application_manager/application_manager.h" #include "utils/helpers.h" namespace application_manager { -HmiState::HmiState(utils::SharedPtr<Application> app, +CREATE_LOGGERPTR_GLOBAL(logger_, "HmiState") + +HmiState::HmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr, StateID state_id) : app_(app) @@ -45,36 +50,21 @@ HmiState::HmiState(utils::SharedPtr<Application> app, , app_mngr_(app_mngr) , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) - , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {} + , video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM) + , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { + LOG4CXX_DEBUG(logger_, *this); +} -HmiState::HmiState(utils::SharedPtr<Application> app, +HmiState::HmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : app_(app) , state_id_(STATE_ID_REGULAR) , app_mngr_(app_mngr) , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) - , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {} - -DEPRECATED HmiState::HmiState(uint32_t app_id, - const ApplicationManager& app_mngr, - StateID state_id) - : state_id_(state_id) - , app_mngr_(app_mngr) - , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) - , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) - , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { - app_ = app_mngr_.application(app_id); -} - -DEPRECATED HmiState::HmiState(uint32_t app_id, - const ApplicationManager& app_mngr) - : state_id_(STATE_ID_REGULAR) - , app_mngr_(app_mngr) - , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) - , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) + , video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM) , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { - app_ = app_mngr_.application(app_id); + LOG4CXX_DEBUG(logger_, *this); } void HmiState::set_parent(HmiStatePtr parent) { @@ -104,22 +94,14 @@ mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state() return AudioStreamingState::NOT_AUDIBLE; } -VRHmiState::VRHmiState(utils::SharedPtr<Application> app, +VRHmiState::VRHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_VR_SESSION) {} -DEPRECATED VRHmiState::VRHmiState(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_VR_SESSION) {} - -TTSHmiState::TTSHmiState(utils::SharedPtr<Application> app, +TTSHmiState::TTSHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_TTS_SESSION) {} -DEPRECATED TTSHmiState::TTSHmiState(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_TTS_SESSION) {} - mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state() const { using namespace helpers; @@ -135,13 +117,24 @@ mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state() return expected_state; } -NaviStreamingHmiState::NaviStreamingHmiState(utils::SharedPtr<Application> app, - const ApplicationManager& app_mngr) - : HmiState(app, app_mngr, STATE_ID_NAVI_STREAMING) {} +VideoStreamingHmiState::VideoStreamingHmiState( + std::shared_ptr<Application> app, const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_VIDEO_STREAMING) {} + +mobile_apis::VideoStreamingState::eType +VideoStreamingHmiState::video_streaming_state() const { + if (app_->IsVideoApplication()) { + return parent()->video_streaming_state(); + } -DEPRECATED NaviStreamingHmiState::NaviStreamingHmiState( - uint32_t app_id, const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_NAVI_STREAMING) {} + return mobile_apis::VideoStreamingState::NOT_STREAMABLE; +} + +NaviStreamingHmiState::NaviStreamingHmiState(std::shared_ptr<Application> app, + const ApplicationManager& app_mngr) + : VideoStreamingHmiState(app, app_mngr) { + set_state_id(STATE_ID_NAVI_STREAMING); +} mobile_apis::AudioStreamingState::eType NaviStreamingHmiState::audio_streaming_state() const { @@ -149,24 +142,24 @@ NaviStreamingHmiState::audio_streaming_state() const { using namespace mobile_apis; AudioStreamingState::eType expected_state = parent()->audio_streaming_state(); - if (!is_navi_app() && AudioStreamingState::AUDIBLE == expected_state) { + if (!is_navi_app() && Compare<AudioStreamingState::eType, EQ, ONE>( + expected_state, + AudioStreamingState::AUDIBLE, + AudioStreamingState::ATTENUATED)) { if (app_mngr_.is_attenuated_supported()) { expected_state = AudioStreamingState::ATTENUATED; } else { expected_state = AudioStreamingState::NOT_AUDIBLE; } } + return expected_state; } -PhoneCallHmiState::PhoneCallHmiState(utils::SharedPtr<Application> app, +PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {} -DEPRECATED PhoneCallHmiState::PhoneCallHmiState( - uint32_t app_id, const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_PHONE_CALL) {} - mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { using namespace helpers; using namespace mobile_apis; @@ -184,22 +177,14 @@ mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { return HMILevel::HMI_BACKGROUND; } -SafetyModeHmiState::SafetyModeHmiState(utils::SharedPtr<Application> app, +SafetyModeHmiState::SafetyModeHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {} -DEPRECATED SafetyModeHmiState::SafetyModeHmiState( - uint32_t app_id, const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {} - -DeactivateHMI::DeactivateHMI(utils::SharedPtr<Application> app, +DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {} -DEPRECATED DeactivateHMI::DeactivateHMI(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_DEACTIVATE_HMI) {} - mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { using namespace helpers; using namespace mobile_apis; @@ -208,42 +193,31 @@ mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { HMILevel::HMI_NONE)) { return parent()->hmi_level(); } + return HMILevel::HMI_BACKGROUND; } -AudioSource::AudioSource(utils::SharedPtr<Application> app, +AudioSource::AudioSource(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) {} -DEPRECATED AudioSource::AudioSource(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_AUDIO_SOURCE) {} - mobile_apis::HMILevel::eType AudioSource::hmi_level() const { - using namespace mobile_apis; - using namespace helpers; - // TODO(AOleynik): That NONE check is necessary to avoid issue during + // Checking for NONE is necessary to avoid issue during // calculation of HMI level during setting default HMI level - // Should be investigated (used in multiple places here), since looks weird - if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(), - HMILevel::HMI_BACKGROUND, - HMILevel::HMI_NONE)) { - return parent()->hmi_level(); + if (mobile_apis::HMILevel::HMI_NONE == parent()->hmi_level()) { + return mobile_apis::HMILevel::HMI_NONE; } - if (is_navi_app() || is_voice_communication_app()) { - return HMILevel::HMI_LIMITED; + if (mobile_apis::HMILevel::HMI_FULL == parent()->hmi_level()) { + return mobile_apis::HMILevel::HMI_FULL; } - return HMILevel::HMI_BACKGROUND; + + return mobile_apis::HMILevel::HMI_BACKGROUND; } -EmbeddedNavi::EmbeddedNavi(utils::SharedPtr<Application> app, +EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_EMBEDDED_NAVI) {} -DEPRECATED EmbeddedNavi::EmbeddedNavi(uint32_t app_id, - const ApplicationManager& app_mngr) - : HmiState(app_id, app_mngr, STATE_ID_EMBEDDED_NAVI) {} - mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const { using namespace mobile_apis; using namespace helpers; @@ -252,9 +226,46 @@ mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const { HMILevel::HMI_NONE)) { return parent()->hmi_level(); } - if (is_media_app()) { - return HMILevel::HMI_LIMITED; - } return HMILevel::HMI_BACKGROUND; } + +namespace { +typedef boost::bimap<HmiState::StateID, std::string> StateID2StrMap; +const StateID2StrMap kStateID2StrMap = + boost::assign::list_of<StateID2StrMap::relation>( + HmiState::StateID::STATE_ID_CURRENT, "CURRENT")( + HmiState::StateID::STATE_ID_REGULAR, "REGULAR")( + HmiState::StateID::STATE_ID_POSTPONED, "POSTPONED")( + HmiState::StateID::STATE_ID_PHONE_CALL, "PHONE_CALL")( + HmiState::StateID::STATE_ID_SAFETY_MODE, "SAFETY_MODE")( + HmiState::StateID::STATE_ID_VR_SESSION, "VR_SESSION")( + HmiState::StateID::STATE_ID_TTS_SESSION, "TTS_SESSION")( + HmiState::StateID::STATE_ID_VIDEO_STREAMING, "VIDEO_STREAMING")( + HmiState::StateID::STATE_ID_NAVI_STREAMING, "NAVI_STREAMING")( + HmiState::StateID::STATE_ID_DEACTIVATE_HMI, "DEACTIVATE_HMI")( + HmiState::StateID::STATE_ID_AUDIO_SOURCE, "AUDIO_SOURCE")( + HmiState::StateID::STATE_ID_EMBEDDED_NAVI, "EMBEDDED_NAVI"); +} // anonymous namespace + +std::ostream& operator<<(std::ostream& os, const HmiState::StateID src) { + try { + os << kStateID2StrMap.left.at(src); + } catch (const std::exception&) { + // specified element have NOT been found + os << "UNRECOGNIZED(" << static_cast<int>(src) << ")"; + } + + return os; } + +std::ostream& operator<<(std::ostream& os, const HmiState& src) { + os << "HMIState(app id:" << src.app_->app_id() << ", state:" << src.state_id() + << ", hmi_level:" << src.hmi_level() + << ", audio:" << src.audio_streaming_state() + << ", video:" << src.video_streaming_state() + << ", context:" << src.system_context() << ')'; + + return os; +} + +} // namespace application_manager diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc index 7bc686aef1..332d68adbf 100644 --- a/src/components/application_manager/src/message.cc +++ b/src/components/application_manager/src/message.cc @@ -130,11 +130,9 @@ int32_t Message::function_id() const { return function_id_; } -#ifdef SDL_REMOTE_CONTROL std::string Message::function_name() const { return function_name_; } -#endif // SDL_REMOTE_CONTROL int32_t Message::correlation_id() const { return correlation_id_; @@ -176,11 +174,9 @@ void Message::set_function_id(int32_t id) { function_id_ = id; } -#ifdef SDL_REMOTE_CONTROL void Message::set_function_name(const std::string& name) { function_name_ = name; } -#endif // SDL_REMOTE_CONTROL void Message::set_correlation_id(int32_t id) { correlation_id_ = id; @@ -194,19 +190,6 @@ void Message::set_message_type(MessageType type) { type_ = type; } -void Message::set_binary_data(BinaryData* data) { - if (NULL == data) { - NOTREACHED(); - return; - } - - if (binary_data_) { - delete binary_data_; - } - - binary_data_ = new BinaryData(*data); -} - void Message::set_binary_data(const BinaryData* data) { if (NULL == data) { NOTREACHED(); 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 6a908c4ebc..5bda17ecbd 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -53,6 +53,7 @@ #include "application_manager/message_helper.h" #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/resumption/resume_ctrl.h" +#include "application_manager/rpc_service.h" #include "connection_handler/connection_handler_impl.h" #include "transport_manager/common.h" #include "interfaces/MOBILE_API.h" @@ -60,7 +61,6 @@ #include "utils/file_system.h" #include "utils/macro.h" #include "utils/logger.h" -#include "utils/make_shared.h" #include "formatters/formatter_json_rpc.h" #include "formatters/CFormatterJsonSDLRPCv2.h" @@ -94,11 +94,8 @@ bool ValidateSoftButtons(smart_objects::SmartObject& soft_buttons) { // Check if image parameter is valid if (button.keyExists(strings::image)) { SmartObject& buttonImage = button[strings::image]; - - // Image name must not be empty and must not contain incorrect - // character - if (false == MessageHelper::VerifySoftButtonString( - buttonImage[strings::value].asString())) { + if (false == + MessageHelper::VerifyString(buttonImage[strings::value].asString())) { return false; } } @@ -175,8 +172,12 @@ std::pair<std::string, mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL_STATE), std::make_pair(strings::instant_fuel_consumption, mobile_apis::VehicleDataType::VEHICLEDATA_FUELCONSUMPTION), + std::make_pair(strings::fuel_range, + mobile_apis::VehicleDataType::VEHICLEDATA_FUELRANGE), std::make_pair(strings::external_temp, mobile_apis::VehicleDataType::VEHICLEDATA_EXTERNTEMP), + std::make_pair(strings::turn_signal, + mobile_apis::VehicleDataType::VEHICLEDATA_TURNSIGNAL), std::make_pair(strings::vin, mobile_apis::VehicleDataType::VEHICLEDATA_VIN), std::make_pair(strings::prndl, mobile_apis::VehicleDataType::VEHICLEDATA_PRNDL), @@ -186,6 +187,9 @@ std::pair<std::string, mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER), std::make_pair(strings::belt_status, mobile_apis::VehicleDataType::VEHICLEDATA_BELTSTATUS), + std::make_pair( + strings::electronic_park_brake_status, + mobile_apis::VehicleDataType::VEHICLEDATA_ELECTRONICPARKBRAKESTATUS), std::make_pair(strings::body_information, mobile_apis::VehicleDataType::VEHICLEDATA_BODYINFO), std::make_pair(strings::device_status, @@ -217,64 +221,51 @@ std::pair<std::string, mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL), std::make_pair(strings::steering_wheel_angle, mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL), -}; + std::make_pair(strings::engine_oil_life, + mobile_apis::VehicleDataType::VEHICLEDATA_ENGINEOILLIFE)}; const VehicleData MessageHelper::vehicle_data_( kVehicleDataInitializer, kVehicleDataInitializer + ARRAYSIZE(kVehicleDataInitializer)); -#ifdef HMI_DBUS_API -namespace { -struct VehicleInfo_Requests { - hmi_apis::FunctionID::eType func_id; - const char* str; -}; -static VehicleInfo_Requests ivi_subrequests[] = { - {hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State, - strings::fuel_level_state}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption, - strings::instant_fuel_consumption}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature, - strings::external_temp}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin}, - {hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure, - strings::tire_pressure}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus, - strings::belt_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation, - strings::body_information}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus, - strings::device_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking, - strings::driver_braking}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus, - strings::wiper_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus, - strings::head_lamp_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque, - strings::engine_torque}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition, - strings::acc_pedal_pos}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle, - strings::steering_wheel_angle}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo, - strings::e_call_info}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus, - strings::airbag_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent, - strings::emergency_event}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus, - strings::cluster_mode_status}, - {hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key}, -}; +smart_objects::SmartObjectSPtr MessageHelper::CreateNotification( + mobile_apis::FunctionID::eType function_id, uint32_t app_id) { + using smart_objects::SmartObject; + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObjectSPtr object( + new SmartObject(smart_objects::SmartType_Map)); + (*object)[strings::params][strings::message_type] = + static_cast<int>(kNotification); + (*object)[strings::params][strings::function_id] = function_id; + (*object)[strings::params][strings::connection_key] = app_id; + (*object)[strings::params][strings::protocol_version] = + commands::CommandImpl::protocol_version_; + (*object)[strings::params][strings::protocol_type] = + commands::CommandImpl::mobile_protocol_type_; + (*object)[strings::msg_params] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + return object; +} + +ns_smart_device_link::ns_smart_objects::SmartObjectSPtr +MessageHelper::CreateHMINotification(hmi_apis::FunctionID::eType function_id) { + using smart_objects::SmartObject; + using smart_objects::SmartObjectSPtr; + using smart_objects::SmartType_Map; + LOG4CXX_AUTO_TRACE(logger_); + SmartObjectSPtr notification_ptr = + std::make_shared<SmartObject>(SmartType_Map); + SmartObject& notification = *notification_ptr; + notification[strings::params][strings::message_type] = + static_cast<int32_t>(kNotification); + notification[strings::params][strings::protocol_version] = + commands::CommandImpl::protocol_version_; + notification[strings::params][strings::protocol_type] = + commands::CommandImpl::hmi_protocol_type_; + notification[strings::params][strings::function_id] = function_id; + + return notification_ptr; } -#endif // #ifdef HMI_DBUS_API const uint32_t MessageHelper::GetPriorityCode(const std::string& priority) { CommonAppPriorityMap::const_iterator it = app_priority_values.find(priority); @@ -286,7 +277,7 @@ const uint32_t MessageHelper::GetPriorityCode(const std::string& priority) { hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString( const std::string& language) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; hmi_apis::Common_Language::eType value; if (EnumConversionHelper<hmi_apis::Common_Language::eType>::StringToEnum( language, &value)) { @@ -307,7 +298,7 @@ std::string MessageHelper::GetDeviceMacAddressForHandle( std::string MessageHelper::CommonLanguageToString( hmi_apis::Common_Language::eType language) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; const char* str = 0; if (EnumConversionHelper<hmi_apis::Common_Language::eType>::EnumToCString( language, &str)) { @@ -320,7 +311,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI( hmi_apis::messageType::eType message_type, const uint32_t correlation_id) { using namespace smart_objects; - SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map); SmartObject& ref = *message; ref[strings::params][strings::message_type] = static_cast<int>(message_type); @@ -336,7 +327,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification( const uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = mobile_apis::FunctionID::OnHashChangeID; @@ -362,7 +353,21 @@ void MessageHelper::SendDecryptCertificateToHMI(const std::string& file_name, msg_params[hmi_request::file_name] = file_name; object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); +} + +void MessageHelper::SendGetSystemTimeRequest(const uint32_t correlation_id, + ApplicationManager& app_mngr) { + using namespace smart_objects; + SmartObjectSPtr message = + CreateMessageForHMI(hmi_apis::messageType::request, correlation_id); + + DCHECK(message); + + (*message)[strings::params][strings::function_id] = + hmi_apis::FunctionID::BasicCommunication_GetSystemTime; + + app_mngr.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendHashUpdateNotification(const uint32_t app_id, @@ -375,7 +380,8 @@ void MessageHelper::SendHashUpdateNotification(const uint32_t app_id, } smart_objects::SmartObjectSPtr so = CreateHashUpdateNotification(app_id); PrintSmartObject(*so); - if (!app_mngr.ManageMobileCommand(so, commands::Command::ORIGIN_SDL)) { + if (!app_mngr.GetRPCService().ManageMobileCommand( + so, commands::Command::SOURCE_SDL)) { LOG4CXX_ERROR(logger_, "Failed to send HashUpdate notification."); return; } @@ -389,7 +395,7 @@ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = static_cast<int32_t>( @@ -427,7 +433,7 @@ void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd, object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } if ((*cmd).keyExists(strings::vr_commands)) { @@ -444,7 +450,7 @@ void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd, object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } } @@ -470,7 +476,7 @@ void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd, object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); const DataAccessor<CommandsMap> accessor = application->commands_map(); const CommandsMap& commands = accessor.GetData(); @@ -499,7 +505,7 @@ void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd, object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } } } @@ -532,7 +538,7 @@ void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd, object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } } @@ -569,7 +575,7 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application, object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } { @@ -589,7 +595,7 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application, object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } } @@ -615,41 +621,7 @@ void MessageHelper::SendUnsubscribeButtonNotification( object[strings::msg_params] = msg_params; - app_mngr.ManageHMICommand(message); -} - -void MessageHelper::SendUnsubscribeIVIRequest(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr) { - using namespace smart_objects; - - std::string key_name; - for (auto item : vehicle_data_) { - if (ivi_id == item.second) { - key_name = item.first; - break; - } - } - - if (key_name.empty()) { - return; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[key_name] = true; - - SmartObjectSPtr message = CreateMessageForHMI( - hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); - DCHECK(message); - - SmartObject& object = *message; - object[strings::params][strings::function_id] = - hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData; - - object[strings::msg_params] = msg_params; - - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } const VehicleData& MessageHelper::vehicle_data() { @@ -658,7 +630,7 @@ const VehicleData& MessageHelper::vehicle_data() { std::string MessageHelper::HMIResultToString( hmi_apis::Common_Result::eType hmi_result) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; const char* str = 0; if (EnumConversionHelper<hmi_apis::Common_Result::eType>::EnumToCString( hmi_result, &str)) { @@ -669,7 +641,7 @@ std::string MessageHelper::HMIResultToString( hmi_apis::Common_Result::eType MessageHelper::HMIResultFromString( const std::string& hmi_result) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; hmi_apis::Common_Result::eType value; if (EnumConversionHelper<hmi_apis::Common_Result::eType>::StringToEnum( hmi_result, &value)) { @@ -680,7 +652,7 @@ hmi_apis::Common_Result::eType MessageHelper::HMIResultFromString( std::string MessageHelper::MobileResultToString( mobile_apis::Result::eType mobile_result) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; const char* str = 0; if (EnumConversionHelper<mobile_apis::Result::eType>::EnumToCString( mobile_result, &str)) { @@ -691,7 +663,7 @@ std::string MessageHelper::MobileResultToString( mobile_apis::Result::eType MessageHelper::MobileResultFromString( const std::string& mobile_result) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; mobile_apis::Result::eType value; if (EnumConversionHelper<mobile_apis::Result::eType>::StringToEnum( mobile_result, &value)) { @@ -718,12 +690,12 @@ hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult( return HMIResultFromString(result); } -#ifdef SDL_REMOTE_CONTROL void MessageHelper::SendHMIStatusNotification( const Application& application_impl, ApplicationManager& application_manager) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr notification = + std::make_shared<smart_objects::SmartObject>(); if (!notification) { LOG4CXX_ERROR(logger_, "Failed to create smart object"); return; @@ -748,8 +720,8 @@ void MessageHelper::SendHMIStatusNotification( message[strings::msg_params][strings::system_context] = static_cast<int32_t>(application_impl.system_context()); - application_manager.ManageMobileCommand(notification, - commands::Command::ORIGIN_SDL); + application_manager.GetRPCService().ManageMobileCommand( + notification, commands::Command::SOURCE_SDL); } void MessageHelper::SendActivateAppToHMI( @@ -764,8 +736,9 @@ void MessageHelper::SendActivateAppToHMI( return; } - utils::SharedPtr<smart_objects::SmartObject> message = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::shared_ptr<smart_objects::SmartObject> message = + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_ActivateApp; @@ -803,13 +776,12 @@ void MessageHelper::SendActivateAppToHMI( (*message)[strings::msg_params][strings::activate_app_hmi_level] = level; } - application_manager.ManageHMICommand(message); + application_manager.GetRPCService().ManageHMICommand(message); } -#endif // SDL_REMOTE_CONTROL mobile_apis::HMILevel::eType MessageHelper::StringToHMILevel( const std::string& hmi_level) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; mobile_apis::HMILevel::eType value; if (EnumConversionHelper<mobile_apis::HMILevel::eType>::StringToEnum( hmi_level, &value)) { @@ -820,7 +792,7 @@ mobile_apis::HMILevel::eType MessageHelper::StringToHMILevel( std::string MessageHelper::StringifiedHMILevel( const mobile_apis::HMILevel::eType hmi_level) { - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; const char* str = 0; if (EnumConversionHelper<mobile_apis::HMILevel::eType>::EnumToCString( hmi_level, &str)) { @@ -832,7 +804,7 @@ std::string MessageHelper::StringifiedHMILevel( std::string MessageHelper::StringifiedFunctionID( mobile_apis::FunctionID::eType function_id) { LOG4CXX_AUTO_TRACE(logger_); - using namespace NsSmartDeviceLink::NsSmartObjects; + using namespace ns_smart_device_link::ns_smart_objects; const char* str = 0; if (EnumConversionHelper<mobile_apis::FunctionID::eType>::EnumToCString( function_id, &str)) { @@ -845,103 +817,13 @@ std::string MessageHelper::StringifiedFunctionID( return std::string(); } -#ifdef HMI_DBUS_API -namespace { -const std::map<std::string, uint16_t> create_get_vehicle_data_args() { - std::map<std::string, uint16_t> rc; - rc.insert(std::make_pair(strings::gps, - hmi_apis::FunctionID::VehicleInfo_GetGpsData)); - rc.insert(std::make_pair(strings::speed, - hmi_apis::FunctionID::VehicleInfo_GetSpeed)); - rc.insert( - std::make_pair(strings::rpm, hmi_apis::FunctionID::VehicleInfo_GetRpm)); - rc.insert(std::make_pair(strings::fuel_level, - hmi_apis::FunctionID::VehicleInfo_GetFuelLevel)); - rc.insert( - std::make_pair(strings::fuel_level_state, - hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState)); - rc.insert(std::make_pair( - strings::instant_fuel_consumption, - hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption)); - rc.insert( - std::make_pair(strings::external_temp, - hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature)); - rc.insert( - std::make_pair(strings::vin, hmi_apis::FunctionID::VehicleInfo_GetVin)); - rc.insert(std::make_pair(strings::prndl, - hmi_apis::FunctionID::VehicleInfo_GetPrndl)); - rc.insert(std::make_pair(strings::tire_pressure, - hmi_apis::FunctionID::VehicleInfo_GetTirePressure)); - rc.insert(std::make_pair(strings::odometer, - hmi_apis::FunctionID::VehicleInfo_GetOdometer)); - rc.insert(std::make_pair(strings::belt_status, - hmi_apis::FunctionID::VehicleInfo_GetBeltStatus)); - rc.insert( - std::make_pair(strings::body_information, - hmi_apis::FunctionID::VehicleInfo_GetBodyInformation)); - rc.insert(std::make_pair(strings::device_status, - hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus)); - rc.insert(std::make_pair(strings::driver_braking, - hmi_apis::FunctionID::VehicleInfo_GetDriverBraking)); - rc.insert(std::make_pair(strings::wiper_status, - hmi_apis::FunctionID::VehicleInfo_GetWiperStatus)); - rc.insert( - std::make_pair(strings::head_lamp_status, - hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus)); - rc.insert(std::make_pair(strings::engine_torque, - hmi_apis::FunctionID::VehicleInfo_GetEngineTorque)); - rc.insert( - std::make_pair(strings::acc_pedal_pos, - hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition)); - rc.insert( - std::make_pair(strings::steering_wheel_angle, - hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle)); - rc.insert(std::make_pair(strings::e_call_info, - hmi_apis::FunctionID::VehicleInfo_GetECallInfo)); - rc.insert(std::make_pair(strings::airbag_status, - hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus)); - rc.insert( - std::make_pair(strings::emergency_event, - hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent)); - rc.insert( - std::make_pair(strings::cluster_mode_status, - hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus)); - rc.insert(std::make_pair(strings::my_key, - hmi_apis::FunctionID::VehicleInfo_GetMyKey)); - return rc; -} -static std::map<std::string, uint16_t> vehicle_data_args = - create_get_vehicle_data_args(); -} -#endif - void MessageHelper::CreateGetVehicleDataRequest( const uint32_t correlation_id, const std::vector<std::string>& params, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); -#ifdef HMI_DBUS_API - for (std::vector<std::string>::const_iterator it = params.begin(); - it != params.end(); - it++) { - smart_objects::SmartObjectSPtr request = - utils::MakeShared<smart_objects::SmartObject>(); - - (*request)[strings::params][strings::message_type] = - static_cast<int>(kRequest); - (*request)[strings::params][strings::correlation_id] = correlation_id; - (*request)[strings::params][strings::protocol_version] = - commands::CommandImpl::protocol_version_; - (*request)[strings::params][strings::protocol_type] = - commands::CommandImpl::hmi_protocol_type_; - (*request)[strings::params][strings::function_id] = - static_cast<int>(vehicle_data_args[*it]); - app_mngr.ManageHMICommand(request); - } -#else - smart_objects::SmartObjectSPtr request = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*request)[strings::params][strings::message_type] = static_cast<int>(kRequest); @@ -959,8 +841,7 @@ void MessageHelper::CreateGetVehicleDataRequest( it++) { (*request)[strings::msg_params][*it] = true; } - app_mngr.ManageHMICommand(request); -#endif + app_mngr.GetRPCService().ManageHMICommand(request); } smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse( @@ -970,7 +851,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse( uint32_t connection_key) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr response = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*response)[strings::params][strings::function_id] = static_cast<int>(function_id); @@ -994,7 +875,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO( ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr device_list_so = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*device_list_so)[strings::device_list] = @@ -1028,7 +909,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO( uint32_t function_id, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr module_info = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); smart_objects::SmartObject& object = *module_info; object[strings::params][strings::message_type] = static_cast<int>(kRequest); @@ -1044,7 +925,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( const std::string& path_to_icon, uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr set_icon = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!set_icon) { @@ -1061,84 +942,6 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( return set_icon; } -bool MessageHelper::SendIVISubscribtions(const uint32_t app_id, - ApplicationManager& app_mngr) { - return SendIVISubscriptions(app_id, app_mngr); -} - -bool MessageHelper::SendIVISubscriptions(const uint32_t app_id, - ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); - - bool result = true; - ApplicationSharedPtr app = app_mngr.application(app_id); - - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "Invalid application " << app_id); - return result; - } - - smart_objects::SmartObjectList requests = - GetIVISubscriptionRequests(app, app_mngr); - for (smart_objects::SmartObjectList::const_iterator it = requests.begin(); - it != requests.end(); - ++it) { - if (!app_mngr.ManageHMICommand(*it)) { - result = false; - } - } - return result; -} - -smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests( - ApplicationSharedPtr app, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); - - smart_objects::SmartObjectList hmi_requests; - if (!app.valid()) { - LOG4CXX_ERROR(logger_, "Invalid application pointer "); - return hmi_requests; - } - - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::app_id] = app->app_id(); - const VehicleData& vehicle_data = MessageHelper::vehicle_data_; - VehicleData::const_iterator ivi_it = vehicle_data.begin(); - DataAccessor<VehicleInfoSubscriptions> vi_accessor = app->SubscribedIVI(); - const VehicleInfoSubscriptions& subscriptions = vi_accessor.GetData(); - - for (; vehicle_data.end() != ivi_it; ++ivi_it) { - mobile_apis::VehicleDataType::eType type_id = ivi_it->second; - if (subscriptions.end() != subscriptions.find(type_id)) { - std::string key_name = ivi_it->first; - msg_params[key_name] = true; - } - } - -#ifdef HMI_JSON_API - smart_objects::SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO( - hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData, app_mngr); - (*request)[strings::msg_params] = msg_params; - hmi_requests.push_back(request); -#endif // #ifdef HMI_JSON_API -#ifdef HMI_DBUS_API - // Generate list of ivi_subrequests - for (size_t i = 0; i < sizeof(ivi_subrequests) / sizeof(ivi_subrequests[0]); - ++i) { - const VehicleInfo_Requests& sr = ivi_subrequests[i]; - if (true == msg_params.keyExists(sr.str) && - true == msg_params[sr.str].asBool()) { - smart_objects::SmartObjectSPtr request = - MessageHelper::CreateModuleInfoSO(sr.func_id, app_mngr); - (*request)[strings::msg_params] = msg_params; - hmi_requests.push_back(request); - } - } -#endif // #ifdef HMI_DBUS_API - return hmi_requests; -} - void MessageHelper::SendOnButtonSubscriptionNotification( uint32_t app_id, hmi_apis::Common_ButtonName::eType button, @@ -1149,7 +952,7 @@ void MessageHelper::SendOnButtonSubscriptionNotification( LOG4CXX_AUTO_TRACE(logger_); SmartObjectSPtr notification_ptr = - utils::MakeShared<SmartObject>(SmartType_Map); + std::make_shared<SmartObject>(SmartType_Map); if (!notification_ptr) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); return; @@ -1171,7 +974,7 @@ void MessageHelper::SendOnButtonSubscriptionNotification( hmi_apis::FunctionID::Buttons_OnButtonSubscription; notification[strings::msg_params] = msg_params; - if (!app_mngr.ManageHMICommand(notification_ptr)) { + if (!app_mngr.GetRPCService().ManageHMICommand(notification_ptr)) { LOG4CXX_ERROR(logger_, "Unable to send HMI notification"); } } @@ -1183,7 +986,7 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( using namespace mobile_apis; LOG4CXX_AUTO_TRACE(logger_); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application pointer "); return; } @@ -1223,7 +1026,7 @@ void MessageHelper::SendSetAppIcon( if (msg_params) { so_to_send[strings::msg_params] = *msg_params; } - application_manager.ManageHMICommand(set_app_icon); + application_manager.GetRPCService().ManageHMICommand(set_app_icon); } } @@ -1239,7 +1042,7 @@ void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app, void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application"); return; } @@ -1249,7 +1052,7 @@ void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, for (smart_objects::SmartObjectList::const_iterator it = requests.begin(); it != requests.end(); ++it) { - DCHECK(app_mngr.ManageHMICommand(*it)); + DCHECK(app_mngr.GetRPCService().ManageHMICommand(*it)); } } @@ -1259,14 +1062,24 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectList requests; - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application"); return requests; } + auto& help_prompt_manager = + const_cast<Application*>(app.get())->help_prompt_manager(); + + const bool can_send_ui = helpers::Compare<HelpPromptManager::SendingType, + helpers::EQ, + helpers::ONE>( + help_prompt_manager.GetSendingType(), + HelpPromptManager::SendingType::kSendVRHelp, + HelpPromptManager::SendingType::kSendBoth); + // UI global properties - if (app->vr_help_title() || app->vr_help()) { + if (can_send_ui && (app->vr_help_title() || app->vr_help())) { smart_objects::SmartObjectSPtr ui_global_properties = CreateMessageForHMI(hmi_apis::messageType::request, correlation_id); if (!ui_global_properties) { @@ -1300,8 +1113,15 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( requests.push_back(ui_global_properties); } + const bool can_send_vr = helpers::Compare<HelpPromptManager::SendingType, + helpers::EQ, + helpers::ONE>( + help_prompt_manager.GetSendingType(), + HelpPromptManager::SendingType::kSendHelpPrompt, + HelpPromptManager::SendingType::kSendBoth); + // TTS global properties - if (app->help_prompt() || app->timeout_prompt()) { + if (can_send_vr && (app->help_prompt() || app->timeout_prompt())) { smart_objects::SmartObjectSPtr tts_global_properties = CreateMessageForHMI(hmi_apis::messageType::request, correlation_id); if (!tts_global_properties) { @@ -1368,14 +1188,14 @@ void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app, app->set_help_prompt(msg_params[strings::help_prompt]); msg_params[strings::app_id] = app->app_id(); so_to_send[strings::msg_params] = msg_params; - app_man.ManageHMICommand(tts_global_properties); + app_man.GetRPCService().ManageHMICommand(tts_global_properties); } } smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp( ApplicationConstSharedPtr app) { smart_objects::SmartObjectSPtr result = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!result) { return NULL; @@ -1436,7 +1256,7 @@ void MessageHelper::SendShowRequestToHMI(ApplicationConstSharedPtr app, for (smart_objects::SmartObjectList::const_iterator it = shows.begin(); it != shows.end(); ++it) { - DCHECK(app_mngr.ManageHMICommand(*it)); + DCHECK(app_mngr.GetRPCService().ManageHMICommand(*it)); } } @@ -1456,7 +1276,7 @@ void MessageHelper::SendShowConstantTBTRequestToHMI( static_cast<int>(hmi_apis::FunctionID::Navigation_ShowConstantTBT); (*navi_show_tbt)[strings::msg_params] = (*app->tbt_show_command()); - DCHECK(app_man.ManageHMICommand(navi_show_tbt)); + DCHECK(app_man.GetRPCService().ManageHMICommand(navi_show_tbt)); } } @@ -1470,7 +1290,7 @@ void MessageHelper::SendAddCommandRequestToHMI(ApplicationConstSharedPtr app, for (smart_objects::SmartObjectList::iterator it = requests.begin(); it != requests.end(); ++it) { - DCHECK(app_man.ManageHMICommand(*it)); + DCHECK(app_man.GetRPCService().ManageHMICommand(*it)); } } @@ -1598,7 +1418,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration( void MessageHelper::SendUIChangeRegistrationRequestToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Application is not valid"); return; } @@ -1612,7 +1432,7 @@ void MessageHelper::SendUIChangeRegistrationRequestToHMI( app_mngr); if (ui_command) { - app_mngr.ManageHMICommand(ui_command); + app_mngr.GetRPCService().ManageHMICommand(ui_command); } } } @@ -1624,7 +1444,7 @@ void MessageHelper::SendAddVRCommandToHMI( ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr request = CreateAddVRCommandToHMI(cmd_id, vr_commands, app_id, app_mngr); - DCHECK(app_mngr.ManageHMICommand(request)); + DCHECK(app_mngr.GetRPCService().ManageHMICommand(request)); } smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI( @@ -1659,13 +1479,47 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI( return vr_command; } +bool MessageHelper::CreateDeviceInfo( + connection_handler::DeviceHandle device_handle, + const protocol_handler::SessionObserver& session_observer, + const policy::PolicyHandlerInterface& policy_handler, + ApplicationManager& app_mngr, + smart_objects::SmartObject* output) { + DCHECK_OR_RETURN(output, false); + + std::string device_name; + std::string mac_address; + std::string transport_type; + if (-1 == + session_observer.GetDataOnDeviceID( + device_handle, &device_name, NULL, &mac_address, &transport_type)) { + LOG4CXX_ERROR(logger_, + "Failed to extract information for device " << device_handle); + } + + smart_objects::SmartObject& device_info_map = *output; + device_info_map = smart_objects::SmartObject(smart_objects::SmartType_Map); + + device_info_map[strings::name] = device_name; + device_info_map[strings::id] = mac_address; + device_info_map[strings::transport_type] = + app_mngr.GetDeviceTransportType(transport_type); + + const policy::DeviceConsent device_consent = + policy_handler.GetUserConsentForDevice(mac_address); + device_info_map[strings::isSDLAllowed] = + policy::DeviceConsent::kDeviceAllowed == device_consent; + + return true; +} + bool MessageHelper::CreateHMIApplicationStruct( ApplicationConstSharedPtr app, const protocol_handler::SessionObserver& session_observer, const policy::PolicyHandlerInterface& policy_handler, - NsSmartDeviceLink::NsSmartObjects::SmartObject* output, + ns_smart_device_link::ns_smart_objects::SmartObject* output, ApplicationManager& app_mngr) { - using NsSmartDeviceLink::NsSmartObjects::SmartObject; + using ns_smart_device_link::ns_smart_objects::SmartObject; DCHECK_OR_RETURN(output, false); SmartObject& message = *output; @@ -1677,15 +1531,9 @@ bool MessageHelper::CreateHMIApplicationStruct( const smart_objects::SmartObject* app_types = app->app_types(); const smart_objects::SmartObject* ngn_media_screen_name = app->ngn_media_screen_name(); - std::string device_name; - std::string mac_address; - std::string transport_type; - if (-1 == - session_observer.GetDataOnDeviceID( - app->device(), &device_name, NULL, &mac_address, &transport_type)) { - LOG4CXX_ERROR(logger_, - "Failed to extract information for device " << app->device()); - } + const smart_objects::SmartObject* day_color_scheme = app->day_color_scheme(); + const smart_objects::SmartObject* night_color_scheme = + app->night_color_scheme(); message = smart_objects::SmartObject(smart_objects::SmartType_Map); message[strings::app_name] = app->name(); @@ -1714,23 +1562,38 @@ bool MessageHelper::CreateHMIApplicationStruct( message[strings::app_type] = *app_types; } + if (day_color_scheme) { + message[strings::day_color_scheme] = *day_color_scheme; + } + + if (night_color_scheme) { + message[strings::night_color_scheme] = *night_color_scheme; + } + message[strings::device_info] = smart_objects::SmartObject(smart_objects::SmartType_Map); - message[strings::device_info][strings::name] = device_name; - message[strings::device_info][strings::id] = mac_address; - const policy::DeviceConsent device_consent = - policy_handler.GetUserConsentForDevice(mac_address); - message[strings::device_info][strings::isSDLAllowed] = - policy::DeviceConsent::kDeviceAllowed == device_consent; + smart_objects::SmartObject& device_info = message[strings::device_info]; + CreateDeviceInfo( + app->device(), session_observer, policy_handler, app_mngr, &device_info); + + if (app->secondary_device() != 0) { + message[strings::secondary_device_info] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject& secondary_device_info = + message[strings::secondary_device_info]; + CreateDeviceInfo(app->secondary_device(), + session_observer, + policy_handler, + app_mngr, + &secondary_device_info); + } - message[strings::device_info][strings::transport_type] = - app_mngr.GetDeviceTransportType(transport_type); return true; } void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application"); return; } @@ -1740,7 +1603,7 @@ void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app, for (smart_objects::SmartObjectList::iterator it = requests.begin(); it != requests.end(); ++it) { - DCHECK(app_mngr.ManageHMICommand(*it)); + DCHECK(app_mngr.GetRPCService().ManageHMICommand(*it)); } } @@ -1770,6 +1633,12 @@ smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI( (*i->second)[strings::menu_name]; msg_params[strings::app_id] = app->app_id(); (*ui_sub_menu)[strings::msg_params] = msg_params; + if (((*i->second).keyExists(strings::menu_icon)) && + (0 < (*i->second)[strings::menu_icon][strings::value].length())) { + msg_params[strings::menu_icon] = (*i->second)[strings::menu_icon]; + msg_params[strings::menu_icon][strings::value] = + (*i->second)[strings::menu_icon][strings::value].asString(); + } requsets.push_back(ui_sub_menu); } return requsets; @@ -1780,7 +1649,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( bool is_unexpected_disconnect, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); smart_objects::SmartObject& message = *notification; @@ -1796,7 +1665,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( message[strings::msg_params][strings::app_id] = app->hmi_app_id(); message[strings::msg_params][strings::unexpected_disconnect] = is_unexpected_disconnect; - app_mngr.ManageHMICommand(notification); + app_mngr.GetRPCService().ManageHMICommand(notification); } smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( @@ -1810,7 +1679,7 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID(); smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_ActivateApp; @@ -1853,8 +1722,8 @@ void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id, return; } - utils::SharedPtr<smart_objects::SmartObject> message = - utils::MakeShared<smart_objects::SmartObject>( + std::shared_ptr<smart_objects::SmartObject> message = + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = @@ -1865,7 +1734,7 @@ void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id, app_mngr.GetNextHMICorrelationID(); (*message)[strings::msg_params][strings::app_id] = app_id; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendSDLActivateAppResponse( @@ -1873,7 +1742,7 @@ void MessageHelper::SendSDLActivateAppResponse( const uint32_t correlation_id, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = @@ -1916,13 +1785,13 @@ void MessageHelper::SendSDLActivateAppResponse( hmi_apis::Common_Result::REJECTED; } - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendOnSDLConsentNeeded( const policy::DeviceParams& device_info, ApplicationManager& app_man) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = @@ -1934,7 +1803,7 @@ void MessageHelper::SendOnSDLConsentNeeded( device_info.device_mac_address; (*message)[strings::msg_params]["device"]["name"] = device_info.device_name; - app_man.ManageHMICommand(message); + app_man.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendPolicyUpdate(const std::string& file_path, @@ -1954,7 +1823,7 @@ void MessageHelper::SendPolicyUpdate(const std::string& file_path, for (size_t i = 0; i < retries.size(); ++i) { object[strings::msg_params][hmi_request::retry][i] = retries[i]; } - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendGetUserFriendlyMessageResponse( const std::vector<policy::UserFriendlyMessage>& msg, @@ -1962,7 +1831,8 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr message = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); if (!message) { return; } @@ -1975,7 +1845,7 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( // If no any messages found - skip sending of "messages" param if (msg.empty()) { - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); return; } @@ -2020,7 +1890,7 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( #endif // EXTERNAL_PROPRIETARY_MODE } - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } #ifdef EXTERNAL_PROPRIETARY_MODE @@ -2032,7 +1902,7 @@ void MessageHelper::SendGetListOfPermissionsResponse( using namespace smart_objects; using namespace hmi_apis; - SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map); DCHECK_OR_RETURN_VOID(message); SmartObject& params = (*message)[strings::params]; @@ -2064,7 +1934,7 @@ void MessageHelper::SendGetListOfPermissionsResponse( external_consent_status.end(), external_consent_status_appender); - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } #else void MessageHelper::SendGetListOfPermissionsResponse( @@ -2074,7 +1944,7 @@ void MessageHelper::SendGetListOfPermissionsResponse( using namespace smart_objects; using namespace hmi_apis; - SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map); DCHECK_OR_RETURN_VOID(message); SmartObject& params = (*message)[strings::params]; @@ -2093,7 +1963,7 @@ void MessageHelper::SendGetListOfPermissionsResponse( GroupsAppender groups_appender(allowed_functions_array); std::for_each(permissions.begin(), permissions.end(), groups_appender); - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } #endif // EXTERNAL_PROPRIETARY_MODE @@ -2115,7 +1985,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse( response_data[strings::msg_params][strings::success] = false; response_data[strings::params][strings::connection_key] = connection_key; - return utils::MakeShared<smart_objects::SmartObject>(response_data); + return std::make_shared<smart_objects::SmartObject>(response_data); } void MessageHelper::SendNaviSetVideoConfig( @@ -2135,7 +2005,7 @@ void MessageHelper::SendNaviSetVideoConfig( (*request)[strings::msg_params][strings::app_id] = app_id; (*request)[strings::msg_params][strings::config] = video_params; - app_mngr.ManageHMICommand(request); + app_mngr.GetRPCService().ManageHMICommand(request); } void MessageHelper::SendNaviStartStream(const int32_t app_id, @@ -2174,7 +2044,7 @@ void MessageHelper::SendNaviStartStream(const int32_t app_id, (*start_stream)[strings::msg_params][strings::app_id] = app_id; (*start_stream)[strings::msg_params][strings::url] = url; - app_mngr.ManageHMICommand(start_stream); + app_mngr.GetRPCService().ManageHMICommand(start_stream); } void MessageHelper::SendNaviStopStream(const int32_t app_id, @@ -2191,7 +2061,7 @@ void MessageHelper::SendNaviStopStream(const int32_t app_id, (*stop_stream)[strings::msg_params][strings::app_id] = app_id; - app_mngr.ManageHMICommand(stop_stream); + app_mngr.GetRPCService().ManageHMICommand(stop_stream); } void MessageHelper::SendAudioStartStream(const int32_t app_id, @@ -2231,7 +2101,7 @@ void MessageHelper::SendAudioStartStream(const int32_t app_id, (*start_stream)[strings::msg_params][strings::app_id] = app_id; (*start_stream)[strings::msg_params][strings::url] = url; - DCHECK(app_mngr.ManageHMICommand(start_stream)); + DCHECK(app_mngr.GetRPCService().ManageHMICommand(start_stream)); } void MessageHelper::SendAudioStopStream(const int32_t app_id, @@ -2249,7 +2119,7 @@ void MessageHelper::SendAudioStopStream(const int32_t app_id, (*stop_stream)[strings::msg_params][strings::app_id] = app_id; - app_mngr.ManageHMICommand(stop_stream); + app_mngr.GetRPCService().ManageHMICommand(stop_stream); } void MessageHelper::SendOnDataStreaming( @@ -2265,7 +2135,7 @@ void MessageHelper::SendOnDataStreaming( } smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*notification)[strings::params][strings::function_id] = @@ -2281,7 +2151,7 @@ void MessageHelper::SendOnDataStreaming( (*notification)[strings::msg_params]["available"] = available; - app_mngr.ManageHMICommand(notification); + app_mngr.GetRPCService().ManageHMICommand(notification); } bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { @@ -2293,7 +2163,7 @@ bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { (*result)[strings::params][strings::function_id] = hmi_apis::FunctionID::UI_EndAudioPassThru; - return app_mngr.ManageHMICommand(result); + return app_mngr.GetRPCService().ManageHMICommand(result); } bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) { @@ -2305,7 +2175,7 @@ bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) { (*result)[strings::params][strings::function_id] = hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints; - return app_mngr.ManageHMICommand(result); + return app_mngr.GetRPCService().ManageHMICommand(result); } void MessageHelper::SendPolicySnapshotNotification( @@ -2354,9 +2224,9 @@ void MessageHelper::SendSystemRequestNotification( PrintSmartObject(content); #endif - DCHECK(app_mngr.ManageMobileCommand( - utils::MakeShared<smart_objects::SmartObject>(content), - commands::Command::ORIGIN_SDL)); + DCHECK(app_mngr.GetRPCService().ManageMobileCommand( + std::make_shared<smart_objects::SmartObject>(content), + commands::Command::SOURCE_SDL)); } void MessageHelper::SendLaunchApp(const uint32_t connection_key, @@ -2522,9 +2392,9 @@ void MessageHelper::SendOnPermissionsChangeNotification( } } - app_mngr.ManageMobileCommand( - utils::MakeShared<smart_objects::SmartObject>(content), - commands::Command::ORIGIN_SDL); + app_mngr.GetRPCService().ManageMobileCommand( + std::make_shared<smart_objects::SmartObject>(content), + commands::Command::SOURCE_SDL); } void MessageHelper::FillAppRevokedPermissions( @@ -2589,22 +2459,33 @@ void MessageHelper::SendOnAppPermissionsChangedNotification( if (permissions.requestTypeChanged) { smart_objects::SmartObject request_types_array( smart_objects::SmartType_Array); - ; + for (uint16_t index = 0; index < permissions.requestType.size(); ++index) { request_types_array[index] = permissions.requestType[index]; } message[strings::msg_params][strings::request_type] = request_types_array; } + if (permissions.requestSubTypeChanged) { + smart_objects::SmartObject request_subtypes_array( + smart_objects::SmartType_Array); - app_mngr.ManageHMICommand( - utils::MakeShared<smart_objects::SmartObject>(message)); + for (uint16_t index = 0; index < permissions.requestSubType.size(); + ++index) { + request_subtypes_array[index] = permissions.requestSubType[index]; + } + message[strings::msg_params][strings::request_subtype] = + request_subtypes_array; + } + + app_mngr.GetRPCService().ManageHMICommand( + std::make_shared<smart_objects::SmartObject>(message)); } void MessageHelper::SendGetStatusUpdateResponse(const std::string& status, const uint32_t correlation_id, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!message) { return; @@ -2618,14 +2499,14 @@ void MessageHelper::SendGetStatusUpdateResponse(const std::string& status, (*message)[strings::msg_params]["status"] = status; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendUpdateSDLResponse(const std::string& result, const uint32_t correlation_id, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); DCHECK(message); @@ -2637,13 +2518,13 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result, (*message)[strings::msg_params]["result"] = result; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendOnStatusUpdate(const std::string& status, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!message) { return; @@ -2656,7 +2537,7 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status, (*message)[strings::msg_params]["status"] = status; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } void MessageHelper::SendGetSystemInfoRequest(ApplicationManager& app_mngr) { @@ -2669,14 +2550,15 @@ void MessageHelper::SendGetSystemInfoRequest(ApplicationManager& app_mngr) { (*message)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_GetSystemInfo; - app_mngr.ManageHMICommand(message); + app_mngr.GetRPCService().ManageHMICommand(message); } mobile_apis::Result::eType MessageHelper::VerifyImageFiles( smart_objects::SmartObject& message, ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - if (NsSmartDeviceLink::NsSmartObjects::SmartType_Array == message.getType()) { + if (ns_smart_device_link::ns_smart_objects::SmartType_Array == + message.getType()) { for (uint32_t i = 0; i < message.length(); ++i) { mobile_apis::Result::eType res = VerifyImageFiles(message[i], app, app_mngr); @@ -2685,7 +2567,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( return res; } } - } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map == + } else if (ns_smart_device_link::ns_smart_objects::SmartType_Map == message.getType()) { if (message.keyExists(strings::image_type)) { mobile_apis::Result::eType verification_result = @@ -2717,25 +2599,25 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( return mobile_apis::Result::SUCCESS; } -mobile_apis::Result::eType MessageHelper::VerifyImageApplyPath( - smart_objects::SmartObject& image, - ApplicationConstSharedPtr app, - ApplicationManager& app_mngr) { - // Checking image type first: if STATIC - skip existence check, since it is - // HMI related file and it should know it location - const uint32_t image_type = image[strings::image_type].asUInt(); - mobile_apis::ImageType::eType type = - static_cast<mobile_apis::ImageType::eType>(image_type); - if (mobile_apis::ImageType::STATIC == type) { - return mobile_apis::Result::SUCCESS; - } - +void MessageHelper::ApplyImagePath(smart_objects::SmartObject& image, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr) { 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; + + return; +} + +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; @@ -2761,31 +2643,86 @@ 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( smart_objects::SmartObject& image, ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - smart_objects::SmartObject temp_image = image; const uint32_t image_type = image[strings::image_type].asUInt(); - const mobile_apis::ImageType::eType type = + mobile_apis::ImageType::eType type = static_cast<mobile_apis::ImageType::eType>(image_type); + const std::string& file_name = image[strings::value].asString(); - const mobile_apis::Result::eType result = - VerifyImageApplyPath(temp_image, app, app_mngr); - if ((mobile_apis::Result::SUCCESS == result) && - (mobile_apis::ImageType::DYNAMIC == type)) { - image[strings::value] = temp_image[strings::value]; + if (!VerifyString(file_name)) { + return mobile_apis::Result::INVALID_DATA; } - return result; + if (mobile_apis::ImageType::STATIC == type) { + return mobile_apis::Result::SUCCESS; + } + + ApplyImagePath(image, app, app_mngr); + + const std::string& imagePath = image[strings::value].asString(); + + if (file_system::FileExists(imagePath)) { + return mobile_apis::Result::SUCCESS; + } + return mobile_apis::Result::WARNINGS; +} + +MessageHelper::ChoiceSetVRCommandsStatus +MessageHelper::CheckChoiceSetVRCommands( + const smart_objects::SmartObject& choice_set) { + // if this is false, someone doesn't have vrCommands + bool all_have = true; + // if this is false, someone has vrCommands + bool none_have = true; + smart_objects::SmartArray::const_iterator current_choice_set_it = + choice_set.asArray()->begin(); + // Iterate through choices + for (; choice_set.asArray()->end() != current_choice_set_it; + ++current_choice_set_it) { + // if the vrCommands is present + if (current_choice_set_it->keyExists( + application_manager::strings::vr_commands)) { + // this one has the parameter + none_have = false; + } else { + // this one doesn't + all_have = false; + } + } + // everyone has it + if (all_have) { + return MessageHelper::ChoiceSetVRCommandsStatus::ALL; + } + // No one has it + if (none_have) { + return MessageHelper::ChoiceSetVRCommandsStatus::NONE; + } + // mix-and-match + return MessageHelper::ChoiceSetVRCommandsStatus::MIXED; } mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems( @@ -2798,21 +2735,21 @@ mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems( if (message[i].keyExists(strings::image)) { verification_result_image = VerifyImage(message[i][strings::image], app, app_mngr); - if (mobile_apis::Result::SUCCESS != verification_result_image) { - return verification_result_image; + if (mobile_apis::Result::INVALID_DATA == verification_result_image) { + break; } } } - return mobile_apis::Result::SUCCESS; + return verification_result_image; } -bool MessageHelper::VerifySoftButtonString(const std::string& str) { +bool MessageHelper::VerifyString(const std::string& str) { if ((std::string::npos != str.find_first_of("\t\n")) || (std::string::npos != str.find("\\n")) || (std::string::npos != str.find("\\t")) || (std::string::npos == str.find_first_not_of(' '))) { LOG4CXX_ERROR(logger_, - "MessageHelper::VerifySoftButtonString" + "MessageHelper::VerifyString" "string contains incorrect character"); return false; } @@ -2871,7 +2808,7 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons( } if ((!request_soft_buttons[i].keyExists(strings::image) || - (Result::SUCCESS != + (Result::INVALID_DATA == VerifyImage( request_soft_buttons[i][strings::image], app, app_mngr)))) { return Result::INVALID_DATA; @@ -2883,7 +2820,7 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons( request_soft_buttons[i].erase(strings::image); } if ((!request_soft_buttons[i].keyExists(strings::text)) || - (!VerifySoftButtonString( + (!VerifyString( request_soft_buttons[i][strings::text].asString()))) { return Result::INVALID_DATA; } @@ -2892,13 +2829,13 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons( case SoftButtonType::SBT_BOTH: { if ((!request_soft_buttons[i].keyExists(strings::text)) || ((request_soft_buttons[i][strings::text].length()) && - (!VerifySoftButtonString( + (!VerifyString( request_soft_buttons[i][strings::text].asString())))) { return Result::INVALID_DATA; } if ((!request_soft_buttons[i].keyExists(strings::image) || - (Result::SUCCESS != + (Result::INVALID_DATA == VerifyImage( request_soft_buttons[i][strings::image], app, app_mngr)))) { return Result::INVALID_DATA; @@ -2952,7 +2889,7 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) { } switch (object.getType()) { - case NsSmartDeviceLink::NsSmartObjects::SmartType_Array: { + case ns_smart_device_link::ns_smart_objects::SmartType_Array: { for (size_t i = 0; i < object.length(); i++) { ++tab; @@ -2964,7 +2901,7 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) { } break; } - case NsSmartDeviceLink::NsSmartObjects::SmartType_Map: { + case ns_smart_device_link::ns_smart_objects::SmartType_Map: { std::set<std::string> keys = object.enumerate(); for (std::set<std::string>::const_iterator key = keys.begin(); @@ -2980,20 +2917,20 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) { } break; } - case NsSmartDeviceLink::NsSmartObjects::SmartType_Boolean: + case ns_smart_device_link::ns_smart_objects::SmartType_Boolean: object.asBool() ? printf("true\n") : printf("false\n"); break; - case NsSmartDeviceLink::NsSmartObjects::SmartType_Double: { + case ns_smart_device_link::ns_smart_objects::SmartType_Double: { printf("%f", object.asDouble()); break; } - case NsSmartDeviceLink::NsSmartObjects::SmartType_Integer: + case ns_smart_device_link::ns_smart_objects::SmartType_Integer: printf("%lld", static_cast<long long int>(object.asInt())); break; - case NsSmartDeviceLink::NsSmartObjects::SmartType_String: + case ns_smart_device_link::ns_smart_objects::SmartType_String: printf("%s", object.asString().c_str()); break; - case NsSmartDeviceLink::NsSmartObjects::SmartType_Character: + case ns_smart_device_link::ns_smart_objects::SmartType_Character: printf("%c", object.asChar()); break; default: diff --git a/src/components/application_manager/src/mobile_command_factory.cc b/src/components/application_manager/src/mobile_command_factory.cc deleted file mode 100644 index f6f9cab7f5..0000000000 --- a/src/components/application_manager/src/mobile_command_factory.cc +++ /dev/null @@ -1,731 +0,0 @@ -/* - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Copyright (c) 2017 Xevo Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the copyright holders nor the names of their contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/mobile_command_factory.h" -#include "application_manager/commands/mobile/add_command_request.h" -#include "application_manager/commands/mobile/add_command_response.h" -#include "application_manager/commands/mobile/delete_command_request.h" -#include "application_manager/commands/mobile/delete_command_response.h" -#include "application_manager/commands/mobile/add_sub_menu_request.h" -#include "application_manager/commands/mobile/add_sub_menu_response.h" -#include "application_manager/commands/mobile/alert_request.h" -#include "application_manager/commands/mobile/alert_response.h" -#include "application_manager/commands/mobile/alert_maneuver_request.h" -#include "application_manager/commands/mobile/alert_maneuver_response.h" -#include "application_manager/commands/mobile/change_registration_request.h" -#include "application_manager/commands/mobile/change_registration_response.h" -#include "application_manager/commands/mobile/create_interaction_choice_set_request.h" -#include "application_manager/commands/mobile/create_interaction_choice_set_response.h" -#include "application_manager/commands/mobile/delete_file_request.h" -#include "application_manager/commands/mobile/delete_file_response.h" -#include "application_manager/commands/mobile/delete_interaction_choice_set_request.h" -#include "application_manager/commands/mobile/delete_interaction_choice_set_response.h" -#include "application_manager/commands/mobile/delete_sub_menu_request.h" -#include "application_manager/commands/mobile/delete_sub_menu_response.h" -#include "application_manager/commands/mobile/end_audio_pass_thru_request.h" -#include "application_manager/commands/mobile/end_audio_pass_thru_response.h" -#include "application_manager/commands/mobile/generic_response.h" -#include "application_manager/commands/mobile/get_dtcs_request.h" -#include "application_manager/commands/mobile/get_dtcs_response.h" -#include "application_manager/commands/mobile/get_system_capability_request.h" -#include "application_manager/commands/mobile/get_system_capability_response.h" -#include "application_manager/commands/mobile/get_vehicle_data_request.h" -#include "application_manager/commands/mobile/get_vehicle_data_response.h" -#include "application_manager/commands/mobile/get_way_points_request.h" -#include "application_manager/commands/mobile/get_way_points_response.h" -#include "application_manager/commands/mobile/list_files_request.h" -#include "application_manager/commands/mobile/list_files_response.h" -#include "application_manager/commands/mobile/on_app_interface_unregistered_notification.h" -#include "application_manager/commands/mobile/on_audio_pass_thru_notification.h" -#include "application_manager/commands/mobile/on_button_event_notification.h" -#include "application_manager/commands/mobile/on_button_press_notification.h" -#include "application_manager/commands/mobile/on_driver_distraction_notification.h" -#include "application_manager/commands/mobile/on_hmi_status_notification.h" -#include "application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h" -#include "application_manager/commands/mobile/on_language_change_notification.h" -#include "application_manager/commands/mobile/on_command_notification.h" -#include "application_manager/commands/mobile/on_permissions_change_notification.h" -#include "application_manager/commands/mobile/on_tbt_client_state_notification.h" -#include "application_manager/commands/mobile/on_vehicle_data_notification.h" -#include "application_manager/commands/mobile/on_hash_change_notification.h" -#include "application_manager/commands/mobile/on_way_point_change_notification.h" -#include "application_manager/commands/mobile/perform_audio_pass_thru_request.h" -#include "application_manager/commands/mobile/perform_audio_pass_thru_response.h" -#include "application_manager/commands/mobile/perform_interaction_request.h" -#include "application_manager/commands/mobile/perform_interaction_response.h" -#include "application_manager/commands/mobile/put_file_request.h" -#include "application_manager/commands/mobile/put_file_response.h" -#include "application_manager/commands/mobile/read_did_request.h" -#include "application_manager/commands/mobile/read_did_response.h" -#include "application_manager/commands/mobile/register_app_interface_request.h" -#include "application_manager/commands/mobile/register_app_interface_response.h" -#include "application_manager/commands/mobile/reset_global_properties_request.h" -#include "application_manager/commands/mobile/reset_global_properties_response.h" -#include "application_manager/commands/mobile/scrollable_message_request.h" -#include "application_manager/commands/mobile/scrollable_message_response.h" -#include "application_manager/commands/mobile/set_display_layout_request.h" -#include "application_manager/commands/mobile/set_display_layout_response.h" -#include "application_manager/commands/mobile/set_global_properties_request.h" -#include "application_manager/commands/mobile/set_global_properties_response.h" -#include "application_manager/commands/mobile/set_app_icon_request.h" -#include "application_manager/commands/mobile/set_app_icon_response.h" -#include "application_manager/commands/mobile/set_media_clock_timer_request.h" -#include "application_manager/commands/mobile/set_media_clock_timer_response.h" -#include "application_manager/commands/mobile/show_constant_tbt_request.h" -#include "application_manager/commands/mobile/show_constant_tbt_response.h" -#include "application_manager/commands/mobile/show_request.h" -#include "application_manager/commands/mobile/show_response.h" -#include "application_manager/commands/mobile/slider_request.h" -#include "application_manager/commands/mobile/slider_response.h" -#include "application_manager/commands/mobile/speak_request.h" -#include "application_manager/commands/mobile/speak_response.h" -#include "application_manager/commands/mobile/subscribe_button_request.h" -#include "application_manager/commands/mobile/subscribe_button_response.h" -#include "application_manager/commands/mobile/subscribe_vehicle_data_request.h" -#include "application_manager/commands/mobile/subscribe_vehicle_data_response.h" -#include "application_manager/commands/mobile/subscribe_way_points_request.h" -#include "application_manager/commands/mobile/subscribe_way_points_response.h" -#include "application_manager/commands/mobile/unsubscribe_way_points_request.h" -#include "application_manager/commands/mobile/unsubscribe_way_points_response.h" -#include "application_manager/commands/mobile/unregister_app_interface_request.h" -#include "application_manager/commands/mobile/unregister_app_interface_response.h" -#include "application_manager/commands/mobile/unsubscribe_button_request.h" -#include "application_manager/commands/mobile/unsubscribe_button_response.h" -#include "application_manager/commands/mobile/unsubscribe_vehicle_data_request.h" -#include "application_manager/commands/mobile/unsubscribe_vehicle_data_response.h" -#include "application_manager/commands/mobile/update_turn_list_request.h" -#include "application_manager/commands/mobile/update_turn_list_response.h" -#include "application_manager/commands/mobile/system_request.h" -#include "application_manager/commands/mobile/system_response.h" -#include "application_manager/commands/mobile/on_keyboard_input_notification.h" -#include "application_manager/commands/mobile/on_touch_event_notification.h" -#include "application_manager/commands/mobile/on_system_request_notification.h" -#include "application_manager/commands/mobile/diagnostic_message_request.h" -#include "application_manager/commands/mobile/diagnostic_message_response.h" -#include "application_manager/commands/mobile/send_location_request.h" -#include "application_manager/commands/mobile/send_location_response.h" -#include "application_manager/commands/mobile/dial_number_request.h" -#include "application_manager/commands/mobile/dial_number_response.h" -#include "application_manager/commands/mobile/send_haptic_data_request.h" -#include "application_manager/commands/mobile/send_haptic_data_response.h" -#include "interfaces/MOBILE_API.h" -#include "utils/make_shared.h" - -namespace application_manager { - -CommandSharedPtr MobileCommandFactory::CreateCommand( - const commands::MessageSharedPtr& message, - commands::Command::CommandOrigin origin, - ApplicationManager& application_manager) { - CommandSharedPtr command; - - switch ((*message)[strings::params][strings::function_id].asInt()) { - case mobile_apis::FunctionID::RegisterAppInterfaceID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kRequest)) { - command.reset(new commands::RegisterAppInterfaceRequest( - message, application_manager)); - - } else { - command.reset(new commands::RegisterAppInterfaceResponse( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::UnregisterAppInterfaceID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kRequest)) { - command.reset(new commands::UnregisterAppInterfaceRequest( - message, application_manager)); - } else { - command.reset(new commands::UnregisterAppInterfaceResponse( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SetGlobalPropertiesID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SetGlobalPropertiesResponse( - message, application_manager)); - } else { - command.reset(new commands::SetGlobalPropertiesRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::ResetGlobalPropertiesID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ResetGlobalPropertiesResponse( - message, application_manager)); - } else { - command.reset(new commands::ResetGlobalPropertiesRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::AddCommandID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::AddCommandResponse(message, application_manager)); - } else { - command.reset( - new commands::AddCommandRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::DeleteCommandID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::DeleteCommandResponse(message, application_manager)); - } else { - command.reset( - new commands::DeleteCommandRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::AddSubMenuID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::AddSubMenuResponse(message, application_manager)); - } else { - command.reset( - new commands::AddSubMenuRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::DeleteSubMenuID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::DeleteSubMenuResponse(message, application_manager)); - } else { - command.reset( - new commands::DeleteSubMenuRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::DeleteInteractionChoiceSetID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::DeleteInteractionChoiceSetResponse( - message, application_manager)); - } else { - command.reset(new commands::DeleteInteractionChoiceSetRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::AlertID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::AlertResponse(message, application_manager)); - } else { - command.reset(new commands::AlertRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SpeakID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SpeakResponse(message, application_manager)); - } else { - command.reset(new commands::SpeakRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SliderID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SliderResponse(message, application_manager)); - } else { - command.reset( - new commands::SliderRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::PerformAudioPassThruID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::PerformAudioPassThruResponse( - message, application_manager)); - } else { - command.reset(new commands::PerformAudioPassThruRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::CreateInteractionChoiceSetID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::CreateInteractionChoiceSetResponse( - message, application_manager)); - } else { - command.reset(new commands::CreateInteractionChoiceSetRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::PerformInteractionID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::PerformInteractionResponse( - message, application_manager)); - } else { - command.reset(new commands::PerformInteractionRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::EndAudioPassThruID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::EndAudioPassThruResponse( - message, application_manager)); - } else { - command.reset(new commands::EndAudioPassThruRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::PutFileID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::PutFileResponse(message, application_manager)); - } else { - command.reset( - new commands::PutFileRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::DeleteFileID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::DeleteFileResponse(message, application_manager)); - } else { - command.reset( - new commands::DeleteFileRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::ListFilesID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::ListFilesResponse(message, application_manager)); - } else { - command.reset( - new commands::ListFilesRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SubscribeButtonID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SubscribeButtonResponse( - message, application_manager)); - } else { - command.reset( - new commands::SubscribeButtonRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::UnsubscribeButtonID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::UnsubscribeButtonResponse( - message, application_manager)); - } else { - command.reset(new commands::UnsubscribeButtonRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::ShowConstantTBTID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ShowConstantTBTResponse( - message, application_manager)); - } else { - command.reset( - new commands::ShowConstantTBTRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::ShowID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ShowResponse(message, application_manager)); - } else { - command.reset(new commands::ShowRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::GetWayPointsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command = utils::MakeShared<commands::GetWayPointsResponse>( - message, application_manager); - } else { - command = utils::MakeShared<commands::GetWayPointsRequest>( - message, application_manager); - } - break; - } - case mobile_apis::FunctionID::SubscribeVehicleDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SubscribeVehicleDataResponse( - message, application_manager)); - } else { - command.reset(new commands::SubscribeVehicleDataRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::UnsubscribeVehicleDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::UnsubscribeVehicleDataResponse( - message, application_manager)); - } else { - command.reset(new commands::UnsubscribeVehicleDataRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SubscribeWayPointsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command = utils::MakeShared<commands::SubscribeWayPointsResponse>( - message, application_manager); - } else { - command = utils::MakeShared<commands::SubscribeWayPointsRequest>( - message, application_manager); - } - break; - } - case mobile_apis::FunctionID::UnsubscribeWayPointsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command = utils::MakeShared<commands::UnsubscribeWayPointsResponse>( - message, application_manager); - } else { - command = utils::MakeShared<commands::UnSubscribeWayPointsRequest>( - message, application_manager); - } - break; - } - case mobile_apis::FunctionID::GetSystemCapabilityID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::GetSystemCapabilityResponse( - message, application_manager)); - } else { - command.reset(new commands::GetSystemCapabilityRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::ReadDIDID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::ReadDIDResponse(message, application_manager)); - } else { - command.reset( - new commands::ReadDIDRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::GetVehicleDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::GetVehicleDataResponse(message, application_manager)); - } else { - command.reset( - new commands::GetVehicleDataRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::ScrollableMessageID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ScrollableMessageResponse( - message, application_manager)); - } else { - command.reset(new commands::ScrollableMessageRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::AlertManeuverID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::AlertManeuverResponse(message, application_manager)); - } else { - command.reset( - new commands::AlertManeuverRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SetAppIconID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SetAppIconResponse(message, application_manager)); - } else { - command.reset( - new commands::SetAppIconRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SetDisplayLayoutID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SetDisplayLayoutResponse( - message, application_manager)); - } else { - command.reset(new commands::SetDisplayLayoutRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::UpdateTurnListID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::UpdateTurnListResponse(message, application_manager)); - } else { - command.reset( - new commands::UpdateTurnListRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::ChangeRegistrationID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::ChangeRegistrationResponse( - message, application_manager)); - } else { - command.reset(new commands::ChangeRegistrationRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::GetDTCsID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::GetDTCsResponse(message, application_manager)); - } else { - command.reset( - new commands::GetDTCsRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::DiagnosticMessageID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::DiagnosticMessageResponse( - message, application_manager)); - } else { - command.reset(new commands::DiagnosticMessageRequest( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SetMediaClockTimerID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset(new commands::SetMediaClockTimerResponse( - message, application_manager)); - } else { - command.reset( - new commands::SetMediaClockRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SystemRequestID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SystemResponse(message, application_manager)); - } else { - command.reset( - new commands::SystemRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SendLocationID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SendLocationResponse(message, application_manager)); - } else { - command.reset( - new commands::SendLocationRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::DialNumberID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::DialNumberResponse(message, application_manager)); - } else { - command.reset( - new commands::DialNumberRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::SendHapticDataID: { - if ((*message)[strings::params][strings::message_type] == - static_cast<int>(application_manager::MessageType::kResponse)) { - command.reset( - new commands::SendHapticDataResponse(message, application_manager)); - } else { - command.reset( - new commands::SendHapticDataRequest(message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::OnButtonEventID: { - command.reset(new commands::mobile::OnButtonEventNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnButtonPressID: { - command.reset(new commands::mobile::OnButtonPressNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnAudioPassThruID: { - command.reset(new commands::OnAudioPassThruNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnVehicleDataID: { - command.reset(new commands::OnVehicleDataNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnAppInterfaceUnregisteredID: { - command.reset(new commands::OnAppInterfaceUnregisteredNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnCommandID: { - command.reset( - new commands::OnCommandNotification(message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnTBTClientStateID: { - command.reset(new commands::OnTBTClientStateNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnDriverDistractionID: { - command.reset(new commands::mobile::OnDriverDistractionNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnLanguageChangeID: { - command.reset(new commands::OnLanguageChangeNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnPermissionsChangeID: { - command.reset(new commands::OnPermissionsChangeNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnHMIStatusID: { - if (commands::Command::ORIGIN_SDL == origin) { - command.reset(new commands::OnHMIStatusNotification( - message, application_manager)); - } else { - command.reset(new commands::OnHMIStatusNotificationFromMobile( - message, application_manager)); - } - break; - } - case mobile_apis::FunctionID::OnKeyboardInputID: { - command.reset(new commands::mobile::OnKeyBoardInputNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnTouchEventID: { - command.reset(new commands::mobile::OnTouchEventNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnSystemRequestID: { - command.reset(new commands::mobile::OnSystemRequestNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnHashChangeID: { - command.reset(new commands::mobile::OnHashChangeNotification( - message, application_manager)); - break; - } - case mobile_apis::FunctionID::OnWayPointChangeID: { - command = utils::MakeShared<commands::OnWayPointChangeNotification>( - message, application_manager); - break; - } - default: { - (*message)[strings::params][strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::GenericResponseID); - command.reset( - new commands::GenericResponse(message, application_manager)); - } - } - return command; -} - -} // namespace application_manager diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc index 2f06c5f3b5..1ee368a212 100644 --- a/src/components/application_manager/src/mobile_message_handler.cc +++ b/src/components/application_manager/src/mobile_message_handler.cc @@ -143,6 +143,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1( message->service_type())); if (!message) { NOTREACHED(); + delete outgoing_message; return NULL; } @@ -178,7 +179,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( return NULL; } - std::auto_ptr<application_manager::Message> outgoing_message( + std::unique_ptr<application_manager::Message> outgoing_message( new application_manager::Message( protocol_handler::MessagePriority::FromServiceType( message->service_type()))); diff --git a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc new file mode 100644 index 0000000000..bbd0011298 --- /dev/null +++ b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc @@ -0,0 +1,110 @@ +#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h" +#include <dlfcn.h> + +#include "utils/file_system.h" + +namespace application_manager { +namespace plugin_manager { + +CREATE_LOGGERPTR_GLOBAL(logger_, "PluginManager") + +RPCPluginManagerImpl::RPCPluginManagerImpl( + ApplicationManager& app_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : app_manager_(app_manager) + , rpc_service_(rpc_service) + , hmi_capabilities_(hmi_capabilities) + , policy_handler_(policy_handler) {} + +bool IsLibraryFile(const std::string& file_path) { + size_t pos = file_path.find_last_of("."); + if (std::string::npos == pos) { + return false; + } + if (file_path.substr(pos + 1).compare("so") != 0) { + return false; + } + return true; +} + +RPCPluginPtr LoadPlugin(const std::string& full_plugin_path) { + if (!IsLibraryFile(full_plugin_path)) { + LOG4CXX_DEBUG(logger_, "Skip loading " << full_plugin_path); + return RPCPluginPtr(); + } + + void* plugin_dll = dlopen(full_plugin_path.c_str(), RTLD_LAZY); + if (nullptr == plugin_dll) { + LOG4CXX_ERROR(logger_, + "Failed to open dll " << full_plugin_path << " : " + << dlerror()); + return RPCPluginPtr(); + } + + typedef RPCPlugin* (*Create)(); + Create create_plugin = reinterpret_cast<Create>(dlsym(plugin_dll, "Create")); + char* error_string = dlerror(); + if (nullptr != error_string) { + LOG4CXX_ERROR(logger_, + "Failed to export dll's " << full_plugin_path + << " symbols : " << error_string); + dlclose(plugin_dll); + return RPCPluginPtr(); + } + RPCPlugin* plugin = create_plugin(); + return RPCPluginPtr(plugin); +} + +uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) { + LOG4CXX_INFO(logger_, "Loading plugins from " << plugins_path); + std::vector<std::string> plugin_files = file_system::ListFiles(plugins_path); + for (auto& plugin_file : plugin_files) { + std::string full_name = plugins_path + '/' + plugin_file; + auto plugin = LoadPlugin(full_name); + if (!plugin) { + continue; + } + LOG4CXX_DEBUG(logger_, + "Loaded " << plugin->PluginName() << " plugin from " + << full_name); + if (plugin->Init( + app_manager_, rpc_service_, hmi_capabilities_, policy_handler_)) { + loaded_plugins_.push_back(std::move(plugin)); + } else { + LOG4CXX_ERROR(logger_, + "Initialisation of " << plugin->PluginName() + << " plugin from " << full_name + << " failed"); + } + } + return loaded_plugins_.size(); +} + +std::vector<RPCPluginPtr>& RPCPluginManagerImpl::GetPlugins() { + return loaded_plugins_; +} + +utils::Optional<RPCPlugin> RPCPluginManagerImpl::FindPluginToProcess( + const int32_t function_id, + const commands::Command::CommandSource message_source) { + typedef utils::Optional<RPCPlugin> PluginOptional; + for (auto& plugin : loaded_plugins_) { + if (plugin->IsAbleToProcess(function_id, message_source)) { + return PluginOptional(*plugin); + } + } + return PluginOptional(PluginOptional::EMPTY, + std::string("Plugin for processing RPC not found")); +} + +void RPCPluginManagerImpl::ForEachPlugin( + std::function<void(RPCPlugin&)> functor) { + for (auto& plugin : loaded_plugins_) { + functor(*plugin); + } +} + +} // namespace plugin_manager +} // namespace application_manager diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index 828f2d923a..f397814005 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -63,14 +63,6 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { -#ifdef HMI_DBUS_API - case hmi_apis::FunctionID::VehicleInfo_GetOdometer: { - ProcessOdometerEvent(message); - break; - } - default: { break; } - unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetOdometer); -#else case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: { ProcessOdometerEvent(message); unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData); @@ -82,7 +74,6 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) { break; } default: { break; } -#endif } } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 559b9c0035..cbc434a485 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -42,6 +42,7 @@ #include "application_manager/application_manager.h" #include "application_manager/state_controller.h" #include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" #include "policy/policy_manager_impl.h" #include "connection_handler/connection_handler.h" #include "utils/macro.h" @@ -53,11 +54,9 @@ #include "interfaces/MOBILE_API.h" #include "utils/file_system.h" #include "utils/scope_guard.h" -#include "utils/make_shared.h" + +#include "utils/helpers.h" #include "policy/policy_manager.h" -#ifdef SDL_REMOTE_CONTROL -#include "functional_module/plugin_manager.h" -#endif // SDL_REMOTE_CONTROL namespace policy { @@ -90,7 +89,8 @@ RequestTypeMap TypeToString = { {mobile_apis::RequestType::VEHICLE_DIAGNOSTICS, "VEHICLE_DIAGNOSTICS"}, {mobile_apis::RequestType::EMERGENCY, "EMERGENCY"}, {mobile_apis::RequestType::MEDIA, "MEDIA"}, - {mobile_apis::RequestType::FOTA, "FOTA"}}; + {mobile_apis::RequestType::FOTA, "FOTA"}, + {mobile_apis::RequestType::OEM_SPECIFIC, "OEM_SPECIFIC"}}; const std::string RequestTypeToString(mobile_apis::RequestType::eType type) { RequestTypeMap::const_iterator it = TypeToString.find(type); @@ -162,10 +162,12 @@ struct DeactivateApplication { void operator()(const ApplicationSharedPtr& app) { if (device_id_ == app->device()) { - state_ctrl_.SetRegularState(app, - mobile_apis::HMILevel::HMI_NONE, - mobile_apis::AudioStreamingState::NOT_AUDIBLE, - true); + state_ctrl_.SetRegularState( + app, + mobile_apis::HMILevel::HMI_NONE, + mobile_apis::AudioStreamingState::NOT_AUDIBLE, + mobile_apis::VideoStreamingState::NOT_STREAMABLE, + true); } } @@ -222,7 +224,7 @@ struct LinksCollector { } void operator()(const ApplicationSharedPtr& app) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Invalid pointer to application was passed." "Skip current application."); @@ -256,7 +258,7 @@ struct LinkAppToDevice { } void operator()(const ApplicationSharedPtr& app) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Invalid pointer to application was passed." "Skip current application."); @@ -325,8 +327,7 @@ PolicyHandler::PolicyHandler(const PolicySettings& settings, : AsyncRunner("PolicyHandler async runner thread") , dl_handle_(0) , last_activated_app_id_(0) - , app_to_device_link_lock_(true) - , statistic_manager_impl_(utils::MakeShared<StatisticManagerImpl>(this)) + , statistic_manager_impl_(std::make_shared<StatisticManagerImpl>(this)) , settings_(settings) , application_manager_(application_manager) {} @@ -353,14 +354,14 @@ bool PolicyHandler::LoadPolicyLibrary() { if (CreateManager()) { policy_manager_->set_listener(this); event_observer_ = - utils::SharedPtr<PolicyEventObserver>(new PolicyEventObserver( + std::shared_ptr<PolicyEventObserver>(new PolicyEventObserver( this, application_manager_.event_dispatcher())); } } else { LOG4CXX_ERROR(logger_, error); } - return policy_manager_.valid(); + return (policy_manager_.use_count() != 0); } bool PolicyHandler::CreateManager() { @@ -373,11 +374,11 @@ bool PolicyHandler::CreateManager() { char* error_string = dlerror(); if (NULL == error_string) { policy_manager_ = - utils::SharedPtr<PolicyManager>(create_manager(), delete_manager); + std::shared_ptr<PolicyManager>(create_manager(), delete_manager); } else { LOG4CXX_WARN(logger_, error_string); } - return policy_manager_.valid(); + return (policy_manager_.use_count() != 0); } const PolicySettings& PolicyHandler::get_settings() const { @@ -518,7 +519,7 @@ void PolicyHandler::SendOnAppPermissionsChanged( << policy_app_id); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "No app found for policy app id = " << policy_app_id); return; } @@ -553,7 +554,7 @@ struct SmartObjectToInt { StatusNotifier PolicyHandler::AddApplication( const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { - POLICY_LIB_CHECK(utils::MakeShared<utils::CallNothing>()); + POLICY_LIB_CHECK(std::make_shared<utils::CallNothing>()); return policy_manager_->AddApplication(application_id, hmi_types); } @@ -589,7 +590,7 @@ void PolicyHandler::OnAppPermissionConsentInternal( if (connection_key) { ApplicationSharedPtr app = application_manager_.application(connection_key); - if (app.valid()) { + if (app.use_count() != 0) { out_permissions.policy_app_id = app->policy_app_id(); DeviceParams device_params = GetDeviceParams( app->device(), @@ -616,7 +617,7 @@ void PolicyHandler::OnAppPermissionConsentInternal( // If list of apps sent to HMI for user consents is not the same as // current, // permissions should be set only for coincident to registered apps - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Invalid pointer to application was passed." "Permissions setting skipped."); @@ -657,9 +658,9 @@ void PolicyHandler::OnAppPermissionConsentInternal( void policy::PolicyHandler::SetDaysAfterEpoch() { POLICY_LIB_CHECK_VOID(); - TimevalStruct current_time = date_time::DateTime::getCurrentTime(); + date_time::TimeDuration current_time = date_time::getCurrentTime(); const int kSecondsInDay = 60 * 60 * 24; - int days_after_epoch = current_time.tv_sec / kSecondsInDay; + int days_after_epoch = date_time::getSecs(current_time) / kSecondsInDay; PTUpdatedAt(Counters::DAYS_AFTER_EPOCH, days_after_epoch); } @@ -731,7 +732,7 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions( ApplicationSharedPtr app = application_manager_.application(connection_key); std::vector<FunctionalGroupPermission> group_permissions; - if (NULL == app.get() || !app.valid()) { + if (NULL == app.get() || app.use_count() == 0) { LOG4CXX_WARN(logger_, "Connection key '" << connection_key @@ -881,7 +882,7 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Application with id '" << policy_app_id @@ -956,7 +957,7 @@ void PolicyHandler::OnPendingPermissionChange( POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "No app found for " << policy_app_id << " policy app id."); return; @@ -974,6 +975,7 @@ void PolicyHandler::OnPendingPermissionChange( app, mobile_apis::HMILevel::HMI_NONE, mobile_apis::AudioStreamingState::NOT_AUDIBLE, + mobile_apis::VideoStreamingState::NOT_STREAMABLE, true); policy_manager_->RemovePendingPermissionChanges(policy_app_id); return; @@ -1013,18 +1015,18 @@ void PolicyHandler::OnPendingPermissionChange( MessageHelper::SendOnAppPermissionsChangedNotification( app->app_id(), permissions, application_manager_); } - application_manager_.ManageMobileCommand( + application_manager_.GetRPCService().ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app->app_id(), mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED), - commands::Command::ORIGIN_SDL); + commands::Command::SOURCE_SDL); application_manager_.OnAppUnauthorized(app->app_id()); policy_manager_->RemovePendingPermissionChanges(policy_app_id); } - if (permissions.requestTypeChanged) { + if (permissions.requestTypeChanged || permissions.requestSubTypeChanged) { MessageHelper::SendOnAppPermissionsChangedNotification( app->app_id(), permissions, application_manager_); policy_manager_->RemovePendingPermissionChanges(policy_app_id); @@ -1080,12 +1082,7 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file, SetDaysAfterEpoch(); event_observer_->subscribe_on_event( -#ifdef HMI_DBUS_API - hmi_apis::FunctionID::VehicleInfo_GetOdometer, correlation_id -#else - hmi_apis::FunctionID::VehicleInfo_GetVehicleData, correlation_id -#endif - ); + hmi_apis::FunctionID::VehicleInfo_GetVehicleData, correlation_id); std::vector<std::string> vehicle_data_args; vehicle_data_args.push_back(strings::odometer); MessageHelper::CreateGetVehicleDataRequest( @@ -1193,10 +1190,6 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( accessor.GetData().end(), DeactivateApplication(device_handle, application_manager_.state_controller())); -#ifdef SDL_REMOTE_CONTROL - application_manager_.GetPluginManager().OnPolicyEvent( - functional_modules::PolicyEvent::kApplicationsDisabled); -#endif // SDL_REMOTE_CONTROL } else { std::for_each( accessor.GetData().begin(), @@ -1245,12 +1238,15 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( if (is_allowed) { // Send HMI status notification to mobile // Put application in full - AudioStreamingState::eType state = app->is_audio() - ? AudioStreamingState::AUDIBLE - : AudioStreamingState::NOT_AUDIBLE; + AudioStreamingState::eType audio_state = + app->IsAudioApplication() ? AudioStreamingState::AUDIBLE + : AudioStreamingState::NOT_AUDIBLE; + VideoStreamingState::eType video_state = + app->IsVideoApplication() ? VideoStreamingState::STREAMABLE + : VideoStreamingState::NOT_STREAMABLE; application_manager_.state_controller().SetRegularState( - app, mobile_apis::HMILevel::HMI_FULL, state, true); + app, mobile_apis::HMILevel::HMI_FULL, audio_state, video_state, true); last_activated_app_id_ = 0; } else { DeactivateApplication deactivate_notification( @@ -1270,9 +1266,8 @@ void PolicyHandler::OnIgnitionCycleOver() { void PolicyHandler::OnActivateApp(uint32_t connection_key, uint32_t correlation_id) { LOG4CXX_AUTO_TRACE(logger_); - POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application(connection_key); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Activated App failed: no app found."); return; } @@ -1366,7 +1361,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN( logger_, "Connection_key not found for application_id:" << policy_app_id); @@ -1419,7 +1414,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN( logger_, "Connection_key not found for application_id:" << policy_app_id); @@ -1462,7 +1457,7 @@ void PolicyHandler::OnSnapshotCreated( std::string policy_snapshot_full_path; if (SaveSnapshot(pt_string, policy_snapshot_full_path)) { const uint32_t timeout_exchange_s = - timeout_exchange_ms / date_time::DateTime::MILLISECONDS_IN_SECOND; + timeout_exchange_ms / date_time::MILLISECONDS_IN_SECOND; MessageHelper::SendPolicyUpdate(policy_snapshot_full_path, timeout_exchange_s, retry_delay_seconds, @@ -1519,6 +1514,13 @@ void PolicyHandler::CheckPermissions( POLICY_LIB_CHECK_VOID(); const std::string hmi_level = MessageHelper::StringifiedHMILevel(app->hmi_level()); + if (hmi_level.empty()) { + LOG4CXX_WARN(logger_, + "HMI level for " << app->policy_app_id() << " is invalid, rpc " + << rpc << " is not allowed."); + result.hmi_level_permitted = policy::kRpcDisallowed; + return; + } const std::string device_id = MessageHelper::GetDeviceMacAddressForHandle( app->device(), application_manager_); LOG4CXX_INFO(logger_, @@ -1584,7 +1586,7 @@ uint32_t PolicyHandler::NextRetryTimeout() { } uint32_t PolicyHandler::TimeoutExchangeSec() const { - return TimeoutExchangeMSec() / date_time::DateTime::MILLISECONDS_IN_SECOND; + return TimeoutExchangeMSec() / date_time::MILLISECONDS_IN_SECOND; } uint32_t PolicyHandler::TimeoutExchangeMSec() const { @@ -1623,7 +1625,7 @@ void PolicyHandler::remove_listener(PolicyHandlerObserver* listener) { listeners_.remove(listener); } -utils::SharedPtr<usage_statistics::StatisticsManager> +std::shared_ptr<usage_statistics::StatisticsManager> PolicyHandler::GetStatisticManager() const { return statistic_manager_impl_; } @@ -1665,7 +1667,7 @@ custom_str::CustomString PolicyHandler::GetAppName( ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN( logger_, "Connection_key not found for application_id:" << policy_app_id); @@ -1879,6 +1881,18 @@ void PolicyHandler::OnAppRegisteredOnMobile(const std::string& application_id) { policy_manager_->OnAppRegisteredOnMobile(application_id); } +RequestType::State PolicyHandler::GetAppRequestTypeState( + const std::string& policy_app_id) const { + POLICY_LIB_CHECK(RequestType::State::UNAVAILABLE); + return policy_manager_->GetAppRequestTypesState(policy_app_id); +} + +RequestSubType::State PolicyHandler::GetAppRequestSubTypeState( + const std::string& policy_app_id) const { + POLICY_LIB_CHECK(RequestSubType::State::UNAVAILABLE); + return policy_manager_->GetAppRequestSubTypesState(policy_app_id); +} + bool PolicyHandler::IsRequestTypeAllowed( const std::string& policy_app_id, mobile_apis::RequestType::eType type) const { @@ -1891,17 +1905,66 @@ bool PolicyHandler::IsRequestTypeAllowed( return false; } - std::vector<std::string> request_types = - policy_manager_->GetAppRequestTypes(policy_app_id); + const RequestType::State request_type_state = + policy_manager_->GetAppRequestTypesState(policy_app_id); - // If no request types are assigned to app - any is allowed - if (request_types.empty()) { - return true; + switch (request_type_state) { + case RequestType::State::EMPTY: { + // If empty array of request types is assigned to app - any is allowed + LOG4CXX_TRACE(logger_, "Any Request Type is allowed by policies."); + return true; + } + case RequestType::State::OMITTED: { + // If RequestType parameter omitted for app - any is disallowed + LOG4CXX_TRACE(logger_, "All Request Types are disallowed by policies."); + return false; + } + case RequestType::State::AVAILABLE: { + // If any of request types is available for current application - get them + const auto request_types = + policy_manager_->GetAppRequestTypes(policy_app_id); + return helpers::in_range(request_types, stringified_type); + } + default: + return false; } +} - std::vector<std::string>::const_iterator it = - std::find(request_types.begin(), request_types.end(), stringified_type); - return request_types.end() != it; +bool PolicyHandler::IsRequestSubTypeAllowed( + const std::string& policy_app_id, + const std::string& request_subtype) const { + POLICY_LIB_CHECK(false); + using namespace mobile_apis; + + if (request_subtype.empty()) { + LOG4CXX_ERROR(logger_, "Request subtype to check is empty."); + return false; + } + + const RequestSubType::State request_subtype_state = + policy_manager_->GetAppRequestSubTypesState(policy_app_id); + switch (request_subtype_state) { + case RequestSubType::State::EMPTY: { + // If empty array of request subtypes is assigned to app - any is allowed + LOG4CXX_TRACE(logger_, "Any Request SubType is allowed by policies."); + return true; + } + case RequestSubType::State::OMITTED: { + // If RequestSubType parameter omitted for app - any is disallowed + LOG4CXX_TRACE(logger_, + "All Request SubTypes are disallowed by policies."); + return false; + } + case RequestSubType::State::AVAILABLE: { + // If any of request subtypes is available for current application + // get them all + const auto request_subtypes = + policy_manager_->GetAppRequestSubTypes(policy_app_id); + return helpers::in_range(request_subtypes, request_subtype); + } + default: + return false; + } } const std::vector<std::string> PolicyHandler::GetAppRequestTypes( @@ -1910,6 +1973,12 @@ const std::vector<std::string> PolicyHandler::GetAppRequestTypes( return policy_manager_->GetAppRequestTypes(policy_app_id); } +const std::vector<std::string> PolicyHandler::GetAppRequestSubTypes( + const std::string& policy_app_id) const { + POLICY_LIB_CHECK(std::vector<std::string>()); + return policy_manager_->GetAppRequestSubTypes(policy_app_id); +} + const VehicleInfo policy::PolicyHandler::GetVehicleInfo() const { POLICY_LIB_CHECK(VehicleInfo()); return policy_manager_->GetVehicleInfo(); @@ -1961,8 +2030,6 @@ bool PolicyHandler::IsUrlAppIdValid(const uint32_t app_idx, return ((is_registered && !is_empty_urls) || is_default); } -#ifdef SDL_REMOTE_CONTROL - std::vector<std::string> PolicyHandler::GetDevicesIds( const std::string& policy_app_id) { return application_manager_.devices(policy_app_id); @@ -2096,5 +2163,4 @@ void PolicyHandler::OnUpdateHMILevel(const std::string& device_id, } UpdateHMILevel(app, level); } -#endif // SDL_REMOTE_CONTROL } // namespace policy diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index 1b9bd7ffb9..28c773ffcb 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -34,8 +34,8 @@ #include "application_manager/request_controller.h" #include "application_manager/commands/command_request_impl.h" -#include "application_manager/commands/hmi/request_to_hmi.h" -#include "utils/make_shared.h" +#include "application_manager/commands/request_to_hmi.h" + #include "utils/timer_task_impl.h" namespace application_manager { @@ -50,6 +50,7 @@ RequestController::RequestController(const RequestControlerSettings& settings) : pool_state_(UNDEFINED) , pool_size_(settings.thread_pool_size()) , request_tracker_(settings) + , duplicate_message_count_() , timer_("AM RequestCtrlTimer", new timer::TimerTaskImpl<RequestController>( this, &RequestController::TimeoutThread)) @@ -175,7 +176,7 @@ RequestController::TResult RequestController::addHMIRequest( const RequestPtr request) { LOG4CXX_AUTO_TRACE(logger_); - if (!request.valid()) { + if (request.use_count() == 0) { LOG4CXX_ERROR(logger_, "HMI request pointer is invalid"); return RequestController::INVALID_DATA; } @@ -184,7 +185,7 @@ RequestController::TResult RequestController::addHMIRequest( const uint64_t timeout_in_mseconds = static_cast<uint64_t>(request->default_timeout()); RequestInfoPtr request_info_ptr = - utils::MakeShared<HMIRequestInfo>(request, timeout_in_mseconds); + std::make_shared<HMIRequestInfo>(request, timeout_in_mseconds); if (0 == timeout_in_mseconds) { LOG4CXX_DEBUG(logger_, @@ -230,6 +231,21 @@ void RequestController::TerminateRequest(const uint32_t correlation_id, << correlation_id << " connection_key = " << connection_key << " function_id = " << function_id << " force_terminate = " << force_terminate); + { + AutoLock auto_lock(duplicate_message_count_lock_); + auto dup_it = duplicate_message_count_.find(correlation_id); + if (duplicate_message_count_.end() != dup_it) { + duplicate_message_count_[correlation_id]--; + if (0 == duplicate_message_count_[correlation_id]) { + duplicate_message_count_.erase(dup_it); + } + LOG4CXX_DEBUG(logger_, + "Ignoring termination request due to duplicate correlation " + "ID being sent"); + return; + } + } + RequestInfoPtr request = waiting_for_response_.Find(connection_key, correlation_id); if (!request) { @@ -271,7 +287,7 @@ void RequestController::terminateWaitingForExecutionAppRequests( std::list<RequestPtr>::iterator request_it = mobile_request_list_.begin(); while (mobile_request_list_.end() != request_it) { RequestPtr request = (*request_it); - if ((request.valid()) && (request->connection_key() == app_id)) { + if ((request.use_count() != 0) && (request->connection_key() == app_id)) { mobile_request_list_.erase(request_it++); } else { ++request_it; @@ -391,11 +407,11 @@ void RequestController::TimeoutThread() { << " request id: " << probably_expired->requestId() << " connection_key: " << probably_expired->app_id() << " NOT expired"); - const TimevalStruct current_time = date_time::DateTime::getCurrentTime(); - const TimevalStruct end_time = probably_expired->end_time(); + const date_time::TimeDuration current_time = date_time::getCurrentTime(); + const date_time::TimeDuration end_time = probably_expired->end_time(); if (current_time < end_time) { - const uint32_t msecs = static_cast<uint32_t>( - date_time::DateTime::getmSecs(end_time - current_time)); + const uint32_t msecs = + static_cast<uint32_t>(date_time::getmSecs(end_time - current_time)); LOG4CXX_DEBUG(logger_, "Sleep for " << msecs << " millisecs"); timer_condition_.WaitFor(auto_lock, msecs); } @@ -472,9 +488,26 @@ void RequestController::Worker::threadMain() { const uint32_t timeout_in_mseconds = request_ptr->default_timeout(); RequestInfoPtr request_info_ptr = - utils::MakeShared<MobileRequestInfo>(request_ptr, timeout_in_mseconds); - - request_controller_->waiting_for_response_.Add(request_info_ptr); + std::make_shared<MobileRequestInfo>(request_ptr, timeout_in_mseconds); + + if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) { + commands::CommandRequestImpl* cmd_request = + dynamic_cast<commands::CommandRequestImpl*>(request_ptr.get()); + if (cmd_request != NULL) { + uint32_t corr_id = cmd_request->correlation_id(); + request_controller_->duplicate_message_count_lock_.Acquire(); + auto dup_it = + request_controller_->duplicate_message_count_.find(corr_id); + if (request_controller_->duplicate_message_count_.end() == dup_it) { + request_controller_->duplicate_message_count_[corr_id] = 0; + } + request_controller_->duplicate_message_count_[corr_id]++; + request_controller_->duplicate_message_count_lock_.Release(); + cmd_request->SendResponse( + false, mobile_apis::Result::INVALID_ID, "Duplicate correlation_id"); + } + continue; + } LOG4CXX_DEBUG(logger_, "timeout_in_mseconds " << timeout_in_mseconds); if (0 != timeout_in_mseconds) { diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 9a5828d939..45e56c5f9e 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -51,7 +51,7 @@ HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec) } HMIRequestInfo::HMIRequestInfo(RequestPtr request, - const TimevalStruct& start_time, + const date_time::TimeDuration& start_time, const uint64_t timeout_msec) : RequestInfo(request, HMIRequest, start_time, timeout_msec) { correlation_id_ = request_->correlation_id(); @@ -66,7 +66,7 @@ MobileRequestInfo::MobileRequestInfo(RequestPtr request, } MobileRequestInfo::MobileRequestInfo(RequestPtr request, - const TimevalStruct& start_time, + const date_time::TimeDuration& start_time, const uint64_t timeout_msec) : RequestInfo(request, MobileRequest, start_time, timeout_msec) { correlation_id_ = request_.get()->correlation_id(); @@ -75,7 +75,7 @@ MobileRequestInfo::MobileRequestInfo(RequestPtr request, RequestInfo::RequestInfo(RequestPtr request, const RequestInfo::RequestType requst_type, - const TimevalStruct& start_time, + const date_time::TimeDuration& start_time, const uint64_t timeout_msec) : request_(request), start_time_(start_time), timeout_msec_(timeout_msec) { updateEndTime(); @@ -85,8 +85,8 @@ RequestInfo::RequestInfo(RequestPtr request, } void application_manager::request_controller::RequestInfo::updateEndTime() { - end_time_ = date_time::DateTime::getCurrentTime(); - date_time::DateTime::AddMilliseconds(end_time_, timeout_msec_); + end_time_ = date_time::getCurrentTime(); + date_time::AddMilliseconds(end_time_, timeout_msec_); } void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) { @@ -95,9 +95,8 @@ void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) { } bool RequestInfo::isExpired() { - TimevalStruct curr_time = date_time::DateTime::getCurrentTime(); - return date_time::DateTime::getmSecs(end_time_) <= - date_time::DateTime::getmSecs(curr_time); + date_time::TimeDuration curr_time = date_time::getCurrentTime(); + return date_time::getmSecs(end_time_) <= date_time::getmSecs(curr_time); } uint64_t RequestInfo::hash() { @@ -151,7 +150,7 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key, RequestInfoPtr result; // Request info for searching in request info set by log_n time - utils::SharedPtr<FakeRequestInfo> request_info_for_search( + std::shared_ptr<FakeRequestInfo> request_info_for_search( new FakeRequestInfo(connection_key, correlation_id)); sync_primitives::AutoLock lock(this_lock_); @@ -283,7 +282,7 @@ bool RequestInfoSet::AppIdCompararator::operator()( bool RequestInfoTimeComparator::operator()(const RequestInfoPtr lhs, const RequestInfoPtr rhs) const { date_time::TimeCompare compare_result = - date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time()); + date_time::compareTime(lhs->end_time(), rhs->end_time()); if (compare_result == date_time::LESS) { return true; } else if (compare_result == date_time::GREATER) { diff --git a/src/components/application_manager/src/request_tracker.cc b/src/components/application_manager/src/request_tracker.cc index 13b3d4d873..c047c82579 100644 --- a/src/components/application_manager/src/request_tracker.cc +++ b/src/components/application_manager/src/request_tracker.cc @@ -77,7 +77,7 @@ bool RequestTracker::Track(const ApplicationID& app_id, const uint32_t max_requests, ApplicationsRequestsTracker& tracker) { LOG4CXX_AUTO_TRACE(logger_); - using date_time::DateTime; + using namespace date_time; if (!time_scale || !max_requests) { LOG4CXX_INFO(logger_, "Time scale request tracking is disabled."); @@ -93,7 +93,7 @@ bool RequestTracker::Track(const ApplicationID& app_id, if (tracker.end() == it_app) { LOG4CXX_DEBUG(logger_, "Adding new application into tracking."); - tracker[app_id].push_back(DateTime::getCurrentTime()); + tracker[app_id].push_back(getCurrentTime()); return true; } @@ -102,25 +102,24 @@ bool RequestTracker::Track(const ApplicationID& app_id, if (it_app->second.size() < max_requests) { LOG4CXX_DEBUG(logger_, "Adding new request into tracking."); - tracker[app_id].push_back(DateTime::getCurrentTime()); + tracker[app_id].push_back(getCurrentTime()); return true; } LOG4CXX_DEBUG(logger_, "Oldest request is added at: " - << DateTime::getmSecs(it_app->second.front()) - << ". Current time is: " - << DateTime::getmSecs(DateTime::getCurrentTime()) + << getmSecs(it_app->second.front()) + << ". Current time is: " << getmSecs(getCurrentTime()) << ". Time scale is: " << time_scale); - if (DateTime::calculateTimeSpan(it_app->second.front()) > time_scale) { + if (calculateTimeSpan(it_app->second.front()) > time_scale) { LOG4CXX_DEBUG(logger_, "Dropping oldest request, adding new one."); ApplicationsRequestsTracker::mapped_type& times = tracker[app_id]; DCHECK_OR_RETURN(!times.empty(), false); times.erase(times.begin()); - times.push_back(DateTime::getCurrentTime()); + times.push_back(getCurrentTime()); return true; } diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index e3fd423970..3e77078ee5 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -35,6 +35,7 @@ #include <algorithm> #include "application_manager/application_manager.h" +#include "application_manager/rpc_service.h" #include "utils/file_system.h" #include "connection_handler/connection_handler_impl.h" @@ -47,17 +48,22 @@ #include "utils/helpers.h" #include "application_manager/resumption/resumption_data_db.h" #include "application_manager/resumption/resumption_data_json.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace resumption { using namespace application_manager; +static mobile_api::HMILevel::eType PickHigherHmiLevel( + mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2); +static mobile_api::HMILevel::eType PickLowerHmiLevel( + mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2); +static mobile_api::HMILevel::eType ConvertHmiLevelString(const std::string str); + CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager) : event_engine::EventObserver(application_manager.event_dispatcher()) - , queue_lock_(false) , restore_hmi_level_timer_( "RsmCtrlRstore", new timer::TimerTaskImpl<ResumeCtrlImpl>( @@ -68,13 +74,20 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager) , is_resumption_active_(false) , is_data_saved_(false) , is_suspended_(false) - , launch_time_(time(NULL)) + , launch_time_(time(nullptr)) + , low_voltage_time_(0) + , wake_up_time_(0) , application_manager_(application_manager) {} #ifdef BUILD_TESTS void ResumeCtrlImpl::set_resumption_storage( - utils::SharedPtr<ResumptionData> mock_storage) { + std::shared_ptr<ResumptionData> mock_storage) { resumption_storage_ = mock_storage; } + +bool ResumeCtrlImpl::get_resumption_active() const { + sync_primitives::AutoLock auto_lock(queue_lock_); + return is_resumption_active_; +} #endif // BUILD_TESTS bool ResumeCtrlImpl::Init(resumption::LastState& last_state) { @@ -117,6 +130,8 @@ bool ResumeCtrlImpl::Init(resumption::LastState& last_state) { application_manager_.get_settings() .app_resumption_save_persistent_data_timeout(), timer::kPeriodic); + + resumption_storage_->IncrementGlobalIgnOnCounter(); return true; } @@ -133,9 +148,13 @@ void ResumeCtrlImpl::SaveAllApplications() { void ResumeCtrlImpl::SaveApplication(ApplicationSharedPtr application) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(application); - LOG4CXX_INFO(logger_, - "application with appID " << application->app_id() - << " will be saved"); + if (application_manager_.IsLowVoltage()) { + LOG4CXX_DEBUG(logger_, "Low Voltage state is active"); + return; + } + LOG4CXX_DEBUG(logger_, + "application with appID " << application->app_id() + << " will be saved"); resumption_storage_->SaveApplication(application); } @@ -157,10 +176,38 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) { if (result) { DCHECK_OR_RETURN(application, false); if (saved_app.keyExists(strings::hmi_level)) { - const HMILevel::eType saved_hmi_level = - static_cast<mobile_apis::HMILevel::eType>( - saved_app[strings::hmi_level].asInt()); - LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level); + HMILevel::eType saved_hmi_level; + if (HMILevel::eType::INVALID_ENUM != + application->deferred_resumption_hmi_level()) { + saved_hmi_level = application->deferred_resumption_hmi_level(); + LOG4CXX_INFO(logger_, + "Retry resuming into HMI level : " << saved_hmi_level); + application->set_deferred_resumption_hmi_level( + HMILevel::eType::INVALID_ENUM); + } else { + saved_hmi_level = static_cast<mobile_apis::HMILevel::eType>( + saved_app[strings::hmi_level].asInt()); + LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level); + } + + // Check one of the high-bandwidth transports (configured through + // smartDeviceLink.ini file) is available. If not, then the HMI level to + // resume into will be modified. + if (!application_manager_.CheckResumptionRequiredTransportAvailable( + application)) { + mobile_apis::HMILevel::eType low_bandwidth_level = + GetHmiLevelOnLowBandwidthTransport(application); + + application->set_deferred_resumption_hmi_level(saved_hmi_level); + + saved_hmi_level = + PickLowerHmiLevel(saved_hmi_level, low_bandwidth_level); + LOG4CXX_DEBUG( + logger_, + "High-bandwidth transport not available, app will resume into : " + << saved_hmi_level); + } + return SetAppHMIState(application, saved_hmi_level, true); } else { result = false; @@ -175,9 +222,23 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) { bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(application, false); - mobile_apis::HMILevel::eType default_hmi = + mobile_apis::HMILevel::eType hmi_level = application_manager_.GetDefaultHmiLevel(application); - return SetAppHMIState(application, default_hmi, false); + + // Check one of the high-bandwidth transports (configured through + // smartDeviceLink.ini file) is available. If not, then the HMI level to + // resume into will be modified. + if (!application_manager_.CheckResumptionRequiredTransportAvailable( + application)) { + mobile_apis::HMILevel::eType low_bandwidth_level = + GetHmiLevelOnLowBandwidthTransport(application); + hmi_level = PickLowerHmiLevel(hmi_level, low_bandwidth_level); + LOG4CXX_DEBUG( + logger_, + "High-bandwidth transport not available, default HMI level is set to : " + << hmi_level); + } + return SetAppHMIState(application, hmi_level, false); } void ResumeCtrlImpl::ApplicationResumptiOnTimer() { @@ -257,6 +318,10 @@ uint32_t ResumeCtrlImpl::GetHMIApplicationID( bool ResumeCtrlImpl::RemoveApplicationFromSaved( ApplicationConstSharedPtr application) { + if (application_manager_.IsLowVoltage()) { + LOG4CXX_DEBUG(logger_, "Low Voltage state is active"); + return false; + } const std::string& device_mac = application->mac_address(); return resumption_storage_->RemoveApplicationFromSaved( application->policy_app_id(), device_mac); @@ -270,8 +335,11 @@ void ResumeCtrlImpl::OnSuspend() { void ResumeCtrlImpl::OnIgnitionOff() { LOG4CXX_AUTO_TRACE(logger_); - resumption_storage_->IncrementIgnOffCount(); - FinalPersistData(); + if (!application_manager_.IsLowVoltage()) { + resumption_storage_->IncrementIgnOffCount(); + resumption_storage_->ResetGlobalIgnOnCount(); + FinalPersistData(); + } } void ResumeCtrlImpl::OnAwake() { @@ -281,6 +349,25 @@ void ResumeCtrlImpl::OnAwake() { StartSavePersistentDataTimer(); } +void ResumeCtrlImpl::SaveLowVoltageTime() { + low_voltage_time_ = time(nullptr); + LOG4CXX_DEBUG(logger_, + "Low Voltage timestamp : " << low_voltage_time_ << " saved"); +} + +void ResumeCtrlImpl::SaveWakeUpTime() { + wake_up_time_ = std::time(nullptr); + LOG4CXX_DEBUG(logger_, "Wake Up timestamp : " << wake_up_time_ << " saved"); +} + +time_t ResumeCtrlImpl::LowVoltageTime() const { + return low_voltage_time_; +} + +time_t ResumeCtrlImpl::WakeUpTime() const { + return wake_up_time_; +} + bool ResumeCtrlImpl::is_suspended() const { return is_suspended_; } @@ -352,6 +439,28 @@ bool ResumeCtrlImpl::StartResumptionOnlyHMILevel( return result; } +void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) { + LOG4CXX_AUTO_TRACE(logger_); + + ApplicationSharedPtr app = application_manager_.application(app_id); + if (!app) { + LOG4CXX_WARN(logger_, "Invalid app_id = " << app_id); + return; + } + + { + sync_primitives::AutoLock auto_lock(queue_lock_); + // check and update resumption deferred flag in queue_lock_ + if (mobile_api::HMILevel::eType::INVALID_ENUM == + app->deferred_resumption_hmi_level()) { + LOG4CXX_DEBUG(logger_, "No need to retry resumption for app: " << app_id); + return; + } + } + + AddToResumptionTimerQueue(app_id); +} + void ResumeCtrlImpl::StartAppHmiStateResumption( ApplicationSharedPtr application) { using namespace date_time; @@ -365,15 +474,33 @@ void ResumeCtrlImpl::StartAppHmiStateResumption( LOG4CXX_ERROR(logger_, "Application was not saved"); return; } - const uint32_t ign_off_count = saved_app[strings::ign_off_count].asUInt(); - bool restore_data_allowed = false; - restore_data_allowed = - CheckAppRestrictions(application, saved_app) && - ((0 == ign_off_count) || CheckIgnCycleRestrictions(saved_app)); - if (restore_data_allowed) { + + const bool is_hmi_level_applicable_to_resume = + CheckAppRestrictions(application, saved_app); + + if (!is_hmi_level_applicable_to_resume) { + LOG4CXX_DEBUG(logger_, "No applicable HMI level found for resuming"); + return; + } + + const bool is_resume_allowed_by_low_voltage = + CheckLowVoltageRestrictions(saved_app); + + const bool is_hmi_level_allowed_by_ign_cycle = + CheckIgnCycleRestrictions(saved_app); + + const bool restore_hmi_level_allowed = + is_resume_allowed_by_low_voltage && is_hmi_level_allowed_by_ign_cycle; + + if (restore_hmi_level_allowed) { LOG4CXX_INFO(logger_, "Resume application " << application->policy_app_id()); RestoreAppHMIState(application); + if (mobile_apis::HMILevel::eType::INVALID_ENUM != + application->deferred_resumption_hmi_level()) { + // the application has not been fully resumed + return; + } RemoveApplicationFromSaved(application); } else { LOG4CXX_INFO(logger_, @@ -544,8 +671,12 @@ void ResumeCtrlImpl::AddCommands(ApplicationSharedPtr application, saved_app[strings::application_commands]; for (size_t i = 0; i < app_commands.length(); ++i) { const smart_objects::SmartObject& command = app_commands[i]; + const uint32_t cmd_id = command[strings::cmd_id].asUInt(); + const bool is_resumption = true; - application->AddCommand(command[strings::cmd_id].asUInt(), command); + application->AddCommand(cmd_id, command); + application->help_prompt_manager().OnVrCommandAdded( + cmd_id, command, is_resumption); } ProcessHMIRequests(MessageHelper::CreateAddCommandRequestToHMI( application, application_manager_)); @@ -623,17 +754,8 @@ void ResumeCtrlImpl::AddSubscriptions( MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( application, application_manager_); - if (subscriptions.keyExists(strings::application_vehicle_info)) { - const smart_objects::SmartObject& subscriptions_ivi = - subscriptions[strings::application_vehicle_info]; - mobile_apis::VehicleDataType::eType ivi; - for (size_t i = 0; i < subscriptions_ivi.length(); ++i) { - ivi = static_cast<mobile_apis::VehicleDataType::eType>( - (subscriptions_ivi[i]).asInt()); - application->SubscribeToIVI(ivi); - } - ProcessHMIRequests(MessageHelper::GetIVISubscriptionRequests( - application, application_manager_)); + for (auto& extension : application->Extensions()) { + extension->ProcessResumption(subscriptions); } } } @@ -641,30 +763,62 @@ void ResumeCtrlImpl::AddSubscriptions( bool ResumeCtrlImpl::CheckIgnCycleRestrictions( const smart_objects::SmartObject& saved_app) { LOG4CXX_AUTO_TRACE(logger_); - bool result = true; if (!CheckDelayAfterIgnOn()) { - LOG4CXX_INFO(logger_, "Application was connected long after ign on"); - result = false; + LOG4CXX_DEBUG(logger_, "Application was connected long after ign on"); + return false; } - if (!DisconnectedJustBeforeIgnOff(saved_app)) { - LOG4CXX_INFO(logger_, "Application was dissconnected long before ign off"); - result = false; + if (!CheckDelayBeforeIgnOff(saved_app)) { + LOG4CXX_DEBUG(logger_, "Application was disconnected long before ign off"); + return false; } - return result; + return true; } -bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff( +bool ResumeCtrlImpl::CheckLowVoltageRestrictions( const smart_objects::SmartObject& saved_app) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!CheckDelayBeforeLowVoltage(saved_app)) { + LOG4CXX_DEBUG(logger_, + "Application was disconnected long before low voltage"); + return false; + } + + if (!CheckDelayAfterWakeUp()) { + LOG4CXX_DEBUG(logger_, "Application was connected long after wake up"); + return false; + } + + LOG4CXX_DEBUG(logger_, "HMI Level resuming in not restricted by Low Voltage"); + return true; +} + +bool ResumeCtrlImpl::CheckDelayBeforeIgnOff( + const smart_objects::SmartObject& saved_app) const { using namespace date_time; LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); const time_t time_stamp = static_cast<time_t>(saved_app[strings::time_stamp].asInt()); - time_t ign_off_time = + const time_t ign_off_time = static_cast<time_t>(resumption_storage_->GetIgnOffTime()); + + if (CheckIgnCyclesData() && 0 == ign_off_time) { + LOG4CXX_DEBUG( + logger_, "No IGNITION OFF records found: This is first Ignition cycle"); + return true; + } + + // This means that ignition off timestamp was not saved + // Possible reasons: Low Voltage event, core crash etc. + if (ign_off_time < time_stamp) { + LOG4CXX_DEBUG(logger_, "Last IGNITION OFF record missed"); + return true; + } + const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp); LOG4CXX_DEBUG( logger_, @@ -677,6 +831,71 @@ bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff( application_manager_.get_settings().resumption_delay_before_ign(); } +bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage( + const smart_objects::SmartObject& saved_app) const { + using namespace date_time; + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); + + if (0 == LowVoltageTime()) { + LOG4CXX_DEBUG(logger_, "No Low Voltage signal timestamp saved"); + return true; + } + + const time_t unregistration_time_stamp = + static_cast<time_t>(saved_app[strings::time_stamp].asInt()); + const time_t low_voltage_timestamp = static_cast<time_t>(LowVoltageTime()); + const int32_t sec_spent_before_low_voltage = + (low_voltage_timestamp - unregistration_time_stamp); + if (0 > sec_spent_before_low_voltage) { + LOG4CXX_DEBUG(logger_, + "Low Voltage time: " + << low_voltage_timestamp + << "; App disconnect time: " << unregistration_time_stamp + << "; Secs between app disconnect and low voltage event " + << sec_spent_before_low_voltage); + return true; + } + + const uint32_t secs_between_app_disconnect_and_low_voltage = + static_cast<uint32_t>(sec_spent_before_low_voltage); + const uint32_t wait_time = + application_manager_.get_settings().resumption_delay_before_ign(); + LOG4CXX_DEBUG(logger_, + "Low Voltage time: " + << low_voltage_timestamp + << "; App disconnect time: " << unregistration_time_stamp + << "; Secs between app disconnect and low voltage event " + << secs_between_app_disconnect_and_low_voltage + << "; Timeout for HMI level resuming: " << wait_time); + return secs_between_app_disconnect_and_low_voltage <= wait_time; +} + +bool ResumeCtrlImpl::CheckDelayAfterWakeUp() const { + using namespace date_time; + LOG4CXX_AUTO_TRACE(logger_); + + if (0 == WakeUpTime()) { + LOG4CXX_DEBUG(logger_, "No WakeUp signal timestamp saved"); + return true; + } + + const time_t current_time = time(nullptr); + const time_t wake_up_timestamp = static_cast<time_t>(WakeUpTime()); + + const uint32_t seconds_from_wake_up_signal = + labs(current_time - wake_up_timestamp); + const uint32_t wait_time = + application_manager_.get_settings().resumption_delay_after_ign(); + LOG4CXX_DEBUG( + logger_, + "Current time: " << current_time << "; WakeUp Signal time: " + << wake_up_timestamp << "; Seconds passed from wake up: " + << seconds_from_wake_up_signal + << "; Timeout for HMI level resuming: " << wait_time); + return seconds_from_wake_up_signal <= wait_time; +} + bool ResumeCtrlImpl::CheckAppRestrictions( ApplicationConstSharedPtr application, const smart_objects::SmartObject& saved_app) { @@ -685,16 +904,23 @@ bool ResumeCtrlImpl::CheckAppRestrictions( LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN(saved_app.keyExists(strings::hmi_level), false); - const HMILevel::eType hmi_level = - static_cast<HMILevel::eType>(saved_app[strings::hmi_level].asInt()); + HMILevel::eType hmi_level; + if (mobile_api::HMILevel::eType::INVALID_ENUM != + application->deferred_resumption_hmi_level()) { + hmi_level = application->deferred_resumption_hmi_level(); + } else { + hmi_level = + static_cast<HMILevel::eType>(saved_app[strings::hmi_level].asInt()); + } const bool result = Compare<HMILevel::eType, EQ, ONE>( hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED) ? true : false; LOG4CXX_DEBUG(logger_, - "is_media_app " << application->is_media_application() - << "; hmi_level " << hmi_level << " result " - << result); + "is_media_app: " << application->is_media_application() + << "; hmi_level: " << hmi_level << "; result: " + << (result ? "Applicable for resume" + : "Non-applicable for resume")); return result; } @@ -707,11 +933,36 @@ bool ResumeCtrlImpl::CheckIcons(ApplicationSharedPtr application, return mobile_apis::Result::INVALID_DATA != verify_images; } -bool ResumeCtrlImpl::CheckDelayAfterIgnOn() { +bool ResumeCtrlImpl::CheckIgnCyclesData() const { + LOG4CXX_AUTO_TRACE(logger_); + const uint32_t global_ign_on_count = + resumption_storage_->GetGlobalIgnOnCounter(); + const uint32_t the_first_ignition = 1; + const bool is_emergency_ign_off_occurred = + global_ign_on_count > the_first_ignition; + // global_ign_on_count is reseting to 0 at ignition off + // global_ign_on_count is incrementing at ignition on + // global_ign_on_count > 1 means that correct ignition off was not present. + if (is_emergency_ign_off_occurred) { + LOG4CXX_WARN(logger_, + "Emergency IGN OFF occurred. Possibly after Low Voltage"); + return false; + } + return true; +} + +bool ResumeCtrlImpl::CheckDelayAfterIgnOn() const { using namespace date_time; LOG4CXX_AUTO_TRACE(logger_); - const time_t curr_time = time(NULL); + const time_t ign_off_time = GetIgnOffTime(); + + if (CheckIgnCyclesData() && 0 == ign_off_time) { + LOG4CXX_DEBUG(logger_, "This is first Ignition cycle"); + return true; + } + const time_t curr_time = time(nullptr); const time_t sdl_launch_time = LaunchTime(); + const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time); const uint32_t wait_time = application_manager_.get_settings().resumption_delay_after_ign(); @@ -727,7 +978,7 @@ time_t ResumeCtrlImpl::LaunchTime() const { return launch_time_; } -time_t ResumeCtrlImpl::GetIgnOffTime() { +time_t ResumeCtrlImpl::GetIgnOffTime() const { return resumption_storage_->GetIgnOffTime(); } @@ -743,7 +994,7 @@ bool ResumeCtrlImpl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request, (*request)[strings::correlation_id].asInt(); subscribe_on_event(function_id, hmi_correlation_id); } - if (!application_manager_.ManageHMICommand(request)) { + if (!application_manager_.GetRPCService().ManageHMICommand(request)) { LOG4CXX_ERROR(logger_, "Unable to send request"); return false; } @@ -762,14 +1013,21 @@ void ResumeCtrlImpl::ProcessHMIRequests( void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); + bool run_resumption = false; queue_lock_.Acquire(); waiting_for_timer_.push_back(app_id); + + if (!is_resumption_active_) { + is_resumption_active_ = true; + run_resumption = true; + } queue_lock_.Release(); LOG4CXX_DEBUG(logger_, "Application ID " << app_id << " have been added" " to resumption queue."); - if (!is_resumption_active_) { - is_resumption_active_ = true; + if (run_resumption) { + LOG4CXX_DEBUG(logger_, + "Application ID " << app_id << " will be restored by timer"); restore_hmi_level_timer_.Start( application_manager_.get_settings().app_resuming_timeout(), timer::kSingleShot); @@ -834,4 +1092,97 @@ bool ResumeCtrlImpl::IsAppDataResumptionExpired( return max_ign_off_count <= application[strings::ign_off_count].asInt(); } +mobile_apis::HMILevel::eType ResumeCtrlImpl::GetHmiLevelOnLowBandwidthTransport( + ApplicationConstSharedPtr application) const { + using namespace mobile_apis; + LOG4CXX_AUTO_TRACE(logger_); + + const ApplicationManagerSettings& settings = + application_manager_.get_settings(); + const std::string& level_for_navi_app = + settings.navigation_lowbandwidth_resumption_level(); + const std::string& level_for_projection_app = + settings.projection_lowbandwidth_resumption_level(); + const std::string& level_for_media_app = + settings.media_lowbandwidth_resumption_level(); + + HMILevel::eType result_level = HMILevel::HMI_NONE; + HMILevel::eType level; + + // NAVIGATION, PROJECTION and media apps have special exceptions. Their HMI + // level can be configured through .ini file. when the app has multiple + // AppHMIType, then the highest level will be applied. + if (application->is_navi()) { + level = ConvertHmiLevelString(level_for_navi_app); + LOG4CXX_DEBUG(logger_, + "NAVIGATION apps may have level " + << level + << " while high-bandwidth transport is not available."); + result_level = PickHigherHmiLevel(level, result_level); + } + if (application->mobile_projection_enabled()) { + level = ConvertHmiLevelString(level_for_projection_app); + LOG4CXX_DEBUG(logger_, + "PROJECTION apps may have level " + << level + << " while high-bandwidth transport is not available."); + result_level = PickHigherHmiLevel(level, result_level); + } + if (application->is_media_application()) { + level = ConvertHmiLevelString(level_for_media_app); + LOG4CXX_DEBUG(logger_, + "media apps may have level " + << level + << " while high-bandwidth transport is not available."); + result_level = PickHigherHmiLevel(level, result_level); + } + + return result_level; +} + +static mobile_api::HMILevel::eType PickHigherHmiLevel( + mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2) { + using namespace mobile_apis; + + if (val1 == HMILevel::INVALID_ENUM) { + return val2; + } else if (val2 == HMILevel::INVALID_ENUM) { + return val1; + } + + // smaller enum value has higher level + return val1 < val2 ? val1 : val2; +} + +static mobile_api::HMILevel::eType PickLowerHmiLevel( + mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2) { + using namespace mobile_apis; + + if (val1 == HMILevel::INVALID_ENUM) { + return val2; + } else if (val2 == HMILevel::INVALID_ENUM) { + return val1; + } + + // bigger enum value has lower level + return val1 > val2 ? val1 : val2; +} + +static mobile_api::HMILevel::eType ConvertHmiLevelString( + const std::string str) { + using namespace mobile_apis; + + if ("BACKGROUND" == str) { + return HMILevel::HMI_BACKGROUND; + } else if ("FULL" == str) { + return HMILevel::HMI_FULL; + } else if ("LIMITED" == str) { + return HMILevel::HMI_LIMITED; + } else if ("NONE" == str) { + return HMILevel::HMI_NONE; + } else { + return HMILevel::HMI_NONE; + } +} + } // namespce resumption diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index bd5bdbddab..856fb03750 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -41,7 +41,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") ResumptionData::ResumptionData( const application_manager::ApplicationManager& application_manager) - : resumption_lock_(true), application_manager_(application_manager) {} + : application_manager_(application_manager) {} smart_objects::SmartObject ResumptionData::GetApplicationCommands( app_mngr::ApplicationConstSharedPtr application) const { @@ -159,16 +159,9 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( strings::application_buttons, subscriptions); - DataAccessor<VehicleInfoSubscriptions> vi_accessor = - application->SubscribedIVI(); - - const VehicleInfoSubscriptions& vi_subscription = vi_accessor.GetData(); - - LOG4CXX_DEBUG(logger_, "SubscribedIVI:" << vi_subscription.size()); - Append(vi_subscription.begin(), - vi_subscription.end(), - strings::application_vehicle_info, - subscriptions); + for (auto extension : application->Extensions()) { + extension->SaveResumptionData(subscriptions); + } return subscriptions; } diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 2fe7330a9c..1591ce566a 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -163,11 +163,10 @@ void ResumptionDataDB::SaveApplication( } if (application->is_application_data_changed()) { - if (application_exist) { - if (!DeleteSavedApplication(policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Deleting of application data is not finished"); - return; - } + if (application_exist && + !DeleteSavedApplication(policy_app_id, device_mac)) { + LOG4CXX_ERROR(logger_, "Deleting of application data is not finished"); + return; } if (!SaveApplicationToDB(application, policy_app_id, device_mac)) { @@ -176,23 +175,15 @@ void ResumptionDataDB::SaveApplication( } LOG4CXX_INFO(logger_, "All data from application were saved successfully"); application->set_is_application_data_changed(false); - } else { - if (application_exist) { - if (!UpdateApplicationData(application, policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Updating application data is failed"); - return; - } - LOG4CXX_INFO(logger_, "Application data were updated successfully"); - } else { - if (Compare<HMILevel::eType, EQ, ONE>(application->hmi_level(), - HMILevel::HMI_FULL, - HMILevel::HMI_LIMITED)) { - if (!InsertApplicationData(application, policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Saving data of application is failed"); - return; - } - } + } else if (application_exist) { + if (!UpdateApplicationData(application, policy_app_id, device_mac)) { + LOG4CXX_ERROR(logger_, "Updating application data is failed"); + return; } + LOG4CXX_INFO(logger_, "Application data were updated successfully"); + } else if (!InsertApplicationData(application, policy_app_id, device_mac)) { + LOG4CXX_ERROR(logger_, "Saving data of application is failed"); + return; } WriteDb(); } @@ -212,8 +203,6 @@ uint32_t ResumptionDataDB::GetHMIApplicationID( return hmi_app_id; } -DEPRECATED void ResumptionDataDB::OnSuspend() {} - void ResumptionDataDB::IncrementIgnOffCount() { LOG4CXX_AUTO_TRACE(logger_); @@ -240,7 +229,7 @@ void ResumptionDataDB::IncrementIgnOffCount() { } } - if (query_update_last_ign_off_time.Prepare(KUpdateLastIgnOffTime)) { + if (query_update_last_ign_off_time.Prepare(kUpdateLastIgnOffTime)) { query_update_last_ign_off_time.Bind(0, static_cast<int64_t>(time(NULL))); if (query_update_last_ign_off_time.Exec()) { LOG4CXX_INFO(logger_, "Data last_ign_off_time was updated"); @@ -293,8 +282,6 @@ bool ResumptionDataDB::GetHashId(const std::string& policy_app_id, return SelectHashId(policy_app_id, device_id, hash_id); } -DEPRECATED void ResumptionDataDB::OnAwake() {} - void ResumptionDataDB::DecrementIgnOffCount() { LOG4CXX_AUTO_TRACE(logger_); @@ -376,10 +363,61 @@ bool ResumptionDataDB::RemoveApplicationFromSaved( uint32_t ResumptionDataDB::GetIgnOffTime() const { LOG4CXX_AUTO_TRACE(logger_); - return SelectIgnOffTime(); } +uint32_t ResumptionDataDB::GetGlobalIgnOnCounter() const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(kSelectGlobalIgnOnCounter)) { + LOG4CXX_ERROR(logger_, + "Problem with prepare query : " << kSelectGlobalIgnOnCounter); + return 1; + } + + if (!query.Exec()) { + LOG4CXX_ERROR(logger_, + "Problem with exec query : " << kSelectGlobalIgnOnCounter); + return 1; + } + + const auto global_ign_on_counter = query.GetUInteger(0); + LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter); + return global_ign_on_counter; +} + +void ResumptionDataDB::IncrementGlobalIgnOnCounter() { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + + db_->BeginTransaction(); + utils::dbms::SQLQuery query_update_global_ign_on_count(db()); + if (query_update_global_ign_on_count.Prepare(kUpdateGlobalIgnOnCount)) { + if (query_update_global_ign_on_count.Exec()) { + LOG4CXX_DEBUG(logger_, + "Data query_update_global_ign_on_count was updated"); + } + } + db_->CommitTransaction(); + WriteDb(); +} + +void ResumptionDataDB::ResetGlobalIgnOnCount() { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + + LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting"); + + utils::dbms::SQLQuery query_update_global_ign_on_count(db()); + if (query_update_global_ign_on_count.Prepare(kResetGlobalIgnOnCount)) { + if (query_update_global_ign_on_count.Exec()) { + LOG4CXX_DEBUG(logger_, "Data was updated"); + } + } +} + ssize_t ResumptionDataDB::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { LOG4CXX_AUTO_TRACE(logger_); @@ -557,7 +595,6 @@ void ResumptionDataDB::SelectDataForLoadResumeData( using namespace app_mngr; using namespace smart_objects; LOG4CXX_AUTO_TRACE(logger_); - utils::dbms::SQLQuery select_data(db()); utils::dbms::SQLQuery count_application(db()); if (!select_data.Prepare(kSelectDataForLoadResumeData) || diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index b6a50fd5de..c8e9032dfa 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -41,7 +41,7 @@ namespace resumption { -namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; +namespace formatters = ns_smart_device_link::ns_json_handler::formatters; CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") @@ -81,22 +81,22 @@ void ResumptionDataJson::SaveApplication( json_app[strings::hmi_level] = static_cast<int32_t>(hmi_level); json_app[strings::ign_off_count] = 0; json_app[strings::hash_id] = hash; - Formatters::CFormatterJsonBase::objToJsonValue( + formatters::CFormatterJsonBase::objToJsonValue( GetApplicationCommands(application), tmp); json_app[strings::application_commands] = tmp; - Formatters::CFormatterJsonBase::objToJsonValue( + formatters::CFormatterJsonBase::objToJsonValue( GetApplicationSubMenus(application), tmp); json_app[strings::application_submenus] = tmp; - Formatters::CFormatterJsonBase::objToJsonValue( + formatters::CFormatterJsonBase::objToJsonValue( GetApplicationInteractionChoiseSets(application), tmp); json_app[strings::application_choice_sets] = tmp; - Formatters::CFormatterJsonBase::objToJsonValue( + formatters::CFormatterJsonBase::objToJsonValue( GetApplicationGlobalProperties(application), tmp); json_app[strings::application_global_properties] = tmp; - Formatters::CFormatterJsonBase::objToJsonValue( + formatters::CFormatterJsonBase::objToJsonValue( GetApplicationSubscriptions(application), tmp); json_app[strings::application_subscriptions] = tmp; - Formatters::CFormatterJsonBase::objToJsonValue( + formatters::CFormatterJsonBase::objToJsonValue( GetApplicationFiles(application), tmp); json_app[strings::application_files] = tmp; json_app[strings::time_stamp] = time_stamp; @@ -143,8 +143,6 @@ uint32_t ResumptionDataJson::GetHMIApplicationID( return hmi_app_id; } -DEPRECATED void ResumptionDataJson::OnSuspend() {} - void ResumptionDataJson::IncrementIgnOffCount() { using namespace app_mngr; LOG4CXX_AUTO_TRACE(logger_); @@ -169,8 +167,6 @@ void ResumptionDataJson::IncrementIgnOffCount() { LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString()); } -DEPRECATED void ResumptionDataJson::OnAwake() {} - void ResumptionDataJson::DecrementIgnOffCount() { using namespace app_mngr; LOG4CXX_AUTO_TRACE(logger_); @@ -229,7 +225,7 @@ bool ResumptionDataJson::GetSavedApplication( return false; } const Json::Value& json_saved_app = GetSavedApplications()[idx]; - Formatters::CFormatterJsonBase::jsonValueToObj(json_saved_app, saved_app); + formatters::CFormatterJsonBase::jsonValueToObj(json_saved_app, saved_app); return true; } @@ -283,6 +279,51 @@ uint32_t ResumptionDataJson::GetIgnOffTime() const { return resumption[strings::last_ign_off_time].asUInt(); } +uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + Json::Value& resumption = GetResumptionData(); + if (resumption.isMember(strings::global_ign_on_counter)) { + const uint32_t global_ign_on_counter = + resumption[strings::global_ign_on_counter].asUInt(); + LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter); + return global_ign_on_counter; + } + return 1; +} + +void ResumptionDataJson::IncrementGlobalIgnOnCounter() { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + Json::Value& resumption = GetResumptionData(); + if (resumption.isMember(strings::global_ign_on_counter)) { + const uint32_t global_ign_on_counter = + resumption[strings::global_ign_on_counter].asUInt(); + LOG4CXX_DEBUG( + logger_, + "Global IGN ON counter in resumption data: " << global_ign_on_counter); + resumption[strings::global_ign_on_counter] = global_ign_on_counter + 1; + LOG4CXX_DEBUG(logger_, + "Global IGN ON counter new value: " + << resumption[strings::global_ign_on_counter].asUInt()); + } else { + resumption[strings::global_ign_on_counter] = 1; + } + last_state().SaveStateToFileSystem(); +} + +void ResumptionDataJson::ResetGlobalIgnOnCount() { + using namespace app_mngr; + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock autolock(resumption_lock_); + Json::Value& resumption = GetResumptionData(); + + resumption[strings::global_ign_on_counter] = 0; + LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting"); +} + ssize_t ResumptionDataJson::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc index 9ca91e859a..4770bafef4 100644 --- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc +++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc @@ -37,6 +37,7 @@ const std::string kCreateSchema = "BEGIN ; " "CREATE TABLE IF NOT EXISTS `resumption`( " " `idresumption` INTEGER PRIMARY KEY, " + " `global_ign_on_count` INTEGER, " " `last_ign_off_time` INTEGER " " ); " "CREATE TABLE IF NOT EXISTS `subscribedForWayPoints`( " @@ -372,7 +373,9 @@ const std::string kDropSchema = "VACUUM;"; const std::string kInsertInitData = - "INSERT OR IGNORE INTO `resumption` (`last_ign_off_time`) VALUES (0); " + "INSERT OR IGNORE INTO `resumption` " + "(`last_ign_off_time`, `global_ign_on_count`) " + "VALUES (0, 0); " "INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "; const std::string kChecksResumptionData = @@ -410,6 +413,17 @@ const std::string kSelectHashId = const std::string kSelectIgnOffTime = "SELECT `last_ign_off_time` FROM `resumption`"; +const std::string kSelectGlobalIgnOnCounter = + "SELECT `global_ign_on_count` FROM `resumption`"; + +const std::string kResetGlobalIgnOnCount = + "UPDATE `resumption` " + "SET `global_ign_on_count` = 0"; + +const std::string kUpdateGlobalIgnOnCount = + "UPDATE `resumption` " + "SET `global_ign_on_count` = `global_ign_on_count` + 1 "; + const std::string kCheckApplication = "SELECT COUNT (`deviceID`) FROM `application` " "WHERE `deviceID` = ? AND `appID` = ?"; @@ -445,7 +459,7 @@ const std::string kUpdateSuspendData = "UPDATE `application` " "SET `ign_off_count` = `ign_off_count` + 1"; -const std::string KUpdateLastIgnOffTime = +const std::string kUpdateLastIgnOffTime = "UPDATE `resumption` " "SET `last_ign_off_time` = ?"; diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc new file mode 100644 index 0000000000..0ccdf8b758 --- /dev/null +++ b/src/components/application_manager/src/rpc_handler_impl.cc @@ -0,0 +1,426 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/rpc_handler_impl.h" + +namespace application_manager { +namespace rpc_handler { + +CREATE_LOGGERPTR_LOCAL(logger_, "RPCHandlerImpl") +namespace formatters = ns_smart_device_link::ns_json_handler::formatters; +namespace jhs = ns_smart_device_link::ns_json_handler::strings; + +RPCHandlerImpl::RPCHandlerImpl(ApplicationManager& app_manager) + : app_manager_(app_manager) + , messages_from_mobile_("AM FromMobile", this) + , messages_from_hmi_("AM FromHMI", this) + , hmi_so_factory_(hmi_apis::HMI_API()) + , mobile_so_factory_(mobile_apis::MOBILE_API()) +#ifdef TELEMETRY_MONITOR + , metric_observer_(NULL) +#endif // TELEMETRY_MONITOR +{ +} + +RPCHandlerImpl::~RPCHandlerImpl() {} + +void RPCHandlerImpl::ProcessMessageFromMobile( + const std::shared_ptr<Message> message) { + LOG4CXX_AUTO_TRACE(logger_); +#ifdef TELEMETRY_MONITOR + AMTelemetryObserver::MessageMetricSharedPtr metric( + new AMTelemetryObserver::MessageMetric()); + metric->begin = date_time::getCurrentTime(); +#endif // TELEMETRY_MONITOR + smart_objects::SmartObjectSPtr so_from_mobile = + std::make_shared<smart_objects::SmartObject>(); + + DCHECK_OR_RETURN_VOID(so_from_mobile); + if (!so_from_mobile) { + LOG4CXX_ERROR(logger_, "Null pointer"); + return; + } + + if (!ConvertMessageToSO(*message, *so_from_mobile)) { + LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); + return; + } +#ifdef TELEMETRY_MONITOR + metric->message = so_from_mobile; +#endif // TELEMETRY_MONITOR + + if (!app_manager_.GetRPCService().ManageMobileCommand( + so_from_mobile, commands::Command::SOURCE_MOBILE)) { + LOG4CXX_ERROR(logger_, "Received command didn't run successfully"); + } +#ifdef TELEMETRY_MONITOR + metric->end = date_time::getCurrentTime(); + if (metric_observer_) { + metric_observer_->OnMessage(metric); + } +#endif // TELEMETRY_MONITOR +} + +void RPCHandlerImpl::ProcessMessageFromHMI( + const std::shared_ptr<Message> message) { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObjectSPtr smart_object = + std::make_shared<smart_objects::SmartObject>(); + + if (!smart_object) { + LOG4CXX_ERROR(logger_, "Null pointer"); + return; + } + + if (!ConvertMessageToSO(*message, *smart_object)) { + if (application_manager::MessageType::kResponse == + (*smart_object)[strings::params][strings::message_type].asInt()) { + (*smart_object).erase(strings::msg_params); + (*smart_object)[strings::params][hmi_response::code] = + hmi_apis::Common_Result::GENERIC_ERROR; + (*smart_object)[strings::msg_params][strings::info] = + std::string("Invalid message received from vehicle"); + } else { + LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); + return; + } + } + + LOG4CXX_DEBUG(logger_, "Converted message, trying to create hmi command"); + if (!app_manager_.GetRPCService().ManageHMICommand(smart_object)) { + LOG4CXX_ERROR(logger_, "Received command didn't run successfully"); + } +} +void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_ERROR(logger_, "Null-pointer message received."); + return; + } + if (app_manager_.is_stopping()) { + LOG4CXX_INFO(logger_, "Application manager is stopping"); + return; + } + + ProcessMessageFromMobile(message); +} + +void RPCHandlerImpl::Handle(const impl::MessageFromHmi message) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_ERROR(logger_, "Null-pointer message received."); + return; + } + ProcessMessageFromHMI(message); +} + +void RPCHandlerImpl::OnMessageReceived( + const protocol_handler::RawMessagePtr message) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_ERROR(logger_, "Null-pointer message received."); + NOTREACHED(); + return; + } + + std::shared_ptr<Message> outgoing_message = ConvertRawMsgToMessage(message); + + if (outgoing_message) { + LOG4CXX_DEBUG(logger_, "Posting new Message"); + messages_from_mobile_.PostMessage( + impl::MessageFromMobile(outgoing_message)); + } +} + +void RPCHandlerImpl::OnMobileMessageSent( + const protocol_handler::RawMessagePtr message) { + LOG4CXX_AUTO_TRACE(logger_); +} + +void RPCHandlerImpl::OnMessageReceived( + hmi_message_handler::MessageSharedPointer message) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_ERROR(logger_, "Null-pointer message received."); + NOTREACHED(); + return; + } + + messages_from_hmi_.PostMessage(impl::MessageFromHmi(message)); +} + +void RPCHandlerImpl::OnErrorSending( + hmi_message_handler::MessageSharedPointer message) { + return; +} + +#ifdef TELEMETRY_MONITOR +void RPCHandlerImpl::SetTelemetryObserver(AMTelemetryObserver* observer) { + metric_observer_ = observer; +} + +#endif // TELEMETRY_MONITOR + +void RPCHandlerImpl::GetMessageVersion( + ns_smart_device_link::ns_smart_objects::SmartObject& output, + utils::SemanticVersion& message_version) { + if (output.keyExists( + ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS) && + output[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] + .keyExists(strings::sync_msg_version)) { + // SyncMsgVersion exists, check if it is valid. + auto sync_msg_version = + output[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] + [strings::sync_msg_version]; + uint16_t major = 0; + uint16_t minor = 0; + uint16_t patch = 0; + if (sync_msg_version.keyExists(strings::major_version)) { + major = sync_msg_version[strings::major_version].asUInt(); + } + if (sync_msg_version.keyExists(strings::minor_version)) { + minor = sync_msg_version[strings::minor_version].asUInt(); + } + if (sync_msg_version.keyExists(strings::patch_version)) { + patch = sync_msg_version[strings::patch_version].asUInt(); + } + utils::SemanticVersion temp_version(major, minor, patch); + if (temp_version.isValid()) { + utils::SemanticVersion ver_4_5(4, 5, 0); + message_version = (temp_version > ver_4_5) ? temp_version : ver_4_5; + } + } +} + +bool RPCHandlerImpl::ConvertMessageToSO( + const Message& message, + ns_smart_device_link::ns_smart_objects::SmartObject& output) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "\t\t\tMessage to convert: protocol " + << message.protocol_version() << "; json " + << message.json_message()); + + switch (message.protocol_version()) { + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3: + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2: { + const bool conversion_result = + formatters::CFormatterJsonSDLRPCv2::fromString( + message.json_message(), + output, + message.function_id(), + message.type(), + message.correlation_id()); + + rpc::ValidationReport report("RPC"); + + // Attach RPC version to SmartObject if it does not exist yet. + auto app_ptr = app_manager_.application(message.connection_key()); + utils::SemanticVersion msg_version(0, 0, 0); + if (app_ptr) { + msg_version = app_ptr->msg_version(); + } else if (mobile_apis::FunctionID::RegisterAppInterfaceID == + static_cast<mobile_apis::FunctionID::eType>( + output[strings::params][strings::function_id].asInt())) { + GetMessageVersion(output, msg_version); + } + + if (!conversion_result || + !mobile_so_factory().attachSchema(output, true, msg_version) || + ((output.validate(&report, msg_version) != + smart_objects::errors::OK))) { + LOG4CXX_WARN(logger_, + "Failed to parse string to smart object with API version " + << msg_version.toString() << " : " + << message.json_message()); + std::shared_ptr<smart_objects::SmartObject> response( + MessageHelper::CreateNegativeResponse( + message.connection_key(), + message.function_id(), + message.correlation_id(), + mobile_apis::Result::INVALID_DATA)); + + (*response)[strings::msg_params][strings::info] = + rpc::PrettyFormat(report); + app_manager_.GetRPCService().ManageMobileCommand( + response, commands::Command::SOURCE_SDL); + return false; + } + LOG4CXX_DEBUG(logger_, + "Convertion result for sdl object is true function_id " + << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + + output[strings::params][strings::connection_key] = + message.connection_key(); + output[strings::params][strings::protocol_version] = + message.protocol_version(); + if (message.binary_data()) { + if (message.payload_size() < message.data_size()) { + LOG4CXX_ERROR(logger_, + "Incomplete binary" + << " binary size should be " << message.data_size() + << " payload data size is " + << message.payload_size()); + std::shared_ptr<smart_objects::SmartObject> response( + MessageHelper::CreateNegativeResponse( + message.connection_key(), + message.function_id(), + message.correlation_id(), + mobile_apis::Result::INVALID_DATA)); + app_manager_.GetRPCService().ManageMobileCommand( + response, commands::Command::SOURCE_SDL); + return false; + } + output[strings::params][strings::binary_data] = + *(message.binary_data()); + } + break; + } + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI: { +#ifdef ENABLE_LOG + int32_t result = +#endif + formatters::FormatterJsonRpc::FromString< + hmi_apis::FunctionID::eType, + hmi_apis::messageType::eType>(message.json_message(), output); + LOG4CXX_DEBUG(logger_, + "Convertion result: " + << result << " function id " + << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + if (!hmi_so_factory().attachSchema(output, false)) { + LOG4CXX_WARN(logger_, "Failed to attach schema to object."); + return false; + } + + rpc::ValidationReport report("RPC"); + + if (output.validate(&report) != smart_objects::errors::OK) { + LOG4CXX_ERROR(logger_, + "Incorrect parameter from HMI" + << rpc::PrettyFormat(report)); + + output.erase(strings::msg_params); + output[strings::params][hmi_response::code] = + hmi_apis::Common_Result::INVALID_DATA; + output[strings::msg_params][strings::info] = rpc::PrettyFormat(report); + return false; + } + break; + } + case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: { + static ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra v1_shema; + + if (message.function_id() == 0 || message.type() == kUnknownType) { + LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION"); + + int32_t conversation_result = + formatters::CFormatterJsonSDLRPCv1::fromString< + ns_smart_device_link_rpc::V1::FunctionID::eType, + ns_smart_device_link_rpc::V1::messageType::eType>( + message.json_message(), output); + + if (formatters::CFormatterJsonSDLRPCv1::kSuccess == + conversation_result) { + smart_objects::SmartObject params = smart_objects::SmartObject( + smart_objects::SmartType::SmartType_Map); + + output[strings::params][strings::message_type] = + ns_smart_device_link_rpc::V1::messageType::response; + output[strings::params][strings::connection_key] = + message.connection_key(); + + output[strings::msg_params] = smart_objects::SmartObject( + smart_objects::SmartType::SmartType_Map); + output[strings::msg_params][strings::success] = false; + output[strings::msg_params][strings::result_code] = + ns_smart_device_link_rpc::V1::Result::UNSUPPORTED_VERSION; + + smart_objects::SmartObjectSPtr msg_to_send = + std::make_shared<smart_objects::SmartObject>(output); + v1_shema.attachSchema(*msg_to_send, false); + app_manager_.GetRPCService().SendMessageToMobile(msg_to_send); + return false; + } + } + break; + } + default: + LOG4CXX_WARN(logger_, + "Application used unsupported protocol :" + << message.protocol_version() << "."); + return false; + } + + LOG4CXX_DEBUG(logger_, "Successfully parsed message into smart object"); + return true; +} + +std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage( + const protocol_handler::RawMessagePtr message) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(message); + std::shared_ptr<Message> outgoing_message; + + LOG4CXX_DEBUG(logger_, "Service type." << message->service_type()); + if (message->service_type() != protocol_handler::kRpc && + message->service_type() != protocol_handler::kBulk) { + // skip this message, not under handling of ApplicationManager + LOG4CXX_TRACE(logger_, "Skipping message; not the under AM handling."); + return outgoing_message; + } + + Message* convertion_result = + MobileMessageHandler::HandleIncomingMessageProtocol(message); + + if (convertion_result) { + outgoing_message = std::shared_ptr<Message>(convertion_result); + } else { + LOG4CXX_ERROR(logger_, "Received invalid message"); + } + return outgoing_message; +} + +hmi_apis::HMI_API& RPCHandlerImpl::hmi_so_factory() { + return hmi_so_factory_; +} + +mobile_apis::MOBILE_API& RPCHandlerImpl::mobile_so_factory() { + return mobile_so_factory_; +} +} +} diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc new file mode 100644 index 0000000000..217af091b5 --- /dev/null +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -0,0 +1,630 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/rpc_service_impl.h" + +namespace application_manager { +namespace rpc_service { + +CREATE_LOGGERPTR_LOCAL(logger_, "RPCServiceImpl") +namespace formatters = ns_smart_device_link::ns_json_handler::formatters; +namespace jhs = ns_smart_device_link::ns_json_handler::strings; + +RPCServiceImpl::RPCServiceImpl( + ApplicationManager& app_manager, + request_controller::RequestController& request_ctrl, + protocol_handler::ProtocolHandler* protocol_handler, + hmi_message_handler::HMIMessageHandler* hmi_handler, + CommandHolder& commands_holder) + : app_manager_(app_manager) + , request_ctrl_(request_ctrl) + , protocol_handler_(protocol_handler) + , hmi_handler_(hmi_handler) + , commands_holder_(commands_holder) + , messages_to_mobile_("AM ToMobile", this) + , messages_to_hmi_("AM ToHMI", this) + , hmi_so_factory_(hmi_apis::HMI_API()) + , mobile_so_factory_(mobile_apis::MOBILE_API()) {} + +RPCServiceImpl::~RPCServiceImpl() {} + +bool RPCServiceImpl::ManageMobileCommand( + const commands::MessageSharedPtr message, + commands::Command::CommandSource source) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_WARN(logger_, "Null-pointer message received."); + return false; + } + + if (app_manager_.IsLowVoltage()) { + LOG4CXX_WARN(logger_, "Low Voltage is active"); + return false; + } +#ifdef DEBUG + MessageHelper::PrintSmartObject(*message); +#endif + + const uint32_t connection_key = static_cast<uint32_t>( + (*message)[strings::params][strings::connection_key].asUInt()); + + auto app_ptr = app_manager_.application(connection_key); + if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->policy_app_id())) { + commands_holder_.Suspend( + app_ptr, CommandHolder::CommandType::kMobileCommand, message); + return true; + } + mobile_apis::FunctionID::eType function_id = + static_cast<mobile_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asInt()); + + // Notifications from HMI have no such parameter + uint32_t correlation_id = + (*message)[strings::params].keyExists(strings::correlation_id) + ? (*message)[strings::params][strings::correlation_id].asUInt() + : 0; + + int32_t protocol_type = + (*message)[strings::params][strings::protocol_type].asInt(); + + ApplicationSharedPtr app; + if (((mobile_apis::FunctionID::RegisterAppInterfaceID != function_id) && + (protocol_type == commands::CommandImpl::mobile_protocol_type_)) && + (mobile_apis::FunctionID::UnregisterAppInterfaceID != function_id)) { + app = app_manager_.application(connection_key); + if (!app) { + LOG4CXX_ERROR(logger_, "RET APPLICATION_NOT_REGISTERED"); + smart_objects::SmartObjectSPtr response = + MessageHelper::CreateNegativeResponse( + connection_key, + static_cast<int32_t>(function_id), + correlation_id, + static_cast<int32_t>( + mobile_apis::Result::APPLICATION_NOT_REGISTERED)); + + SendMessageToMobile(response); + return false; + } + + // Message for "CheckPermission" must be with attached schema + mobile_so_factory().attachSchema(*message, false); + } + + auto plugin = + app_manager_.GetPluginManager().FindPluginToProcess(function_id, source); + if (!plugin) { + LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error()); + return false; + } + application_manager::CommandFactory& factory = (*plugin).GetCommandFactory(); + auto command = factory.CreateCommand(message, source); + + if (!command) { + LOG4CXX_WARN(logger_, "Failed to create mobile command from smart object"); + return false; + } + + int32_t message_type = + (*message)[strings::params][strings::message_type].asInt(); + if (message_type == mobile_apis::messageType::response) { + if (command->Init()) { + command->Run(); + command->CleanUp(); + } + return true; + } + if (message_type == mobile_apis::messageType::notification) { + request_ctrl_.addNotification(command); + if (command->Init()) { + command->Run(); + if (command->CleanUp()) { + request_ctrl_.removeNotification(command.get()); + } + // If CleanUp returned false notification should remove it self. + } + return true; + } + + if (message_type == mobile_apis::messageType::request) { + // commands will be launched from requesr_ctrl + mobile_apis::HMILevel::eType app_hmi_level = + mobile_apis::HMILevel::INVALID_ENUM; + if (app) { + app_hmi_level = app->hmi_level(); + } + + // commands will be launched from request_ctrl + + const request_controller::RequestController::TResult result = + request_ctrl_.addMobileRequest(command, app_hmi_level); + + if (result == request_controller::RequestController::SUCCESS) { + LOG4CXX_DEBUG(logger_, "Perform request"); + } else if (result == request_controller::RequestController:: + TOO_MANY_PENDING_REQUESTS) { + LOG4CXX_ERROR(logger_, + "RET Unable top perform request: " + << "TOO_MANY_PENDING_REQUESTS"); + + smart_objects::SmartObjectSPtr response = + MessageHelper::CreateNegativeResponse( + connection_key, + static_cast<int32_t>(function_id), + correlation_id, + static_cast<int32_t>( + mobile_apis::Result::TOO_MANY_PENDING_REQUESTS)); + ApplicationSharedPtr app_ptr = app_manager_.application(connection_key); + if (app_ptr) { + app_ptr->usage_report().RecordRemovalsForBadBehavior(); + } + + SendMessageToMobile(response); + return false; + } else if (result == + request_controller::RequestController::TOO_MANY_REQUESTS) { + LOG4CXX_ERROR(logger_, + "RET Unable to perform request: " + << "TOO_MANY_REQUESTS"); + + ManageMobileCommand( + MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( + connection_key, + mobile_api::AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS), + commands::Command::SOURCE_SDL); + + app_manager_.UnregisterApplication( + connection_key, + mobile_apis::Result::TOO_MANY_PENDING_REQUESTS, + false); + ApplicationSharedPtr app_ptr = app_manager_.application(connection_key); + if (app_ptr) { + app_ptr->usage_report().RecordRemovalsForBadBehavior(); + } + return false; + } else if (result == request_controller::RequestController:: + NONE_HMI_LEVEL_MANY_REQUESTS) { + LOG4CXX_ERROR(logger_, + "RET Unable to perform request: " + << "REQUEST_WHILE_IN_NONE_HMI_LEVEL"); + + ManageMobileCommand( + MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( + connection_key, + mobile_api::AppInterfaceUnregisteredReason:: + REQUEST_WHILE_IN_NONE_HMI_LEVEL), + commands::Command::SOURCE_SDL); + + ApplicationSharedPtr app_ptr = app_manager_.application(connection_key); + if (app_ptr) { + app_ptr->usage_report().RecordRemovalsForBadBehavior(); + } + app_manager_.UnregisterApplication( + connection_key, mobile_apis::Result::INVALID_ENUM, false); + return false; + } else { + LOG4CXX_ERROR(logger_, "RET Unable to perform request: Unknown case"); + return false; + } + return true; + } + + LOG4CXX_ERROR(logger_, "RET UNKNOWN MESSAGE TYPE " << message_type); + return false; +} + +bool RPCServiceImpl::ManageHMICommand( + const commands::MessageSharedPtr message) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_WARN(logger_, "Null-pointer message received."); + return false; + } + + if (app_manager_.IsLowVoltage()) { + LOG4CXX_WARN(logger_, "Low Voltage is active"); + return false; + } + + MessageHelper::PrintSmartObject(*message); + const int32_t function_id = + (*(message.get()))[strings::params][strings::function_id].asInt(); + auto plugin = app_manager_.GetPluginManager().FindPluginToProcess( + function_id, commands::Command::SOURCE_HMI); + if (!plugin) { + LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error()); + return false; + } + + application_manager::CommandFactory& factory = (*plugin).GetCommandFactory(); + auto command = factory.CreateCommand(message, commands::Command::SOURCE_HMI); + + if (!command) { + LOG4CXX_WARN(logger_, "Failed to create command from smart object"); + return false; + } + + if ((*message).keyExists(strings::msg_params) && + (*message)[strings::msg_params].keyExists(strings::app_id)) { + const auto connection_key = + (*message)[strings::msg_params][strings::app_id].asUInt(); + + auto app = app_manager_.application(static_cast<uint32_t>(connection_key)); + if (app && app_manager_.IsAppInReconnectMode(app->policy_app_id())) { + commands_holder_.Suspend( + app, CommandHolder::CommandType::kHmiCommand, message); + return true; + } + } + + int32_t message_type = + (*(message.get()))[strings::params][strings::message_type].asInt(); + + if (kRequest == message_type) { + LOG4CXX_DEBUG(logger_, "ManageHMICommand"); + request_ctrl_.addHMIRequest(command); + } + + if (command->Init()) { + command->Run(); + if (kResponse == message_type) { + const uint32_t correlation_id = + (*(message.get()))[strings::params][strings::correlation_id].asUInt(); + const int32_t function_id = + (*(message.get()))[strings::params][strings::function_id].asInt(); + request_ctrl_.OnHMIResponse(correlation_id, function_id); + } + return true; + } + return false; +} + +void RPCServiceImpl::Handle(const impl::MessageToHmi message) { + LOG4CXX_AUTO_TRACE(logger_); + if (!hmi_handler_) { + LOG4CXX_ERROR(logger_, "Observer is not set for HMIMessageHandler"); + return; + } + + hmi_handler_->SendMessageToHMI(message); + LOG4CXX_INFO(logger_, "Message for HMI given away"); +} + +void RPCServiceImpl::Handle(const impl::MessageToMobile message) { + if (!protocol_handler_) { + LOG4CXX_WARN(logger_, + "Protocol Handler is not set; cannot send message to mobile."); + return; + } + + std::shared_ptr<protocol_handler::RawMessage> rawMessage( + MobileMessageHandler::HandleOutgoingMessageProtocol(message)); + + if (!rawMessage) { + LOG4CXX_ERROR(logger_, "Failed to create raw message."); + return; + } + + bool is_final = message.is_final; + bool close_session = false; + if (is_final) { + if (1 < app_manager_.connection_handler().GetConnectionSessionsCount( + message->connection_key())) { + is_final = false; + close_session = true; + } + } + + protocol_handler_->SendMessageToMobileApp(rawMessage, is_final); + LOG4CXX_INFO(logger_, "Message for mobile given away"); + + if (close_session) { + app_manager_.connection_handler().CloseSession(message->connection_key(), + connection_handler::kCommon); + } +} + +void RPCServiceImpl::SendMessageToMobile( + const application_manager::commands::MessageSharedPtr message, + bool final_message) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_ERROR(logger_, "Null-pointer message received."); + NOTREACHED(); + return; + } + + if (!protocol_handler_) { + LOG4CXX_WARN(logger_, "No Protocol Handler set"); + return; + } + + ApplicationSharedPtr app = app_manager_.application( + (*message)[strings::params][strings::connection_key].asUInt()); + + const bool is_result_code_exists = + (*message)[strings::msg_params].keyExists(strings::result_code); + + if (!app) { + LOG4CXX_ERROR(logger_, "No application associated with connection key"); + if (is_result_code_exists && + ((*message)[strings::msg_params][strings::result_code] == + ns_smart_device_link_rpc::V1::Result::UNSUPPORTED_VERSION)) { + (*message)[strings::params][strings::protocol_version] = + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1; + } else { + (*message)[strings::params][strings::protocol_version] = + app_manager_.SupportedSDLVersion(); + } + } else { + (*message)[strings::params][strings::protocol_version] = + app->protocol_version(); + } + + if (app && is_result_code_exists && + (*message)[strings::msg_params][strings::result_code] == + mobile_apis::Result::OUT_OF_MEMORY) { + app->usage_report().RecordRejectionsSyncOutOfMemory(); + } + + mobile_so_factory().attachSchema(*message, false); + LOG4CXX_DEBUG( + logger_, + "Attached schema to message, result if valid: " << message->isValid()); + + // Messages to mobile are not yet prioritized so use default priority value + std::shared_ptr<Message> message_to_send( + new Message(protocol_handler::MessagePriority::kDefault)); + if (!ConvertSOtoMessage((*message), (*message_to_send))) { + LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string"); + return; + } + + smart_objects::SmartObject& msg_to_mobile = *message; + // If correlation_id is not present, it is from-HMI message which should be + // checked against policy permissions + if (msg_to_mobile[strings::params].keyExists(strings::correlation_id)) { + request_ctrl_.OnMobileResponse( + msg_to_mobile[strings::params][strings::correlation_id].asUInt(), + msg_to_mobile[strings::params][strings::connection_key].asUInt(), + msg_to_mobile[strings::params][strings::function_id].asInt()); + } else if (app) { + mobile_apis::FunctionID::eType function_id = + static_cast<mobile_apis::FunctionID::eType>( + (*message)[strings::params][strings::function_id].asUInt()); + RPCParams params; + + const smart_objects::SmartObject& s_map = (*message)[strings::msg_params]; + if (smart_objects::SmartType_Map == s_map.getType()) { + smart_objects::SmartMap::iterator iter = s_map.map_begin(); + smart_objects::SmartMap::iterator iter_end = s_map.map_end(); + + for (; iter != iter_end; ++iter) { + if (true == iter->second.asBool()) { + LOG4CXX_INFO(logger_, "Request's param: " << iter->first); + params.insert(iter->first); + } + } + } + const std::string string_functionID = + MessageHelper::StringifiedFunctionID(function_id); + const mobile_apis::Result::eType check_result = + app_manager_.CheckPolicyPermissions(app, string_functionID, params); + if (mobile_apis::Result::SUCCESS != check_result) { + LOG4CXX_WARN(logger_, + "Function \"" << string_functionID << "\" (#" << function_id + << ") not allowed by policy"); + return; + } + +#ifdef EXTERNAL_PROPRIETARY_MODE + if (function_id == mobile_apis::FunctionID::OnSystemRequestID) { + mobile_apis::RequestType::eType request_type = + static_cast<mobile_apis::RequestType::eType>( + (*message)[strings::msg_params][strings::request_type].asUInt()); + if (mobile_apis::RequestType::PROPRIETARY == request_type || + mobile_apis::RequestType::HTTP == request_type) { + app_manager_.GetPolicyHandler().OnUpdateRequestSentToMobile(); + } + } +#endif // EXTERNAL_PROPRIETARY_MODE + } + + if (message_to_send->binary_data()) { + LOG4CXX_DEBUG( + logger_, + "Binary data size: " << message_to_send->binary_data()->size()); + } + messages_to_mobile_.PostMessage( + impl::MessageToMobile(message_to_send, final_message)); +} + +void RPCServiceImpl::SendMessageToHMI( + const commands::MessageSharedPtr message) { + LOG4CXX_AUTO_TRACE(logger_); + + if (!message) { + LOG4CXX_WARN(logger_, "Null-pointer message received."); + NOTREACHED(); + return; + } + + if (!hmi_handler_) { + LOG4CXX_WARN(logger_, "No HMI Handler set"); + return; + } + + // SmartObject |message| has no way to declare priority for now + std::shared_ptr<Message> message_to_send( + new Message(protocol_handler::MessagePriority::kDefault)); + if (!message_to_send) { + LOG4CXX_ERROR(logger_, "Null pointer"); + return; + } + + hmi_so_factory().attachSchema(*message, false); + LOG4CXX_INFO( + logger_, + "Attached schema to message, result if valid: " << message->isValid()); + + if (!ConvertSOtoMessage(*message, *message_to_send)) { + LOG4CXX_WARN(logger_, + "Cannot send message to HMI: failed to create string"); + return; + } + + messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send)); +} + +void RPCServiceImpl::set_protocol_handler( + protocol_handler::ProtocolHandler* handler) { + protocol_handler_ = handler; +} + +void RPCServiceImpl::set_hmi_message_handler( + hmi_message_handler::HMIMessageHandler* handler) { + hmi_handler_ = handler; +} + +bool RPCServiceImpl::ConvertSOtoMessage( + const ns_smart_device_link::ns_smart_objects::SmartObject& message, + Message& output) { + LOG4CXX_AUTO_TRACE(logger_); + + if (smart_objects::SmartType_Null == message.getType() || + smart_objects::SmartType_Invalid == message.getType()) { + LOG4CXX_WARN(logger_, "Invalid smart object received."); + return false; + } + + LOG4CXX_DEBUG( + logger_, + "Message with protocol: " << message.getElement(jhs::S_PARAMS) + .getElement(jhs::S_PROTOCOL_TYPE) + .asInt()); + + std::string output_string; + const int64_t protocol_type = message.getElement(jhs::S_PARAMS) + .getElement(jhs::S_PROTOCOL_TYPE) + .asInt(); + const int64_t protocol_version = message.getElement(jhs::S_PARAMS) + .getElement(jhs::S_PROTOCOL_VERSION) + .asInt(); + switch (protocol_type) { + case 0: { + if (protocol_version == 1) { + if (!formatters::CFormatterJsonSDLRPCv1::toString(message, + output_string)) { + LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + return false; + } + output.set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1); + } else { + if (!formatters::CFormatterJsonSDLRPCv2::toString(message, + output_string)) { + LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + return false; + } + output.set_protocol_version( + static_cast<protocol_handler::MajorProtocolVersion>( + protocol_version)); + } + + break; + } + case 1: { + if (!formatters::FormatterJsonRpc::ToString(message, output_string)) { + LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + return false; + } + output.set_protocol_version( + protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI); + break; + } + default: + NOTREACHED(); + return false; + } + + LOG4CXX_DEBUG(logger_, "Convertion result: " << output_string); + + output.set_connection_key(message.getElement(jhs::S_PARAMS) + .getElement(strings::connection_key) + .asInt()); + + output.set_function_id( + message.getElement(jhs::S_PARAMS).getElement(jhs::S_FUNCTION_ID).asInt()); + + output.set_correlation_id(message.getElement(jhs::S_PARAMS) + .getElement(jhs::S_CORRELATION_ID) + .asInt()); + output.set_message_type( + static_cast<MessageType>(message.getElement(jhs::S_PARAMS) + .getElement(jhs::S_MESSAGE_TYPE) + .asInt())); + + // Currently formatter creates JSON = 3 bytes for empty SmartObject. + // workaround for notification. JSON must be empty + if (mobile_apis::FunctionID::OnAudioPassThruID != + message.getElement(jhs::S_PARAMS) + .getElement(strings::function_id) + .asInt()) { + output.set_json_message(output_string); + } + + if (message.getElement(jhs::S_PARAMS).keyExists(strings::binary_data)) { + const application_manager::BinaryData binaryData( + message.getElement(jhs::S_PARAMS) + .getElement(strings::binary_data) + .asBinary()); + + output.set_binary_data(&binaryData); + } + + LOG4CXX_DEBUG(logger_, "Successfully parsed smart object into message"); + return true; +} + +hmi_apis::HMI_API& RPCServiceImpl::hmi_so_factory() { + return hmi_so_factory_; +} + +mobile_apis::MOBILE_API& RPCServiceImpl::mobile_so_factory() { + return mobile_so_factory_; +} + +} // namespace rpc_service + +} // namespace application_manager diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index c3aba90dd5..ff9ebb6208 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -18,6 +18,7 @@ const char* msg_params = "msg_params"; const char* method_name = "methodName"; const char* info = "info"; const char* app_id = "appID"; +const char* full_app_id = "fullAppID"; const char* bundle_id = "appBundleID"; const char* app_info = "appInfo"; const char* app_launch = "app_launch"; @@ -124,10 +125,12 @@ const char* hours = "hours"; const char* minutes = "minutes"; const char* seconds = "seconds"; const char* update_mode = "updateMode"; +const char* audioStreamingIndicator = "audioStreamingIndicator"; const char* trigger_source = "triggerSource"; const char* hmi_level = "hmiLevel"; const char* activate_app_hmi_level = "level"; const char* audio_streaming_state = "audioStreamingState"; +const char* video_streaming_state = "videoStreamingState"; const char* system_context = "systemContext"; const char* speech_capabilities = "speechCapabilities"; const char* vr_capabilities = "vrCapabilities"; @@ -142,17 +145,30 @@ const char* navigation_capability = "navigationCapability"; const char* phone_capability = "phoneCapability"; const char* video_streaming_capability = "videoStreamingCapability"; const char* rc_capability = "remoteControlCapability"; +const char* day_color_scheme = "dayColorScheme"; +const char* night_color_scheme = "nightColorScheme"; +const char* primary_color = "primaryColor"; +const char* secondary_color = "secondaryColor"; +const char* background_color = "backgroundColor"; +const char* red = "red"; +const char* green = "green"; +const char* blue = "blue"; +const char* display_layout = "displayLayout"; +const char* icon_resumed = "iconResumed"; // PutFile const char* sync_file_name = "syncFileName"; const char* file_name = "fileName"; const char* file_type = "fileType"; const char* file_size = "fileSize"; +const char* crc32_check_sum = "crc"; const char* request_type = "requestType"; +const char* request_subtype = "requestSubType"; const char* persistent_file = "persistentFile"; const char* file_data = "fileData"; const char* space_available = "spaceAvailable"; const char* image_type = "imageType"; +const char* is_template = "isTemplate"; const char* image = "image"; const char* type = "type"; const char* system_file = "systemFile"; @@ -168,6 +184,7 @@ const char* did_location = "didLocation"; const char* app_list = "appList"; const char* device_list = "deviceList"; const char* device_info = "deviceInfo"; +const char* secondary_device_info = "secondaryDeviceInfo"; const char* name = "name"; const char* id = "id"; const char* isSDLAllowed = "isSDLAllowed"; @@ -202,12 +219,15 @@ const char* rpm = "rpm"; const char* fuel_level = "fuelLevel"; const char* fuel_level_state = "fuelLevel_State"; const char* instant_fuel_consumption = "instantFuelConsumption"; +const char* fuel_range = "fuelRange"; const char* external_temp = "externalTemperature"; +const char* turn_signal = "turnSignal"; const char* vin = "vin"; const char* prndl = "prndl"; const char* tire_pressure = "tirePressure"; const char* odometer = "odometer"; const char* belt_status = "beltStatus"; +const char* electronic_park_brake_status = "electronicParkBrakeStatus"; const char* body_information = "bodyInformation"; const char* device_status = "deviceStatus"; const char* driver_braking = "driverBraking"; @@ -238,6 +258,7 @@ const char* remote_control = "remoteControl"; const char* sdl_version = "sdlVersion"; const char* system_software_version = "systemSoftwareVersion"; const char* priority = "priority"; +const char* engine_oil_life = "engineOilLife"; // resuming const char* application_commands = "applicationCommands"; @@ -256,6 +277,7 @@ const char* last_ign_off_time = "last_ign_off_time"; const char* resume_vr_grammars = "resumeVrGrammars"; const char* ign_off_count = "ign_off_count"; +const char* global_ign_on_counter = "global_ign_on_counter"; const char* suspend_count = "suspend_count"; const char* connection_info = "connection_info"; @@ -351,7 +373,7 @@ const char* instance_follow_redirect = "InstanceFollowRedirect"; const char* charset = "charset"; const char* content_lenght = "Content_Lenght"; const char* GET = "GET"; -} // http_request +} // namespace http_request namespace mobile_notification { const char* state = "state"; @@ -364,7 +386,17 @@ const char* kFull = "FULL"; const char* kLimited = "LIMITED"; const char* kBackground = "BACKGROUND"; const char* kNone = "NONE"; -} +} // namespace hmi_levels + +namespace time_keys { +const char* millisecond = "millisecond"; +const char* second = "second"; +const char* minute = "minute"; +const char* hour = "hour"; +const char* day = "day"; +const char* month = "month"; +const char* year = "year"; +} // namespace time_keys namespace hmi_request { const char* parent_id = "parentID"; @@ -426,6 +458,7 @@ const char* dtc = "dtc"; const char* ecu_header = "ecuHeader"; const char* image_capabilities = "imageCapabilities"; const char* display_type = "displayType"; +const char* display_name = "displayName"; const char* text_fields = "textFields"; const char* media_clock_formats = "mediaClockFormats"; const char* graphic_supported = "graphicSupported"; @@ -436,7 +469,7 @@ const char* num_custom_presets_available = "numCustomPresetsAvailable"; const char* urls = "urls"; const char* policy_app_id = "policyAppID"; const char* enabled = "enabled"; - +const char* system_time = "systemTime"; } // namespace hmi_response namespace hmi_notification { @@ -451,7 +484,6 @@ const char* policyfile = "policyfile"; const char* is_active = "isActive"; const char* is_deactivated = "isDeactivated"; const char* event_name = "eventName"; - } // namespace hmi_notification } // namespace application_manager diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index 84081a3830..3d44709657 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -31,24 +31,29 @@ */ #include "application_manager/state_controller_impl.h" +#include <tuple> #include "application_manager/usage_statistics.h" +#include "application_manager/rpc_service.h" #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "connection_handler/connection_handler.h" namespace application_manager { CREATE_LOGGERPTR_GLOBAL(logger_, "StateControllerImpl") -bool IsStatusChanged(HmiStatePtr old_state, HmiStatePtr new_state) { - if (old_state->hmi_level() != new_state->hmi_level() || - old_state->audio_streaming_state() != - new_state->audio_streaming_state() || - old_state->system_context() != new_state->system_context()) { - return true; - } - return false; +namespace { +bool IsStateChanged(const HmiState& old_state, const HmiState& new_state) { + return std::make_tuple(old_state.hmi_level(), + old_state.audio_streaming_state(), + old_state.video_streaming_state(), + old_state.system_context()) != + std::make_tuple(new_state.hmi_level(), + new_state.audio_streaming_state(), + new_state.video_streaming_state(), + new_state.system_context()); } +} // unnamed namespace StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr) : EventObserver(app_mngr.event_dispatcher()), app_mngr_(app_mngr) { @@ -64,20 +69,20 @@ StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr) void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, HmiStatePtr state, const bool send_activate_app) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); - DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR); + DCHECK_OR_RETURN_VOID(HmiState::STATE_ID_REGULAR == state->state_id()); + + LOG4CXX_DEBUG(logger_, "Set regular state " << *state); if (state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM || state->audio_streaming_state() == mobile_apis::AudioStreamingState::INVALID_ENUM || + state->video_streaming_state() == + mobile_apis::VideoStreamingState::INVALID_ENUM || state->system_context() == mobile_apis::SystemContext::INVALID_ENUM) { - LOG4CXX_ERROR(logger_, "Get invalid state"); + LOG4CXX_ERROR(logger_, "Got invalid state"); return; } @@ -91,7 +96,8 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, app->SetPostponedState(state); return; } - hmi_apis::Common_HMILevel::eType hmi_level = + LOG4CXX_DEBUG(logger_, "Resolved state: " << *resolved_state); + const hmi_apis::Common_HMILevel::eType hmi_level = static_cast<hmi_apis::Common_HMILevel::eType>( resolved_state->hmi_level()); @@ -100,7 +106,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, if (-1 != corr_id) { subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp, corr_id); - waiting_for_activate[app->app_id()] = resolved_state; + waiting_for_activate_[app->app_id()] = resolved_state; return; } LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp"); @@ -113,13 +119,10 @@ void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::VideoStreamingState::eType video_state, const bool send_activate_app) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = @@ -127,6 +130,7 @@ void StateControllerImpl::SetRegularState( DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); hmi_state->set_audio_streaming_state(audio_state); + hmi_state->set_video_streaming_state(video_state); hmi_state->set_system_context(prev_regular->system_context()); SetRegularState(app, hmi_state, send_activate_app); } @@ -136,19 +140,15 @@ void StateControllerImpl::SetRegularState( const mobile_apis::HMILevel::eType hmi_level, const bool send_activate_app) { using namespace mobile_apis; - using namespace helpers; - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); const HmiStatePtr hmi_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level)); + hmi_state->set_video_streaming_state(CalcVideoState(app, hmi_level)); hmi_state->set_system_context(SystemContext::SYSCTXT_MAIN); SetRegularState(app, hmi_state, send_activate_app); } @@ -157,37 +157,32 @@ void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::VideoStreamingState::eType video_state, const mobile_apis::SystemContext::eType system_context, const bool send_activate_app) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); HmiStatePtr hmi_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); hmi_state->set_audio_streaming_state(audio_state); + hmi_state->set_video_streaming_state(video_state); hmi_state->set_system_context(system_context); SetRegularState(app, hmi_state, send_activate_app); } void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(); HmiStatePtr hmi_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level)); + hmi_state->set_video_streaming_state(CalcVideoState(app, hmi_level)); hmi_state->set_system_context(prev_state ? prev_state->system_context() : mobile_apis::SystemContext::SYSCTXT_MAIN); @@ -197,12 +192,8 @@ void StateControllerImpl::SetRegularState( void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const mobile_apis::SystemContext::eType system_context) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = @@ -211,19 +202,18 @@ void StateControllerImpl::SetRegularState( hmi_state->set_hmi_level(prev_regular->hmi_level()); hmi_state->set_audio_streaming_state( CalcAudioState(app, prev_regular->hmi_level())); + hmi_state->set_video_streaming_state( + CalcVideoState(app, prev_regular->hmi_level())); hmi_state->set_system_context(system_context); SetRegularState(app, hmi_state, false); } void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, - const mobile_apis::AudioStreamingState::eType audio_state) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); + const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::VideoStreamingState::eType video_state) { LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_state); HmiStatePtr hmi_state = @@ -231,18 +221,15 @@ void StateControllerImpl::SetRegularState( DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(prev_state->hmi_level()); hmi_state->set_audio_streaming_state(audio_state); + hmi_state->set_video_streaming_state(video_state); hmi_state->set_system_context(prev_state->system_context()); SetRegularState(app, hmi_state, false); } void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) { - CREATE_LOGGERPTR_LOCAL(logger_, "StateControllerImpl"); LOG4CXX_AUTO_TRACE(logger_); - if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application pointer"); - return; - } + DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); if (mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) { SetRegularState(app, state, true); @@ -251,84 +238,178 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, } } -void StateControllerImpl::HmiLevelConflictResolver::operator()( - ApplicationSharedPtr to_resolve) { - using namespace mobile_apis; +namespace { + +/** + * @brief IsStreamableHMILevel checks whether the HMI level + * supports audio/video streaming. + * @param val HMI level + * @return true if streamable, false otherwise + */ +bool IsStreamableHMILevel(mobile_apis::HMILevel::eType val) { using namespace helpers; + return Compare<mobile_apis::HMILevel::eType, EQ, ONE>( + val, mobile_apis::HMILevel::HMI_FULL, mobile_apis::HMILevel::HMI_LIMITED); +} + +/** + * @brief IsSameAudioAppType checks whether the both applications: + * 1) belongs to exact HMI type that may stream audio without + * 'isMediaApplication' parameter set to true ('NAVIGATION', 'COMMUNICATION') + * 2) belongs to other HMI types with parameter 'isMediaApplication' + * is set to true. + * 3) are not media. + * @param app1 1st application + * @param app2 2nd application + * @return true if audio applications have same application HMI type + */ +bool IsSameAudioAppType(const Application& app1, const Application& app2) { + const auto is_only_media_app_type = [](const Application& app) { + return app.is_media_application() && !app.is_navi() && + !app.is_voice_communication_supported(); + }; + + const bool both_navi = app1.is_navi() && app2.is_navi(); + const bool both_vc = app1.is_voice_communication_supported() && + app2.is_voice_communication_supported(); + const bool both_media = + is_only_media_app_type(app1) && is_only_media_app_type(app2); + const bool both_other = + !app1.IsAudioApplication() && !app2.IsAudioApplication(); + const bool same_app_audio_type = + both_navi || both_vc || both_media || both_other; + + return same_app_audio_type; +} +} // unnamed namespace + +void StateControllerImpl::HmiLevelConflictResolver::operator()( + ApplicationSharedPtr app_to_resolve) { + DCHECK_OR_RETURN_VOID(app_to_resolve); DCHECK_OR_RETURN_VOID(state_ctrl_); - if (to_resolve == applied_) + DCHECK_OR_RETURN_VOID(applied_); + DCHECK_OR_RETURN_VOID(state_); + + if (applied_ == app_to_resolve) { + // Same app. Nothing to resolve + return; + } + + const HmiStatePtr state_to_resolve = app_to_resolve->RegularHmiState(); + DCHECK_OR_RETURN_VOID(state_to_resolve); + + // If applied HMI state is FULL: + // - all NOT audio/video applications becomes BACKGROUND + // - all audio/video applications with other app type + // (navi, vc, media, projection) in FULL becomes LIMMITED + // - all audio/video applications with same app type becomes BACKGROUND + // + // If applied HMI state is LIMITED: + // - all NOT audio/video applications saves their's HMI states + // - all applications with other app types saves their's HMI states + // - all audio/video applications with same app type becomes BACKGROUND + + if (!IsStreamableHMILevel(state_->hmi_level())) { + LOG4CXX_DEBUG(logger_, + "Applied for app " << applied_->app_id() << " HMI level " + << state_->hmi_level() + << " is NOT streamable. Exit."); return; - HmiStatePtr cur_state = to_resolve->RegularHmiState(); - - const bool applied_grabs_audio = - Compare<HMILevel::eType, EQ, ONE>( - state_->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED) && - applied_->IsAudioApplication(); - const bool applied_grabs_full = state_->hmi_level() == HMILevel::HMI_FULL; - const bool to_resolve_handles_full = - cur_state->hmi_level() == HMILevel::HMI_FULL; - const bool to_resolve_handles_audio = - Compare<HMILevel::eType, EQ, ONE>( - cur_state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED) && - to_resolve->IsAudioApplication(); - const bool same_app_type = state_ctrl_->IsSameAppType(applied_, to_resolve); - - // If applied Hmi state is FULL: - // all not audio applications will get BACKGROUND - // all applications with same HMI type will get BACKGROUND - // all audio applications with other HMI type(navi, vc, media) in FULL will - // get LIMMITED HMI level - - // If applied Hmi state is LIMITED: - // all applications with other HMI types will save HMI states - // all not audio applications will save HMI states - // all applications with same HMI type will get BACKGROUND - - // If applied Hmi state is BACKGROUND: - // all applications will save HMI states - - HMILevel::eType result_hmi_level = cur_state->hmi_level(); - if (applied_grabs_full && to_resolve_handles_audio && !same_app_type) - result_hmi_level = HMILevel::HMI_LIMITED; - - if ((applied_grabs_full && to_resolve_handles_full && - !to_resolve->IsAudioApplication()) || - (applied_grabs_audio && to_resolve_handles_audio && same_app_type)) - result_hmi_level = HMILevel::HMI_BACKGROUND; - - if (cur_state->hmi_level() != result_hmi_level) { + } + + if (!IsStreamableHMILevel(state_to_resolve->hmi_level())) { LOG4CXX_DEBUG(logger_, - "Application " << to_resolve->app_id() - << " will change HMI level to " - << result_hmi_level); - state_ctrl_->SetupRegularHmiState(to_resolve, + "To resolve app " << app_to_resolve->app_id() << " HMI level " + << state_to_resolve->hmi_level() + << " is NOT streamable. Exit."); + return; + } + + // Applied app constants + const auto applied_hmi_level = state_->hmi_level(); + + const bool applied_grabs_video = + IsStreamableHMILevel(applied_hmi_level) && applied_->IsVideoApplication(); + + // App to resolve constants + const auto to_resolve_hmi_level = state_to_resolve->hmi_level(); + + const bool to_resolve_grabs_audio = + IsStreamableHMILevel(to_resolve_hmi_level) && + app_to_resolve->IsAudioApplication(); + + const bool to_resolve_grabs_video = + IsStreamableHMILevel(to_resolve_hmi_level) && + app_to_resolve->IsVideoApplication(); + + // Compatibility constants + const bool same_app_audio_type = + IsSameAudioAppType(*applied_, *app_to_resolve); + + // Result variables + mobile_apis::VideoStreamingState::eType result_video_state = + mobile_apis::VideoStreamingState::NOT_STREAMABLE; + mobile_apis::AudioStreamingState::eType result_audio_state = + mobile_apis::AudioStreamingState::NOT_AUDIBLE; + + if (to_resolve_grabs_audio && !same_app_audio_type) { + result_audio_state = mobile_apis::AudioStreamingState::AUDIBLE; + } + + if (to_resolve_grabs_video && !applied_grabs_video) { + result_video_state = mobile_apis::VideoStreamingState::STREAMABLE; + } + + mobile_apis::HMILevel::eType result_hmi_level = state_to_resolve->hmi_level(); + + using namespace helpers; + if (mobile_apis::VideoStreamingState::STREAMABLE == result_video_state || + Compare<mobile_apis::AudioStreamingState::eType, EQ, ONE>( + result_audio_state, + mobile_apis::AudioStreamingState::AUDIBLE, + mobile_apis::AudioStreamingState::ATTENUATED)) { + result_hmi_level = mobile_apis::HMILevel::HMI_LIMITED; + } else { + result_hmi_level = mobile_apis::HMILevel::HMI_BACKGROUND; + } + + if (std::make_tuple(to_resolve_hmi_level, + state_to_resolve->audio_streaming_state(), + state_to_resolve->video_streaming_state()) != + std::make_tuple( + result_hmi_level, result_audio_state, result_video_state)) { + LOG4CXX_DEBUG(logger_, + "Application " + << app_to_resolve->app_id() << " will change state to: " + << "HMI level " << to_resolve_hmi_level << " --> " + << result_hmi_level << ", audio " + << state_to_resolve->audio_streaming_state() << " --> " + << result_audio_state << ", video " + << state_to_resolve->video_streaming_state() << " --> " + << result_video_state); + state_ctrl_->SetupRegularHmiState(app_to_resolve, result_hmi_level, - result_hmi_level == HMILevel::HMI_LIMITED - ? AudioStreamingState::AUDIBLE - : AudioStreamingState::NOT_AUDIBLE); + result_audio_state, + result_video_state); } else { LOG4CXX_DEBUG(logger_, - "Application " << to_resolve->app_id() - << " will not change HMI level"); + "Application " << app_to_resolve->app_id() + << " will NOT change HMI level"); } } HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, HmiStatePtr state) const { using namespace mobile_apis; - using namespace helpers; LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "State to resolve: hmi_level " - << state->hmi_level() << ", audio_state " - << state->audio_streaming_state() << ", system_context " - << state->system_context()); + LOG4CXX_DEBUG(logger_, "State to resolve: " << *state); HmiStatePtr available_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN(available_state, HmiStatePtr()); available_state->set_hmi_level(state->hmi_level()); available_state->set_audio_streaming_state(state->audio_streaming_state()); + available_state->set_video_streaming_state(state->video_streaming_state()); available_state->set_system_context(state->system_context()); if (app->is_resuming()) { @@ -337,6 +418,8 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, available_state->set_hmi_level(available_level); available_state->set_audio_streaming_state( CalcAudioState(app, available_level)); + available_state->set_video_streaming_state( + CalcVideoState(app, available_level)); } return IsStateAvailable(app, available_state) ? available_state : HmiStatePtr(); @@ -345,11 +428,8 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app, HmiStatePtr state) const { LOG4CXX_AUTO_TRACE(logger_); - using namespace helpers; using namespace mobile_apis; - if (!app->is_resuming() || - !Compare<HMILevel::eType, EQ, ONE>( - state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) { + if (!app->is_resuming() || !IsStreamableHMILevel(state->hmi_level())) { LOG4CXX_DEBUG(logger_, "Application is not in resuming mode."); return true; } @@ -375,27 +455,27 @@ bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app, mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( ApplicationSharedPtr app, mobile_apis::HMILevel::eType hmi_level) const { - using namespace mobile_apis; - using namespace helpers; LOG4CXX_AUTO_TRACE(logger_); mobile_apis::HMILevel::eType result = hmi_level; - if (!Compare<HMILevel::eType, EQ, ONE>( - hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) { + LOG4CXX_DEBUG(logger_, "HMI Level: " << hmi_level); + + if (!IsStreamableHMILevel(hmi_level)) { return result; } const bool is_audio_app = app->IsAudioApplication(); const bool does_audio_app_with_same_type_exist = app_mngr_.IsAppTypeExistsInFullOrLimited(app); - if (HMILevel::HMI_LIMITED == hmi_level) { + + if (mobile_apis::HMILevel::HMI_LIMITED == hmi_level) { if (!is_audio_app || does_audio_app_with_same_type_exist) { result = app_mngr_.GetDefaultHmiLevel(app); } return result; } - const bool is_active_app_exist = app_mngr_.active_application(); + const bool is_active_app_exist = (bool)app_mngr_.active_application(); if (is_audio_app) { if (does_audio_app_with_same_type_exist) { result = app_mngr_.GetDefaultHmiLevel(app); @@ -424,13 +504,8 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( bool StateControllerImpl::IsStateAvailable(ApplicationSharedPtr app, HmiStatePtr state) const { using namespace mobile_apis; - using namespace helpers; LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Checking state: hmi_level " - << state->hmi_level() << ", audio_state " - << state->audio_streaming_state() << ", system_context " - << state->system_context()); + LOG4CXX_DEBUG(logger_, "Checking state: " << *state); if (app->is_resuming()) { return IsStateAvailableForResumption(app, state); @@ -454,11 +529,8 @@ bool StateControllerImpl::IsStateAvailableForResumption( ApplicationSharedPtr app, HmiStatePtr state) const { LOG4CXX_AUTO_TRACE(logger_); using namespace mobile_apis; - using namespace helpers; - if (!app->is_resuming() || - !Compare<HMILevel::eType, EQ, ONE>( - state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) { + if (!app->is_resuming() || !IsStreamableHMILevel(state->hmi_level())) { LOG4CXX_DEBUG(logger_, "Application is not in resuming mode." << " Requested state is available"); @@ -492,20 +564,17 @@ bool StateControllerImpl::IsStateAvailableForResumption( void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state) { - namespace HMILevel = mobile_apis::HMILevel; - namespace AudioStreamingState = mobile_apis::AudioStreamingState; + using namespace mobile_apis; LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(state); - LOG4CXX_DEBUG(logger_, - "hmi_level " << state->hmi_level() << ", audio_state " - << state->audio_streaming_state() - << ", system_context " << state->system_context()); + LOG4CXX_DEBUG(logger_, "Setup regular state: " << *state); HmiStatePtr curr_state = app->CurrentHmiState(); HmiStatePtr old_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(old_state); old_state->set_hmi_level(curr_state->hmi_level()); old_state->set_audio_streaming_state(curr_state->audio_streaming_state()); + old_state->set_video_streaming_state(curr_state->video_streaming_state()); old_state->set_system_context(curr_state->system_context()); app->SetRegularState(state); @@ -524,10 +593,8 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app, void StateControllerImpl::SetupRegularHmiState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level, - const mobile_apis::AudioStreamingState::eType audio_state) { - namespace HMILevel = mobile_apis::HMILevel; - namespace AudioStreamingState = mobile_apis::AudioStreamingState; - using helpers::Compare; + const mobile_apis::AudioStreamingState::eType audio_state, + const mobile_apis::VideoStreamingState::eType video_state) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(); @@ -537,6 +604,7 @@ void StateControllerImpl::SetupRegularHmiState( DCHECK_OR_RETURN_VOID(new_state); new_state->set_hmi_level(hmi_level); new_state->set_audio_streaming_state(audio_state); + new_state->set_video_streaming_state(video_state); new_state->set_system_context(prev_state->system_context()); SetupRegularHmiState(app, new_state); } @@ -547,28 +615,12 @@ void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app, DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR); + LOG4CXX_DEBUG(logger_, + "Applying to app " << app->app_id() << " state " << *state); SetupRegularHmiState(app, state); - ForEachApplication<HmiLevelConflictResolver>( - HmiLevelConflictResolver(app, state, this)); -} - -bool StateControllerImpl::IsSameAppType(ApplicationConstSharedPtr app1, - ApplicationConstSharedPtr app2) { - const bool both_media = - app1->is_media_application() && app2->is_media_application(); - - const bool both_navi = app1->is_navi() && app2->is_navi(); - - const bool both_vc = app1->is_voice_communication_supported() && - app2->is_voice_communication_supported(); - - const bool both_simple = - !app1->IsAudioApplication() && !app2->IsAudioApplication(); - - const bool both_projection = - app1->mobile_projection_enabled() && app2->mobile_projection_enabled(); - - return both_simple || both_media || both_navi || both_vc || both_projection; + LOG4CXX_DEBUG(logger_, + "Resolving HMI level conflicts for app " << app->app_id()); + ForEachApplication(HmiLevelConflictResolver(app, state, this)); } void StateControllerImpl::on_event(const event_engine::Event& event) { @@ -615,7 +667,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { const uint32_t id = message[strings::msg_params][hmi_notification::event_name].asUInt(); // TODO(AOleynik): Add verification/conversion check here - Common_EventTypes::eType state_id = + const Common_EventTypes::eType state_id = static_cast<Common_EventTypes::eType>(id); if (is_active) { if (Common_EventTypes::AUDIO_SOURCE == state_id) { @@ -660,6 +712,9 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { break; } } + + LOG4CXX_WARN(logger_, + "Couldn't recognize state id (val='" << state_id << "')"); break; } default: @@ -674,17 +729,9 @@ void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app, DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(old_state); DCHECK_OR_RETURN_VOID(new_state); - LOG4CXX_DEBUG(logger_, - "old: hmi_level " << old_state->hmi_level() << ", audio_state " - << old_state->audio_streaming_state() - << ", system_context " - << old_state->system_context()); - LOG4CXX_DEBUG(logger_, - "new: hmi_level " << new_state->hmi_level() << ", audio_state " - << new_state->audio_streaming_state() - << ", system_context " - << new_state->system_context()); - if (IsStatusChanged(old_state, new_state)) { + LOG4CXX_DEBUG(logger_, "Old state: " << *old_state); + LOG4CXX_DEBUG(logger_, "New state: " << *new_state); + if (IsStateChanged(*old_state, *new_state)) { app_mngr_.SendHMIStatusNotification(app); if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) { app->ResetDataInNone(); @@ -693,15 +740,13 @@ void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app, app->app_id(), old_state->hmi_level(), new_state->hmi_level()); app->usage_report().RecordHmiStateChanged(new_state->hmi_level()); } else { - LOG4CXX_ERROR(logger_, "Status not changed"); + LOG4CXX_ERROR(logger_, "State has NOT been changed."); } } -bool StateControllerImpl::IsTempStateActive(HmiState::StateID ID) const { +bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const { sync_primitives::AutoLock autolock(active_states_lock_); - StateIDList::const_iterator itr = - std::find(active_states_.begin(), active_states_.end(), ID); - return active_states_.end() != itr; + return helpers::in_range(active_states_, id); } void StateControllerImpl::OnApplicationRegistered( @@ -713,23 +758,25 @@ void StateControllerImpl::OnApplicationRegistered( LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); - active_states_lock_.Acquire(); - StateIDList::iterator it = active_states_.begin(); - for (; it != active_states_.end(); ++it) { - HmiStatePtr new_state = CreateHmiState(app, *it); - DCHECK_OR_RETURN_VOID(new_state); - DCHECK_OR_RETURN_VOID(new_state->state_id() != HmiState::STATE_ID_REGULAR); - HmiStatePtr old_hmi_state = app->CurrentHmiState(); - new_state->set_parent(old_hmi_state); - app->AddHMIState(new_state); + { + sync_primitives::AutoLock lck(active_states_lock_); + for (const auto state_id : active_states_) { + HmiStatePtr new_state = CreateHmiState(app, state_id); + DCHECK_OR_RETURN_VOID(new_state); + DCHECK_OR_RETURN_VOID(new_state->state_id() != + HmiState::STATE_ID_REGULAR); + HmiStatePtr old_hmi_state = app->CurrentHmiState(); + new_state->set_parent(old_hmi_state); + app->AddHMIState(new_state); + } } - active_states_lock_.Release(); HmiStatePtr default_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(default_state); default_state->set_hmi_level(default_level); default_state->set_audio_streaming_state(CalcAudioState(app, default_level)); + default_state->set_video_streaming_state(CalcVideoState(app, default_level)); default_state->set_system_context(SystemContext::SYSCTXT_MAIN); HmiStatePtr initial_state = app->RegularHmiState(); @@ -758,7 +805,7 @@ int64_t StateControllerImpl::SendBCActivateApp( LOG4CXX_ERROR(logger_, "Unable to create BC.ActivateAppRequest"); return -1; } - if (!app_mngr_.ManageHMICommand(bc_activate_app_request)) { + if (!app_mngr_.GetRPCService().ManageHMICommand(bc_activate_app_request)) { LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateAppRequest"); return -1; } @@ -778,16 +825,18 @@ void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) { } } -void StateControllerImpl::TempStateStarted(HmiState::StateID ID) { +void StateControllerImpl::TempStateStarted(HmiState::StateID id) { LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock autolock(active_states_lock_); - StateIDList::iterator it = - std::find(active_states_.begin(), active_states_.end(), ID); - if (it == active_states_.end()) { - active_states_.push_back(ID); - } else { - LOG4CXX_ERROR(logger_, "StateID " << ID << " is already active"); + + { + sync_primitives::AutoLock autolock(active_states_lock_); + if (!helpers::in_range(active_states_, id)) { + active_states_.push_back(id); + return; + } } + + LOG4CXX_ERROR(logger_, "StateID '" << id << "' is already active"); } void StateControllerImpl::TempStateStopped(HmiState::StateID ID) { @@ -805,16 +854,34 @@ void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); - HmiStatePtr regular = app->RegularHmiState(); + const HmiStatePtr regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(regular); - HmiStatePtr new_regular = utils::MakeShared<HmiState>(*regular); + HmiStatePtr new_regular = std::make_shared<HmiState>(*regular); + + LOG4CXX_DEBUG(logger_, "Current HMI level: '" << app->hmi_level() << "'"); + const bool is_audio_app = app->IsAudioApplication(); + const bool is_video_app = app->IsVideoApplication(); - if (app->IsAudioApplication()) { + if (is_audio_app || is_video_app) { + // audio or video app move to HMI level limited new_regular->set_hmi_level(HMILevel::HMI_LIMITED); - new_regular->set_audio_streaming_state(AudioStreamingState::AUDIBLE); + + if (is_audio_app) { + new_regular->set_audio_streaming_state(AudioStreamingState::AUDIBLE); + } else { + new_regular->set_audio_streaming_state(AudioStreamingState::NOT_AUDIBLE); + } + + if (is_video_app) { + new_regular->set_video_streaming_state(VideoStreamingState::STREAMABLE); + } else { + new_regular->set_video_streaming_state( + VideoStreamingState::NOT_STREAMABLE); + } } else { new_regular->set_hmi_level(HMILevel::HMI_BACKGROUND); new_regular->set_audio_streaming_state(AudioStreamingState::NOT_AUDIBLE); + new_regular->set_video_streaming_state(VideoStreamingState::NOT_STREAMABLE); } SetRegularState(app, new_regular, false); @@ -831,7 +898,7 @@ void StateControllerImpl::OnActivateAppResponse( ApplicationSharedPtr application = app_mngr_.application_by_hmi_app(hmi_app_id); if (application && hmi_apis::Common_Result::SUCCESS == code) { - HmiStatePtr pending_state = waiting_for_activate[application->app_id()]; + HmiStatePtr pending_state = waiting_for_activate_[application->app_id()]; DCHECK_OR_RETURN_VOID(pending_state); ApplyRegularState(application, pending_state); } @@ -854,9 +921,7 @@ void StateControllerImpl::OnAppActivated( void StateControllerImpl::OnAppDeactivated( const smart_objects::SmartObject& message) { - using namespace hmi_apis; using namespace mobile_apis; - using namespace helpers; LOG4CXX_AUTO_TRACE(logger_); uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt(); @@ -875,12 +940,22 @@ void StateControllerImpl::OnAppDeactivated( DeactivateApp(app); } -void StateControllerImpl::OnNaviStreamingStarted() { - ApplyTempState<HmiState::STATE_ID_NAVI_STREAMING>(); +void StateControllerImpl::OnVideoStreamingStarted( + ApplicationConstSharedPtr app) { + if (app->is_navi()) { + ApplyTempState<HmiState::STATE_ID_NAVI_STREAMING>(); + } else { + ApplyTempState<HmiState::STATE_ID_VIDEO_STREAMING>(); + } } -void StateControllerImpl::OnNaviStreamingStopped() { - CancelTempState<HmiState::STATE_ID_NAVI_STREAMING>(); +void StateControllerImpl::OnVideoStreamingStopped( + ApplicationConstSharedPtr app) { + if (app->is_navi()) { + CancelTempState<HmiState::STATE_ID_NAVI_STREAMING>(); + } else { + CancelTempState<HmiState::STATE_ID_VIDEO_STREAMING>(); + } } bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { @@ -896,49 +971,53 @@ bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { } HmiStatePtr StateControllerImpl::CreateHmiState( - utils::SharedPtr<Application> app, HmiState::StateID state_id) const { + std::shared_ptr<Application> app, HmiState::StateID state_id) const { using namespace utils; LOG4CXX_AUTO_TRACE(logger_); HmiStatePtr new_state; switch (state_id) { case HmiState::STATE_ID_PHONE_CALL: { - new_state = MakeShared<PhoneCallHmiState>(app, app_mngr_); + new_state = std::make_shared<PhoneCallHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_SAFETY_MODE: { - new_state = MakeShared<SafetyModeHmiState>(app, app_mngr_); + new_state = std::make_shared<SafetyModeHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_VR_SESSION: { - new_state = MakeShared<VRHmiState>(app, app_mngr_); + new_state = std::make_shared<VRHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_TTS_SESSION: { - new_state = MakeShared<TTSHmiState>(app, app_mngr_); + new_state = std::make_shared<TTSHmiState>(app, app_mngr_); + break; + } + case HmiState::STATE_ID_VIDEO_STREAMING: { + new_state = std::make_shared<VideoStreamingHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_NAVI_STREAMING: { - new_state = MakeShared<NaviStreamingHmiState>(app, app_mngr_); + new_state = std::make_shared<NaviStreamingHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_REGULAR: { - new_state = MakeShared<HmiState>(app, app_mngr_); + new_state = std::make_shared<HmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_POSTPONED: { - new_state = MakeShared<HmiState>(app, app_mngr_, state_id); + new_state = std::make_shared<HmiState>(app, app_mngr_, state_id); break; } case HmiState::STATE_ID_DEACTIVATE_HMI: { - new_state = MakeShared<DeactivateHMI>(app, app_mngr_); + new_state = std::make_shared<DeactivateHMI>(app, app_mngr_); break; } case HmiState::STATE_ID_AUDIO_SOURCE: { - new_state = MakeShared<AudioSource>(app, app_mngr_); + new_state = std::make_shared<AudioSource>(app, app_mngr_); break; } case HmiState::STATE_ID_EMBEDDED_NAVI: { - new_state = MakeShared<EmbeddedNavi>(app, app_mngr_); + new_state = std::make_shared<EmbeddedNavi>(app, app_mngr_); break; } default: @@ -952,20 +1031,31 @@ HmiStatePtr StateControllerImpl::CreateHmiState( mobile_apis::AudioStreamingState::eType StateControllerImpl::CalcAudioState( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) const { - namespace HMILevel = mobile_apis::HMILevel; - namespace AudioStreamingState = mobile_apis::AudioStreamingState; - using helpers::Compare; - using helpers::EQ; - using helpers::ONE; - - AudioStreamingState::eType audio_state = AudioStreamingState::NOT_AUDIBLE; - if (Compare<HMILevel::eType, EQ, ONE>( - hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) { - if (app->IsAudioApplication()) { - audio_state = AudioStreamingState::AUDIBLE; - } + auto state = mobile_apis::AudioStreamingState::NOT_AUDIBLE; + if (IsStreamableHMILevel(hmi_level) && app->IsAudioApplication()) { + state = mobile_apis::AudioStreamingState::AUDIBLE; } - return audio_state; + + LOG4CXX_DEBUG(logger_, + "Calculated audio state of app " + << app->app_id() << " for " << hmi_level << " HMI level is " + << state); + return state; +} + +mobile_apis::VideoStreamingState::eType StateControllerImpl::CalcVideoState( + ApplicationSharedPtr app, + const mobile_apis::HMILevel::eType hmi_level) const { + auto state = mobile_apis::VideoStreamingState::NOT_STREAMABLE; + if (IsStreamableHMILevel(hmi_level) && app->IsVideoApplication()) { + state = mobile_apis::VideoStreamingState::STREAMABLE; + } + + LOG4CXX_DEBUG(logger_, + "Calculated video state of app " + << app->app_id() << " for " << hmi_level << " HMI level is " + << state); + return state; } } // namespace application_manager diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc new file mode 100644 index 0000000000..6ae6d3e901 --- /dev/null +++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/system_time/system_time_handler_impl.h" + +#include <algorithm> + +#include "application_manager/message_helper.h" +#include "application_manager/smart_object_keys.h" +#include "interfaces/HMI_API.h" +#include "utils/logger.h" + +namespace application_manager { + +SystemTimeHandlerImpl::SystemTimeHandlerImpl( + ApplicationManager& application_manager) + : event_engine::EventObserver(application_manager.event_dispatcher()) + , utc_time_can_be_received_(false) + , awaiting_get_system_time_(false) + , system_time_listener_(NULL) + , app_manager_(application_manager) { + LOG4CXX_AUTO_TRACE(logger_); + subscribe_on_event( + hmi_apis::FunctionID::BasicCommunication_OnSystemTimeReady); +} + +SystemTimeHandlerImpl::~SystemTimeHandlerImpl() { + LOG4CXX_AUTO_TRACE(logger_); + unsubscribe_from_all_events(); +} + +void SystemTimeHandlerImpl::DoSystemTimeQuery() { + LOG4CXX_AUTO_TRACE(logger_); + using namespace application_manager; + + sync_primitives::AutoLock lock(state_lock_); + if (!utc_time_can_be_received_) { + LOG4CXX_INFO(logger_, + "Navi module is not yet ready." + << "Will process request once it became ready."); + return; + } + SendTimeRequest(); +} + +void SystemTimeHandlerImpl::DoSubscribe(utils::SystemTimeListener* listener) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK(listener); + sync_primitives::AutoLock lock(system_time_listener_lock_); + system_time_listener_ = listener; +} + +void SystemTimeHandlerImpl::DoUnsubscribe(utils::SystemTimeListener* listener) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(system_time_listener_lock_); + system_time_listener_ = NULL; +} + +time_t SystemTimeHandlerImpl::FetchSystemTime() { + LOG4CXX_AUTO_TRACE(logger_); + return last_time_; +} + +bool SystemTimeHandlerImpl::utc_time_can_be_received() const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(state_lock_); + return utc_time_can_be_received_; +} + +void SystemTimeHandlerImpl::SendTimeRequest() { + LOG4CXX_AUTO_TRACE(logger_); + + if (awaiting_get_system_time_) { + LOG4CXX_WARN(logger_, "Another GetSystemTime request in progress. Skipped"); + return; + } + + using namespace application_manager; + uint32_t correlation_id = app_manager_.GetNextHMICorrelationID(); + subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_GetSystemTime, + correlation_id); + MessageHelper::SendGetSystemTimeRequest(correlation_id, app_manager_); + awaiting_get_system_time_ = true; +} + +void SystemTimeHandlerImpl::on_event( + const application_manager::event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + using namespace application_manager; + using namespace hmi_apis::FunctionID; + switch (event.id()) { + case BasicCommunication_OnSystemTimeReady: + ProcessSystemTimeReadyNotification(); + break; + case BasicCommunication_GetSystemTime: + ProcessSystemTimeResponse(event); + break; + default: + LOG4CXX_ERROR(logger_, "Unknown Event received"); + break; + } +} + +void SystemTimeHandlerImpl::ProcessSystemTimeReadyNotification() { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(state_lock_); + utc_time_can_be_received_ = true; + unsubscribe_from_event( + hmi_apis::FunctionID::BasicCommunication_OnSystemTimeReady); +} + +void SystemTimeHandlerImpl::ProcessSystemTimeResponse( + const application_manager::event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + const smart_objects::SmartObject& message = event.smart_object(); + const smart_objects::SmartObject& system_time_so = + message[strings::msg_params][hmi_response::system_time]; + + struct tm system_time; + memset(&system_time, 0, sizeof(struct tm)); + + system_time.tm_sec = system_time_so[time_keys::second].asInt(); + system_time.tm_min = system_time_so[time_keys::minute].asInt(); + // According to tm specification of tm type hour should be decreased by 1 + system_time.tm_hour = system_time_so[time_keys::hour].asInt() - 1; + system_time.tm_mday = system_time_so[time_keys::day].asInt(); + // According to tm specification of tm type mon should be decreased by 1 + system_time.tm_mon = system_time_so[time_keys::month].asInt() - 1; + // According to tm specification of tm type + // tm_year - number of years since 1900 + system_time.tm_year = system_time_so[time_keys::year].asInt() - 1900; + + // Normalize and convert time from 'tm' format to 'time_t' + last_time_ = mktime(&system_time); + + sync_primitives::AutoLock lock(system_time_listener_lock_); + if (system_time_listener_) { + system_time_listener_->OnSystemTimeArrived(last_time_); + } + sync_primitives::AutoLock state_lock(state_lock_); + awaiting_get_system_time_ = false; +} + +} // namespace application_manager diff --git a/src/components/application_manager/src/usage_statistics.cc b/src/components/application_manager/src/usage_statistics.cc index 80755b6509..1cfccd816e 100644 --- a/src/components/application_manager/src/usage_statistics.cc +++ b/src/components/application_manager/src/usage_statistics.cc @@ -35,10 +35,9 @@ #include "smart_objects/enum_schema_item.h" #include "policy/usage_statistics/statistics_manager.h" #include "utils/macro.h" -#include "utils/make_shared.h" using namespace mobile_apis; -using namespace NsSmartDeviceLink::NsSmartObjects; +using namespace ns_smart_device_link::ns_smart_objects; using namespace usage_statistics; namespace application_manager { @@ -56,7 +55,7 @@ std::string LanguageIdToString(Language::eType lang_id) { UsageStatistics::UsageStatistics( const std::string& app_id, - utils::SharedPtr<StatisticsManager> statistics_manager) + std::shared_ptr<StatisticsManager> statistics_manager) : time_in_hmi_state_sptr_( new usage_statistics::AppStopwatchImpl(statistics_manager, app_id)) , app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI) @@ -78,7 +77,7 @@ UsageStatistics::UsageStatistics( UsageStatistics::UsageStatistics( const std::string& app_id, - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, AppStopwatch* time_in_hmi_state_ptr) : time_in_hmi_state_sptr_(time_in_hmi_state_ptr) , app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI) |